transformation project deletion section
[sgn.git] / mason / order / re_open_dialog.mas
blobea7d37dfe111656b393029266b975e5ed2134208
1 <%args>
2 $order_id
3 $order_to
4 </%args>
7 <div class="modal fade" id="requester_re_open_order_dialog" name="requester_re_open_order_dialog" tabindex="-1" role="dialog" aria-labelledby="requesterReOpenOrderDialog">
8     <div class="modal-dialog modal-lg" role="document">
9         <div class="modal-content">
10             <div class="modal-header">
11                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
12                 <h4 class="modal-title" id="requesterReOpenOrderDialog">Re-Open Order</h4>
13             </div>
14             <div class="modal-body">
15                 <div class="container-fluid">
16                     <div id="requester_re_open_order_div">
17                     </div>
18                 </div>
19             </div>
20             <div class="modal-footer">
21                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
22                 <button id="requester_re_open_order_submit" type="button" class="btn btn-primary" >Submit</button>
23             </div>
24         </div>
25     </div>
26 </div>
28 <div class="modal fade" id="re_open_saved_dialog" name="re_open_saved_dialog" tabindex="-1" role="dialog" aria-labelledby="reOpenSavedDialog">
29     <div class="modal-dialog" role="document">
30         <div class="modal-content">
31             <div class="modal-header">
32                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
33                 <h4 class="modal-title" id="reOpenSavedDialog">Success</h4>
34             </div>
35             <div class="modal-body">
36                 <div class="container-fluid">
37                     <p>
38                         <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
39                         The order has been re-opened.
40                     </p>
41                 </div>
42             </div>
43             <div class="modal-footer">
44                 <button id="dismiss_re_open_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
45             </div>
46         </div>
47     </div>
48 </div>
51 <script>
53 jQuery(document).ready( function() {
54     var order_id = "<% $order_id %>";
55     var order_to = "<% $order_to %>";
57     jQuery('#requester_re_open_link').click(function(){
58         requesterReOpen(order_id, order_to)
59     });
61     jQuery('#requester_re_open_order_submit').click( function() {
62         var order_id = jQuery('#requester_re_open_order_id').val();
63         var re_open_status = jQuery('#requester_re_open_status').val();
64         var requester_re_open_comments = jQuery('#requester_re_open_comments').val();
65         if (!requester_re_open_comments) {
66             alert ("Please add comments for re-opening the order");
67             return;
68         }
70         jQuery.ajax({
71             url: '/ajax/order/update',
72             dataType: "json",
73             type: 'POST',
74             data : {
75                 'order_id' : order_id,
76                 'new_status': re_open_status,
77                 'contact_person_comments': requester_re_open_comments
78             },
79             beforeSend: function(response){
80                 jQuery('#working_modal').modal('show');
81             },
82             success: function(response) {
83                 jQuery('#working_modal').modal('hide');
84                 if (response.success == 1) {
85                     jQuery('#re_open_saved_dialog').modal('show');
86                     jQuery('#requester_re_open_order_dialog').modal('hide');
87                 }
88                 if (response.error_string) {
89                     alert(response.error);
90                 }
91             },
92             error: function(response){
93                 jQuery('#working_modal').modal('hide');
94                 alert('An error occurred re-opening the order');
95             }
96         });
97     });
99     jQuery("#dismiss_re_open_saved_dialog").click(function(){
100         location.reload();
101     });
106 function requesterReOpen(order_id, order_to){
107     var re_open = "re-opened"
108     var html = '';
109     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="requester_re_open_order_id" name="requester_re_open_order_id" value="'+order_id+'" disabled></div></div>';
110     html += '<div class="form-group"><label class="col-sm-3 control-label">Vendor: </label><div class="col-sm-9" ><input class="form-control" id="re_open_order_to" name="re_open_order_to" value="'+order_to+'" disabled></div></div>';
111     html += '<div class="form-group"><label class="col-sm-3 control-label">Status: </label><div class="col-sm-9" ><input class="form-control" id="requester_re_open_status" name="requester_re_open_status" value="'+re_open+'" disabled></div></div>';
112     html += '<div class="form-group"><label class="col-sm-3 control-label">Comments: </label><div class="col-sm-9" ><input class="form-control" id="requester_re_open_comments" placeholder="Required"></div></div></form>'
114     jQuery('#requester_re_open_order_div').html(html);
115     jQuery('#requester_re_open_order_dialog').modal('show');
119 </script>