summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/templates
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2020-04-10 17:11:20 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:20 +0100
commit3bba23e35348744b58809a2068d6a8536b6c02e1 (patch)
tree93817496eadc13648680de8c70e7052ce06cb8df /archaeological_warehouse/templates
parent3176e8cecfbf8e0e4dbcff9d5f8c19f164198010 (diff)
downloadIshtar-3bba23e35348744b58809a2068d6a8536b6c02e1.tar.bz2
Ishtar-3bba23e35348744b58809a2068d6a8536b6c02e1.zip
Container: adapt forms for the new container management
Diffstat (limited to 'archaeological_warehouse/templates')
-rw-r--r--archaeological_warehouse/templates/ishtar/sheet_container.html24
-rw-r--r--archaeological_warehouse/templates/ishtar/wizard/wizard_container.html39
2 files changed, 45 insertions, 18 deletions
diff --git a/archaeological_warehouse/templates/ishtar/sheet_container.html b/archaeological_warehouse/templates/ishtar/sheet_container.html
index 1bb004071..60f49b7ae 100644
--- a/archaeological_warehouse/templates/ishtar/sheet_container.html
+++ b/archaeological_warehouse/templates/ishtar/sheet_container.html
@@ -2,8 +2,11 @@
{% load i18n window_header window_field window_tables link_to_window %}
{% block head_title %}<strong>{% trans "Container" %}</strong> -
-{{ item.container_type|default:"" }} {{ item.reference|default:"" }} -
-{{ item.location.name|default:"" }}
+{% if item.cached_division %}
+{{item.cached_division}}
+{% else %}
+{{ item.container_type|default:"" }} {{ item.reference|default:"" }} {% endif %}
+- {{ item.location.name|default:"" }}
{% endblock %}
{% block toolbar %}
@@ -34,7 +37,7 @@
{% endif %}
{% field_flex_detail "Warehouse" item.location %}
{% if item.parent %}
- <dl class="col-12 col-md-6 flex-wrap">
+ <dl class="col-12 col-md-9 flex-wrap">
<dt>{% trans "Location" %}</dt>
<dd>
<nav aria-label="breadcrumb">
@@ -55,6 +58,21 @@
</div>
</div>
+
+{% with item.container_type as container_type %}
+{% if container_type.length or container_type.width or container_type.height or container_type.volume or container_type.reference %}
+<h4>{% trans "Container type" %}</h4>
+<div class='row'>
+ {% field_flex "Length (mm)" container_type.length %}
+ {% field_flex "Width (mm)" container_type.width %}
+ {% field_flex "Height (mm)" container_type.height %}
+ {% field_flex "Volume (l)" container_type.volume %}
+ {% field_flex "Reference" container_type.reference %}
+</div>
+{% endif %}
+{% endwith %}
+
+
{% if item.container_content.count or item.children.count %}
<h4>{% trans "Content" %}</h4>
diff --git a/archaeological_warehouse/templates/ishtar/wizard/wizard_container.html b/archaeological_warehouse/templates/ishtar/wizard/wizard_container.html
index 4d0a63c17..cf9d4122e 100644
--- a/archaeological_warehouse/templates/ishtar/wizard/wizard_container.html
+++ b/archaeological_warehouse/templates/ishtar/wizard/wizard_container.html
@@ -1,17 +1,26 @@
{% extends "ishtar/wizard/default_wizard.html" %}
-{% load i18n %}
-{% block form_head %}
-{% if not wizard.form.fields %}
-<p class="alert">
- <i class="fa fa-exclamation-triangle"></i>
- {% trans "No division set for this warehouse. Define at least one division to localise containers in this warehouse." %}<br/>
- {{wizard.form.warehouse}}
- <a href="{% url 'warehouse_modify' wizard.form.warehouse.pk %}">
- <span class="fa-stack fa-lg">
- <i class="fa fa-circle fa-stack-2x"></i>
- <i class="fa fa-pencil fa-stack-1x fa-inverse"></i>
- </span>
- </a>
-</p>
-{% endif %}
+{% load i18n replace_underscore %}
+
+{% block "js_extra_generic" %}
+var constraint_on_parent = function(){
+ var warehouse_location_id = $("#id_{{wizard.steps.current}}-location").val();
+ if (!warehouse_location_id) return;
+
+ var parent_search_url = source_{{wizard.steps.current|replace_underscore}}_parent;
+ parent_search_url += warehouse_location_id;
+ $("#id_select_{{wizard.steps.current}}-parent").autocomplete(
+ "option", "source", parent_search_url);
+ var ctips;
+ if (current_label_{{wizard.steps.current|replace_underscore}}_location){
+ ctips = current_label_{{wizard.steps.current|replace_underscore}}_location;
+ } else {
+ ctips = $("#id_{{wizard.steps.current}}-location_previous_label").val();
+ }
+ $("#id_{{wizard.steps.current}}-parent-tips").html(ctips);
+}
+{% endblock %}
+{% block "js_extra_ready" %}
+
+constraint_on_parent();
+$("#id_{{wizard.steps.current}}-location").change(constraint_on_parent);
{% endblock %}