no need for FS calendar buttons in RT 4.2
[freeside.git] / rt / share / html / Elements / CalendarDaySchedule
1 <%args>
2 $Date        => undef
3 $today       => undef
4 $Tickets     => undef
5 $DateTypes   => undef
6 @username    => ()
7 $CurrentUser => undef
8 </%args>
9 %if ( DateTime->compare( $Date, $today ) == -1 ) {#flag to show the past anyway?
10 % #the past already happened...
11 %} else {
12 % foreach my $username ( @username ) {
13 %   my $mapname = "$username-$date";
14 %   my $img = "$RT::WebPath/Schedule/UserBar?Username=$username;Date=$date";
15     <span class="calendarright"
16     ><% $username %><img src    = "<%$img|n%>"
17                          useMap = "#<%$mapname%>"
18                          height = <%$height%>
19                          width  = <%$width%>
20     ></span><br>
21
22     <MAP name="<%$mapname%>">
23
24 %   my %schedule = UserDaySchedule( CurrentUser => $CurrentUser,
25 %                                   username    => $username,
26 %                                   'date'      => $date, #$Date->strftime('%F'),
27 %                                 );
28 %
29 %   #block out / show / color code existing appointments
30 %   foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
31 %     my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
32 %     my $s = int(($starts-$stime)/10);
33 %     my $e = int(($due-$stime)/10)-1;
34
35 %     #false laziness w/misc/xmlhttp-ticket-update.html & CalendarSlotSchedule
36 %     my %hash = $m->comp('/Ticket/Elements/Customers', Ticket => $t);
37 %     my @cust_main = values( %{$hash{cust_main}} );
38
39       <AREA
40          onmouseover = "overlib('<% FS::sched_avail::pretty_time($starts). '-'. FS::sched_avail::pretty_time($due) %><BR>' + <% $cust_main[0]->_FreesideURILabel |js_string %>, WRAP, BGCOLOR, '#000000', FGCOLOR, '#<%$col%>')"
41          onmouseout  = "nd(); return true;"
42          shape       = "rect"
43          coords      = "<%$s%>,0,<%$e%>,<%$height%>"
44 %#         href        = "test_href"
45 %#         alt         =
46 %#         title       =
47       >
48 %   }
49 %
50 %   #white out available times
51 %   foreach my $avail ( @{ $schedule{'avail'} } ) {
52 %     my( $start, $end ) = @$avail;
53 %     
54 %     my $s = $start >= $stime ? int(($start-$stime)/10) : 0;
55 %     my $e = int(($end-$stime)/10)-1;
56       <AREA
57          onmouseover = "overlib('Available', WRAP, BGCOLOR, '#000000', FGCOLOR, '#FFFFFF')"
58          onmouseout  = "nd(); return true;"
59          shape       = "rect"
60          coords      = "<%$s%>,0,<%$e%>,<%$height%>"
61 %# XXX link to book - if the appointment we want can fit
62 %#         href        = "test_href"
63 %#         alt         =
64 %#         title       =
65       >
66 %   }
67
68       <AREA 
69          onmouseover = "overlib('Not available', WRAP, BGCOLOR, '#000000', FGCOLOR, '#666666', TEXTCOLOR, '#FFFFFF' )"
70          onmouseout  = "nd(); return true;"
71          shape       = "default"
72 %#         href        = "test_href"
73 %#         alt         =
74 %#         title       =
75       >
76
77     </MAP>
78
79 % }
80 %}
81 <%once>
82
83 my $stime    = RT->Config->Get('CalendarWeeklyStartMin');
84 $stime = 480 unless $stime =~ /^\d+$/; #8am
85 my $etime    = RT->Config->Get('CalendarWeeklyEndMin');
86 $etime = 1080 unless $etime =~ /^\d+$/; #6pm
87
88 my $width = int( ( $etime - $stime ) / 10 );
89 my $height = 12; #Schedule/UserBar
90
91 </%once>
92 <%init>
93
94 use RTx::Schedule qw( UserDaySchedule );
95 use FS::sched_avail; #just for pretty_time
96
97 #my( $date, $time ) = split('T', $Date);
98 my $date = $Date->strftime('%F');
99
100 </%init>