fb5b7c1ab31cf8e5be3d7d82496f902c85764f6c
[freeside.git] / rt / share / html / Elements / CalendarSlotSchedule
1 <%ARGS>
2   $Date     => undef
3   @Tickets  => ()
4   $slots    => $default_slots
5   $sday     => undef
6   $tod_row  => undef
7   $timestep => $default_timestep
8   @username => ()
9 </%ARGS>
10 % foreach my $username ( @username ) {
11 %
12 %   my %schedule = UserDaySchedule( username => $username,
13 %                                   'date'   => $Date->strftime('%F'),
14 %                                   Tickets  => \@Tickets,
15 %                                 );
16 %
17 %   my $bgcolor = 'ffffff';
18 %   my $content = '';
19 %
20 %   #XXX block out unavailable times
21 %
22 %   #block out / show / color code existing appointments
23 %       foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
24 %
25 %         my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
26 %
27 %         next if $starts >= ($tod_row+$timestep) || $due < $tod_row;
28 %
29 %         if ( $starts >= $tod_row ) {
30 %           $bgcolor = $col;
31 %           $content .= ($content?', ':''). $id; #XXX more
32 %         } else {
33 %           $bgcolor = $col;
34 %         }
35 %       }
36
37     <td style="background:#<%$bgcolor%>" class="weekly
38 %#               <%   $is_today     ? 'today'
39 %#                  : $is_yesterday ? 'yesterday'
40 %#                  : $is_aweekago  ? 'aweekago'
41 %#                  : ''
42 %#               %>
43                    "
44     ><% $content %></td>
45 % }
46 <%ONCE>
47 my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5;
48 my $default_timestep = RT->Config->Get('CalendarWeeklySizeMin') || 30; #1/2h
49 </%ONCE>
50 <%INIT>
51
52 use RTx::Schedule qw( UserDaySchedule );
53
54 </%INIT>