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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-9 / +11 lines)
Lines 638-643 Link Here
638
        var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
638
        var table_settings = [% TablesSettings.GetTableSettings( 'admin', 'libraries', 'libraries', 'json' ) | $raw %];
639
        var saved_table = localStorage.getItem("DataTables_libraries_/cgi-bin/koha/admin/branches.pl");
639
        var saved_table = localStorage.getItem("DataTables_libraries_/cgi-bin/koha/admin/branches.pl");
640
        var updated_settings = get_columns_saved_state(saved_table, table_settings);
640
        var updated_settings = get_columns_saved_state(saved_table, table_settings);
641
        var calendarFirstDayOfWeek = '[% Koha.Preference('CalendarFirstDayOfWeek') | html %]';
641
642
642
        $(document).ready(function() {
643
        $(document).ready(function() {
643
644
Lines 747-762 Link Here
747
                    },
748
                    },
748
                    {
749
                    {
749
                        "data": function( row, type, val, meta ) {
750
                        "data": function( row, type, val, meta ) {
750
                            const daynames = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];
751
                            const daysOfWeek = [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday") ];
751
                            var daycount = 0;
752
752
                            var result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>';
753
                            var result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>';
753
                            while ( row.library_hours[daycount] ) {
754
                            let counter = 0;
754
                                result += '<tr id="hours_'+daycount+'">';
755
                            for (let i = calendarFirstDayOfWeek; counter < 7; i++) {
755
                                result += '<td>'+daynames[daycount]+'</td>';
756
                                const index = i % 7; // Wrap around the index using modulo operator
756
                                result += '<td><span>'+row.library_hours[daycount].open_time+'</span></td>';
757
                                result += '<tr id="hours_'+index+'">';
757
                                result += '<td><span>'+row.library_hours[daycount].close_time+'</span></td>';
758
                                result += '<td>'+daysOfWeek[index]+'</td>';
759
                                result += '<td><span>'+row.library_hours[index].open_time+'</span></td>';
760
                                result += '<td><span>'+row.library_hours[index].close_time+'</span></td>';
758
                                result += '</tr>';
761
                                result += '</tr>';
759
                                daycount++;
762
                                counter++;
760
                            }
763
                            }
761
                            result += '</tbody></table>';
764
                            result += '</tbody></table>';
762
                            return result;
765
                            return result;
763
- 

Return to bug 6796