3 $ordering_service_name => undef
4 $additional_order_info => undef
5 $ordering_type => undef
6 $order_properties => undef
7 $order_properties_dialog => undef
12 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'jquery', 'jquery.dataTables', 'CXGN.List'] &>
13 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
15 <div class="modal fade" id="re_order_dialog" name="re_order_dialog" tabindex="-1" role="dialog" aria-labelledby="reOrderDialog">
16 <div class="modal-dialog modal-lg" role="document">
17 <div class="modal-content">
18 <div class="modal-header">
19 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
20 <h4 class="modal-title" id="reOrderDialog">Ordering Information</h4>
22 <div class="modal-body">
23 <div class="container-fluid">
24 <div id="ordering_info_div">
28 <div class="modal-footer">
29 <button id="close_re_order_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
30 <button id="re_order_submit" type="button" class="btn btn-primary" >Submit</button>
36 <div class="modal fade" id="re_order_response_dialog" name="re_order_response_dialog" tabindex="-1" role="dialog" aria-labelledby="reOrderResponseDialog">
37 <div class="modal-dialog" role="document">
38 <div class="modal-content">
39 <div class="modal-header">
40 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
41 <h4 class="modal-title" id="reOrderResponseDialog">Your Order</h4>
43 <div class="modal-body">
44 <div class="container-fluid">
45 <div id="re_order_response_div"></div>
48 <div class="modal-footer">
49 <button id="dismiss_re_order_response_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
59 jQuery(document).ready( function() {
60 var order_properties = "<% $order_properties %>";
61 var properties = order_properties.split(",");
62 properties.unshift("Item Name");
64 var order_values = "<% $order_values %>";
66 jQuery('#re_order_link').click(function(){
67 reOrderInfo(order_properties, order_values)
70 jQuery('#re_order_submit').click(function(){
71 var order_details = {};
72 var item_name = jQuery('#0').val();
73 for(var i=1; i<properties.length; i++){
74 var each_value = jQuery('#'+ i +'').val();
75 order_details[properties[i]] = each_value;
79 url: '/ajax/order/single_step_submission',
83 'item_name' : item_name,
84 'order_details': JSON.stringify(order_details),
86 beforeSend: function(response){
87 jQuery('#working_modal').modal('show');
89 success: function(response) {
90 jQuery('#working_modal').modal('hide');
91 if (response.success) {
92 jQuery('#re_order_response_div').html(response.success);
94 jQuery('#re_order_response_dialog').modal('show');
95 jQuery('#re_order_dialog').modal('hide');
97 if (response.error_string) {
98 alert(response.error_string);
101 error: function(response){
102 jQuery('#working_modal').modal('hide');
103 alert('An error occurred saving your request');
111 function reOrderInfo(order_properties, order_values){
112 var properties = order_properties.split(",");
113 properties.unshift("Item Name");
114 var values = order_values.split(",");
117 for(var i=0; i<properties.length; i++){
118 var each_property_info = properties[i].split(":");
119 if (each_property_info.length == 1) {
120 html = html + '<label class="col-sm-3 control-label">'+ properties[i] +'</label><div class="col-sm-9" ><input class="form-control" id= '+ i +' name= '+ i +' value="'+values[i]+'" ></div><br><br>';
122 html = html + '<label class="col-sm-3 control-label">'+ each_property_info[0] +'</label><div class="col-sm-9" ><select class="form-control" id= '+ i +' name= '+ i +'> ';
123 for (var j=1; j<each_property_info.length; j++) {
124 html = html + "<option value='"+each_property_info[j]+"'>" + each_property_info[j] + "</option>";
126 html = html + "</select></div><br><br><br>";
129 html = html + '</div></div></form>';
131 jQuery('#ordering_info_div').html(html);
132 jQuery('#re_order_dialog').modal('show');