View | Details | Raw Unified | Return to bug 29478
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/lib/flatpickr/shortcut-buttons-flatpickr.min.js (+2 lines)
Line 0 Link Here
1
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ShortcutButtonsPlugin=e():t.ShortcutButtonsPlugin=e()}(window,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:o})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const o={theme:"light"};e.ShortcutButtonsPlugin=function(t){const e=Object.assign({},o,t);return t=>{let n;function o(n){n.stopPropagation(),n.preventDefault();const o=n.target;if("button"!==o.tagName.toLowerCase()||void 0===e.onClick)return;const r=parseInt(o.dataset.index,10),c=Array.isArray(e.onClick)?e.onClick:[e.onClick];for(const e of c)"function"==typeof e&&e(r,t)}return{onReady:()=>{if((n=document.createElement("div")).classList.add("shortcut-buttons-flatpickr-wrapper",e.theme),void 0!==e.label&&e.label.length){const t=document.createElement("div");t.classList.add("shortcut-buttons-flatpickr-label"),t.textContent=e.label,n.appendChild(t)}const r=document.createElement("div");r.classList.add("shortcut-buttons-flatpickr-buttons"),(Array.isArray(e.button)?e.button:[e.button]).forEach((t,e)=>{const n=document.createElement("button");n.classList.add("shortcut-buttons-flatpickr-button"),n.textContent=t.label,n.dataset.index=String(e),r.appendChild(n)}),n.appendChild(r),t.calendarContainer.appendChild(n),n.addEventListener("click",o)},onDestroy:()=>{n.removeEventListener("click",o),n=void 0}}}}}]).ShortcutButtonsPlugin});
2
//# sourceMappingURL=shortcut-buttons-flatpickr.min.js.map
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-1 / +33 lines)
Lines 34-39 Link Here
34
<!-- / calendar.inc -->
34
<!-- / calendar.inc -->
35
[% Asset.js("js/calendar.js") | $raw %]
35
[% Asset.js("js/calendar.js") | $raw %]
36
[% Asset.js("lib/flatpickr/flatpickr.min.js") | $raw %]
36
[% Asset.js("lib/flatpickr/flatpickr.min.js") | $raw %]
37
[% Asset.js("lib/flatpickr/shortcut-buttons-flatpickr.min.js") | $raw %]
37
<script>
38
<script>
38
    flatpickr.l10ns.default.weekdays = flatpickr_weekdays;
39
    flatpickr.l10ns.default.weekdays = flatpickr_weekdays;
39
    flatpickr.l10ns.default.months   = flatpickr_months;
40
    flatpickr.l10ns.default.months   = flatpickr_months;
Lines 84-89 Link Here
84
                $(on_close_focus).focus();
85
                $(on_close_focus).focus();
85
            }
86
            }
86
        },
87
        },
88
        plugins: [
89
          ShortcutButtonsPlugin({
90
            button: [
91
              {
92
                label: __("Yesterday")
93
              },
94
              {
95
                label: __("Today")
96
              },
97
              {
98
                label: __("Tomorrow")
99
              }
100
            ],
101
            label: "or",
102
            onClick: (index, fp) => {
103
              let date;
104
              switch (index) {
105
                case 0:
106
                  date = new Date(Date.now() - 24 * 60 * 60 * 1000);
107
                  break;
108
                case 1:
109
                  date = new Date();
110
                  break;
111
                case 2:
112
                  date = new Date(Date.now() + 24 * 60 * 60 * 1000);
113
                  break;
114
              }
115
              date.setHours(23, 59, 0, 0);
116
              fp.setDate(date);
117
            }
118
          })
119
        ]
87
    });
120
    });
88
    $(document).ready(function(){
121
    $(document).ready(function(){
89
        $(".flatpickr").each(function(){
122
        $(".flatpickr").each(function(){
90
- 

Return to bug 29478