summaryrefslogtreecommitdiff
path: root/archaeological_files/templates/ishtar/forms/preventive_detail.html
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files/templates/ishtar/forms/preventive_detail.html')
-rw-r--r--archaeological_files/templates/ishtar/forms/preventive_detail.html23
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(){