diff options
Diffstat (limited to 'archaeological_operations')
7 files changed, 326 insertions, 249 deletions
| diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 6ba343508..b1f87c249 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) @@ -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( @@ -1386,13 +1378,13 @@ class AdministrativeActOpeSelect(TableSelect):          return ids -class AdministrativeActOpeFormSelection(forms.Form): +class AdministrativeActOpeFormSelection(IshtarForm):      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 +1398,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 +1412,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 +1474,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 +1521,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 +1544,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/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/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html index e46db74c7..0052dde7b 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 %}{% trans "Operation:" %} {{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 }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/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 %} – 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 }} €{% if item.cost_by_m2 %}, ({{ item.cost_by_m2 }} €/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> +          <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> +    </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> +          <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> +    </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> +          <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> +    </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> +          <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> +          <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> +    </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"> +          <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/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): | 
