Merge pull request #5123 from solgenomics/topic/wishlist
[sgn.git] / mason / order / create_item_file_dialog.mas
blob9cbb870bbb19bf28c4afb3e16bbc14c6107c47c6
1 <%args>
3 $order_id => undef
5 </%args>
7 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'jquery', 'jquery.dataTables', 'CXGN.List'] &>
8 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
10 <div class="modal fade" id="download_item_file_dialog" name="download_item_file_dialog" tabindex="-1" role="dialog" aria-labelledby="downloadItemFileDialog">
11     <div class="modal-dialog modal-xl" role="document">
12         <div class="modal-content">
13             <div class="modal-header">
14                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
15                 <h4 class="modal-title" id="downloadItemFileDialog">Create Ordering Item File</h4>
16             </div>
17             <div class="modal-body">
18                 <div class="container-fluid">
19                     <div id="item_tracking_ids_div"></div>
20                 </div>
21             </div>
22             <div class="modal-footer">
23                 <a href="/ajax/order/download_order_item_file?order_id=<% $order_id %>" class="btn btn-default">Download</a>
24                 <button id="close_create_item_file_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
25             </div>
26         </div>
27     </div>
28 </div>
30 <style>
32 .table_1 table {
33     border: 1px solid black;
34     border-collapse: collapse;
37 .table_1 thead th {
38     border: 1px solid black;
39     border-collapse: collapse;
42 .table_1 td {
43     border: 1px solid black;
44     border-collapse: collapse;
47 </style>
49 <script>
51 jQuery(document).ready( function() {
53     var order_id = "<% $order_id %>";
55     jQuery("#download_active_item_file_button").click( function() {
56         jQuery.ajax({
57             url:'/ajax/order/active_order_tracking_ids',
59             success: function(response){
60                 console.log(response);
61                 var html = '';
62                 html += '<div class="well well-sm"><table class="table table_1 table-hover table-condensed">';
63                 html += '<thead><tr><th>order_tracking_name</th><th>order_tracking_id</th><th>item_name</th><th>order_number</th><th>item_number</th><th>required_quantity</th><th>required_stage</th></tr></thead><tbody>';
65                 for(var i=0; i<response.tracking_info.length; i++){
66                     html += '<tr><td>'+response.tracking_info[i][0]+'</td>';
67                     html += '<td>'+response.tracking_info[i][1]+'</td>';
68                     html += '<td>'+response.tracking_info[i][2]+'</td>';
69                     html += '<td>'+response.tracking_info[i][3]+'</td>';
70                     html += '<td>'+response.tracking_info[i][4]+'</td>';
71                     html += '<td>'+response.tracking_info[i][5]+'</td>';
72                     html += '<td>'+response.tracking_info[i][6]+'</td></tr>';
73                 }
74                 html = html + '</tbody></table></div>';
76                 jQuery('#item_tracking_ids_div').html(html);
77                 jQuery('#download_item_file_dialog').modal('show');
78             }
80         });
81     });
83     jQuery("#download_item_file_button").click( function() {
84         jQuery.ajax({
85             url:'/ajax/order/order_tracking_ids',
86             data: {'order_id': order_id },
87             success: function(response){
88                 console.log(response);
89                 var html = '';
90                 html += '<div class="well well-sm"><table class="table table_1 table-hover table-condensed">';
91                 html += '<thead><tr><th>order_tracking_name</th><th>order_tracking_id</th><th>item_name</th><th>order_number</th><th>item_number</th><th>required_quantity</th><th>required_stage</th></tr></thead><tbody>';
93                 for(var i=0; i<response.tracking_info.length; i++){
94                     html += '<tr><td>'+response.tracking_info[i][0]+'</td>';
95                     html += '<td>'+response.tracking_info[i][1]+'</td>';
96                     html += '<td>'+response.tracking_info[i][2]+'</td>';
97                     html += '<td>'+response.tracking_info[i][3]+'</td>';
98                     html += '<td>'+response.tracking_info[i][4]+'</td>';
99                     html += '<td>'+response.tracking_info[i][5]+'</td>';
100                     html += '<td>'+response.tracking_info[i][6]+'</td></tr>';
101                 }
102                 html = html + '</tbody></table></div>';
104                 jQuery('#item_tracking_ids_div').html(html);
105                 jQuery('#download_item_file_dialog').modal('show');
106             }
108         });
109     });
117 </script>