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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt (-29 / +32 lines)
Lines 4-9 Link Here
4
[% USE Asset %]
4
[% USE Asset %]
5
[% SET footerjs = 1 %]
5
[% SET footerjs = 1 %]
6
[% USE TablesSettings %]
6
[% USE TablesSettings %]
7
[% PROCESS 'i18n.inc' %]
7
[% INCLUDE 'doc-head-open.inc' %]
8
[% INCLUDE 'doc-head-open.inc' %]
8
<title>
9
<title>
9
    Curbside pickup &rsaquo; Administration &rsaquo; Koha
10
    Curbside pickup &rsaquo; Administration &rsaquo; Koha
Lines 141-160 Link Here
141
                            <ol>
142
                            <ol>
142
                                <li>
143
                                <li>
143
                                    <label>New slot:</label>
144
                                    <label>New slot:</label>
145
                                    [% days = { "0" = t("Sunday"), "1" = t("Monday"), "2" = t("Tuesday"), "3" = t("Wednesday"), "4" = t("Thursday"), "5" = t("Friday"), "6" = t("Saturday") } %]
146
                                    [% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %]
144
                                    <div>
147
                                    <div>
145
                                        <select id="day-[% l.branchcode | html %]">
148
                                        <select id="day-[% l.branchcode | html %]">
146
                                            <option value="0">Sunday</option>
149
                                            [% FOR i IN [0, 1, 2, 3, 4, 5, 6] %]
147
                                            <option value="1">Monday</option>
150
                                                [% SET d = ( CalendarFirstDayOfWeek + i ) % 7 %]
148
                                            <option value="2">Tuesday</option>
151
                                                <option value="[% d | html %]">[% days.$d | html %]</option>
149
                                            <option value="3">Wednesday</option>
152
                                            [% END %]
150
                                            <option value="4">Thursday</option>
153
                                        </select>
151
                                            <option value="5">Friday</option>
152
                                            <option value="6">Saturday</option>
153
                                            <span>
154
                                            <span>
154
                                                From <input type="text" size="5" class="noEnterSubmit" id="new-start-[% l.branchcode | html %]" placeholder="00:00" />
155
                                                From <input type="text" size="5" class="noEnterSubmit" id="new-start-[% l.branchcode | html %]" placeholder="00:00" />
155
                                                to <input type="text" size="5" class="noEnterSubmit" id="new-end-[% l.branchcode | html %]" placeholder="23:55" />
156
                                                to <input type="text" size="5" class="noEnterSubmit" id="new-end-[% l.branchcode | html %]" placeholder="23:55" />
156
                                            </span>
157
                                            </span>
157
                                        </select>
158
                                        <input type="button" class="add-new-slot" data-branchcode="[% l.branchcode | html %]" value="Add" />
158
                                        <input type="button" class="add-new-slot" data-branchcode="[% l.branchcode | html %]" value="Add" />
159
                                        <span id="invalid_slot_warning" style="display:none;">Invalid format for this new slot, must be '00:00 to 23:59'.</span>
159
                                        <span id="invalid_slot_warning" style="display:none;">Invalid format for this new slot, must be '00:00 to 23:59'.</span>
160
                                    </div>
160
                                    </div>
Lines 228-270 Link Here
228
228
229
            $("#conf-"+branchcode).find(".pickup_hours li").remove();
229
            $("#conf-"+branchcode).find(".pickup_hours li").remove();
230
230
231
            Object.keys(slots_per_day).forEach(function(day){
231
            const CalendarFirstDayOfWeek = [% Koha.Preference("CalendarFirstDayOfWeek") || 0 | html %];
232
                let li_node = $('<li><label>'+get_day_lib(day)+'<label></li>');
232
            [0, 1, 2, 3, 4, 5, 6]
233
                slots_per_day[day].forEach(function(slot) {
233
               .map(i => ( CalendarFirstDayOfWeek + i ) % 7)
234
                    let span_node = $('<span class="pickup-slot"></span>');
234
               .filter(d => d in slots_per_day)
235
                    span_node.append('<input type="hidden" name="pickup-slot-'+branchcode+'" value="'+slot+'"/>');
235
               .map( day => {
236
                    span_node.append('<span>'+format_slot(slot)+'</span>');
236
                    let li_node = $('<li><label>'+get_day_lib(day)+'<label></li>');
237
237
                    slots_per_day[day].forEach(function(slot) {
238
                    let delete_link = $('<a href="#" on> <i class="fa fa-trash" aria-hidden="true" title="%s"></i>'.format(_("Remove this slot"))).on('click', function(e){ e.preventDefault(); delete_slot($(this).closest('li'), branchcode); });
238
                        let span_node = $('<span class="pickup-slot"></span>');
239
                    span_node.append(delete_link);
239
                        span_node.append('<input type="hidden" name="pickup-slot-'+branchcode+'" value="'+slot+'"/>');
240
240
                        span_node.append('<span>'+format_slot(slot)+'</span>');
241
                    span_node.appendTo(li_node);
241
242
                        let delete_link = $('<a href="#" on> <i class="fa fa-trash" aria-hidden="true" title="%s"></i>'.format(_("Remove this slot"))).on('click', function(e){ e.preventDefault(); delete_slot($(this).closest('li'), branchcode); });
243
                        span_node.append(delete_link);
244
245
                        span_node.appendTo(li_node);
246
                    });
247
                    li_node.appendTo($("#conf-"+branchcode).find(".pickup_hours"));
242
                });
248
                });
243
                li_node.appendTo($("#conf-"+branchcode).find(".pickup_hours"));
244
            });
245
        }
249
        }
246
        function get_day_lib(day){
250
        function get_day_lib(day){
247
            let lib;
251
            let lib;
248
            switch(day){
252
            switch(day){
249
            case '0':
253
            case 0:
250
                lib = _("Sunday");
254
                lib = _("Sunday");
251
                break;
255
                break;
252
            case '1':
256
            case 1:
253
                lib = _("Monday");
257
                lib = _("Monday");
254
                break;
258
                break;
255
            case '2':
259
            case 2:
256
                lib = _("Tuesday");
260
                lib = _("Tuesday");
257
                break;
261
                break;
258
            case '3':
262
            case 3:
259
                lib = _("Wednesday");
263
                lib = _("Wednesday");
260
                break;
264
                break;
261
            case '4':
265
            case 4:
262
                lib = _("Thursday");
266
                lib = _("Thursday");
263
                break;
267
                break;
264
            case '5':
268
            case 5:
265
                lib = _("Friday");
269
                lib = _("Friday");
266
                break;
270
                break;
267
            case '6':
271
            case 6:
268
                lib = _("Saturday");
272
                lib = _("Saturday");
269
                break;
273
                break;
270
            }
274
            }
271
- 

Return to bug 31264