From 1aa51c61c1104dfac3648993db4af1aed0ae89d2 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Mon, 27 Jul 2015 02:28:20 -0700 Subject: appointment drag and drop, RT#34237 --- rt/share/html/Elements/CalendarSlotSchedule | 132 ++++++++++++++------- rt/share/html/Search/Calendar.html | 2 +- rt/share/html/Search/Schedule.html | 174 ++++++++++++++++++++++++++-- rt/share/static/css/calendar.css | 4 + 4 files changed, 259 insertions(+), 53 deletions(-) (limited to 'rt') diff --git a/rt/share/html/Elements/CalendarSlotSchedule b/rt/share/html/Elements/CalendarSlotSchedule index ff3e6342c..045d6e436 100644 --- a/rt/share/html/Elements/CalendarSlotSchedule +++ b/rt/share/html/Elements/CalendarSlotSchedule @@ -20,6 +20,10 @@ % my $bgcolor = '666666;border-color:#555555'; % my $content = ''; % my $selectable = 0; +% my $draggable_ticketid = 0; +% my $draggable_length = 0; +% my $droppable = 0; +% my $cells = 0; % % #white out available times % foreach my $avail ( @{ $schedule{'avail'} } ) { @@ -44,58 +48,104 @@ % $selectable = 0; % % if ( $starts >= $tod_row ) { #first row -% $content .= ($content?', ':''). $id. -% ': '. FS::sched_avail::pretty_time($starts). '-'. -% FS::sched_avail::pretty_time($due); +% $content .= ($content?', ':''). #$id. ': '. +% #false laziness w/xmlhttp-ticket-update.html +% FS::sched_avail::pretty_time($starts). '-'. +% FS::sched_avail::pretty_time($due); % #'install for custname XX miles away'; #XXX placeholder/more +% $draggable_ticketid = $id; +% $draggable_length = $due - $starts; +% +% $cells = int( ($due-$starts) / $timestep ); +% $cells++ if ($due-$starts) % $timestep; +% % #} else { % # $content .= ($content?', ':''). $id; % } % } +% +% my $td_id = 'td_'. $Date->epoch. '_'. $tod_row. '_'. $username; - " + " % if ( $selectable ) { % -% #XXX for now, construct a ticket creation URL -% # eventually, do much the same, but say "appointment made", show time -% # and date, have # options to do things with it? etc. -% # then redir back to customer/appointment view i guess -% -% #abstraction is leaking like a sieve... linking back to freeside cust -% # (XXX and eventually, package) -% my $cust_main = qsearchs('cust_main', { custnum=>$custnum } ) -% or die "unknown custnum $custnum"; -% my $Queue = $cust_main->agent->ticketing_queueid || 1; # || $default_queueid;#XXX really, pick pkg_category queue -% my $member = "freeside://freeside/cust_main/$custnum"; -% -%warn my $Starts = int($tod_row/60). ':'. sprintf('%02d',$tod_row%60). ':00'; -%warn my $Due = int(($tod_row+$LengthMin)/60). ':'. -% sprintf('%02d',($tod_row+$LengthMin)%60). ':00'; -% -% my $url = $RT::WebPath. '/Ticket/Display.html?id=new'. -% "&Queue=$Queue". -% "&Owner=$username". -% '&Starts='. $Date->strftime('%F').'%20'. $Starts. -% '&Due='. $Date->strftime('%F').'%20'. $Due. -% '&new-MemberOf='. $member. #XXX uri_escape? -% '&Status=new'; -% #'&Requestors='. #XXX Freeside customer requestor(s) (package? +% if ( $custnum && $LengthMin ) { +% +% #XXX for now, construct a ticket creation URL +% # eventually, do much the same, but say "appointment made", show time +% # and date, have # options to do things with it? etc. +% # then redir back to customer/appointment view i guess +% +% #abstraction is leaking like a sieve... linking back to freeside cust +% # (XXX and eventually, package) +% my $cust_main = qsearchs('cust_main', { custnum=>$custnum } ) +% or die "unknown custnum $custnum"; +% my $Queue = $cust_main->agent->ticketing_queueid || 1; # || $default_queueid;#XXX really, pick pkg_category queue +% my $member = "freeside://freeside/cust_main/$custnum"; +% +%warn my $Starts = int($tod_row/60). ':'. sprintf('%02d',$tod_row%60). ':00'; +%warn my $Due = int(($tod_row+$LengthMin)/60). ':'. +% sprintf('%02d',($tod_row+$LengthMin)%60). ':00'; +% +% my $url = $RT::WebPath. '/Ticket/Display.html?id=new'. +% "&Queue=$Queue". +% "&Owner=$username". +% '&Starts='. $Date->strftime('%F').'%20'. $Starts. +% '&Due='. $Date->strftime('%F').'%20'. $Due. +% '&new-MemberOf='. $member. #XXX uri_escape? +% '&Status=new'; +% #'&Requestors='. #XXX Freeside customer requestor(s) (package? - onmouseover = "boxon(this);" - onmouseout = "boxoff(this);" - title = "<% 'Make appointment for '. - FS::sched_avail::pretty_time($tod_row). '-'. - FS::sched_avail::pretty_time($tod_row+$LengthMin) - %>" - onclick = "window.location.href = '<% $url %>'" + onmouseover = "boxon(this);" + onmouseout = "boxoff(this);" + title = "<% 'Make appointment for '. + FS::sched_avail::pretty_time($tod_row). '-'. + FS::sched_avail::pretty_time($tod_row+$LengthMin) + %>" + onclick = "window.location.href = '<% $url %>'" +% +% } else { +% $droppable = 1; +% } +% % } ><% $content %> + % } <%ONCE> my $default_slots = RT->Config->Get('CalendarWeeklySlots') || 5; diff --git a/rt/share/html/Search/Calendar.html b/rt/share/html/Search/Calendar.html index 092f6a5a1..2c19296f9 100644 --- a/rt/share/html/Search/Calendar.html +++ b/rt/share/html/Search/Calendar.html @@ -78,7 +78,7 @@ $DimPast => 0 % } - +
diff --git a/rt/share/html/Search/Schedule.html b/rt/share/html/Search/Schedule.html index 34ba142bd..be5a140ef 100644 --- a/rt/share/html/Search/Schedule.html +++ b/rt/share/html/Search/Schedule.html @@ -1,14 +1,9 @@ -<& /Elements/Header, Title => 'Schedule' &> - -%#init_overlib.html -%foreach my $file (@files) { - -%} - - +<& /Elements/Header, Title => 'Schedule', JavaScript => 0 &> <& /Search/Calendar.html, @@ -86,9 +234,13 @@ if ( ref($ARGS{username}) ) { } elsif ( $ARGS{username} ) { @usernames = ( $ARGS{username} ); } else { - #XXX shouldn't even get offered the link in the first place rather than perl - # barf, but this is better than erroring out later or empty @username - die "Can't schedule an appointment - no employees are configured as installers"; + #look them up ourslves... again, more FS abstraction-leaking, but + # we want to link to the schedule view, and better than doing this every + # menu render + use FS::Record qw( qsearch ); + use FS::sched_item; + my @sched_item = qsearch('sched_item', { 'disabled' => '', }); + @usernames = map $_->access_user->username, @sched_item; } ( my $LengthMin = $ARGS{LengthMin} ) =~ /^\d+$/ or die 'non-numeric LengthMin'; diff --git a/rt/share/static/css/calendar.css b/rt/share/static/css/calendar.css index a91917c24..566f969ba 100644 --- a/rt/share/static/css/calendar.css +++ b/rt/share/static/css/calendar.css @@ -201,3 +201,7 @@ table.rtxweeklycalendar td.labels { border-bottom: 1px solid #eeeeee; } +.ui-effects-transfer { + border: 1px solid black; +} + -- cgit v1.2.1