diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-07-22 18:22:54 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:47 +0200 |
| commit | 1ab34e1c692400ef5e7b51b72a0a1d637d6d5f33 (patch) | |
| tree | 3baeabba234b84ff9ad82e5513ce70e63bd5a3f2 /archaeological_files/templates | |
| parent | faa399bb5232883d51f848a2795d33853896cc8f (diff) | |
| download | Ishtar-1ab34e1c692400ef5e7b51b72a0a1d637d6d5f33.tar.bz2 Ishtar-1ab34e1c692400ef5e7b51b72a0a1d637d6d5f33.zip | |
Preventive file: work on inlines - 2
Diffstat (limited to 'archaeological_files/templates')
| -rw-r--r-- | archaeological_files/templates/ishtar/forms/preventive_detail.html | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/archaeological_files/templates/ishtar/forms/preventive_detail.html b/archaeological_files/templates/ishtar/forms/preventive_detail.html index 5b6f7f9ed..cc27e26f3 100644 --- a/archaeological_files/templates/ishtar/forms/preventive_detail.html +++ b/archaeological_files/templates/ishtar/forms/preventive_detail.html @@ -16,10 +16,10 @@ </label> </div> </div> - <div class="w-100 pb-3 text-center"> + <div class="w-100 pb-3 text-center form-group"> <button class="btn btn-secondary btn-sm form-planned" type="button">{% trans "Add default costs" %}</button> </div> - <div class="w-100 pb-3 text-center"> + <div class="w-100 pb-3 text-center form-group"> <button class="btn btn-secondary btn-sm form-worked" type="button">{% trans "Copy planned costs" %}</button> </div> {% for inline in inline_forms %} @@ -34,18 +34,21 @@ {% block end_js %} {{block.super}} var check_planned_value = function() { - if (this.value === 'false'){ - $(".form-planned").parent().hide() - $(".form-worked").parent().show() + if ($('#planned-toggle-true').is(":checked") === false){ + $(".form-planned").closest("div.form-group").hide() + $(".form-worked").closest("div.form-group").show() } else { - $(".form-planned").parent().show() - $(".form-worked").parent().hide() + $(".form-planned").closest("div.form-group").show() + $(".form-worked").closest("div.form-group").hide() } }; const cost_units = {{% for unit_pk, value in form_unities %}{% if forloop.counter0 %},{% endif %} {{unit_pk}}: "{{value}}"{% endfor %} }; + const flat_rates = [{% for pk in form_flat_rates %}{% if forloop.counter0 %},{% endif %} + "{{pk}}"{% endfor %} + ]; var update_units = function() { $(".form-cost").each(function(){ var unit = cost_units[$(this).val()]; @@ -53,6 +56,12 @@ unit = "..."; } $(this).parent().parent().find(".unit-label").html(unit); + if (flat_rates.indexOf($(this).val()) != -1){ + $(this).parent().parent().find(".unit-form").prop("disabled", true); + } else { + $(this).parent().parent().find(".unit-form").prop("disabled", false); + } + check_planned_value(); }); }; $(document).ready(function(){ |
