diff options
Diffstat (limited to 'archaeological_finds')
| -rw-r--r-- | archaeological_finds/forms.py | 26 | ||||
| -rw-r--r-- | archaeological_finds/forms_treatments.py | 54 | ||||
| -rw-r--r-- | archaeological_finds/migrations/0015_auto_20180119_1516.py | 31 | ||||
| -rw-r--r-- | archaeological_finds/models_finds.py | 1 | ||||
| -rw-r--r-- | archaeological_finds/models_treatments.py | 20 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_find.html | 241 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_findsource.html | 4 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_treatment.html | 85 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_treatmentfile.html | 74 |
9 files changed, 310 insertions, 226 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index eca12f6e9..26ba8350f 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -41,11 +41,12 @@ import models from ishtar_common.forms import FormSet, FloatField, \ get_form_selection, reverse_lazy, TableSelect, get_now, FinalForm, \ - ManageOldType, FieldType + ManageOldType, FieldType, IshtarForm from ishtar_common.forms_common import get_town_field, SourceSelect, CustomForm from ishtar_common.utils import convert_coordinates_to_point from ishtar_common import widgets +from bootstrap_datepicker.widgets import DatePicker from archaeological_operations.widgets import OAWidget from archaeological_warehouse.models import Warehouse @@ -126,7 +127,7 @@ class RecordFormSelection(CustomForm, forms.Form): cr.operation.pk) -class FindForm(CustomForm, ManageOldType, forms.Form): +class FindForm(CustomForm, ManageOldType): file_upload = True form_label = _("Find") form_admin_name = _(u"Find - 020 - General") @@ -147,7 +148,7 @@ class FindForm(CustomForm, ManageOldType, forms.Form): description = forms.CharField(label=_("Description"), widget=forms.Textarea, required=False) get_first_base_find__discovery_date = forms.DateField( - label=_(u"Discovery date"), widget=widgets.JQueryDate, required=False) + label=_(u"Discovery date"), widget=DatePicker, required=False) get_first_base_find__batch = forms.ChoiceField( label=_(u"Batch/object"), choices=[], required=False) @@ -196,7 +197,7 @@ class FindForm(CustomForm, ManageOldType, forms.Form): mark = forms.CharField(label=_(u"Mark"), required=False) checked = forms.ChoiceField(label=_(u"Check")) check_date = forms.DateField( - initial=get_now, label=_(u"Check date"), widget=widgets.JQueryDate) + initial=get_now, label=_(u"Check date"), widget=DatePicker) comment = forms.CharField(label=_(u"Comment"), required=False, widget=forms.Textarea) dating_comment = forms.CharField( @@ -268,7 +269,7 @@ class FindForm(CustomForm, ManageOldType, forms.Form): return self.cleaned_data -class PreservationForm(CustomForm, ManageOldType, forms.Form): +class PreservationForm(CustomForm, ManageOldType): form_label = _("Preservation") form_admin_name = _(u"Find - 030 - Preservation") form_slug = "find-030-preservation" @@ -295,7 +296,7 @@ class PreservationForm(CustomForm, ManageOldType, forms.Form): choices=[], required=False) insurance_value = FloatField(label=_(u"Insurance value"), required=False) appraisal_date = forms.DateField( - label=_(u"Appraisal date"), widget=widgets.JQueryDate, required=False) + label=_(u"Appraisal date"), widget=DatePicker, required=False) conservatory_comment = forms.CharField( label=_(u"Conservatory comment"), required=False, widget=forms.Textarea) @@ -463,12 +464,13 @@ class FindSelectWarehouseModule(FindSelect): class FindFormSelection(forms.Form): + SEARCH_AND_SELECT = True form_label = _("Find search") associated_models = {'pk': models.Find} currents = {'pk': models.Find} pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-find'), FindSelect, models.Find, source_full=reverse_lazy('get-find-full')), @@ -478,7 +480,7 @@ class FindFormSelection(forms.Form): class FindFormSelectionWarehouseModule(FindFormSelection): pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-find'), FindSelectWarehouseModule, models.Find, source_full=reverse_lazy('get-find-full')), @@ -491,7 +493,7 @@ class MultipleFindFormSelection(forms.Form): currents = {'pk': models.Find} pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-find'), FindSelect, models.Find, multiple_select=True, @@ -502,7 +504,7 @@ class MultipleFindFormSelection(forms.Form): class MultipleFindFormSelectionWarehouseModule(MultipleFindFormSelection): pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-find'), FindSelectWarehouseModule, models.Find, multiple_select=True, @@ -518,7 +520,7 @@ class FindMultipleFormSelection(forms.Form): # the warehouse module activated finds = forms.CharField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-find'), FindSelectWarehouseModule, models.Find, multiple=True, multiple_cols=[2, 3, 4]), validators=[valid_ids(models.Find)]) @@ -729,7 +731,7 @@ class NewFindBasketForm(forms.ModelForm): return super(NewFindBasketForm, self).save(commit) -class SelectFindBasketForm(forms.Form): +class SelectFindBasketForm(IshtarForm): form_label = _(u"Basket") associated_models = {'basket': models.FindBasket} need_user_for_initialization = True diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 4e5994ca9..6dfc028e6 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -37,10 +37,11 @@ from archaeological_operations.forms import AdministrativeActOpeForm, \ AdministrativeActOpeFormSelection, AdministrativeActModifForm from ishtar_common.forms import reverse_lazy, TableSelect, FinalForm, \ - ManageOldType, get_form_selection, CustomForm, FieldType + ManageOldType, get_form_selection, CustomForm, FieldType, IshtarForm from ishtar_common.forms_common import SourceSelect from ishtar_common import widgets +from bootstrap_datepicker.widgets import DatePicker logger = logging.getLogger(__name__) @@ -48,6 +49,7 @@ logger = logging.getLogger(__name__) class TreatmentSelect(TableSelect): + search_vector = forms.CharField(label=_(u"Full text search")) label = forms.CharField(label=_(u"Label")) other_reference = forms.CharField(label=_(u"Other ref.")) year = forms.IntegerField(label=_(u"Year")) @@ -64,18 +66,19 @@ class TreatmentSelect(TableSelect): class TreatmentFormSelection(forms.Form): + SEARCH_AND_SELECT = True form_label = _("Treatment search") associated_models = {'pk': models.Treatment} currents = {'pk': models.Treatment} pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-treatment'), TreatmentSelect, models.Treatment), validators=[valid_id(models.Treatment)]) -class BaseTreatmentForm(CustomForm, ManageOldType, forms.Form): +class BaseTreatmentForm(CustomForm, ManageOldType): form_label = _(u"Base treatment") form_admin_name = _(u"Treatment - 020 - General") form_slug = "treatment-020-general" @@ -137,9 +140,9 @@ class BaseTreatmentForm(CustomForm, ManageOldType, forms.Form): comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, required=False) start_date = forms.DateField(label=_(u"Start date"), required=False, - widget=widgets.JQueryDate) + widget=DatePicker) end_date = forms.DateField(label=_(u"Closing date"), required=False, - widget=widgets.JQueryDate) + widget=DatePicker) estimated_cost = forms.FloatField(label=_(u"Estimated cost ({currency})"), required=False) quoted_cost = forms.FloatField(label=_(u"Quoted cost ({currency})"), @@ -282,12 +285,12 @@ class TreatmentDeletionForm(FinalForm): u"lost!") confirm_end_msg = _(u"Would you like to delete this treatment?") -SLICING = (("month", _(u"months")), ('year', _(u"years")),) +SLICING = (("month", _(u"months")), ('year', _(u"years")),) DATE_SOURCE = (("start", _(u"Start date")), ("end", _(u"Closing date")),) -class DashboardForm(forms.Form): +class DashboardForm(IshtarForm): slicing = forms.ChoiceField(label=_("Slicing"), choices=SLICING, required=False) date_source = forms.ChoiceField( @@ -295,9 +298,9 @@ class DashboardForm(forms.Form): treatment_type = forms.ChoiceField(label=_("Treatment type"), choices=[], required=False) after = forms.DateField(label=_(u"Date after"), - widget=widgets.JQueryDate, required=False) + widget=DatePicker, required=False) before = forms.DateField(label=_(u"Date before"), - widget=widgets.JQueryDate, required=False) + widget=DatePicker, required=False) def __init__(self, *args, **kwargs): if 'prefix' not in kwargs: @@ -330,6 +333,7 @@ class DashboardForm(forms.Form): class AdministrativeActTreatmentSelect(TableSelect): + search_vector = forms.CharField(label=_(u"Full text search")) year = forms.IntegerField(label=_("Year")) index = forms.IntegerField(label=_("Index")) act_type = forms.ChoiceField(label=_("Act type"), choices=[]) @@ -338,9 +342,9 @@ class AdministrativeActTreatmentSelect(TableSelect): max_length=300) signature_date_after = forms.DateField( - label=_(u"Signature date after"), widget=widgets.JQueryDate) + label=_(u"Signature date after"), widget=DatePicker) signature_date_before = forms.DateField( - label=_(u"Signature date before"), widget=widgets.JQueryDate) + label=_(u"Signature date before"), widget=DatePicker) treatment__name = forms.CharField( label=_(u"Treatment name"), max_length=200) treatment__year = forms.IntegerField(label=_(u"Treatment year")) @@ -373,7 +377,7 @@ class AdministrativeActTreatmentFormSelection( AdministrativeActOpeFormSelection): pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-administrativeacttreatment'), AdministrativeActTreatmentSelect, AdministrativeAct), validators=[valid_id(AdministrativeAct)]) @@ -399,6 +403,7 @@ class AdministrativeActTreatmentModifForm( class TreatmentFileSelect(TableSelect): + search_vector = forms.CharField(label=_(u"Full text search")) name = forms.CharField(label=_(u"Name")) internal_reference = forms.CharField(label=_(u"Internal ref.")) year = forms.IntegerField(label=_(u"Year")) @@ -430,18 +435,19 @@ class TreatmentFileSelect(TableSelect): class TreatmentFileFormSelection(forms.Form): + SEARCH_AND_SELECT = True form_label = _("Treatment request search") associated_models = {'pk': models.TreatmentFile} currents = {'pk': models.TreatmentFile} pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-treatmentfile'), TreatmentFileSelect, models.TreatmentFile), validators=[valid_id(models.TreatmentFile)]) -class TreatmentFileForm(ManageOldType, forms.Form): +class TreatmentFileForm(ManageOldType): form_label = _(u"Treatment request") base_models = ['treatment_type_type'] associated_models = { @@ -482,13 +488,13 @@ class TreatmentFileForm(ManageOldType, forms.Form): comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, required=False) creation_date = forms.DateField(label=_(u"Start date"), required=False, - widget=widgets.JQueryDate, + widget=DatePicker, initial=lambda: datetime.datetime.now()) reception_date = forms.DateField( - label=_(u"Reception date"), required=False, widget=widgets.JQueryDate, + label=_(u"Reception date"), required=False, widget=DatePicker, initial=lambda: datetime.datetime.now()) end_date = forms.DateField(label=_(u"Closing date"), required=False, - widget=widgets.JQueryDate) + widget=DatePicker) def __init__(self, *args, **kwargs): user = kwargs.pop('user') @@ -542,7 +548,7 @@ DATE_SOURCE_FILE = ( ("end", _(u"Closing date")),) -class DashboardTreatmentFileForm(forms.Form): +class DashboardTreatmentFileForm(IshtarForm): slicing = forms.ChoiceField(label=_("Slicing"), choices=SLICING, required=False) date_source = forms.ChoiceField( @@ -550,9 +556,9 @@ class DashboardTreatmentFileForm(forms.Form): treatmentfile_type = forms.ChoiceField(label=_("Treatment request type"), choices=[], required=False) after = forms.DateField(label=_(u"Date after"), - widget=widgets.JQueryDate, required=False) + widget=DatePicker, required=False) before = forms.DateField(label=_(u"Date before"), - widget=widgets.JQueryDate, required=False) + widget=DatePicker, required=False) def __init__(self, *args, **kwargs): if 'prefix' not in kwargs: @@ -583,6 +589,7 @@ class DashboardTreatmentFileForm(forms.Form): class AdministrativeActTreatmentFileSelect(TableSelect): + search_vector = forms.CharField(label=_(u"Full text search")) year = forms.IntegerField(label=_("Year")) index = forms.IntegerField(label=_("Index")) act_type = forms.ChoiceField(label=_("Act type"), choices=[]) @@ -591,9 +598,9 @@ class AdministrativeActTreatmentFileSelect(TableSelect): max_length=300) signature_date_after = forms.DateField( - label=_(u"Signature date after"), widget=widgets.JQueryDate) + label=_(u"Signature date after"), widget=DatePicker) signature_date_before = forms.DateField( - label=_(u"Signature date before"), widget=widgets.JQueryDate) + label=_(u"Signature date before"), widget=DatePicker) treatment_file__name = forms.CharField( label=_(u"Treatment request name"), max_length=200) treatment_file__year = forms.IntegerField( @@ -629,7 +636,7 @@ class AdministrativeActTreatmentFileFormSelection( AdministrativeActOpeFormSelection): pk = forms.IntegerField( label="", required=False, - widget=widgets.JQueryJqGrid( + widget=widgets.DataTable( reverse_lazy('get-administrativeacttreatmentfile'), AdministrativeActTreatmentFileSelect, AdministrativeAct), validators=[valid_id(AdministrativeAct)]) @@ -651,6 +658,7 @@ class AdministrativeActTreatmentFileModifForm( pk = forms.IntegerField(required=False, widget=forms.HiddenInput) index = forms.IntegerField(label=_("Index"), required=False) + SourceTreatmentFormSelection = get_form_selection( 'SourceTreatmentFormSelection', _(u"Treatment search"), 'treatment', models.Treatment, TreatmentSelect, 'get-treatment', diff --git a/archaeological_finds/migrations/0015_auto_20180119_1516.py b/archaeological_finds/migrations/0015_auto_20180119_1516.py new file mode 100644 index 000000000..7d2067771 --- /dev/null +++ b/archaeological_finds/migrations/0015_auto_20180119_1516.py @@ -0,0 +1,31 @@ +# -*- 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_finds', '0014_auto_20171110_1717'), + ] + + operations = [ + migrations.AddField( + model_name='findsource', + name='search_vector', + field=django.contrib.postgres.search.SearchVectorField(blank=True, help_text='Auto filled at save', null=True, verbose_name='Search vector'), + ), + migrations.AddField( + model_name='treatmentfilesource', + name='search_vector', + field=django.contrib.postgres.search.SearchVectorField(blank=True, help_text='Auto filled at save', null=True, verbose_name='Search vector'), + ), + migrations.AddField( + model_name='treatmentsource', + 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_finds/models_finds.py b/archaeological_finds/models_finds.py index 2b782c614..e1c866f9d 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -1361,6 +1361,7 @@ class FindSource(Source): 'find__datings__period': 'find__datings__period__pk', 'find__description': 'find__description__icontains', } + PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['find'] class Meta: verbose_name = _(u"Find documentation") diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index 6c173959a..b35912fd0 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -41,6 +41,8 @@ class TreatmentState(GeneralType): verbose_name = _(u"Treatment state type") verbose_name_plural = _(u"Treatment state types") ordering = ('label',) + + post_save.connect(post_save_cache, sender=TreatmentState) post_delete.connect(post_save_cache, sender=TreatmentState) @@ -71,6 +73,13 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, # extra keys than can be passed to save method EXTRA_SAVED_KEYS = ('items', 'user') SLUG = 'treatment' + BASE_SEARCH_VECTORS = [ + 'treatment_types__label', 'treatment_state__label', 'label', 'goal', + 'external_id', 'comment', 'description', 'other_reference', + ] + INT_SEARCH_VECTORS = ["year", "index"] + M2M_SEARCH_VECTORS = ['downstream__cached_label', 'upstream__cached_label'] + PARENT_SEARCH_VECTORS = ['person', 'organization'] label = models.CharField(_(u"Label"), blank=True, null=True, max_length=200) other_reference = models.CharField(_(u"Other ref."), blank=True, null=True, @@ -277,6 +286,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem, return "-".join([str(slugify(getattr(self, attr))) for attr in ('year', 'index', 'label')]) + post_save.connect(cached_label_changed, sender=Treatment) @@ -293,6 +303,7 @@ def pre_delete_treatment(sender, **kwargs): find.downstream_treatment = None find.save() + pre_delete.connect(pre_delete_treatment, sender=Treatment) @@ -470,6 +481,8 @@ class TreatmentFileType(GeneralType): verbose_name = _(u"Treatment request type") verbose_name_plural = _(u"Treatment request types") ordering = ('label',) + + post_save.connect(post_save_cache, sender=TreatmentFileType) post_delete.connect(post_save_cache, sender=TreatmentFileType) @@ -479,6 +492,11 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem, SLUG = 'treatmentfile' SHOW_URL = 'show-treatmentfile' TABLE_COLS = ['type', 'year', 'index', 'internal_reference', 'name'] + BASE_SEARCH_VECTORS = [ + 'type__label', 'internal_reference', 'name', 'comment' + ] + INT_SEARCH_VECTORS = ['year', 'index'] + PARENT_SEARCH_VECTORS = ['in_charge', 'applicant', 'applicant_organisation'] SLUG = 'treatmentfile' # fields @@ -594,6 +612,7 @@ class TreatmentSource(Source): TABLE_COLS = ['treatment__cached_label'] + Source.TABLE_COLS COL_LABELS = {'treatment__cached_label': _(u"Treatment")} SHOW_URL = 'show-treatmentsource' + PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['treatment'] class Meta: verbose_name = _(u"Treatment documentation") @@ -628,6 +647,7 @@ class TreatmentFileSource(Source): TABLE_COLS = ['treatment_file__cached_label'] + Source.TABLE_COLS COL_LABELS = {'treatment_file__cached_label': _(u"Treatment file")} SHOW_URL = 'show-treatmentfilesource' + PARENT_SEARCH_VECTORS = Source.PARENT_SEARCH_VECTORS + ['treatment_file'] class Meta: verbose_name = _(u"Treatment request documentation") diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html index 68304740d..237a4d748 100644 --- a/archaeological_finds/templates/ishtar/sheet_find.html +++ b/archaeological_finds/templates/ishtar/sheet_find.html @@ -1,86 +1,96 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_field from_dict link_to_window window_tables window_header humanize %} -{% block head_title %}{% trans "Find" %}{% endblock %} -{% block content %} -{% window_nav item window_id 'show-find' 'find_modify' 'show-historized-find' 'revert-find' previous next 1 %} - -{% if item.image %} -<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a> -{% endif%} -{% if item.downstream_treatment %} -<p class='alert'><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> - {% trans "This sheet has a downstream treatment: it is related to an old version of the find." %}</p> -{% endif %} +{% block head_title %}<strong>{% trans "Find" %}</strong> - {{item.label|default:""}}{% endblock %} -<p class="window-refs" title="{% trans 'Free ID' %}">{{ item.label|default:"" }}</p> -<p class='window-refs' title="{% trans 'Base find - Complete ID' %}">{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.complete_id}}{% endfor %}</p> -<p class='window-refs' title="{% trans 'Base find - Short ID' %}">{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.short_id}}{% endfor %}</p> -<p class="window-refs" title="{% trans 'Find - Administrative ID' %}">{{ item.administrative_index|default:"" }}</p> -{% include "ishtar/blocks/sheet_external_id.html" %} +{% block toolbar %} +{% window_nav item window_id 'show-find' 'find_modify' 'show-historized-find' 'revert-find' previous next 1 %} +{% endblock %} +{% block content %} -<ul class='form-flex'> - {% field_li "Previous ID" item.previous_id %} +<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"> + <p class="card-text"> + <p class="window-refs" title="{% trans 'Free ID' %}">{{ item.label|default:"" }}</p> + <p class='window-refs' title="{% trans 'Base find - Complete ID' %}">{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.complete_id}}{% endfor %}</p> + <p class='window-refs' title="{% trans 'Base find - Short ID' %}">{% for base_find in item.base_finds.all %}{% if forloop.counter0 %} – {% endif %}{{base_find.short_id}}{% endfor %}</p> + <p class="window-refs" title="{% trans 'Find - Administrative ID' %}">{{ item.administrative_index|default:"" }}</p> + {% include "ishtar/blocks/sheet_external_id.html" %} + </p> + </div> + </div> + </div> +</div> - {% include "ishtar/blocks/sheet_creation_section.html" %} - {% trans "Administrative index" as admin_index_label %} - {% field_li admin_index_label item.administrative_index %} -{% field_li_multiple "Material types" item.material_types %} -{% field_li "Dating" item.dating %} -{% field_li "Length (cm)" item.length %} -{% field_li "Width (cm)" item.width %} -{% field_li "Height (cm)" item.height %} -{% field_li "Diameter (cm)" item.diameter %} -{% field_li "Thickness (cm)" item.thickness %} -{% field_li "Volume (l)" item.volume %} -{% field_li "Weight" item.weight_string %} -{% if item.dimensions_comment %} -</ul> -{% field "Dimensions comment" item.dimensions_comment "<pre>" "</pre>" %} -<ul class='form-flex'> +{% if item.downstream_treatment %} +<div class="alert alert-warning" role="alert"> + {% trans "This sheet has a downstream treatment: it is related to an old version of the find." %}</p> +</div> {% endif %} -{% field_li "Find number" item.find_number %} -{% field_li "Minimum number of individuals (MNI)" item.min_number_of_individuals %} -{% field_li_multiple "Object types" item.object_types %} -{% field_li_multiple "Integrity / interest" item.integrities %} -{% field_li_multiple "Remarkability" item.remarkabilities %} -{% field_li "Estimated value" item.estimated_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %} -{% if item.CHECK_DICT %} -{% field_li "Checked" item.checked|from_dict:item.CHECK_DICT %} -{% endif%} -{% if item.history_object and item.history_object.CHECK_DICT %} -{% field_li "Checked" item.checked|from_dict:item.history_object.CHECK_DICT %} -{% endif%} -</ul> +<div class='row'> + {% field_flex "Previous ID" item.previous_id %} + {% include "ishtar/blocks/sheet_creation_section.html" %} + {% trans "Administrative index" as admin_index_label %} + {% field_flex admin_index_label item.administrative_index %} + {% field_flex_multiple "Material types" item.material_types %} + {% field_flex "Dating" item.dating %} + {% field_flex "Length (cm)" item.length %} + {% field_flex "Width (cm)" item.width %} + {% field_flex "Height (cm)" item.height %} + {% field_flex "Diameter (cm)" item.diameter %} + {% field_flex "Thickness (cm)" item.thickness %} + {% field_flex "Volume (l)" item.volume %} + {% field_flex "Weight" item.weight_string %} + {% field_flex_full "Dimensions comment" item.dimensions_comment "<pre>" "</pre>" %} -{% field "Description" item.description "<pre>" "</pre>" %} -{% field "Comment" item.comment "<pre>" "</pre>" %} + {% field_flex "Find number" item.find_number %} + {% field_flex "Minimum number of individuals (MNI)" item.min_number_of_individuals %} + {% field_flex_multiple "Object types" item.object_types %} + {% field_flex_multiple "Integrity / interest" item.integrities %} + {% field_flex_multiple "Remarkability" item.remarkabilities %} + {% field_flex "Estimated value" item.estimated_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %} + {% if item.CHECK_DICT %} + {% field_flex "Checked" item.checked|from_dict:item.CHECK_DICT %} + {% endif%} + {% if item.history_object and item.history_object.CHECK_DICT %} + {% field_flex "Checked" item.checked|from_dict:item.history_object.CHECK_DICT %} + {% endif%} + {% field_flex_full "Description" item.description "<pre>" "</pre>" %} + {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} +</div> {% include "ishtar/blocks/sheet_json.html" %} {% if item.conservatory_state or item.conservatory_comment or item.alterations.count or item.alteration_causes.count or item.preservation_to_considers.count or item.treatment_emergency or item.insurance_value %} <h4>{% trans "Preservation" %}</h4> -<ul class='form-flex'> - {% field_li "Conservatory state" item.conservatory_state %} - {% field_li_multiple "Alteration" item.alterations %} - {% field_li_multiple "Alteration cause" item.alteration_causes %} - {% field_li_multiple "Recommended treatments" item.preservation_to_considers %} - {% field_li "Treatment emergency" item.treatment_emergency %} - {% field_li "Insurance value" item.insurance_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %} - {% field_li "Appraisal date" item.appraisal_date %} -</ul> - {% field "Conservatory comment" item.conservatory_comment "<pre>" "</pre>" %} +<div class='row'> + {% field_flex "Conservatory state" item.conservatory_state %} + {% field_flex_multiple "Alteration" item.alterations %} + {% field_flex_multiple "Alteration cause" item.alteration_causes %} + {% field_flex_multiple "Recommended treatments" item.preservation_to_considers %} + {% field_flex "Treatment emergency" item.treatment_emergency %} + {% field_flex "Insurance value" item.insurance_value|default_if_none:''|intcomma '' ' '|add:CURRENCY %} + {% field_flex "Appraisal date" item.appraisal_date %} + {% field_flex_full "Conservatory comment" item.conservatory_comment "<pre>" "</pre>" %} +</div> {% endif %} {% if item.container %} <h3>{% trans "Warehouse"%}</h3> -{% field_detail "Container" item.container %} -{% field "Container ID" item.container.cached_location %} -{% field_detail "Responsible warehouse" item.container.responsible %} -{% field_detail "Location (warehouse)" item.container.location %} -{% field "Precise localisation" item.container.divisions_lbl %} +<div class='row'> + {% field_flex_detail "Container" item.container %} + {% field_flex "Container ID" item.container.cached_location %} + {% field_flex_detail "Responsible warehouse" item.container.responsible %} + {% field_flex_detail "Location (warehouse)" item.container.location %} + {% field_flex "Precise localisation" item.container.divisions_lbl %} +</div> {% endif %} {% if item.upstream_treatment or item.downstream_treatment %} @@ -88,9 +98,7 @@ {% if item.upstream_treatment %} <h4>{% trans "Upstream treatment" %}</h4> -<div class='clean-table'> -<div class='clean-table-wrap'> -<table id='{{window_id}}-upstream'> +<table id='{{window_id}}-upstream' class="table table-striped"> <tr> <th> </th> <th>{% trans "Year - index" %}</th> @@ -123,16 +131,12 @@ </tr> {% endfor %} </table> -</div> -</div> <p class='tool'><a class='badge' href="{% url 'get-upstreamtreatment' 'csv' %}?submited=1&find_id={{item.pk}}" target="_blank" title='{% trans "Export as CSV"%}'>{% trans "CSV" %}</a> ({{ENCODING}})</p> {% endif %} {% if item.downstream_treatment %} <h4>{% trans "Downstream treatment" %}</h4> -<div class='clean-table'> -<div class='clean-table-wrap'> -<table id='{{window_id}}-downstream'> +<table id='{{window_id}}-downstream' class="table table-striped"> <tr> <th> </th> <th>{% trans "Year - index" %}</th> @@ -165,8 +169,6 @@ </tr> {% endfor %} </table> -</div> -</div> <p class='tool'><a class='badge' href="{% url 'get-downstreamtreatment' 'csv' %}?submited=1&find_id={{item.pk}}" target="_blank">{% trans "CSV" %}</a> ({{ENCODING}})</p> {% endif %} @@ -176,63 +178,63 @@ <h3>{% trans "Associated base finds"%}</h3> {% for base_find in item.base_finds.all %} -<p class='window-refs'>{{base_find.complete_id }}</p> -<p class='window-refs'>{{base_find.short_id }}</p> +<p class='window-refs text-center'>{{base_find.complete_id }}</p> +<p class='window-refs text-center'>{{base_find.short_id }}</p> {% if base_find.external_id %} -<p class='window-refs external-id'> +<p class='window-refs text-center external-id'> <small title="{% trans 'Internal ID' %}"> <i class="fa fa-key" aria-hidden="true"></i> {{base_find.external_id|default:''}} </small> </p>{% endif %} -<ul class='form-flex'> -{% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} -{% with item.history_creator.ishtaruser.full_label|add:"<br/><i>"|add:creation_date|add:"</i>" as creator %} -{% field_li "Created by" creator|safe %} -{% endwith %} -{% endwith %} -{% if item.history_creation_date != item.last_edition_date %} -{% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} -{% with item.history_modifier.ishtaruser.full_label|add:"<br/><i>"|add:edition_date|add:"</i>" as modifier %} -{% field_li "Last modified by" modifier|safe %} -{% endwith %} -{% endwith %} -{% endif %} -{% field_li "Batch/object" base_find.batch %} -{% if base_find.history_object and base_find.history_object.IS_ISOLATED_DICT %} -{% field_li "Batch/object" base_find.batch|from_dict:base_find.history_object.IS_ISOLATED_DICT %} -{% endif %} -{% field_li "Discovery date" base_find.discovery_date %} -{% field_li "Special interest" base_find.special_interest %} -{% field_li_detail "Context record" base_find.context_record %} -{% field_li "Town" base_find.context_record.parcel.town %} -{% field_li "Parcel" base_find.context_record.parcel %} -{% field_li_detail "Operation" base_find.context_record.operation %} -{% field_li "Point of topographic reference" base_find.topographic_localisation %} - -{% if base_find.x or base_find.y %} - <li><label>{% trans "Coordinates" %}</label> - <span class="value"> - {% trans "X"%} {{base_find.x|default_if_none:"-"}}, - {% trans "Y"%} {{base_find.y|default_if_none:"-"}}, - {% trans "Z"%} {{base_find.z|default_if_none:"-"}} - {% if base_find.spatial_reference_system %} - ({{base_find.spatial_reference_system.label}}{% if base_find.spatial_reference_system.srid %} - - {% trans "SRID"%} {{base_find.spatial_reference_system.srid}}{% endif %}) +<div class='row'> + {% with item.history_creation_date|date:"SHORT_DATETIME_FORMAT" as creation_date %} + {% with item.history_creator.ishtaruser.full_label|add:"<br/><i>"|add:creation_date|add:"</i>" as creator %} + {% field_flex "Created by" creator|safe %} + {% endwith %}{% endwith %} + {% if item.history_creation_date != item.last_edition_date %} + {% with item.last_edition_date|date:"SHORT_DATETIME_FORMAT" as edition_date %} + {% with item.history_modifier.ishtaruser.full_label|add:"<br/><i>"|add:edition_date|add:"</i>" as modifier %} + {% field_flex "Last modified by" modifier|safe %} + {% endwith %}{% endwith %} {% endif %} - </span> -{% endif %} -</ul> + {% field_flex "Batch/object" base_find.batch %} + {% if base_find.history_object and base_find.history_object.IS_ISOLATED_DICT %} + {% field_flex "Batch/object" base_find.batch|from_dict:base_find.history_object.IS_ISOLATED_DICT %} + {% endif %} + + {% field_flex "Discovery date" base_find.discovery_date %} + {% field_flex "Special interest" base_find.special_interest %} + {% field_flex_detail "Context record" base_find.context_record %} + {% field_flex "Town" base_find.context_record.parcel.town %} + {% field_flex "Parcel" base_find.context_record.parcel %} + {% field_flex_detail "Operation" base_find.context_record.operation %} + {% field_flex "Point of topographic reference" base_find.topographic_localisation %} -{% field "Description" base_find.description "<pre>" "</pre>" %} -{% field "Comment" base_find.comment "<pre>" "</pre>" %} + {% if base_find.x or base_find.y %} + <dl class="col-12 col-md-6 col-lg-4 d-flex flex-wrap row"> + <dt class="col-5">{% trans "Coordinates" %}</dt> + <dd class="col-7"> + {% trans "X"%} {{base_find.x|default_if_none:"-"}}, + {% trans "Y"%} {{base_find.y|default_if_none:"-"}}, + {% trans "Z"%} {{base_find.z|default_if_none:"-"}} + {% if base_find.spatial_reference_system %} + ({{base_find.spatial_reference_system.label}}{% if base_find.spatial_reference_system.srid %} - + {% trans "SRID"%} {{base_find.spatial_reference_system.srid}}{% endif %}) + {% endif %} + </dd> + </dl> + {% endif %} + {% field_flex_full "Description" base_find.description "<pre>" "</pre>" %} + {% field_flex_full "Comment" base_find.comment "<pre>" "</pre>" %} +</div> {% if forloop.counter0 %}<hr/>{% endif %} {% endfor %} {% if item.source.count %} <h3>{% trans "Documents"%}</h3> -<table id='{{window_id}}-docs'> +<table id='{{window_id}}-docs' class="table table-striped"> <caption>{%trans "Documents"%}</caption> <tr> <th> </th> @@ -254,11 +256,6 @@ {% empty %} {% endfor %} </table> - -<script type='text/javascript'> -tableToGrid('#{{window_id}}-docs', { - width: null, shrinkToFit: false}); -</script> {% endif %} {% endblock %} diff --git a/archaeological_finds/templates/ishtar/sheet_findsource.html b/archaeological_finds/templates/ishtar/sheet_findsource.html index fedb20911..a3825173f 100644 --- a/archaeological_finds/templates/ishtar/sheet_findsource.html +++ b/archaeological_finds/templates/ishtar/sheet_findsource.html @@ -1,7 +1,7 @@ {% extends "ishtar/sheet_source.html" %} {% load i18n window_field window_header link_to_window %} -{% block head_title %}{% trans "Find source" %}{% endblock %} +{% block head_title %}<strong>{% trans "Find source" %}</strong> - {{item.title}} - {{item.owner}}{% endblock %} {% block window_nav %} {% window_nav item window_id 'show-findsource' 'find_source_modify' %} @@ -9,5 +9,5 @@ {% block related %} {% trans "Related find" 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_finds/templates/ishtar/sheet_treatment.html b/archaeological_finds/templates/ishtar/sheet_treatment.html index 94f6e20a7..c1da714c2 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatment.html +++ b/archaeological_finds/templates/ishtar/sheet_treatment.html @@ -1,48 +1,59 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} -{% block head_title %}{% trans "Treatment" %}{% endblock %} -{% block content %} +{% block head_title %}<strong>{% trans "Treatment" %}</strong> - {{ item.label|default:"" }}{% endblock %} + +{% block toolbar %} {% window_nav item window_id 'show-treatment' 'treatment_modify' 'show-historized-treatment' 'revert-treatment' previous next 1 %} +{% endblock %} -{% if item.image %} -<a href='{{item.image.url}}' rel="prettyPhoto" title="{{item.label}}" class='photo'><img src='{{item.thumbnail.url}}'/></a> -{% endif%} +{% block content %} -<p class="window-refs">{{ item.label|default:"" }}</p> -{% if item.other_reference %} -<p class="window-refs">{{ item.other_reference }}</p>{% endif %} -<p class="window-refs">{{ item.year }} - {{ item.index }}</p> -{% if item.external_id %} -<p class="window-refs">{{ item.external_id }}</p>{% endif %} -{% if item.end_date %} -<p class="window-refs">{% trans "Closed" context "Treatment" %} ({{item.end_date}})</p> -{% else %} -<p class="window-refs">{% trans "Active" context "Treatment" %}</p> -{% endif %} +<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"> + <p class="card-text"> + <p class="window-refs">{{ item.label|default:"" }}</p> + {% if item.other_reference %} + <p class="window-refs">{{ item.other_reference }}</p>{% endif %} + <p class="window-refs">{{ item.year }} - {{ item.index }}</p> + {% if item.external_id %} + <p class="window-refs">{{ item.external_id }}</p>{% endif %} + {% if item.end_date %} + <p class="window-refs">{% trans "Closed" context "Treatment" %} ({{item.end_date}})</p> + {% else %} + <p class="window-refs">{% trans "Active" context "Treatment" %}</p> + {% endif %} + </p> + </div> + </div> + </div> +</div> -<ul class='form-flex'> - {% field_li_multiple "Treatment type" item.treatment_types %} - {% field_li "State" item.treatment_state %} - {% field_li_detail "Associated request" item.file %} - {% field_li "Location" item.location %} - {% field_li "Container" item.container %} - {% field_li "Responsible" item.person %} - {% field_li "Organization" item.organization %} - {% field_li "Start date" item.start_date %} - {% field_li "Closing date" item.end_date %} - {% field_li "Estimated cost" item.estimated_cost|intcomma '' " "|add:CURRENCY %} - {% field_li "Quoted cost" item.quoted_cost|intcomma '' " "|add:CURRENCY %} - {% field_li "Realized cost" item.realized_cost|intcomma '' " "|add:CURRENCY %} - {% field_li "Insurance cost" item.insurance_cost|intcomma '' " "|add:CURRENCY %} -</ul> -{% if item.description or item.comment or item.goal %} -{% field "Comment" item.comment "<pre>" "</pre>" %} -{% field "Description" item.description "<pre>" "</pre>" %} -{% field "Goal" item.goal "<pre>" "</pre>" %} -{% endif %} +<div class="row"> + {% field_flex_multiple "Treatment type" item.treatment_types %} + {% field_flex "State" item.treatment_state %} + {% field_flex_detail "Associated request" item.file %} + {% field_flex "Location" item.location %} + {% field_flex "Container" item.container %} + {% field_flex "Responsible" item.person %} + {% field_flex "Organization" item.organization %} + {% field_flex "Start date" item.start_date %} + {% field_flex "Closing date" item.end_date %} + {% field_flex "Estimated cost" item.estimated_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Quoted cost" item.quoted_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Realized cost" item.realized_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex "Insurance cost" item.insurance_cost|intcomma '' " "|add:CURRENCY %} + {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} + {% field_flex_full "Description" item.description "<pre>" "</pre>" %} + {% field_flex_full "Goal" item.goal "<pre>" "</pre>" %} -{% include "ishtar/blocks/sheet_json.html" %} + {% include "ishtar/blocks/sheet_json.html" %} +</div> {% trans "Upstream finds" as finds %} {% if item.upstream.count %} diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html index 9567d3081..f474aab7c 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html +++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html @@ -1,46 +1,60 @@ {% extends "ishtar/sheet.html" %} {% load i18n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} -{% block head_title %}{% trans "Treatment request" %}{% endblock %} -{% block content %} +{% block head_title %}<strong>{% trans "Treatment request" %}</strong> - {{ item.name|default:"" }}{% endblock %} + +{% block toolbar %} {% window_nav item window_id 'show-treatmentfile' 'treatmentfile_modify' 'show-historized-treatmentfile' 'revert-treatmentfile' previous next 1 %} +{% endblock %} -<p class="window-refs">{{ item.name|default:"" }}</p> -{% if item.internal_reference %} -<p class="window-refs">{{ item.internal_reference }}</p>{% endif %} -<p class="window-refs">{{ item.year }} - {{ item.index }}</p> -{% if item.external_id %} -<p class="window-refs">{{ item.external_id }}</p>{% endif %} -{% if item.end_date %} -<p class="window-refs">{% trans "Closed" context "Treatment request" %} ({{item.end_date}})</p> -{% else %} -<p class="window-refs">{% trans "Active" context "Treatment request" %}</p> -{% endif %} +{% block content %} -<ul class='form-flex'> - {% field_li "Type" item.type %} - {% field_li_detail "Responsible" item.in_charge %} - {% field_li "Creation date" item.creation_date %} - {% field_li "Reception date" item.reception_date %} - {% field_li "Closing date" item.end_date %} -</ul> -{% field "Comment" item.comment "<pre>" "</pre>" %} +<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"> + <div class="card-body"> + <p class="card-text"> + <p class="window-refs">{{ item.name|default:"" }}</p> + {% if item.internal_reference %} + <p class="window-refs">{{ item.internal_reference }}</p>{% endif %} + <p class="window-refs">{{ item.year }} - {{ item.index }}</p> + {% if item.external_id %} + <p class="window-refs">{{ item.external_id }}</p>{% endif %} + {% if item.end_date %} + <p class="window-refs">{% trans "Closed" context "Treatment request" %} ({{item.end_date}})</p> + {% else %} + <p class="window-refs">{% trans "Active" context "Treatment request" %}</p> + {% endif %} + </p> + </div> + </div> + </div> +</div> -{% include "ishtar/blocks/sheet_json.html" %} +<div class="row"> + {% field_flex "Type" item.type %} + {% field_flex_detail "Responsible" item.in_charge %} + {% field_flex "Creation date" item.creation_date %} + {% field_flex "Reception date" item.reception_date %} + {% field_flex "Closing date" item.end_date %} + {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} + {% include "ishtar/blocks/sheet_json.html" %} +</div> {% if item.applicant %} <h3>{% trans "Applicant" %}</h3> -<ul class='form-flex'> - {% field_li_detail "Name" item.applicant %} -</ul> -{% field "Contact" item.applicant.address_lbl %} +<div class="row"> + {% field_flex_detail "Name" item.applicant %} + {% field_flex_full "Contact" item.applicant.address_lbl %} +</div> {% endif %} + {% if item.applicant_organisation %} <h3>{% trans "Applicant organisation" %}</h3> -<ul class='form-flex'> - {% field_li_detail "Name" item.applicant_organisation %} -</ul> -{% field "Contact" item.applicant.address_lbl %} +<div class="row"> + {% field_flex_detail "Name" item.applicant_organisation %} + {% field_flex_full "Contact" item.applicant.address_lbl %} +</div> {% endif %} {% if item.treatments.count %} |
