From 69c798110ef0ef163616f0b2d058baa2d1a93f10 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 2 Sep 2021 14:36:07 +0000 Subject: [PATCH] Bug 28942: Use Flatpickr on acquisitions pages This patch modifies several acquisitions pages replacing jQuery datepickers with Flatpickr widgets. To test, apply the patch and test datepickers on the following Acquisitions pages: - Acquisitions -> Late orders (linked date fields in the sidebar) - Acquisitions -> Invoices (linked date fields in the sidebar) - Acquisitions -> Invoices -> Invoice details (shipment date and billing date) - Acquisitions -> Vendor -> Receive shipment (shipment date) - Acquisitions -> Vendor -> Receive shipment -> Receive (on order line) -> Date received field under "Accounting details - Acquisitions -> Orders search tab in the header -> Advanced search: Linked date fields in the search form." Signed-off-by: Lucas Gass --- .../prog/en/includes/filter-orders.inc | 8 ++-- .../prog/en/modules/acqui/invoice.tt | 6 ++- .../prog/en/modules/acqui/invoices.tt | 48 +++++++++++++++---- .../prog/en/modules/acqui/lateorders.tt | 4 +- .../prog/en/modules/acqui/orderreceive.tt | 3 +- .../prog/en/modules/acqui/parcels.tt | 14 ++++-- 6 files changed, 63 insertions(+), 20 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc index a2a7fc090e..ef8e38496d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/filter-orders.inc @@ -103,11 +103,11 @@
  • - -
    [% INCLUDE 'date-format.inc' %]
    + +
    [% INCLUDE 'date-format.inc' %]
  • - -
    [% INCLUDE 'date-format.inc' %]
    + +
    [% INCLUDE 'date-format.inc' %]
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt index de9df0dcdd..ce0a059b87 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoice.tt @@ -69,7 +69,8 @@ [% IF readonly %] [% shipmentdate | $KohaDates %] [% ELSE %] - + +
    [% INCLUDE 'date-format.inc' %]
    [% END %] @@ -78,7 +79,8 @@ [% IF readonly %] [% billingdate | $KohaDates %] [% ELSE %] - + +
    [% INCLUDE 'date-format.inc' %]
    [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt index 2526e8d46b..79c3942f30 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/invoices.tt @@ -168,11 +168,17 @@ Required -
  • -
  • +
  • + + +
    [% INCLUDE 'date-format.inc' %]
    +
  • -
  • -
  • +
  • + + +
    [% INCLUDE 'date-format.inc' %]
    +
  • @@ -291,11 +297,13 @@
    1. - + +
      [% INCLUDE 'date-format.inc' %]
    2. - + +
      [% INCLUDE 'date-format.inc' %]
    @@ -306,11 +314,13 @@
    1. - + +
      [% INCLUDE 'date-format.inc' %]
    2. - + +
      [% INCLUDE 'date-format.inc' %]
    @@ -449,6 +459,28 @@ $('#merge_invoices').show(); } }); + var shipmentdatefrom = $("#shipmentdatefrom").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + shipmentdateto.set('minDate', selectedDates[0]); + } + }); + var shipmentdateto = $("#shipmentdateto").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + }, + }); + var billingdatefrom = $("#billingdatefrom").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + billingdateto.set('minDate', selectedDates[0]); + } + }); + var billingdateto = $("#billingdateto").flatpickr({ + onClose: function( selectedDates, dateText, instance) { + validate_date( selectedDates, instance ); + }, + }); }); [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index bbe1ee375f..c4847c145c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -232,11 +232,11 @@
    1. days ago
    2. - +
      [% INCLUDE 'date-format.inc' %]
    3. - +
      [% INCLUDE 'date-format.inc' %]
    4. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt index f62b228052..d5a449aad7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/orderreceive.tt @@ -277,7 +277,8 @@
      1. - + +
        [% INCLUDE 'date-format.inc' %]
      2. +
        [% INCLUDE 'date-format.inc' %]
      3. @@ -203,8 +203,16 @@
        1. -

        2. -
        3. +
        4. + + +
          [% INCLUDE 'date-format.inc' %]
          +
        5. +
        6. + + +
          [% INCLUDE 'date-format.inc' %]
          +