From 029945ebd31fce0a3283c6dd581caa65a758bb45 Mon Sep 17 00:00:00 2001
From: Étienne Loks
Date: Fri, 25 Feb 2011 03:56:53 +0100
Subject: Work on archaelogical file sheet (refs #227)
---
ishtar/furnitures/models.py | 29 +++++++++++-
ishtar/templates/sheet_file.html | 99 ++++++++++++++++++++--------------------
static/media/style.css | 52 +++++++++++++--------
3 files changed, 110 insertions(+), 70 deletions(-)
diff --git a/ishtar/furnitures/models.py b/ishtar/furnitures/models.py
index 03a01e872..3b73baba0 100644
--- a/ishtar/furnitures/models.py
+++ b/ishtar/furnitures/models.py
@@ -236,6 +236,11 @@ class Person(Address, OwnPerms) :
lbl += self.email
return lbl
+ def full_label(self):
+ return " ".join([getattr(self, attr)
+ for attr in ('title', 'surname', 'name', 'attached_to')
+ if getattr(self, attr)])
+
class IshtarUser(User):
person = models.ForeignKey(Person, verbose_name=_(u"Person"), unique=True)
@@ -338,6 +343,26 @@ class File(BaseHistorizedItem, OwnPerms):
def get_query_owns(cls, user):
return Q(history_modifier=user) & Q(is_active=True)
+ def closing(self):
+ if self.is_active:
+ return
+ for item in self.history.all():
+ if item.is_active():
+ break
+ closing_item = item
+ return {'date':item.history_date, 'user':item.history_modifier}
+
+ def total_surface_ha(self):
+ if self.total_surface:
+ return self.total_surface/10000.0
+
+ def total_developed_surface_ha(self):
+ if self.total_developed_surface:
+ return self.total_developed_surface/10000.0
+
+ def is_preventive(self):
+ return FileType.is_preventive(self.file_type.pk)
+
class OperationType(GeneralType):
class Meta:
verbose_name = _(u"Operation type")
@@ -666,9 +691,9 @@ related_name='+', verbose_name=_(u"Person in charge of the scientific part"))
signatory = models.ForeignKey(Person, blank=True, null=True,
related_name='+', verbose_name=_(u"Signatory"))
operation = models.ForeignKey(Operation, blank=True, null=True,
- related_name='+', verbose_name=_(u"Operation"))
+ related_name='administrative_act', verbose_name=_(u"Operation"))
associated_file = models.ForeignKey(File, blank=True, null=True,
- related_name='+', verbose_name=_(u"Archaelogical file"))
+ related_name='administrative_act', verbose_name=_(u"Archaelogical file"))
signature_date = models.DateField(_(u"Signature date"))
act_object = models.CharField(_(u"Object"), max_length=200)
if settings.COUNTRY == 'fr':
diff --git a/ishtar/templates/sheet_file.html b/ishtar/templates/sheet_file.html
index 67b48d26b..57f1c00fc 100644
--- a/ishtar/templates/sheet_file.html
+++ b/ishtar/templates/sheet_file.html
@@ -1,79 +1,78 @@
{% extends "sheet.html" %}
{% load i18n %}
{% block content %}
+{% trans "General"%}
{{ item.year }}
{{ item.numeric_reference }}
{{ item.internal_reference }}
{{ item.history.all.0.history_date }}
-{% if item.reception_date %}{%trans "Reception date"%} : {{ item.reception_date }}
{% endif %}
+{% if item.reception_date %} {{ item.reception_date }}
{% endif %}
+ {{ item.creation_date }}
{% comment %}
-{%trans "Creation date"%} : {% item.creation_date %}
{% if item.deadline_date and not item.acts %}
{%trans "Deadline"%} : {% item.deadline_date %}
{% endif %}
+{% endcomment %}
-{%trans "Responsible"%} : {% item.responsible %}
-
-{% if item.is_active %}
- {%trans "Active file"%}
-{% endif %}
-{% if item.is_inactive %}
- {%trans "Closed file"%}
- {%trans "Closure date" %} : {% item.closure_date %} {%trans "by" %} {% item.closer_user%}
+ {{ item.in_charge.full_label }}
+
+{% if item.is_active %}{%trans "Active file"%}
+{% else %}{%trans "Closed file"%}
+ {{ item.closing.date }} {%trans "by" %} {{ item.closing.user }}
{% endif %}
-
-{%trans "Type"%} : {% item.type %}
-{% if item.related %}{%trans "Related file"%} : {% item.related %}
{% endif %}
+ {{ item.file_type }}
-
-{%trans "Communes"%} : {% item.communes %}
+{% if item.related_file %}{%trans "Related file:"%} {{ item.related_file }}
{% endif %}
+ {{ item.comment }}
-{%trans "Principal adress"%} : {% item.princ_adress %}
-{%trans "Complementary adress"%} : {% item.complem_adress %}
-{%trans "Postal code"%} : {% item.postal_code %}
+{% trans "Localisation"%}
+ {{ item.towns.all|join:", " }}
+ {{ item.address }}
+ {{ item.complem_adress }}
+ {{ item.postal_code }}
-
-{%trans "Surface"%} : {% item.surface %} ({% item.surface_ha %) ha)
+ {{ item.total_surface }} m2 ({{ item.total_surface_ha }} ha)
-
{% if item.is_preventive %}
- {%trans "Planed surface"%} : {% item.planed_surface %} ({% item.planed_surface_ha %) ha)
- {%trans "Saisine type"%} : {% item.saisine_type %}
- {% if item.service %}{%trans "Service"%} : {% item.service %}
{% endif %}
- {% if item.permit_type %}{%trans "Permit type"%} : {% item.permit_type %}
{% endif %}
- {% if item.permit_ref %}{%trans "Permit reference"%} : {% item.permit_ref %}
{% endif %}
- {% if item.contractor_org %}{%trans "Contractor organisation"%} : {% item.contractor_org %}
{% endif %}
- {% if item.contractor %}{%trans "Contractor"%} : {% item.contractor %}
{% endif %}
- {%trans "Numerical reference"%} : {% item.index %}
+{% trans "Preventive archaelogical file"%}
+ {{ item.total_developed_surface }} m2 ({{ item.total_developed_surface_ha }} ha)
+ {{ item.saisine_type }}
+{% if item.town_planning_service %}{{ item.town_planning_service }}
{% endif %}
+{% if item.permit_type %} {{ item.permit_type }}
{% endif %}
+{% if item.permit_reference %} {{ item.permit_reference }}
{% endif %}
+{% if item.general_contractor.attached_to %} {{ item.general_contractor.attached_to }}
{% endif %}
+{% if item.general_contractor %} {{ item.general_contractor.full_label }}
{% endif %}
+{% comment %}
+{%trans "Numerical reference"%} : {% item.index %}
+{% endcomment %}
{% endif %}
-{%trans "Comments"%} : {% item.comments %}
-
-
-
-
- {%trans "Admninistrative acts"%}
-
- {% for label, in item.data_acts %}
- {{label}} |
- {% endfor %}
-
- {% for data, in item.data_acts %}
-
- {{year}} |
- {{reference}} |
- {{type}} |
- {{date}} |
-
- {% endfor %}
-
-
+{% if item.administrative_act.all %}
+
+ {%trans "Admninistrative acts"%}
+
+ {% trans "Year" %} |
+ {% trans "Reference" %} |
+ {% trans "Type" %} |
+ {% trans "Date" %} |
+
+ {% for act in item.administrative_act.all %}
+
+ {{act.signature_date.year}} |
+ {{act.ref_sra}} |
+ {{act.act_type}} |
+ {{act.signature_date}} |
+
+ {% endfor %}
+
+{%endif%}
+{% comment %}
diff --git a/static/media/style.css b/static/media/style.css
index f559ac827..5e5613cfc 100644
--- a/static/media/style.css
+++ b/static/media/style.css
@@ -13,11 +13,16 @@ a {
color:#D14;
}
-caption {
+caption, h3 {
color:#922;
font-weight:bold;
}
+h3{
+ text-align:center;
+ margin:1em 0;
+}
+
label{display:block}
label:first-letter {
@@ -240,26 +245,11 @@ table.confirm tr.spacer td:last-child{
color:#D14;
}
-#window{
- position: absolute;
- top: 50px;
- width:600px;
- background: #FFF;
- z-index: 2000;
- left: 50%;
- margin-left: -300px;
- border: 1px solid #AAA;
- -webkit-box-shadow: 0px 0px 20px #444;
- -moz-box-shadow: 0px 0px 20px #444;
- text-align: left;
- display:none;
-}
-
#window{
width:760px;
- height:90%;
position: absolute;
- top: 5%;
+ position:fixed;
+ height:90%;
background: #FFF;
z-index: 2000;
left: 50%;
@@ -273,6 +263,28 @@ table.confirm tr.spacer td:last-child{
border-radius:8px;
}
+#window table{
+ margin:10px 0;
+ width:100%;
+ border-collapse:collapse;
+}
+
+#window caption{
+ font-size:1.2em;
+}
+
+#window table th{
+ text-align:center;
+ background-color:#922;
+ border:1px solid #EEE;
+ color:#FFF;
+}
+#window table td{
+ text-align:right;
+ padding:0 1em;
+ border:1px solid #EEE;
+}
+
#window .sheet{
}
@@ -289,7 +301,11 @@ table.confirm tr.spacer td:last-child{
}
#window .body{
+ position:absolute;
padding:10px;
+ overflow:auto;
+ top:18px;
+ bottom:10px;
}
#window label{
--
cgit v1.2.3