RT#34237: installer scheduling [bug fixes for refactor]
authorJonathan Prykop <jonathan@freeside.biz>
Thu, 31 Mar 2016 23:08:37 +0000 (18:08 -0500)
committerJonathan Prykop <jonathan@freeside.biz>
Thu, 31 Mar 2016 23:08:37 +0000 (18:08 -0500)
rt/share/html/Elements/CalendarSlotSchedule
rt/share/html/Search/Schedule.html

index c8d3bfa..b5c08d6 100644 (file)
@@ -21,7 +21,7 @@
 %
 %   my $bgcolor = '#666666';
 %   my $border = '1px solid #555555';
-%   my $content = '';
+%   my $label = '';
 %   my $selectable = 0; # can we schedule a new appointment
 %   my $ticketid = 0;
 %   my $draggable_length = 0;
 %   }
 %
 %   #block out / show / color code existing appointments
+%   my $maxstarts = 0;
 %   foreach my $id ( keys %{ $schedule{'scheduled'} } ) {
 %
 %     my( $starts, $due, $col, $t ) = @{ $schedule{'scheduled'}->{$id} };
 %
-%     # misleading loop--at most one id will pass this test
+%     # misleading loop--at most one id should pass this test
 %     next if $starts >= ($tod_row+$timestep) || $due <= $tod_row;
 %
+%     # but, if for any reason a scheduling conflict occurs, 
+%     # use the later starting one to minimize UI conflicts--
+%     #   not to imply that this scenario has been tested or should ever happen!!!
+%     next if $starts < $maxstarts;
+%     $maxstarts = $starts;
+%
 %     $ticketid = $id;
 %     $bgcolor = '#'.$col;
 %     $border = '1px solid #D7D7D7';
 %     $cells = int( ($due-$starts) / $timestep );
 %     $cells++ if ($due-$starts) % $timestep;
 %
-%     if ( $starts >= $tod_row ) { #first row
-%
-%       #false laziness w/misc/xmlhttp-ticket-update.html & CalendarDaySchedule
-%       my %hash = $m->comp('/Ticket/Elements/Customers', Ticket => $t);
-%       my @cust_main = values( %{$hash{cust_main}} );
+%     #false laziness w/misc/xmlhttp-ticket-update.html & CalendarDaySchedule
+%     my %hash = $m->comp('/Ticket/Elements/Customers', Ticket => $t);
+%     my @cust_main = values( %{$hash{cust_main}} );
 %
-%       #false laziness w/xmlhttp-ticket-update.html
-%       $content .= FS::sched_avail::pretty_time($starts). '-'.
-%                   FS::sched_avail::pretty_time($due).
-%                   ': '. $cust_main[0]->_FreesideURILabel;
-%                   #'install for custname XX miles away'; #XXX placeholder/more
+%     #false laziness w/xmlhttp-ticket-update.html
+%     $label .= FS::sched_avail::pretty_time($starts). '-'.
+%               FS::sched_avail::pretty_time($due).
+%               ': '. $cust_main[0]->_FreesideURILabel;
+%               #'install for custname XX miles away'; #XXX placeholder/more
 %
-%     } else {
-%       $offset = int( ($tod_row - $starts) / $timestep );
-%       $offset++ if ($tod_row - $starts) % $timestep;
-%     }
+%     $offset = int( ($tod_row - $starts) / $timestep );
+%     $offset++ if ($tod_row - $starts) % $timestep;
 %   }
 %
 %   my $td_id = 'td_'. $Date->epoch. '_'. $tod_row. '_'. $username;
 %       }
 %
 %     }
-    ><% $content |h %></td>
+    ></td>
     <SCRIPT TYPE="text/javascript">
 
       var $cell_<% $td_id %> = $('#<% $td_id %>');
         $cell_<% $td_id %>,
         <% $ticketid |js_string %>,
         <% $bgcolor |n,js_string %>,
-        <% $content |n,js_string %>,
+        <% $label |n,js_string %>,
         <% $draggable_length * 60 %>,
         <% $cells %>,
         <% $offset %>
index b16f609..cfa4558 100644 (file)
@@ -24,8 +24,6 @@
   // sets cell data and appearance as an appointment
   function set_appointment_cell ($cell,ticketid,bgcolor,label,length,cells,offset) {
     $cell.data('bgcolor',  bgcolor );
-    $cell.css('background-color', bgcolor);
-    $cell.css('border',  '1px solid #D7D7D7' );
     $cell.data('ticketid', ticketid );
     $cell.data('length',   length );
     $cell.data('cells',    cells );