summaryrefslogtreecommitdiff
path: root/archaeological_warehouse/templates/ishtar/wizard
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/ishtar/wizard
parent3176e8cecfbf8e0e4dbcff9d5f8c19f164198010 (diff)
downloadIshtar-3bba23e35348744b58809a2068d6a8536b6c02e1.tar.bz2
Ishtar-3bba23e35348744b58809a2068d6a8536b6c02e1.zip
Container: adapt forms for the new container management
Diffstat (limited to 'archaeological_warehouse/templates/ishtar/wizard')
-rw-r--r--archaeological_warehouse/templates/ishtar/wizard/wizard_container.html39
1 files changed, 24 insertions, 15 deletions
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 %}