summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py141
-rw-r--r--archaeological_operations/migrations/0014_operationsource_search_vector.py21
-rw-r--r--archaeological_operations/models.py46
-rw-r--r--archaeological_operations/templates/ishtar/blocks/OAWidget.html7
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html10
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html41
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html23
-rw-r--r--archaeological_operations/templates/ishtar/dashboards/dashboard_operation.html68
-rw-r--r--archaeological_operations/templates/ishtar/sheet_administrativeact.html51
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html353
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operationsource.html4
-rw-r--r--archaeological_operations/widgets.py9
12 files changed, 446 insertions, 328 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 6ba343508..4f5ac0435 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -40,6 +40,7 @@ from ishtar_common.models import valid_id, Person, Town, \
organization_type_pk_lazy
from ishtar_common.wizards import MultiValueDict
+from bootstrap_datepicker.widgets import DateField
from archaeological_files.models import File
import models
@@ -49,7 +50,7 @@ from ishtar_common import widgets
from ishtar_common.forms import FinalForm, FormSet, get_now, \
reverse_lazy, get_form_selection, TableSelect, get_data_from_formset, \
- ManageOldType, CustomForm, FieldType
+ ManageOldType, IshtarForm, CustomForm, FieldType
from ishtar_common.forms_common import TownFormSet, SourceForm, SourceSelect, \
get_town_field, TownForm
@@ -66,7 +67,7 @@ class ParcelField(forms.MultiValueField):
return u"-".join(data_list)
-class ParcelForm(forms.Form):
+class ParcelForm(IshtarForm):
form_label = _("Parcels")
base_model = 'parcel'
associated_models = {'parcel': models.Parcel, 'town': models.Town, }
@@ -202,7 +203,7 @@ class ParcelForm(forms.Form):
return res
-class ParcelSelectionForm(forms.Form):
+class ParcelSelectionForm(IshtarForm):
_town = forms.ChoiceField(label=_("Town"), choices=(), required=False,
validators=[valid_id(models.Town)])
_parcel_selection = forms.CharField(
@@ -367,7 +368,7 @@ class ParcelFormSet(FormSet):
return self.cleaned_data
-class RecordRelationsForm(ManageOldType, forms.Form):
+class RecordRelationsForm(ManageOldType):
base_model = 'right_relation'
current_model = models.RelationType
current_related_model = models.Operation
@@ -525,14 +526,10 @@ class OperationSelect(TableSelect):
# max_length=20)
remains = forms.ChoiceField(label=_(u"Remains"), choices=[])
periods = forms.ChoiceField(label=_(u"Periods"), choices=[])
- start_before = forms.DateField(label=_(u"Started before"),
- widget=widgets.JQueryDate)
- start_after = forms.DateField(label=_(u"Started after"),
- widget=widgets.JQueryDate)
- end_before = forms.DateField(label=_(u"Ended before"),
- widget=widgets.JQueryDate)
- end_after = forms.DateField(label=_(u"Ended after"),
- widget=widgets.JQueryDate)
+ start_before = DateField(label=_(u"Started before"))
+ start_after = DateField(label=_(u"Started after"))
+ end_before = DateField(label=_(u"Ended before"))
+ end_after = DateField(label=_(u"Ended after"))
relation_types = forms.MultipleChoiceField(
label=_(u"Search within relations"), choices=[],
widget=forms.CheckboxSelectMultiple)
@@ -563,16 +560,16 @@ class OperationSelect(TableSelect):
args=['0', 'user']),
associated_model=Person),
validators=[valid_id(Person)])
- documentation_deadline_before = forms.DateField(
- label=_(u"Documentation deadline before"), widget=widgets.JQueryDate)
- documentation_deadline_after = forms.DateField(
- label=_(u"Documentation deadline after"), widget=widgets.JQueryDate)
+ documentation_deadline_before = DateField(
+ label=_(u"Documentation deadline before"))
+ documentation_deadline_after = DateField(
+ label=_(u"Documentation deadline after"))
documentation_received = forms.NullBooleanField(
label=_(u"Documentation received"))
- finds_deadline_before = forms.DateField(
- label=_(u"Finds deadline before"), widget=widgets.JQueryDate)
- finds_deadline_after = forms.DateField(
- label=_(u"Finds deadline after"), widget=widgets.JQueryDate)
+ finds_deadline_before = DateField(
+ label=_(u"Finds deadline before"))
+ finds_deadline_after = DateField(
+ label=_(u"Finds deadline after"))
finds_received = forms.NullBooleanField(
label=_(u"Finds received"))
@@ -618,13 +615,14 @@ class OperationSelect(TableSelect):
return ids
-class OperationFormSelection(forms.Form):
+class OperationFormSelection(IshtarForm):
+ SEARCH_AND_SELECT = True
form_label = _(u"Operation search")
associated_models = {'pk': models.Operation}
currents = {'pk': models.Operation}
pk = forms.IntegerField(
label="", required=False,
- widget=widgets.JQueryJqGrid(
+ widget=widgets.DataTable(
reverse_lazy('get-operation'), OperationSelect, models.Operation,
source_full=reverse_lazy('get-operation-full')),
validators=[valid_id(models.Operation)])
@@ -662,7 +660,7 @@ class OperationCodeInput(forms.TextInput):
return mark_safe(rendered + js)
-class OperationFormFileChoice(forms.Form):
+class OperationFormFileChoice(IshtarForm):
form_label = _(u"Associated file")
associated_models = {'associated_file': File, }
currents = {'associated_file': File}
@@ -673,7 +671,7 @@ class OperationFormFileChoice(forms.Form):
validators=[valid_id(File)], required=False)
-class OperationFormAbstract(CustomForm, forms.Form):
+class OperationFormAbstract(CustomForm, IshtarForm):
form_label = _(u"Abstract")
form_admin_name = _(u"Operation - 090 - Abstract")
form_slug = "operation-090-abstract"
@@ -692,7 +690,7 @@ PREVENTIVE_RESARCH = (('all', _('All')),
('research', _(u"Research")),)
-class DashboardForm(forms.Form):
+class DashboardForm(IshtarForm):
slicing = forms.ChoiceField(label=_("Slicing"), choices=SLICING,
required=False)
department_detail = forms.BooleanField(
@@ -706,10 +704,8 @@ class DashboardForm(forms.Form):
required=False)
operator = forms.ChoiceField(label=_("Operator"), choices=[],
required=False)
- after = forms.DateField(label=_(u"Date after"),
- widget=widgets.JQueryDate, required=False)
- before = forms.DateField(label=_(u"Date before"),
- widget=widgets.JQueryDate, required=False)
+ after = DateField(label=_(u"Date after"), required=False)
+ before = DateField(label=_(u"Date before"), required=False)
with_report = forms.BooleanField(label=_("With reports"), required=False)
with_finds = forms.BooleanField(label=_("With finds"), required=False)
@@ -744,9 +740,9 @@ class DashboardForm(forms.Form):
if self.cleaned_data.get('preventive_research'):
preventive_research = self.cleaned_data['preventive_research']
if preventive_research == 'preventive':
- fltr['file_type__preventive'] = True
- elif preventive_research == 'preventive':
- fltr['file_type__preventive'] = False
+ fltr['operation_type__preventive'] = True
+ elif preventive_research == 'research':
+ fltr['operation_type__preventive'] = False
if self.cleaned_data.get('operation_type'):
fltr['operation_type_id'] = self.cleaned_data['operation_type']
if self.cleaned_data.get('operator'):
@@ -762,7 +758,7 @@ class DashboardForm(forms.Form):
return fltr
-class OperationFormGeneral(ManageOldType, CustomForm, forms.Form):
+class OperationFormGeneral(CustomForm, ManageOldType):
form_label = _(u"General")
form_admin_name = _(u"Operation - 010 - General")
form_slug = "operation-010-general"
@@ -781,12 +777,12 @@ class OperationFormGeneral(ManageOldType, CustomForm, forms.Form):
max_length=500,
widget=OAWidget,
required=False)
+ operation_type = forms.ChoiceField(label=_(u"Operation type"),
+ choices=[])
common_name = forms.CharField(label=_(u"Generic name"), required=False,
max_length=500, widget=forms.Textarea)
address = forms.CharField(label=_(u"Address / Locality"), required=False,
max_length=500, widget=forms.Textarea)
- operation_type = forms.ChoiceField(label=_(u"Operation type"),
- choices=[])
year = forms.IntegerField(label=_(u"Year"),
initial=lambda: datetime.datetime.now().year,
validators=[validators.MinValueValidator(1000),
@@ -831,19 +827,15 @@ class OperationFormGeneral(ManageOldType, CustomForm, forms.Form):
label=_(u"Total surface (m2)"),
validators=[validators.MinValueValidator(0),
validators.MaxValueValidator(999999999)])
- start_date = forms.DateField(
- label=_(u"Start date"), required=False, widget=widgets.JQueryDate)
- excavation_end_date = forms.DateField(
- label=_(u"Excavation end date"), required=False,
- widget=widgets.JQueryDate)
- report_delivery_date = forms.DateField(
- label=_(u"Report delivery date"), required=False,
- widget=widgets.JQueryDate)
+ start_date = DateField(label=_(u"Start date"), required=False)
+ excavation_end_date = DateField(label=_(u"Excavation end date"),
+ required=False)
+ report_delivery_date = DateField(label=_(u"Report delivery date"),
+ required=False)
report_processing = forms.ChoiceField(label=_(u"Report processing"),
choices=[], required=False)
if settings.COUNTRY == 'fr':
- cira_date = forms.DateField(label=u"Date avis CIRA", required=False,
- widget=widgets.JQueryDate)
+ cira_date = DateField(label=u"Date avis CIRA", required=False)
negative_result = forms.NullBooleanField(
required=False, label=u"Résultat considéré comme négatif")
cira_rapporteur = forms.IntegerField(
@@ -858,14 +850,14 @@ class OperationFormGeneral(ManageOldType, CustomForm, forms.Form):
person_type_pk_lazy('head_scientist')]},
associated_model=Person, new=True),
validators=[valid_id(Person)], required=False)
- documentation_deadline = forms.DateField(
+ documentation_deadline = DateField(
label=_(u"Deadline for submission of the documentation"),
- required=False, widget=widgets.JQueryDate)
+ required=False)
documentation_received = forms.NullBooleanField(
required=False, label=_(u"Documentation received"))
- finds_deadline = forms.DateField(
+ finds_deadline = DateField(
label=_(u"Deadline for submission of the finds"), required=False,
- widget=widgets.JQueryDate)
+ )
finds_received = forms.NullBooleanField(
required=False, label=_(u"Finds received"))
@@ -920,7 +912,7 @@ class OperationFormGeneral(ManageOldType, CustomForm, forms.Form):
fields = OrderedDict()
ope_code = self.fields.pop('operation_code')
for key, value in self.fields.items():
- if key == 'year':
+ if key == 'old_code':
fields['operation_code'] = ope_code
fields[key] = value
self.fields = fields
@@ -1008,7 +1000,7 @@ OperationFormModifGeneral.associated_models = \
OperationFormModifGeneral.associated_models['associated_file'] = File
-class CollaboratorForm(CustomForm, forms.Form):
+class CollaboratorForm(CustomForm, IshtarForm):
form_label = _(u"Collaborators")
form_admin_name = _(u"Operation - 020 - Collaborators")
form_slug = "operation-020-collaborators"
@@ -1024,7 +1016,7 @@ class CollaboratorForm(CustomForm, forms.Form):
self.fields['collaborator'].widget.attrs['full-width'] = True
-class OperationFormPreventive(CustomForm, forms.Form):
+class OperationFormPreventive(CustomForm, IshtarForm):
form_label = _(u"Preventive informations - excavation")
form_admin_name = _(u"Operation - 033 - Preventive - Excavation")
form_slug = "operation-033-preventive-excavation"
@@ -1043,7 +1035,7 @@ class OperationFormPreventive(CustomForm, forms.Form):
validators.MaxValueValidator(100)])
-class OperationFormPreventiveDiag(CustomForm, forms.Form):
+class OperationFormPreventiveDiag(CustomForm, IshtarForm):
form_label = _("Preventive informations - diagnostic")
form_admin_name = _(u"Operation - 037 - Preventive - Diagnostic")
form_slug = "operation-037-preventive-diagnostic"
@@ -1058,7 +1050,7 @@ class OperationFormPreventiveDiag(CustomForm, forms.Form):
label=_(u"Prescription on geoarchaeological context"))
-class SelectedTownForm(forms.Form):
+class SelectedTownForm(IshtarForm):
form_label = _("Towns")
associated_models = {'town': Town}
town = forms.ChoiceField(label=_("Town"), choices=(),
@@ -1085,7 +1077,7 @@ TownFormset.form_admin_name = _(u"Operation - 040 - Towns (2)")
TownFormset.form_slug = "operation-040-towns-2"
-class SelectedParcelForm(forms.Form):
+class SelectedParcelForm(IshtarForm):
form_label = _("Parcels")
associated_models = {'parcel': models.Parcel}
parcel = forms.ChoiceField(
@@ -1146,9 +1138,9 @@ class RemainForm(CustomForm, ManageOldType, forms.Form):
base_model = 'remain'
associated_models = {'remain': models.RemainType}
- remain = forms.MultipleChoiceField(
- label=_("Remain type"), required=False, choices=[],
- widget=forms.CheckboxSelectMultiple)
+ remain = widgets.Select2MultipleField(
+ label=_(u"Remain type"), required=False
+ )
TYPES = [
FieldType('remain', models.RemainType, True),
@@ -1162,16 +1154,16 @@ class PeriodForm(CustomForm, ManageOldType, forms.Form):
base_model = 'period'
associated_models = {'period': models.Period}
- period = forms.MultipleChoiceField(
- label=_("Period"), required=False, choices=[],
- widget=forms.CheckboxSelectMultiple)
+ period = widgets.Select2MultipleField(
+ label=_(u"Period"), required=False
+ )
TYPES = [
FieldType('period', models.Period, True),
]
-class ArchaeologicalSiteForm(ManageOldType, forms.Form):
+class ArchaeologicalSiteForm(ManageOldType):
reference = forms.CharField(label=_(u"Reference"), max_length=20)
name = forms.CharField(label=_(u"Name"), max_length=200, required=False)
periods = forms.MultipleChoiceField(
@@ -1212,7 +1204,7 @@ class ArchaeologicalSiteForm(ManageOldType, forms.Form):
return item
-class ArchaeologicalSiteBasicForm(forms.Form):
+class ArchaeologicalSiteBasicForm(IshtarForm):
form_label = _("Archaeological site")
base_model = 'archaeological_site'
associated_models = {'archaeological_site': models.ArchaeologicalSite}
@@ -1234,7 +1226,7 @@ ArchaeologicalSiteFormSet.form_admin_name = _(
ArchaeologicalSiteFormSet.form_slug = "operation-030-archaeological-sites"
-class ArchaeologicalSiteSelectionForm(forms.Form):
+class ArchaeologicalSiteSelectionForm(IshtarForm):
form_label = _("Associated archaeological sites")
archaeological_sites = forms.IntegerField(
widget=widgets.JQueryAutoComplete(
@@ -1295,6 +1287,7 @@ class OperationSourceForm(SourceForm):
"operation": unicode(operation), 'last_val': max_val})
return cleaned_data
+
SourceOperationFormSelection = get_form_selection(
'SourceOperationFormSelection', _(u"Operation search"), 'operation',
models.Operation, OperationSelect, 'get-operation',
@@ -1334,6 +1327,7 @@ OperationSourceFormSelection = get_form_selection(
class AdministrativeActOpeSelect(TableSelect):
+ search_vector = forms.CharField(label=_(u"Full text search"))
year = forms.IntegerField(label=_("Year"))
index = forms.IntegerField(label=_("Index"))
if settings.COUNTRY == 'fr':
@@ -1386,13 +1380,14 @@ class AdministrativeActOpeSelect(TableSelect):
return ids
-class AdministrativeActOpeFormSelection(forms.Form):
+class AdministrativeActOpeFormSelection(IshtarForm):
+ SEARCH_AND_SELECT = True
form_label = _("Administrative act search")
associated_models = {'pk': models.AdministrativeAct}
currents = {'pk': models.AdministrativeAct}
pk = forms.IntegerField(
label="", required=False,
- widget=widgets.JQueryJqGrid(
+ widget=widgets.DataTable(
reverse_lazy('get-administrativeactop'),
AdministrativeActOpeSelect, models.AdministrativeAct,
table_cols='TABLE_COLS_OPE'),
@@ -1406,7 +1401,7 @@ class AdministrativeActOpeFormSelection(forms.Form):
return cleaned_data
-class AdministrativeActOpeForm(CustomForm, ManageOldType, forms.Form):
+class AdministrativeActOpeForm(CustomForm, ManageOldType):
form_label = _("General")
form_admin_name = _(u"Operation - Administrative act - General")
form_slug = "operation-adminact-general"
@@ -1420,8 +1415,8 @@ class AdministrativeActOpeForm(CustomForm, ManageOldType, forms.Form):
# validators=[valid_id(Person)], required=False)
act_object = forms.CharField(label=_(u"Object"), max_length=300,
widget=forms.Textarea, required=False)
- signature_date = forms.DateField(
- label=_(u"Signature date"), initial=get_now, widget=widgets.JQueryDate)
+ signature_date = DateField(
+ label=_(u"Signature date"), initial=get_now)
if settings.COUNTRY == 'fr':
ref_sra = forms.CharField(label=u"Autre référence", max_length=15,
required=False)
@@ -1482,7 +1477,7 @@ class FinalAdministrativeActDeleteForm(FinalForm):
confirm_end_msg = _(u"Would you like to delete this administrative act?")
-class DocumentGenerationAdminActForm(forms.Form):
+class DocumentGenerationAdminActForm(IshtarForm):
_associated_model = models.AdministrativeAct
document_template = forms.ChoiceField(label=_("Template"), choices=[])
@@ -1529,7 +1524,7 @@ class DocumentGenerationAdminActForm(forms.Form):
return template.publish(c_object)
-class GenerateDocForm(forms.Form):
+class GenerateDocForm(IshtarForm):
form_label = _("Doc generation")
doc_generation = forms.ChoiceField(
required=False, choices=[], label=_(u"Generate the associated doc?"))
@@ -1552,13 +1547,13 @@ class AdministrativeActRegisterSelect(AdministrativeActOpeSelect):
self.fields['act_type'].help_text = models.ActType.get_help()
-class AdministrativeActRegisterFormSelection(forms.Form):
+class AdministrativeActRegisterFormSelection(IshtarForm):
form_label = pgettext_lazy('admin act register', u"Register")
associated_models = {'pk': models.AdministrativeAct}
currents = {'pk': models.AdministrativeAct}
pk = forms.IntegerField(
label="", required=False,
- widget=widgets.JQueryJqGrid(
+ widget=widgets.DataTable(
reverse_lazy('get-administrativeact'),
AdministrativeActRegisterSelect, models.AdministrativeAct,
table_cols='TABLE_COLS',
diff --git a/archaeological_operations/migrations/0014_operationsource_search_vector.py b/archaeological_operations/migrations/0014_operationsource_search_vector.py
new file mode 100644
index 000000000..ceac0785f
--- /dev/null
+++ b/archaeological_operations/migrations/0014_operationsource_search_vector.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11 on 2018-01-19 15:16
+from __future__ import unicode_literals
+
+import django.contrib.postgres.search
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_operations', '0013_operation_images'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='operationsource',
+ name='search_vector',
+ field=django.contrib.postgres.search.SearchVectorField(blank=True, help_text='Auto filled at save', null=True, verbose_name='Search vector'),
+ ),
+ ]
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 2f1ea3ea3..d46d55089 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -645,7 +645,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
q = self.context_record.values(
'unit', 'unit__label').distinct().order_by('label')
for res in q.all():
- nbs.append((unicode(res['unit__label']),
+ nbs.append((unicode(res['unit__label'] or "-"),
self.context_record.filter(unit=res['unit']).count()))
return list(set(nbs))
@@ -659,7 +659,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
'datings__period', 'datings__period__label').distinct().order_by(
'datings__period__order')
for res in q.all():
- nbs.append((unicode(res['datings__period__label']),
+ nbs.append((unicode(res['datings__period__label'] or "-"),
self.context_record.filter(
datings__period=res['datings__period']).count()))
return nbs
@@ -690,7 +690,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
'material_types__label')
for res in q.all():
nbs.append(
- (unicode(res['material_types__label']),
+ (unicode(res['material_types__label'] or "-"),
Find.objects.filter(
base_finds__context_record__operation=self,
upstream_treatment_id__isnull=True,
@@ -733,7 +733,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
'datings__period__order')
for res in q.all():
nbs.append(
- (unicode(res['datings__period__label']),
+ (unicode(res['datings__period__label'] or "-"),
Find.objects.filter(
base_finds__context_record__operation=self,
upstream_treatment_id__isnull=True,
@@ -924,6 +924,8 @@ class OperationSource(Source):
'operation__operation_code': _(u"Operation code"),
'code': _(u"Document code")
}
+ PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['operation']
+
# fields
operation = models.ForeignKey(Operation, verbose_name=_(u"Operation"),
@@ -984,6 +986,8 @@ class ActType(GeneralType):
verbose_name = _(u"Act type")
verbose_name_plural = _(u"Act types")
ordering = ('label',)
+
+
post_save.connect(post_save_cache, sender=ActType)
post_delete.connect(post_save_cache, sender=ActType)
@@ -1049,6 +1053,12 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
RELATIVE_SESSION_NAMES = [('operation', 'operation__pk'),
('file', 'associated_file__pk')]
COL_LABELS = {'full_ref': _(u"Ref.")}
+ BASE_SEARCH_VECTORS = ['act_type__label', 'act_object',
+ 'towns_label']
+ INT_SEARCH_VECTORS = ["year", "index"]
+ PARENT_SEARCH_VECTORS = ['operator', 'scientist', 'signatory',
+ 'associated_file', 'operation', 'treatment_file',
+ 'treatment']
# fields
act_type = models.ForeignKey(ActType, verbose_name=_(u"Act type"))
@@ -1246,25 +1256,23 @@ class AdministrativeAct(BaseHistorizedItem, OwnPerms, ValueGetter):
if 'force' in kwargs:
force = kwargs.pop('force')
- if not self.signature_date:
- return super(AdministrativeAct, self).save(*args, **kwargs)
- self.year = self.signature_date.year
-
- if not self.act_type.indexed:
- return super(AdministrativeAct, self).save(*args, **kwargs)
-
- if not force:
- self._get_index()
- else:
- try:
- self._get_index()
- except:
- pass
-
+ if self.signature_date:
+ self.year = self.signature_date.year
+ if self.act_type.indexed:
+ if not force:
+ self._get_index()
+ else:
+ try:
+ self._get_index()
+ except:
+ pass
super(AdministrativeAct, self).save(*args, **kwargs)
if hasattr(self, 'associated_file') and self.associated_file:
self.associated_file.update_has_admin_act()
self.associated_file.update_short_menu_class()
+ updated = self.update_search_vector()
+ if updated:
+ self.save()
def strip_zero(value):
diff --git a/archaeological_operations/templates/ishtar/blocks/OAWidget.html b/archaeological_operations/templates/ishtar/blocks/OAWidget.html
index a1df5a00c..6f4c1af24 100644
--- a/archaeological_operations/templates/ishtar/blocks/OAWidget.html
+++ b/archaeological_operations/templates/ishtar/blocks/OAWidget.html
@@ -1 +1,6 @@
-OA <input class="widget-oa" type="text"{{final_attrs|safe}}>
+<div class="input-group">
+ <div class="input-group-prepend">
+ <div class="input-group-text">OA</div>
+ </div>
+ <input class="form-control widget-oa" type="text"{{final_attrs|safe}}>
+</div> \ No newline at end of file
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
index 4c41ed89e..6b651092b 100644
--- a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
@@ -1,14 +1,15 @@
{% load i18n %}
<h4>{{caption}}</h4>
-<div class='clean-table'>
-<div class='clean-table-wrap'>
-<table>
+<table class="table table-striped">
+ <thead>
<tr>
<th>{% trans "Ref." %}</th>
<th>{% trans "Type" %}</th>
<th>{% trans "Date" %}</th>
<th>{% trans "Object" %}</th>
</tr>
+ </thead>
+ <tbody>
{% for act in data %}
<tr>
<td>{{act.full_ref}}</td>
@@ -19,6 +20,5 @@
{% empty %}
<tr><td colspan="4" class='no_items'>{% trans "No administrative act associated" %}</td></tr>
{% endfor %}
+ </tbody>
</table>
-</div>
-</div>
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html
index d570b9db2..26b1915da 100644
--- a/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/archaeologicalsites.html
@@ -1,24 +1,23 @@
{% load i18n %}
<h4>{{caption}}</h4>
-<div class='clean-table'>
-<div class='clean-table-wrap'>
-<table>
- <tr>
- <th>{% trans "Ref." %}</th>
- <th>{% trans "Name" %}</th>
- <th>{% trans "Periods" %}</th>
- <th>{% trans "Remains" %}</th>
- </tr>
- {% for archaeosite in data %}
- <tr>
- <td class='string'>{{archaeosite.reference}}</td>
- <td class='string'>{{archaeosite.name}}</td>
- <td class='string'>{% for period in archaeosite.periods.all %}{{period}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
- <td class='string'>{% for remain in archaeosite.remains.all %}{{remain}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
- </tr>
- {% empty %}
- <tr><td colspan="4" class='no_items'>{% trans "No archaeological site associated" %}</td></tr>
- {% endfor %}
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>{% trans "Ref." %}</th>
+ <th>{% trans "Name" %}</th>
+ <th>{% trans "Periods" %}</th>
+ <th>{% trans "Remains" %}</th>
+ </tr>
+ <tbody>
+ {% for archaeosite in data %}
+ <tr>
+ <td class='string'>{{archaeosite.reference}}</td>
+ <td class='string'>{{archaeosite.name}}</td>
+ <td class='string'>{% for period in archaeosite.periods.all %}{{period}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
+ <td class='string'>{% for remain in archaeosite.remains.all %}{{remain}}{% include "blocks/comma_list.html" %}{% endfor %}</td>
+ </tr>
+ {% empty %}
+ <tr><td colspan="4" class='no_items'>{% trans "No archaeological site associated" %}</td></tr>
+ {% endfor %}
+ </tbody>
</table>
-</div>
-</div>
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
index 37be138b1..c52e5cd76 100644
--- a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
@@ -1,15 +1,16 @@
{% load i18n %}
<h4>{{ parcels_label }}</h4>
-<div class='clean-table'>
-<div class='clean-table-wrap'>
-<table>
- <tr>
- <th>{% trans "Town" %}</th>
- <th>{% trans "Year" %}</th>
- <th>{% trans "Section" %}</th>
- <th>{% trans "Parcels" %}</th>
- {#<th>{% trans "Owner" %}</th>#}
- </tr>
+<table class="table table-striped">
+ <thead>
+ <tr>
+ <th>{% trans "Town" %}</th>
+ <th>{% trans "Year" %}</th>
+ <th>{% trans "Section" %}</th>
+ <th>{% trans "Parcels" %}</th>
+ {#<th>{% trans "Owner" %}</th>#}
+ </tr>
+ </thead>
+ <tbody>
{% for parcel in item.grouped_parcels %}
<tr>
<td class='string'>{{parcel.town}}</td>
@@ -21,5 +22,5 @@
{% empty %}
<tr><td colspan="4" class='no_items'>{% trans "No parcel" %}</td></tr>
{% endfor %}
+ </tbody>
</table>
-</div></div>
diff --git a/archaeological_operations/templates/ishtar/dashboards/dashboard_operation.html b/archaeological_operations/templates/ishtar/dashboards/dashboard_operation.html
index 5b435032e..19302cd05 100644
--- a/archaeological_operations/templates/ishtar/dashboards/dashboard_operation.html
+++ b/archaeological_operations/templates/ishtar/dashboards/dashboard_operation.html
@@ -13,7 +13,7 @@
<div class='clean-table'>
<h4>{% trans "total" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th><th>{% trans "Number" %}</th>
</tr>
@@ -27,7 +27,7 @@
<div class='clean-table'>
<h4>{% trans "area by type of operation" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th><th>{% trans "Area (ha)" %}</th>
</tr>
@@ -41,7 +41,7 @@
<div class='clean-table'>
<h4>{% trans "by types" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for typ in dashboard.types %}
{% if forloop.counter0|divisibleby:5 %}
@@ -63,7 +63,7 @@
<div class='clean-table'>
<h4>{% trans "by year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -85,7 +85,7 @@
<div class='clean-table'>
<h4>{% trans "by realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.realisation_years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -107,7 +107,7 @@
<div class='clean-table'>
<h4>{% trans "effective operation by type and year" %}</h4>
<div class='clean-table-wrap'>
- <table class='mini-table'>
+ <table class='mini-table table table-striped'>
{% for lbl, years in dashboard.effective %}
{% if forloop.counter0|divisibleby:6 %}
@@ -132,7 +132,7 @@
<div class='clean-table'>
<h4>{% trans "by realisation month" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for mt in dashboard.last_months %}
{% if forloop.counter0|divisibleby:5 %}
@@ -159,7 +159,7 @@
<div class='clean-table'>
<h4>{% trans "total" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th><th>{% trans "Number" %}</th>
</tr>
@@ -173,7 +173,7 @@
<div class='clean-table'>
<h4>{% trans "by year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -195,7 +195,7 @@
<div class='clean-table'>
<h4>{% trans "by realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.realisation_years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -217,7 +217,7 @@
<div class='clean-table'>
<h4>{% trans "current year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th></th>{% for lbl in dashboard.filters_label %}<th>{{lbl}}</th>{%endfor%}
</tr>
@@ -235,7 +235,7 @@
<div class='clean-table'>
<h4>{% trans "organizations (current year)" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>&nbsp;</th><th>{% trans "Area" %}</th><th>{% trans "Man-day" %}</th><th>{% trans "Man-day/hectare" %}</th>
</tr>
@@ -249,7 +249,7 @@
<div class='clean-table'>
<h4>{% trans "current realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th>{% for lbl in dashboard.filters_label %}<th>{{lbl}}</th>{%endfor%}
</tr>
@@ -269,7 +269,7 @@
<div class='clean-table'>
<h4>{% trans "organizations (current realisation year)" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>&nbsp;</th><th>{% trans "Area" %}</th><th>{% trans "Man-day" %}</th><th>{% trans "Man-day/hectare" %}</th>
</tr>
@@ -282,7 +282,7 @@
<div class='clean-table'>
<h4>{% trans "area by organization by year" %}</h4>
<div class='clean-table-wrap'>
- <table class='mini-table'>
+ <table class='mini-table table table-striped'>
<tr>
</tr>
{% for org, vals in dashboard.survey.org_by_year %}
@@ -314,7 +314,7 @@
<div class='clean-table'>
<h4>{% trans "effective operations areas (ha)" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -337,7 +337,7 @@
<div class='clean-table'>
<h4>{% trans "man-days/hectare by year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -362,7 +362,7 @@
<div class='clean-table'>
<h4>{% trans "by month" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for mt in dashboard.last_months %}
{% if forloop.counter0|divisibleby:5 %}
@@ -383,7 +383,7 @@
<div class='clean-table'>
<h4>{% trans "by department" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -404,7 +404,7 @@
<div class='clean-table'>
<h4>{% trans "effective operation by department" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:4 %}
@@ -427,7 +427,7 @@
<div class='clean-table'>
<h4>{% trans "main towns by number" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Town" %}</th><th>{% trans "Number" %}</th>
</tr>
@@ -441,7 +441,7 @@
<div class='clean-table'>
<h4>{% trans "main towns by surface" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Town" %}</th><th>{% trans "Total surface (ha)" %}</th>
</tr>
@@ -458,7 +458,7 @@
<div class='clean-table'>
<h4>{% trans "total" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th><th>{% trans "Number" %}</th>
</tr>
@@ -472,7 +472,7 @@
<div class='clean-table'>
<h4>{% trans "by year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{%for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -492,7 +492,7 @@
<div class='clean-table'>
<h4>{% trans "by realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.realisation_years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -512,7 +512,7 @@
<div class='clean-table'>
<h4>{% trans "current realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Status" %}</th>{% for lbl in dashboard.filters_label %}<th>{{lbl}}</th>{%endfor%}
</tr>
@@ -532,7 +532,7 @@
<div class='clean-table'>
<h4>{% trans "organizations (current realisation year)" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>&nbsp;</th><th>{% trans "Area" %}</th><th>{% trans "Man-day" %}</th><th>{% trans "Man-day/hectare" %}</th>
</tr>
@@ -546,7 +546,7 @@
<div class='clean-table'>
<h4>{% trans "area by organization by year" %}</h4>
<div class='clean-table-wrap'>
- <table class='mini-table'>
+ <table class='mini-table table table-striped'>
{% for org, vals in dashboard.excavation.org_by_year %}
{% if forloop.counter0|divisibleby:5 %}
<tr>
@@ -580,7 +580,7 @@
<div class='clean-table'>
<h4>{% trans "area by organization by realisation year" %}</h4>
<div class='clean-table-wrap'>
- <table class='mini-table'>
+ <table class='mini-table table table-striped'>
{% for org, vals in dashboard.excavation.org_by_year %}
{% if forloop.counter0|divisibleby:5 %}
@@ -616,7 +616,7 @@
<div class='clean-table'>
<h4>{% trans "by month" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for mt in dashboard.last_months %}
{% if forloop.counter0|divisibleby:5 %}
@@ -636,7 +636,7 @@
<div class='clean-table'>
<h4>{% trans "by department" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:5 %}
@@ -657,7 +657,7 @@
<div class='clean-table'>
<h4>{% trans "effective operation by department" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
{% for yr in dashboard.years %}
{% if forloop.counter0|divisibleby:3 %}
@@ -682,7 +682,7 @@
<div class='clean-table'>
<h4>{% trans "main towns by number" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Town" %}</th><th>{% trans "Number" %}</th>
</tr>
@@ -696,7 +696,7 @@
<div class='clean-table'>
<h4>{% trans "main towns by cost" %}</h4>
<div class='clean-table-wrap'>
- <table>
+ <table class="table table-striped">
<tr>
<th>{% trans "Town" %}</th><th>{% trans "Cost (euros)" %}</th>
</tr>
diff --git a/archaeological_operations/templates/ishtar/sheet_administrativeact.html b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
index 92246ba80..1ea2a789d 100644
--- a/archaeological_operations/templates/ishtar/sheet_administrativeact.html
+++ b/archaeological_operations/templates/ishtar/sheet_administrativeact.html
@@ -1,9 +1,9 @@
{% extends "ishtar/sheet.html" %}
{% load i18n window_header window_field %}
-{% block head_title %}{% trans "Administrative act" %}{% endblock %}
+{% block head_title %}<strong>{% trans "Administrative act" %}</strong> - {{item.full_ref}}{% endblock %}
-{% block content %}
+{% block toolbar %}
{% if item.operation %}
{% window_nav item window_id 'show-administrativeact' 'operation_administrativeactop_modify' %}
{% endif %}
@@ -16,31 +16,40 @@
{% if item.treatment_file %}
{% window_nav item window_id 'show-administrativeact' 'treatmentfile_administrativeacttreatmentfile_modify' %}
{% endif %}
+{% endblock %}
+
+{% block content %}
<h3>{% trans "General"%}</h3>
-<ul class='form-flex'>
- {% field_li "Year" item.year %}
- {% field_li "Index" item.index %}
- {% field_li "Internal reference" item.ref_sra %}
- {% field_li "Type" item.act_type %}
- {% field_li "Object" item.act_object %}
- {% field_li "Signature date" item.signature_date %}
- {% field_li "In charge" item.in_charge %}
- {% field_li "Archaeological preventive operator" item.operator %}
- {% field_li_detail "Associated file" item.associated_file %}
- {% field_li_detail "Operation" item.operation %}
- {% field_li_detail "Treatment" item.treatment %}
- {% field_li_detail "Treatment request" item.treatment_file %}
+<div class="row">
+ {% field_flex "Year" item.year %}
+ {% field_flex "Index" item.index %}
+ {% field_flex "Internal reference" item.ref_sra %}
+ {% field_flex "Type" item.act_type %}
+ {% field_flex "Object" item.act_object %}
+ {% field_flex "Signature date" item.signature_date %}
+ {% field_flex "In charge" item.in_charge %}
+ {% field_flex "Archaeological preventive operator" item.operator %}
+ {% field_flex_detail "Associated file" item.associated_file %}
+ {% field_flex_detail "Operation" item.operation %}
+ {% field_flex_detail "Treatment" item.treatment %}
+ {% field_flex_detail "Treatment request" item.treatment_file %}
{% if item.operation and item.operation.surface %}
- <li><label>{% trans "Surface"%}</label> <span class='value'>{{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)</span></li>
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{% trans "Surface"%}</dt>
+ <dd class='col-7'>
+ {{ item.operation.surface }} m<sup>2</sup> ({{ item.operation.surface_ha }} ha)
+ </dd>
+ </div>
{% endif %}
- {% field_li_detail "Created by" item.history_creator.ishtaruser.person %}
-{% comment %}{% if item.general_contractor.attached_to %}<p>
+ {% field_flex_detail "Created by" item.history_creator.ishtaruser.person %}
+
+ {% comment %}{% if item.general_contractor.attached_to %}<p>
<label>{% trans "General contractor organisation"%}</label>
<span class='value'>{{ item.general_contractor.attached_to }}</span></p>{% endif %} <!-- Contractor's organisation displayed as concat of Name/Adress/postal_code/city -->
-{% if item.general_contractor %}<p><label>{%trans "General contractor"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %}
-{% endcomment %}
-</ul>
+ {% if item.general_contractor %}<p><label>{%trans "General contractor"%}</label> <span class='value'>{{ item.general_contractor.full_label }}</span></p>{% endif %}
+ {% endcomment %}
+</div>
{% endblock %}
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index e46db74c7..8166d9d68 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -1,97 +1,162 @@
{% extends "ishtar/sheet.html" %}
{% load i18n window_tables window_header window_ope_tables window_field from_dict %}
-{% block head_title %}{% trans "Operation" %}{% endblock %}
+{% block head_title %}<strong>{% trans "Operation" %}</strong> - {{item.short_label}}{% endblock %}
-{% block content %}
+{% block toolbar %}
{% window_nav item window_id 'show-operation' 'operation_modify' 'show-historized-operation' 'revert-operation' previous next 1 %}
+{% endblock %}
+
+{% block content %}
+
+<div class="row">
+ <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12">
+ <div class="card">
+ {% if item.image %}
+ <img class='card-img-top' src="{{item.thumbnail.url}}">
+ {% endif%}
+ <div class="card-body">
+ <div class="row">
+ <div class="col main">
+ {% if item.year or item.operation_code %}
+ {{item.year|default:''}}-{{item.operation_code|default:''}}{% endif %}<br>
+ {% if item.code_patriarche %}OA{{item.code_patriarche}}{% endif %}
+ </div>
+ <div class="col text-muted">
+ {% include "ishtar/blocks/sheet_external_id.html" %}
+ </div>
+ </div>
+ <p class="card-text">
+ <p class='window-refs' title="{% trans 'Name' %}">{{item.common_name|default:''}}</p>
+ <p class='window-refs' title="{% trans 'Address' %}">{{item.address|default:''}}</p>
+ </p>
+ </div>
+ </div>
+ </div>
+</div>
-{% if item.image %}
-<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a>
-{% endif%}
+<h3>{% trans "General"%}</h3>
+
+<div class="row">
+ {% field_flex "Old code" item.old_code %}
+ {% include "ishtar/blocks/sheet_creation_section.html" %}
+ {% trans "Begining date" as begining_date_label %}
+ {% field_flex begining_date_label item.start_date|date:"DATE_FORMAT" %}
+ {% field_flex "Excavation end date" item.excavation_end_date|date:"DATE_FORMAT"|default:"-" %}
+ {% field_flex_detail "Head scientist" item.scientist %}
+ {% field_flex_detail "In charge" item.in_charge %}
+ {% field_flex_multiple "Collaborators" item.collaborators %}
+ {% field_flex_detail "Operator" item.operator %}
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{%trans "State"%}</dt>
+ <dd class='col-7'>
+ {% if item.is_active %}{%trans "Active file"%}
+ {% else %}{%trans "Closed operation"%}{% endif %}
+ </dd>
+ </div>
+ {% if item.closing.date %}
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{%trans "Closing date"%}</dt>
+ <dd class='col-7'>
+ {{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }}
+ </dd>
+ </div>
+ {% endif %}
+ {% field_flex "Type" item.operation_type %}
+ {% if item.surface %}
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{%trans "Surface"%}</dt>
+ <dd class='col-7'>
+ {{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha)
+ </dd>
+ </div>
+ {% endif %}
+ {% if item.cost %}
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{%trans "Cost" %}</dt>
+ <dd class='col-7'>
+ {{ item.cost }} &euro;{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} &euro;/m<sup>2</sup>){%endif%}
+ </dd>
+ </div>
+ {%endif%}
+ {% if item.duration %}
+ <div class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row">
+ <dt class="col-5">{%trans "Duration"%}</dt>
+ <dd class='col-7'>
+ {{ item.duration }} {% trans "days" %}
+ </dd>
+ </div>
+ {%endif%}
+ {% field_flex_multiple "Remains" item.remains %}
+ {% field_flex_multiple "Periods" item.periods %}
+ {% if item.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.QUALITY_DICT %}{% endif %}
+ {% if item.history_object and item.history_object.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.history_object.QUALITY_DICT %}{% endif %}
+ {% field_flex "Report delivery date" item.report_delivery_date %}
+ {% field_flex "Report processing" item.report_processing %}
+ {% field_flex "Deadline for submission of the documentation" item.documentation_deadline %}
+ {% field_flex "Documentation received" item.documentation_received %}
+ {% field_flex "Deadline for submission of the finds" item.finds_deadline %}
+ {% field_flex "Finds received" item.finds_received %}
+ {% field_flex_detail "Associated file" item.associated_file %}
+ {% field_flex "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %}
+ {% if item.associated_file.town_planning_service %}
+ {% field_flex "Planning service organization" item.associated_file.town_planning_service.full_address %}
+ {% else %}
+ {% field_flex "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %}
+ {% endif %}
+ {% field_flex "Permit type" item.associated_file.permit_type %}
+ {% field_flex "Permit reference" item.associated_file.permit_reference %}
+ {% field_flex "General contractor" item.associated_file.general_contractor.full_address %}
+ {% if item.associated_file.corporation_general_contractor %}
+ {% field_flex "General contractor organization" item.associated_file.corporation_general_contractor.full_address %}
+ {% else%}
+ {% field_flex "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %}
+ {% endif %}
+</div>
+<div class="row">
+ {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %}
+ {% field_flex_full "Abstract" item.abstract "<pre>" "</pre>" %}
+ {% field_flex_full "Comment about scientific documentation" item.scientific_documentation_comment "<pre>" "</pre>" %}
+
+ {% include "ishtar/blocks/sheet_json.html" %}
+</div>
{% if item.virtual_operation %}
-<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {% trans "This operation is virtual." %}</p>
+<div class="alert alert-warning" role="alert">
+ {% trans "This operation is virtual." %}
+</div>
{% endif %}
+
{% if not item.code_patriarche %}
-<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> {%trans "Patriarche OA code not yet recorded!"%}</p>
+<div class="alert alert-warning" role="alert">
+ {% trans "Patriarche OA code not yet recorded!"%}
+</div>
{% endif %}
-<p class='window-refs'>{% if item.year or item.operation_code %}{{item.year|default:''}}-{{item.operation_code|default:''}}{% endif %}{% if item.code_patriarche %} &ndash; OA{{item.code_patriarche}}{% endif %}
-</p>
-<p class='window-refs' title="{% trans 'Name' %}">{{item.common_name|default:''}}</p>
-<p class='window-refs' title="{% trans 'Address' %}">{{item.address|default:''}}</p>
-{% include "ishtar/blocks/sheet_external_id.html" %}
-
-<h3>{% trans "General"%}</h3>
-<ul class='form-flex'>
- {% field_li "Old code" item.old_code %}
- {% include "ishtar/blocks/sheet_creation_section.html" %}
- {% trans "Begining date" as begining_date_label %}
- {% field_li begining_date_label item.start_date %}
- {% field_li "Excavation end date" item.excavation_end_date|default:"-" %}
- {% field_li_detail "Head scientist" item.scientist %}
- {% field_li_detail "In charge" item.in_charge %}
- {% field_li_multiple "Collaborators" item.collaborators %}
- {% field_li_detail "Operator" item.operator %}
-<li><label>{%trans "State:"%}</label> <span class='value'>{% if item.is_active %}{%trans "Active file"%}</span></p>
-{% else %}{%trans "Closed operation"%}</span></li> {% endif %}
-{% if item.closing.date %}<li><label>{%trans "Closing date"%}</label> <span class='value'>{{ item.closing.date }} <strong>{%trans "by" %}</strong> {{ item.closing.user }}</span></li>{% endif %}
-{% field_li "Type" item.operation_type %}
-{% if item.surface %}<li><label>{%trans "Surface"%}</label> <span class='value'>{{ item.surface }} m<sup>2</sup> ({{ item.surface_ha }} ha)</span></li>{% endif %}
-{% if item.cost %}<li><label>{%trans "Cost"%}</label> <span class='value'>{{ item.cost }} &euro;{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} &euro;/m<sup>2</sup>){%endif%}</span></li>{%endif%}
-{% if item.duration %}<li><label>{%trans "Duration"%}</label> <span class='value'>{{ item.duration }} {%trans "Day"%}s</span></li>{%endif%}
-{% field_li_multiple "Remains" item.remains %}
-{% field_li_multiple "Periods" item.periods %}
-{% if item.QUALITY_DICT %}{% field_li "Record quality" item.record_quality|from_dict:item.QUALITY_DICT %}{% endif %}
-{% if item.history_object and item.history_object.QUALITY_DICT %}{% field_li "Record quality" item.record_quality|from_dict:item.history_object.QUALITY_DICT %}{% endif %}
-{% field_li "Report delivery date" item.report_delivery_date %}
-{% field_li "Report processing" item.report_processing %}
-{% field_li "Deadline for submission of the documentation" item.documentation_deadline %}
-{% field_li "Documentation received" item.documentation_received %}
-{% field_li "Deadline for submission of the finds" item.finds_deadline %}
-{% field_li "Finds received" item.finds_received %}
-{% field_li_detail "Associated file" item.associated_file %}
-{% field_li "Responsible for planning service" item.associated_file.responsible_town_planning_service.full_address %}
-{% if item.associated_file.town_planning_service %}
- {% field_li "Planning service organization" item.associated_file.town_planning_service.full_address %}
-{% else %}
- {% field_li "Planning service organization" item.associated_file.responsible_town_planning_service.attached_to.full_address %}
-{% endif %}
-{% field_li "Permit type" item.associated_file.permit_type %}
-{% field_li "Permit reference" item.associated_file.permit_reference %}
-{% field_li "General contractor" item.associated_file.general_contractor.full_address %}
-{% if item.associated_file.corporation_general_contractor %}
- {% field_li "General contractor organization" item.associated_file.corporation_general_contractor.full_address %}
-{% else%}
- {% field_li "General contractor organization" item.associated_file.general_contractor.attached_to.full_address %}
-{% endif %}
-</ul>
-{% field "Comment" item.comment "<pre>" "</pre>" %}
-{% field "Abstract" item.abstract "<pre>" "</pre>" %}
-{% field "Comment about scientific documentation" item.scientific_documentation_comment "<pre>" "</pre>" %}
-
-{% include "ishtar/blocks/sheet_json.html" %}
-
{% if not next %}
{% if item.towns.count %}
<h3>{% trans "Localisation"%}</h3>
-<ul class='form-flex'>
-{% field_li "Towns" item.towns_codes|join:" ; " %}
-{% field_li "Main address" item.associated_file.address %}
-{% field_li "Complement" item.associated_file.address_complement %}
-{% field_li "Postal code" item.associated_file.postal_code %}
-</ul>
+<div class="row">
+ {% field_flex_full "Towns" item.towns_codes|join:" ; " %}
+ {% field_flex "Main address" item.associated_file.address %}
+ {% field_flex "Complement" item.associated_file.address_complement %}
+ {% field_flex "Postal code" item.associated_file.postal_code %}
+</div>
{% endif %}
{% if item.right_relations.count %}
<h3>{% trans "Relations"%}</h3>
{% for rel in item.right_relations.all %}
{% ifchanged rel.relation_type %}
-{% if forloop.counter0 %}</ul>{% endif %}
-<h4>{{rel.relation_type}}</h4><ul>{% endifchanged %}
-<li><a href="#" onclick="load_window('/show-operation/{{rel.right_record.pk}}/');" class="display_details"><i class="fa fa-info-circle" aria-hidden="true"></i></a> {{rel.right_record}}</li>
-{% if forloop.last %}</ul>{% endif %}
+<h4>{{rel.relation_type}}</h4>
+<div class="row">{% endifchanged %}
+ <div class="col-12">
+ <a href="#" onclick="load_window('/show-operation/{{rel.right_record.pk}}/');" class="display_details">
+ <i class="fa fa-info-circle" aria-hidden="true"></i>
+ </a> {{rel.right_record}}
+ </div>
+{% if forloop.last %}
+</div>{% endif %}
{% endfor %}
{% endif %}
@@ -147,95 +212,107 @@
<small class="centered"><em>{% trans "These numbers are updated hourly" %}</em></small>
<h4>{% trans "Administrative acts" %}</h4>
-<ul class='form-flex'>
-{% field_li "Number of administrative acts" item.nb_acts %}
-{% field_li "Number of indexed administrative acts" item.nb_indexed_acts %}
-</ul>
+<div class='row'>
+{% field_flex_2 "Number of administrative acts" item.nb_acts %}
+{% field_flex_2 "Number of indexed administrative acts" item.nb_indexed_acts %}
+</div>
<h4>{% trans "Parcels" %}</h4>
-<ul class='form-flex'>
-{% field_li "Number of parcels" item.nb_parcels %}
-</ul>
+<div class='row'>
+{% field_flex_2 "Number of parcels" item.nb_parcels %}
+</div>
<h4>{% trans "Context records" %}</h4>
-<ul class='form-flex'>
-{% field_li "Number of context records" item.nb_context_records %}
-</ul>
-<ul class='form-flex'>
+<div class='row'>
+{% field_flex_2 "Number of context records" item.nb_context_records %}
+</div>
+<div class='row'>
{% if item.nb_context_records_by_type %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_context_records_by_type %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_context_records_by_type %}
+ <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
{% if item.nb_context_records_by_periods %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_context_records_by_periods %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_context_records_by_periods %}
+ <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
-</ul>
+</div>
<h4>{% trans "Finds" %}</h4>
-<ul class='form-flex'>
-{% field_li "Number of finds" item.nb_finds %}
-</ul>
-<ul class='form-flex'>
+<div class='row'>
+{% field_flex_2 "Number of finds" item.nb_finds %}
+</div>
+<div class='row'>
{% if item.nb_finds_by_material_type %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_finds_by_material_type %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Material type" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_finds_by_material_type %}
+ <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
{% if item.nb_finds_by_types %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_finds_by_types %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Object type" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_finds_by_types %}
+ <tr><td>{{label}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
{% if item.nb_finds_by_periods %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_finds_by_periods %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Period" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_finds_by_periods %}
+ <tr><td>{{label|default:"-"}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
-</ul>
+</div>
<h4>{% trans "Sources" %}</h4>
-<ul class='form-flex'>
-{% field_li "Number of sources" item.nb_documents %}
-</ul>
-<ul class='form-flex'>
+<div class='row'>
+{% field_flex "Number of sources" item.nb_documents %}
+</div>
+<div class='row'>
{% if item.nb_documents_by_types %}
-<li><table class='clean-table small'>
- <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr>
-{% for label, nb in item.nb_documents_by_types %}
- <tr><td>{{label}}</td><td>{{nb}}</td></tr>
-{% endfor %}
-</table></li>
+ <div class="col-12 col-md-6 col-lg-4">
+ <table class="table table-striped">
+ <tr><th>{% trans "Type" %}</th><th>{% trans "Number" %}</th></tr>
+ {% for label, nb in item.nb_documents_by_types %}
+ <tr><td>{{label}}</td><td>{{nb}}</td></tr>
+ {% endfor %}
+ </table>
+ </div>
{% endif %}
-</ul>
+</div>
{% if item.nb_stats_finds_by_ue %}
<h4>{% trans "Finds by context records" %}</h4>
-<ul class='form-flex'>
-{% field_li "Mean" item.nb_stats_finds_by_ue.mean %}
-{% field_li "Min" item.nb_stats_finds_by_ue.min %}
-{% field_li "Max" item.nb_stats_finds_by_ue.max %}
-{% field_li "Mode" item.nb_stats_finds_by_ue.mode %}
-</ul>
+<div class='row'>
+{% field_flex_2 "Mean" item.nb_stats_finds_by_ue.mean %}
+{% field_flex_2 "Min" item.nb_stats_finds_by_ue.min %}
+{% field_flex_2 "Max" item.nb_stats_finds_by_ue.max %}
+{% field_flex_2 "Mode" item.nb_stats_finds_by_ue.mode %}
+</div>
{% endif %}
{% endif %}
-{% endblock %}
+{% endblock %} \ No newline at end of file
diff --git a/archaeological_operations/templates/ishtar/sheet_operationsource.html b/archaeological_operations/templates/ishtar/sheet_operationsource.html
index 55c48b319..91cb483f0 100644
--- a/archaeological_operations/templates/ishtar/sheet_operationsource.html
+++ b/archaeological_operations/templates/ishtar/sheet_operationsource.html
@@ -1,7 +1,7 @@
{% extends "ishtar/sheet_source.html" %}
{% load i18n window_field window_header link_to_window %}
-{% block head_title %}{% trans "Operation source" %}{% endblock %}
+{% block head_title %}<strong>{% trans "Operation source" %}</strong> - {{item.title}} - {{item.owner}}{% endblock %}
{% block window_nav %}
{% window_nav item window_id 'show-operationsource' 'operation_source_modify' %}
@@ -9,5 +9,5 @@
{% block related %}
{% trans "Related operation" as related_item_label %}
-{% field related_item_label item.owner '' item.owner|link_to_window %}
+{% field_flex related_item_label item.owner '' item.owner|link_to_window %}
{% endblock %}
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py
index 3a587e4fd..04e0fcdfd 100644
--- a/archaeological_operations/widgets.py
+++ b/archaeological_operations/widgets.py
@@ -52,9 +52,12 @@ class ParcelWidget(widgets.MultiWidget):
class SelectParcelWidget(widgets.TextInput):
def render(self, *args, **kwargs):
render = super(SelectParcelWidget, self).render(*args, **kwargs)
- render += u" <button name='formset_add' value='add'>%s</button>" \
- % _(u"Add")
- return mark_safe(render)
+ html = u"""{}
+ <div class="input-group-append">
+ <button class='input-group-text btn btn-success' name='formset_add'
+ value='add'>{}</button>
+ </div>""".format(render, _(u"Add"))
+ return mark_safe(html)
class OAWidget(forms.TextInput):