summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-11-15 11:51:49 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:45:55 +0100
commitf3764eea1ac4a6cdb12095322a00fd93d377c2c5 (patch)
tree878cc3ba5ce98d1d7ed28e264d54f4ca4efbdf0d /archaeological_files
parenta2de2eb42009de3b8bf56f2af2a6071a4a98fd8f (diff)
downloadIshtar-f3764eea1ac4a6cdb12095322a00fd93d377c2c5.tar.bz2
Ishtar-f3764eea1ac4a6cdb12095322a00fd93d377c2c5.zip
✨ adapt sheet to manage sheet filters
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/models.py13
-rw-r--r--archaeological_files/templates/ishtar/sheet_file.html23
2 files changed, 30 insertions, 6 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index bea129ea8..3b272a333 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -620,6 +620,7 @@ class File(
HISTORICAL_M2M = ["towns", "departments"]
SERIALIZE_PROPERTIES = ["external_id"]
+ SHEET_EMPTY_KEYS = ["has_jobs", "has_ground_jobs"]
QA_LINK = QuickAction(
url="file-qa-link",
icon_class="fa fa-link",
@@ -937,6 +938,18 @@ class File(
return self.update_has_admin_act(cache_key)
@property
+ def has_equipment_costs(self):
+ return self.equipment_costs.exists()
+
+ @property
+ def has_ground_jobs(self):
+ return self.ground_jobs.exists()
+
+ @property
+ def has_jobs(self):
+ return self.jobs.exists()
+
+ @property
def get_locality(self):
return " - ".join(
[getattr(self, k) for k in ("locality", "address") if getattr(self, k)]
diff --git a/archaeological_files/templates/ishtar/sheet_file.html b/archaeological_files/templates/ishtar/sheet_file.html
index 9a347c978..28f4892d1 100644
--- a/archaeological_files/templates/ishtar/sheet_file.html
+++ b/archaeological_files/templates/ishtar/sheet_file.html
@@ -11,7 +11,7 @@
{% with can_view_documents=permission_view_own_document|or_:permission_view_document %}
{% with has_documents=item.documents.count %}
{% with display_documents=can_view_documents|and_:has_documents %}
-{% with has_costs=item.equipment_costs.count|or_:item.ground_jobs.count|or_:item.jobs.count %}
+{% with has_costs=item.has_equipment_costs|or_:item.has_ground_jobs|or_:item.has_jobs %}
{% if output != "ODT" and output != "PDF"%}
<ul class="nav nav-tabs" id="{{window_id}}-tabs" role="tablist">
@@ -65,12 +65,14 @@
{% field_flex "Reception date" item.reception_date|date:"DATE_FORMAT" %}
{% field_flex _("Instruction deadline") item.instruction_deadline|date:"DATE_FORMAT" %}
{% field_flex_detail _("File managed by") item.in_charge %}
+ {% if item.is_active != None %}
<dl class="col-12 col-md-6 col-lg-3 flex-wrap">
<dt>{%trans "State of the file"%}</dt>
<dd>
{% if item.is_active %}{%trans "Active file"%}{% else %}{%trans "Closed file"%}{% endif %}
</dd>
</dl>
+ {% endif %}
{% if item.closing %}
<dl class="col-12 col-md-6 col-lg-3 flex-wrap">
<dt>{%trans "Closing date"%}</dt>
@@ -86,6 +88,7 @@
{% include "ishtar/blocks/sheet_json.html" %}
+ {% if item.geodata_list or item.towns or item.departments or item.address or item.locality or item.associated_file.address_complement or item.associated_file.postal_code or item.total_surface %}
<h3>{% trans "Geographic localisation" %}</h3>
<div class="row">
{% field_flex_detail_multiple_full "Towns" item.towns %}
@@ -103,9 +106,9 @@
</div>
{% endif %}
</div>
+ {% endif %}
{% if item.is_preventive %}
-
<h3>{% trans "Preventive archaeological file"%}</h3>
<div class="row">
@@ -143,7 +146,7 @@
</div>
{% else %}
-
+ {% if item.scientist or item.requested_operation_type or item.organization or item.cira_advised or item.mh_register or item.mh_listing or item.classified_area or item.protected_area or item.research_comment %}
<h3>{% trans "Research archaeology"%}</h3>
<div class="row">
{% field_flex_detail "Head scientist" item.scientist %}
@@ -174,15 +177,18 @@
</div>
{% endif %}
+ {% endif %}
{% if not next %}
-
+ {% if item.has_parcels %}
{% trans "Associated parcels" as parcels_label %}
{% include "ishtar/blocks/window_tables/parcels.html" %}
-
+ {% endif %}
+ {% if item.administrative_act.exists %}
{% trans "Administrative acts" as administrativeacts_label %}
{% table_administrativact administrativeacts_label item.administrative_act.all %}
-
+ {% endif %}
+ {% if item.operations.exists %}
<h3>{%trans "Associated operations"%}</h3>
<table class="table table-striped">
<tr>
@@ -209,7 +215,9 @@
<tr><td colspan="8" class='no_items'>{% trans "No operation associated to this archaeological file" %}</td></tr>
{% endfor %}
</table>
+ {% endif %}
+ {% if item.operations_acts %}
<h3>{%trans "Admninistrative acts linked to associated operations"%}</h3>
<table class="table table-striped">
<tr>
@@ -231,6 +239,7 @@
</table>
{% endif %}
+ {% endif %}
{% trans "Document for this archaeological file" as fle_docs %}
{% if permission_view_own_document or permission_view_document %}
@@ -240,11 +249,13 @@
{% endif %}
{% if not is_external %}
+ {% if item.history_creator or item.last_edition_date or item.created %}
<h3>{% trans "Sheet"%}</h3>
<div class="row">
{% include "ishtar/blocks/sheet_creation_section.html" %}
</div>
{% endif %}
+ {% endif %}
</div>{% if has_costs %}
<div class="tab-pane fade show active" id="{{window_id}}-costs"