3 $role => "stock_orderer"
4 $check_vendor_role => undef
5 $tracking_order_activity => undef
11 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery/dataTables', 'CXGN.BreedersToolbox.HTMLSelect.js', 'CXGN.List' ] &>
13 % if ($check_vendor_role == 1) {
14 <&| /page/page_title.mas, title => "Manage Orders for Vendor" &>
17 <&| /page/page_title.mas, title => "Your Orders" &>
22 <a href="/catalog/view"><p>Go to Catalog Page</p></a>
26 % if ($check_vendor_role == 1) {
27 <&| /page/info_section.mas, title => 'Manage Current Orders', collapsible=>1, collapsed=>0 &>
28 <div class = "well well-sm">
29 <div class = "panel panel-default">
30 <div class = "panel-body">
31 <div style="overflow:scroll">
32 <table id = "vendor_current_orders" class="table table-hover table-striped">
40 <&| /page/info_section.mas, title => 'Completed Orders', collapsible=>1, collapsed=>1 &>
41 <div class = "well well-sm">
42 <div class = "panel panel-default">
43 <div class = "panel-body">
44 <div style="overflow:scroll">
45 <table id = "vendor_completed_orders" class="table table-hover table-striped">
54 % if ($check_vendor_role != 1) {
55 <&| /page/info_section.mas, title => 'Your Current Orders', collapsible=>1, collapsed=>0 &>
56 <div class = "well well-sm">
57 <div class = "panel panel-default">
58 <div class = "panel-body">
59 <div style="overflow:scroll">
60 <table id = "user_current_orders" class="table table-hover table-striped">
64 <th>Submitted Date</th>
65 <th>Order Details</th>
67 <th>Send Order to</th>
78 <&| /page/info_section.mas, title => 'Your Completed Orders', collapsible=>1, collapsed=>0 &>
79 <div class = "well well-sm">
80 <div class = "panel panel-default">
81 <div class = "panel-body">
82 <div style="overflow:scroll">
83 <table id = "user_completed_orders" class="table table-hover table-striped">
87 <th>Submitted Date</th>
88 <th>Order Details</th>
90 <th>Completed Date</th>
103 <div class="modal fade" id="update_order_dialog" name="update_order_dialog" tabindex="-1" role="dialog" aria-labelledby="updateOrderDialog">
104 <div class="modal-dialog modal-lg" role="document">
105 <div class="modal-content">
106 <div class="modal-header">
107 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
108 <h4 class="modal-title" id="updateOrderDialog">Update Order</h4>
110 <div class="modal-body">
111 <div class="container-fluid">
112 <div id="update_order_div">
116 <div class="modal-footer">
117 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
118 <button id="update_order_button" type="button" class="btn btn-primary" >Update</button>
124 <div class="modal fade" id="update_saved_dialog" name="update_saved_dialog" tabindex="-1" role="dialog" aria-labelledby="updateSavedDialog">
125 <div class="modal-dialog" role="document">
126 <div class="modal-content">
127 <div class="modal-header">
128 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
129 <h4 class="modal-title" id="updateSavedDialog">Success</h4>
131 <div class="modal-body">
132 <div class="container-fluid">
134 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
135 The order has been updated.
139 <div class="modal-footer">
140 <button id="dismiss_update_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
146 <div class="modal fade" id="re_open_order_dialog" name="re_open_order_dialog" tabindex="-1" role="dialog" aria-labelledby="reOpenOrderDialog">
147 <div class="modal-dialog modal-lg" role="document">
148 <div class="modal-content">
149 <div class="modal-header">
150 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
151 <h4 class="modal-title" id="reOpenOrderDialog">Re-Open Order</h4>
153 <div class="modal-body">
154 <div class="container-fluid">
155 <div id="re_open_order_div">
159 <div class="modal-footer">
160 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
161 <button id="re_open_order_button" type="button" class="btn btn-primary" >Re-Open</button>
167 % if (($check_vendor_role == 1) && $tracking_order_activity) {
168 <&| /page/info_section.mas, title => 'Tracking Order Progress', collapsible=>1, collapsed=>0 &>
169 <div class = "well well-sm">
170 <div class = "panel panel-default">
171 <div class = "panel-body">
173 <button id="download_active_item_file_button" class="btn btn-primary">Download Item File</button>
174 <button id="download_ontology_file_button" class="btn btn-primary">Download Data Collection Ontologies</button>
176 <button id="generate_active_item_barcode_button" class="btn btn-primary">Generate Item Barcodes</button>
177 <a href="/activity/record" class="btn btn-default">Go to Record Page</a>
179 <div class = "panel-body">
181 <div style="overflow:scroll">
182 <table class="table table-hover table-bordered" id="order_progress_table">
185 <th>Order Number</th>
186 <th>Order Details</th>
189 % my $activity_types = $c->config->{tracking_activities_header};
190 % my @column_header = split ',',$activity_types;
191 % foreach my $column_header(@column_header){
192 <th><%$column_header%></th>
204 <& /order/create_item_file_dialog.mas&>
205 <& /order/create_ontology_file_dialog.mas &>
206 <& /order/generate_identifier_barcode_dialog.mas, identifier => "", user_id => $user_id &>
210 $(window).ready( function() {
212 jQuery('#user_current_orders').DataTable( {
214 'ajax': '/ajax/order/current',
217 jQuery('#user_completed_orders').DataTable( {
219 'ajax': '/ajax/order/completed',
222 jQuery('#vendor_current_orders').DataTable( {
224 'ajax': '/ajax/order/vendor_current_orders',
226 { title: "Order Number", "data": null, "render": function ( data, type, row ) { return "<a href='/order/details/view/"+row.order_id+"'>"+row.order_id+"</a>"; } },
227 { title: "Ordered by", "data": "order_from_name" },
228 { title: "Submitted Date", "data": "create_date" },
229 { title: "Order Details", "data": "order_details" },
230 { title: "Status", "data": "order_status" },
231 { title: "Comments", "data": "contact_person_comments" },
232 { title: "Update", "data": "null", "render": function ( data, type, row ) { return "<a onclick='updateOrder(\""+row.order_id+"\", \""+row.order_from_name+"\")' >Update</a>"; } },
236 jQuery('#vendor_completed_orders').DataTable( {
238 'ajax': '/ajax/order/vendor_completed_orders',
240 { title: "Order Number", "data": null, "render": function ( data, type, row ) { return "<a href='/order/details/view/"+row.order_id+"'>"+row.order_id+"</a>"; } },
241 { title: "Ordered by", "data": "order_from_name" },
242 { title: "Submitted Date", "data": "create_date" },
243 { title: "Order Details", "data": "order_details" },
244 { title: "Status", "data": "order_status" },
245 { title: "Completion Date", "data": "completion_date" },
246 { title: "Comments", "data": "contact_person_comments" },
247 { title: "Update", "data": "null", "render": function ( data, type, row ) { return "<a onclick='reOpenOrder(\""+row.order_id+"\", \""+row.order_from_name+"\")' >Re-Open</a>"; } },
251 jQuery('#update_order_button').click( function() {
252 var order_id = jQuery('#update_order_id').val();
253 var new_order_status = jQuery('#update_order_status').val();
254 if (!new_order_status) {
255 alert ("Please select a status");
258 var contact_person_comments = jQuery('#contact_person_comments').val();
261 url: '/ajax/order/update',
265 'order_id' : order_id,
266 'new_status': new_order_status,
267 'contact_person_comments': contact_person_comments
269 beforeSend: function(response){
270 jQuery('#working_modal').modal('show');
272 success: function(response) {
273 jQuery('#working_modal').modal('hide');
274 if (response.success == 1) {
275 jQuery('#update_saved_dialog').modal('show');
276 jQuery('#update_order_dialog').modal('hide');
278 if (response.error_string) {
279 alert(response.error);
282 error: function(response){
283 jQuery('#working_modal').modal('hide');
284 alert('An error occurred updating the order');
289 jQuery("#dismiss_update_saved_dialog").click(function(){
293 jQuery('#re_open_order_button').click( function() {
294 var order_id = jQuery('#re_open_order_id').val();
295 var re_open_status = jQuery('#re_open_status').val();
296 var re_open_comments = jQuery('#re_open_comments').val();
297 if (!re_open_comments) {
298 alert ("Please add comments for re-opening the order");
303 url: '/ajax/order/update',
307 'order_id' : order_id,
308 'new_status': re_open_status,
309 'contact_person_comments': re_open_comments
311 beforeSend: function(response){
312 jQuery('#working_modal').modal('show');
314 success: function(response) {
315 jQuery('#working_modal').modal('hide');
316 if (response.success == 1) {
317 jQuery('#update_saved_dialog').modal('show');
318 jQuery('#re_open_order_dialog').modal('hide');
320 if (response.error_string) {
321 alert(response.error);
324 error: function(response){
325 jQuery('#working_modal').modal('hide');
326 alert('An error occurred updating the order');
331 jQuery('#order_progress_table').DataTable({
333 'ajax': '/ajax/order/progress',
338 function updateOrder(order_id, order_from_name){
340 html += '<form class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">Order Number: </label><div class="col-sm-9" ><input class="form-control" id="update_order_id" name="update_order_id" value="'+order_id+'" disabled></div></div>';
341 html += '<div class="form-group"><label class="col-sm-3 control-label">Ordered by: </label><div class="col-sm-9" ><input class="form-control" id="ordered_by_name" name="ordered_by_name" value="'+order_from_name+'" disabled></div></div>';
342 html += '<div class="form-group"><label class="col-sm-3 control-label">Status: </label><div class="col-sm-9" ><select class="form-control" id="update_order_status" name="update_order_status"><option disabled value="" selected hidden>Select a status</option>';
343 html += '<option value='+"being_processed"+'>'+"being_processed"+'</option>';
344 html += '<option value='+"shipped"+'>'+"shipped"+'</option>';
345 html += '<option value='+"completed"+'>'+"completed"+'</option>';
346 html += '<option value='+"cancelled"+'>'+"cancelled"+'</option>';
347 html += '</select></div></div>';
348 html += '<div class="form-group"><label class="col-sm-3 control-label">Comments: </label><div class="col-sm-9" ><input class="form-control" id="contact_person_comments" placeholder="Optional"></div></div></form>'
350 jQuery('#update_order_div').html(html);
351 jQuery('#update_order_dialog').modal('show');
355 function reOpenOrder(order_id, order_from_name){
356 var re_open = "re-opened"
358 html += '<form class="form-horizontal"><div class="form-group"><label class="col-sm-3 control-label">Order Number: </label><div class="col-sm-9" ><input class="form-control" id="re_open_order_id" name="re_open_order_id" value="'+order_id+'" disabled></div></div>';
359 html += '<div class="form-group"><label class="col-sm-3 control-label">Ordered by: </label><div class="col-sm-9" ><input class="form-control" id="re_open_ordered_by" name="re_open_ordered_by" value="'+order_from_name+'" disabled></div></div>';
360 html += '<div class="form-group"><label class="col-sm-3 control-label">Status: </label><div class="col-sm-9" ><input class="form-control" id="re_open_status" name="re_open_status" value="'+re_open+'" disabled></div></div>';
361 html += '<div class="form-group"><label class="col-sm-3 control-label">Comments: </label><div class="col-sm-9" ><input class="form-control" id="re_open_comments" placeholder="Required"></div></div></form>'
363 jQuery('#re_open_order_div').html(html);
364 jQuery('#re_open_order_dialog').modal('show');