Tweaks to trials.mas: hides breeding program table in non-accession stocks and rename...
[sgn.git] / mason / analyses / model_deletion.mas
blob6accfee569194c56e7d435242ae47aee3f8f1f2f
2 <%args>
3 $model_id
4 </%args>
6 <button class="btn btn-default" id="delete_model_data_by_model_id" role="button">Delete</button><br/><br/>
8 <div class="modal  fade" id="delete_model_data_dialog" name="delete_model_data_dialog" tabindex="-1" role="dialog" aria-labelledby="DeleteModelDataDialog">
9     <div class="modal-dialog " role="document">
10         <div class="modal-content">
11             <div class="modal-header" style="text-align: center">
12                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
13                 <h4 class="modal-title" id="DeleteModelDataDialog">Delete Model</h4>
14             </div>
15             <div class="modal-body">
16                 <div class="container-fluid">
18                     <center>
19                     <p3> Are you sure you want to delete this model? <br> Proceed with deletion below...</p3>
20                     </center></br>
22                 </div>
23             </div>
24             <div class="modal-footer">
25                 <button id="close_delete_model_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
26                 <button type="button" class="btn btn-primary" name="delete_model_data_dialog_submit" id="delete_model_data_dialog_submit">Delete Model</button>
27             </div>
28         </div>
29     </div>
30 </div>
32 <script>
33 jQuery(document).ready(function(){
34     jQuery('#delete_model_data_by_model_id').click(function(){
35         jQuery('#delete_model_data_dialog').modal('show');
36     });
38     jQuery('#delete_model_data_dialog_submit').click(function(){
39         jQuery.ajax({
40             type: 'GET',
41             url : '/ajax/analysis_model/delete?model_id=<% $model_id %>',
42             beforeSend: function() {
43                 jQuery('#working_modal').modal('show');
44             },
45             success: function(response){
46                 jQuery('#working_modal').modal('hide');
47                 console.log(response);
48                 if (response.error) {
49                     alert(response.error);
50                 }
51                 if  (response.success) {
52                     alert('DELETED MODEL!')
53                     location.reload();
54                 }
55             },
56             error: function(response){
57                 jQuery('#working_modal').modal('hide');
58                 alert('Error deleting analysis model!');
59             }
60         });
61     });
62 });
63 </script>