Fix 0 quantity not displayed
[order_line_extra.git] / item_schedule.php
index 39c8de52c7a0259c46921b2f551e6abffd245e4b..5e893b9894ab1bfd6b453435a4652e0e6ed40d88 100644 (file)
@@ -60,9 +60,9 @@ if (list_updated('stock_id') || in_ajax()) $Ajax->activate('item_schedule') ;
 
 
 
+       stock_costable_items_list_cells(_("Item:"), 'stock_id', $_POST['stock_id']);
+// Needs to be done afterward  as it can modify the post variable
 $stock_id = $_POST['stock_id'];
-       stock_costable_items_list_cells(_("Item:"), 'stock_id', $stock_id);
-
 
 end_row();
 end_table(1);
@@ -74,6 +74,11 @@ if(isset($_POST['Update'])) {
        $params = new ScheduleParameters($_SESSION['schedule_parameters']);
        $params->setMode('update');
 }
+else if(isset($_POST['Cancel'])) {
+       $Ajax->activate('item_schedule');
+       $params = new ScheduleParameters($_SESSION['schedule_parameters']);
+       $params->setMode('cancel');
+}
 else {
        $params = in_ajax() && $stock_id == @$_POST['last_stock_id'] ? new ScheduleParameters($_POST) : null;
        // save parameters form update
@@ -82,6 +87,8 @@ else {
 $scheduler = new ItemScheduler($stock_id, OrderXtraConfig::$default_location, $params);
 $scheduler->action();
 
+print("<center><h2>$stock_id</h2></center>");
+
 start_table(TABLESTYLE);
 $th = $scheduler->tableHeader();
 
@@ -112,7 +119,12 @@ tr.partial  td:nth-child(5) {
        background: pink;
 }
 
+
 tr.location {
+       font-weight: normal;
+               background: #bbb;
+}
+tr.picked {
        font-weight: normal;
                background: #8f8;
 }
@@ -144,6 +156,18 @@ tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
        color: transparent;
        background: transparent;
 }
+
+span.picked {
+       color: black;
+       font-weight: bold;
+}
+
+tr.partial span.pickable {
+       background: #cfc;
+}
+span.partial  {
+       background: transparent;
+}
 </style>
 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
 <script src="js/jquery.tablednd.0.8.min.js"></script>
@@ -175,6 +199,15 @@ tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
                
        }
 
+       function onPick(element) {
+               /* horible hack but it works */
+               /* in the way it call an Ajax request */
+               var row = $(element).closest('tr')[0];
+               var table = $(element).closest('table')[0];
+               onDrop(table, row);
+               
+       }
+
        var inserts = {
                '#item_schedule table': function (e) { 
                        $(e).tableDnD({onDragStart: onDragStart, onDrop: onDrop})