Skip to content
Snippets Groups Projects
Commit 1faf65b3 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

Merge branch 'test' into 'master'

Release

See merge request !7
parents 9f25c09d 98d130ca
Branches
No related tags found
1 merge request!7Release
Pipeline #13165 passed
......@@ -240,6 +240,7 @@ class ContractAdmin(
{
"fields": [
"paper_form_state",
"paper_form_person_responsible",
"filing_area",
]
},
......
# Generated by Django 4.1.4 on 2023-06-06 17:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contracts', '0061_alter_contract_id_number'),
]
operations = [
migrations.AddField(
model_name='contract',
name='paper_form_person_responsible',
field=models.CharField(blank=True, max_length=256, null=True, verbose_name='Osoba zodpovědná za doručení'),
),
]
......@@ -592,6 +592,13 @@ class Contract(NameStrMixin, models.Model):
verbose_name="Stav fyzického dokumentu",
)
paper_form_person_responsible = models.CharField(
max_length=256,
blank=True,
null=True,
verbose_name="Osoba zodpovědná za doručení",
)
tender_url = SubdomainValidatedURLField(
max_length=256,
blank=True,
......@@ -739,6 +746,22 @@ class Contract(NameStrMixin, models.Model):
}
)
if (
self.paper_form_state not in (
self.PaperFormStates.STORED,
self.PaperFormStates.SHREDDED,
self.PaperFormStates.LOST
)
and not self.paper_form_person_responsible
):
raise ValidationError(
{
"paper_form_person_responsible": (
"Musí být vyplněno, pokud smlouva není uložená / skartovaná / ztracená."
)
}
)
if (
self.valid_start_date
and self.valid_end_date
......
......@@ -25,7 +25,7 @@
</a>
{% endif %}
{% if page.has_previous and page.previous_page_number != 2 %}
{% if page.has_previous and page.previous_page_number > 2 %}
<span class="text-grey-500 hidden md:flex flex-col px-2 justify-center">...</span>
{% endif %}
......
......@@ -173,7 +173,13 @@
<tr>
<td class="w-1/5 !p-2.5">Stav</td>
<td class="w-4/5 !p-2.5">{{ contract.get_paper_form_state_display }}</td>
<td class="w-4/5 !p-2.5">
{{ contract.get_paper_form_state_display }}
{% if contract.paper_form_person_responsible %}
(zodpovídá {{ contract.paper_form_person_responsible }})
{% endif %}
</td>
</tr>
<tr>
<td class="w-1/5 !p-2.5">Spisovna</td>
......
......@@ -16,7 +16,6 @@ import pathlib
import dj_database_url
import environ
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
# Build paths inside the project like this: BASE_DIR / 'subdir'.
......
......@@ -36,7 +36,21 @@ $(window).ready(
($("#id_cost_unit").find(":selected").val() === "other") ?
"block": "none"
)
)
);
$(".field-paper_form_person_responsible").
css(
"display",
(
(
!["stored", "shredded"].includes(
$("#id_paper_form_state").find(":selected").val()
)
) ?
"block" : "none"
)
);
$("#id_cost_unit").on(
"change",
......@@ -55,5 +69,29 @@ $(window).ready(
if (!otherIsSelected) $(".field-cost_unit_other").val("");
}
);
$("#id_paper_form_state").on(
"change",
event => {
const notStoredOrShredded = (
!["stored", "shredded", "lost"].includes(
$(event.target).find(":selected").val()
)
);
$(".field-paper_form_person_responsible").
css(
"display",
(
(notStoredOrShredded) ?
"block" : "none"
)
);
if (!notStoredOrShredded) {
$("#id_paper_form_person_responsible").val("");
}
}
);
}
);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment