Merge pull request #5205 from solgenomics/topic/generic_trial_upload
[sgn.git] / mason / stock / delete.mas
blobeda01d6e9fd26b7b6d81dc25786b607842d2bd99
2 <%args>
3 $stock_id
4 </%args>
6 <& /util/import_javascript.mas, classes => [  ] &>
8 <button class="btn btn-primary" id="stock_detail_page_obsolete_stock">Obsolete This Stock</button>
10 <script>
12     jQuery(document).ready(function () {
13         jQuery('#stock_detail_page_obsolete_stock').click(function(){
14             jQuery.ajax ({
15                 url : '/stock/obsolete?stock_id=<% $stock_id %>&is_obsolete=1',
16                 beforeSend : function() {
17                     jQuery('#working_modal').modal('show');
18                 },
19                 success: function(response){
20                     console.log(response);
21                     jQuery('#working_modal').modal('hide');
22                     alert('Successfully obsoleted!');
23                     location.reload();
24                 },
25                 error: function(response){
26                     jQuery('#working_modal').modal('hide');
27                     alert("Error obsoleting stock.");
28                 }
29             });
30         });
31     });
33 </script>