diff --git a/contracts/migrations/0035_alter_contract_valid_end_date_and_more.py b/contracts/migrations/0035_alter_contract_valid_end_date_and_more.py new file mode 100644 index 0000000000000000000000000000000000000000..4fb5f371d125655504e19e6e663eef08ce128690 --- /dev/null +++ b/contracts/migrations/0035_alter_contract_valid_end_date_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.4 on 2023-04-10 22:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contracts', '0034_alter_contract_agreement_url_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='contract', + name='valid_end_date', + field=models.DateField(blank=True, help_text='<strong>Pokud není konec účinnosti zadán, smlouva je evidována jako na dobu neurčitou.</strong>', null=True, verbose_name='Konec účinnosti'), + ), + migrations.AlterField( + model_name='contract', + name='valid_start_date', + field=models.DateField(blank=True, help_text='<strong>Pokud není začátek účinnosti zadán, vypočítá se automaticky podle posledního data podpisu.</strong>', null=True, verbose_name='Začátek účinnosti'), + ), + ] diff --git a/contracts/migrations/0036_alter_contract_tender_url.py b/contracts/migrations/0036_alter_contract_tender_url.py new file mode 100644 index 0000000000000000000000000000000000000000..7faca40ddfbb3ceca9dd1204c43dc180a449ec28 --- /dev/null +++ b/contracts/migrations/0036_alter_contract_tender_url.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.4 on 2023-04-10 22:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('contracts', '0035_alter_contract_valid_end_date_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='contract', + name='tender_url', + field=models.URLField(blank=True, help_text='Běžně odkaz na <a href="https://forum.pirati.cz/viewforum.php?f=572">fórum</a>.', max_length=256, null=True, verbose_name='Odkaz na výběrové řízení'), + ), + ] diff --git a/contracts/models.py b/contracts/models.py index e1129e870f9ff0d8e866248a2cc552329c2682d2..98c1c0d17e1a6c9174cdde999fc5fbb0d0551bbd 100644 --- a/contracts/models.py +++ b/contracts/models.py @@ -9,6 +9,7 @@ from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver from django.urls import reverse +from django.utils.safestring import mark_safe from markdownx.models import MarkdownxField from shared.models import NameStrMixin @@ -477,11 +478,19 @@ class Contract(NameStrMixin, models.Model): blank=True, null=True, verbose_name="Začátek účinnosti", + help_text=mark_safe( + "<strong>Pokud není začátek účinnosti zadán, vypočítá se automaticky " + "podle posledního data podpisu.</strong>" + ) ) valid_end_date = models.DateField( blank=True, null=True, verbose_name="Konec účinnosti", + help_text=mark_safe( + "<strong>Pokud není konec účinnosti zadán, smlouva je evidována jako " + "na dobu neurčitou.</strong>" + ) ) class LegalStates(models.TextChoices): @@ -531,7 +540,9 @@ class Contract(NameStrMixin, models.Model): blank=True, null=True, verbose_name="Odkaz na výběrové řízení", - help_text="Běžně odkaz na fórum." + help_text=mark_safe( + "Běžně odkaz na <a href=\"https://forum.pirati.cz/viewforum.php?f=572\">fórum</a>." + ) ) agreement_url = models.URLField( diff --git a/static_src/admin/contract_form.js b/static_src/admin/contract_form.js index f1ea5a4a384f9de414354df60d32b745d4524979..dde148dc679cb5aae89770357e8c4dfd46372ba2 100644 --- a/static_src/admin/contract_form.js +++ b/static_src/admin/contract_form.js @@ -1,13 +1,7 @@ import $ from "jquery"; -import alertify from "alertifyjs"; -import "alertifyjs/build/css/alertify.min.css"; - $(window).ready( () => { - let startDateWarningDismissed = false; - let endDateWarningDismissed = false; - $(".field-publishing_rejection_comment"). css( "display", @@ -61,42 +55,5 @@ $(window).ready( if (!otherIsSelected) $(".field-cost_unit_other").val(""); } ); - - $( - "#contract_form .submit-row input[name=\"_save\"]," - + "#contract_form .submit-row input[name=\"_addanother\"]," - + "#contract_form .submit-row input[name=\"_continue\"]" - ).on( - "click", - event => { - if (!startDateWarningDismissed && $("#id_valid_start_date").val() === "") { - event.preventDefault(); - - alertify.alert( - "Začátek platnosti není zadán", - `Začátek platnosti nebyl uveden. Pokud ho necháš tak, jak je, -bude automaticky vyplněn podle posledního data -podpisu smluvních stran. Pokud podpisy neexistují, -pole zůstane prázdné.`, - () => { - startDateWarningDismissed = true; - } - ); - } - - if (!endDateWarningDismissed && $("#id_valid_end_date").val() === "") { - event.preventDefault(); - - alertify.alert( - "Konec platnosti není zadán", - `Konec platnosti nebyl uveden. Pokud ho necháš tak, jak je, -smlouva bude evidována jako na dobu neurčitou.`, - () => { - endDateWarningDismissed = true; - } - ); - } - } - ) } );