From 43ee6b23cbc989bedc45435885382740e430d964 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 16 Sep 2019 14:50:41 +0200 Subject: Bulk update finds: auto fill verified date when check is changed --- .../templates/ishtar/forms/qa_find_edit_form.html | 19 +++++++++++++++++++ archaeological_finds/views.py | 1 + ishtar_common/templates/base.html | 1 + 3 files changed, 21 insertions(+) create mode 100644 archaeological_finds/templates/ishtar/forms/qa_find_edit_form.html diff --git a/archaeological_finds/templates/ishtar/forms/qa_find_edit_form.html b/archaeological_finds/templates/ishtar/forms/qa_find_edit_form.html new file mode 100644 index 000000000..da8beff08 --- /dev/null +++ b/archaeological_finds/templates/ishtar/forms/qa_find_edit_form.html @@ -0,0 +1,19 @@ +{% extends "ishtar/forms/qa_form.html" %} +{% block js_ready %} +$("#id_qa_checked_type").change(function(){ + if (!$("#id_qa_check_date").val()){ + var today = new Date(); + var dd = String(today.getDate()).padStart(2, '0'); + var mm = String(today.getMonth() + 1).padStart(2, '0'); + var yyyy = today.getFullYear(); + if (current_language == "fr"){ + today = dd + '/' + mm + '/' + yyyy; + $("#id_qa_check_date").val(today); + } + if (current_language == "en"){ + today = yyyy + '/' + mm + '/' + dd; + $("#id_qa_check_date").val(today); + } + } +}); +{% endblock %} diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py index 1a64f1c64..0bb835bb7 100644 --- a/archaeological_finds/views.py +++ b/archaeological_finds/views.py @@ -1021,6 +1021,7 @@ def reset_wizards(request): class QAFindForm(QAItemEditForm): model = models.Find form_class = forms.QAFindFormMulti + template_name = 'ishtar/forms/qa_find_edit_form.html' class QAFindBasketFormView(QAItemForm): diff --git a/ishtar_common/templates/base.html b/ishtar_common/templates/base.html index 4854c43d0..bb53092ca 100644 --- a/ishtar_common/templates/base.html +++ b/ishtar_common/templates/base.html @@ -46,6 +46,7 @@ {{EXTRA_JS|safe}}