diff options
Diffstat (limited to 'archaeological_warehouse/templates/ishtar/wizard/wizard_container.html')
-rw-r--r-- | archaeological_warehouse/templates/ishtar/wizard/wizard_container.html | 39 |
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 %} |