Add Ajax : change stock_id update page.
[order_line_extra.git] / item_schedule.php
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 $path_to_root = "../..";
13
14 include_once($path_to_root . "/includes/session.inc");
15 include_once($path_to_root . "/includes/ui/ui_lists.inc");
16 include_once($path_to_root . "/includes/ui/ui_globals.inc");
17 include_once($path_to_root . "/includes/ui/ui_input.inc");
18 include_once($path_to_root . "/reporting/includes/reporting.inc");
19
20 //include_once("includes/item_scheduler.inc");
21 include_once("hincludes/lib/php/Boot.class.php");
22
23 $page_security = 'SA_ORDERLINEX_EDIT';
24 add_access_extensions();
25
26 $_SESSION['page_title'] = _($help_context = "Item schedule");
27
28
29 $js = "";
30 page($_SESSION['page_title'], false, false, "", $js);
31
32 //---------------------------------------------------------------------------------------------
33
34 start_form();
35
36 start_table(TABLESTYLE_NOBORDER);
37 start_row();
38
39 ?>GET<?php
40 print_r($_GET);
41 ?>POST<?php
42 print_r($_POST);
43
44 if (!isset($_POST['stock_id'])) {
45 if (isset($_GET['stock_id']))
46 {
47         $_POST['stock_id'] = $_GET['stock_id'];
48 }
49 else {
50         $_POST['stock_id'] = get_global_stock_item();
51         }
52 }
53 if (list_updated('stock_id')) 
54         $Ajax->activate('item_schedule');
55
56 //if (!@$_GET['popup'])
57         start_form();
58
59
60 $stock_id = $_POST['stock_id'];
61         stock_costable_items_list_cells(_("Item:"), 'stock_id', $stock_id);
62
63 end_row();
64 end_table(1);
65
66 $scheduler = new ItemScheduler($stock_id, 'DEF');
67
68 div_start('item_schedule');
69 start_table(TABLESTYLE);
70 $th = $scheduler->tableHeader();
71
72 table_header($th);
73
74 $scheduler->generateTable();
75
76 end_table();
77 div_end();
78
79
80 submit_center_first('Update', _("Update"), '', 'default', false);
81 submit_center_last('Cancel', _("Cancel"), '', 'cancel', false);
82
83
84
85 end_form();
86 end_page();
87 ?>
88 <style type='text/css'>
89 tr.partial {
90         color: darkred;
91 }
92
93 tr.partial  td:nth-child(5) {
94         background: pink;
95 }
96
97 tr.location {
98         font-weight: normal;
99                 background: #8f8;
100 }
101 tr.on_time {
102 }
103
104 tr.late {
105                 background: #fc8;
106 }
107
108 tr.soldout {
109                 background: pink;
110 }
111
112 tr.tDnD_whileDrag {
113         background: #ccc;
114         border: 2px solid black;
115 }
116 tr.tDnD_whileDrag :nth-child(4), tr.tDnD_whileDrag :nth-child(5) {
117         color: transparent;
118         background: transparent;
119 }
120 </style>
121 <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
122 <script src="js/jquery.tablednd.0.8.min.js"></script>
123 <script text="text/javascript">
124         console.log('hello')
125         $(document).ready(function() {
126                 console.log('ready')
127                 $('#item_schedule table').tableDnD({
128                         onDragStart: function (table, row) {
129                                         console.log(table)
130                                         console.log(row)}
131                         ,onDrop: function (table, row) {
132                                         console.log(table)
133                                         console.log(row)}
134                 })
135         }
136         )
137 </script>