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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt (-10 / +40 lines)
Lines 556-562 Link Here
556
                    </li>
556
                    </li>
557
                    <li>
557
                    <li>
558
                        <span class="label">Opening hours: </span>
558
                        <span class="label">Opening hours: </span>
559
                        [% IF library.library_hours.count > 0 # Existing library %]
559
                        [% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %]
560
                        [% SET set_hours = 0 %]
561
                        [% IF library.library_hours.count > 0 %]
562
                            [% FOR i IN [0..6] %]
563
                                [% IF library.library_hours.as_list.$i.open_time != null || library.library_hours.as_list.$i.close_time != null %]
564
                                    [% set_hours = 1 %]
565
                                [% END %]
566
                            [% END %]
567
                        [% END %]
568
                        [% IF set_hours > 0 # Existing library %]
560
                            [% SET library_hours = library.library_hours.as_list %]
569
                            [% SET library_hours = library.library_hours.as_list %]
561
                            <table id="library_hours_table">
570
                            <table id="library_hours_table">
562
                                <thead>
571
                                <thead>
Lines 574-585 Link Here
574
                                        <td>
583
                                        <td>
575
                                            <span>[% PROCESS dayname day=d %]</span>
584
                                            <span>[% PROCESS dayname day=d %]</span>
576
                                        </td>
585
                                        </td>
577
                                        <td>
586
                                        [% IF hr.open_time == null && hr.close_time == null %]
578
                                            <span>[% hr.open_time | html %]</span>
587
                                            <td colspan="2" style="text-align: center;">
579
                                        </td>
588
                                                <span>Closed</span>
580
                                        <td>
589
                                            </td>
581
                                            <span>[% hr.close_time | html %]</span>
590
                                        [% ELSE %]
582
                                        </td>
591
                                            <td>
592
                                                <span>[% IF hr.open_time != null %][% hr.open_time.substr(0,5) | html %][% END %]</span>
593
                                            </td>
594
                                            <td>
595
                                                <span>[% IF hr.close_time != null %][% hr.close_time.substr(0,5) | html %][% END %]</span>
596
                                            </td>
597
                                        [% END %]
583
                                    </tr>
598
                                    </tr>
584
                                    [% END %]
599
                                    [% END %]
585
                                </tbody>
600
                                </tbody>
Lines 757-763 Link Here
757
                    {
772
                    {
758
                        "data": function( row, type, val, meta ) {
773
                        "data": function( row, type, val, meta ) {
759
                            let result = '';
774
                            let result = '';
775
                            let set_hours = 0;
760
                            if ( row.library_hours.length > 0 ) {
776
                            if ( row.library_hours.length > 0 ) {
777
                                for (let check_counter = 0; check_counter < 7; check_counter++) {
778
                                    if ( row.library_hours[check_counter].open_time != null || row.library_hours[check_counter].close_time != null ) {
779
                                        set_hours = 1;
780
                                    }
781
                                }
782
                            }
783
                            if ( set_hours > 0 ) {
761
                                const daysOfWeek = [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday") ];
784
                                const daysOfWeek = [ _("Sunday"), _("Monday"), _("Tuesday"), _("Wednesday"), _("Thursday"), _("Friday"), _("Saturday") ];
762
785
763
                                result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>';
786
                                result = '<table id="library_hours_table"><thead><tr><th>Day</th><th>Open time</th><th>Close time</th></tr></thead><tbody>';
Lines 766-773 Link Here
766
                                    const day = i % 7; // Wrap around the day using modulo operator
789
                                    const day = i % 7; // Wrap around the day using modulo operator
767
                                    result += '<tr id="hours_'+day+'">';
790
                                    result += '<tr id="hours_'+day+'">';
768
                                    result += '<td>'+daysOfWeek[day]+'</td>';
791
                                    result += '<td>'+daysOfWeek[day]+'</td>';
769
                                    result += '<td><span>'+row.library_hours[day].open_time+'</span></td>';
792
                                    if ( row.library_hours[day].open_time == null && row.library_hours[day].close_time == null ) {
770
                                    result += '<td><span>'+row.library_hours[day].close_time+'</span></td>';
793
                                        result += '<td colspan="2" style="text-align: center;"><span>Closed</span></td>';
794
                                    } else {
795
                                        result += '<td><span>';
796
                                        result += row.library_hours[day].open_time != null ? row.library_hours[day].open_time.substr(0,5) : '';
797
                                        result += '</span></td>';
798
                                        result += '<td><span>';
799
                                        result += row.library_hours[day].close_time != null ? row.library_hours[day].close_time.substr(0,5) : '';
800
                                        result += '</span></td>';
801
                                    }
771
                                    result += '</tr>';
802
                                    result += '</tr>';
772
                                    counter++;
803
                                    counter++;
773
                                }
804
                                }
774
- 

Return to bug 36594