autogenerated name metadata table
[sgn.git] / mason / transformation / add_transformants_using_list_dialog.mas
blob803e54d450c66256f433d37247a85e977ec1fccf
1 <%args>
2 $transformation_id
3 $transformation_name
4 </%args>
7 <div class="modal fade" id="add_transformants_using_list_dialog" name="add_transformants_using_list_dialog" tabindex="-1" role="dialog" aria-labelledby="addTransformantsUsingListDialog">
8     <div class="modal-dialog modal-lg" role="document">
9         <div class="modal-content ">
10             <div class="modal-header">
11                 <button type="reset" class="close" id="add_transformants_using_list_dismiss_button_1" name="add_transformants_using_list_dismiss_button" aria-label="Close"><span aria-hidden="true">&times;</span></button>
12                 <center><h4 class="modal-title" id="addTransformantsUsingList">Add New Transformants Using a List</h4></center>
13             </div>
14             <div class="modal-body">
15                 <div class="container-fluid">
16                     <form class="form-horizontal" role="form" name="add_new_transformants_form" id="add_new_transformants_form">
17                         <div class="form-group">
18                             <label class="control-label col-sm-6">Select a List of Accessions to Add:</label>
19                             <div class="col-sm-6" >
20                                 <div class="input-group">
21                                     <select class="form-control" id="new_transformants_list_select"></select>
22                                 </div>
23                             </div>
24                         </div>
25                     </form>
26                 </div>
27             </div>
28             <div class="modal-footer">
29                 <button type="button" class="btn btn-primary" id="new_transformants_list_submit">Submit</button>
30                 <button id="add_transformants_using_list_dismiss_button_2" name="add_transformants_using_list_dismiss_button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
31             </div>
32         </div>
33     </div>
34 </div>
36 <div class="modal fade" id="add_transformants_using_list_saved_dialog_message" name="add_transformants_using_list_saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="addTransformantsUsingListSavedDialog">
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">&times;</span></button>
41                 <h4 class="modal-title" id="addTransformantsUsingListSavedDialog">Success</h4>
42             </div>
43             <div class="modal-body">
44                 <div class="container-fluid">
45                     <p>
46                         <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
47                         The new transformants were stored successfully.
48                     </p>
49                 </div>
50             </div>
51             <div class="modal-footer">
52                 <button id="dismiss_add_transformants_using_list_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
53             </div>
54         </div>
55     </div>
56 </div>
58 <div class="modal fade" id="add_transformants_using_list_error_dialog" name="add_transformants_using_list_error_dialog" tabindex="-1" role="dialog" aria-labelledby="addTransformantsUsingListErrorDialog">
59     <div class="modal-dialog modal-lg" role="document">
60         <div class="modal-content">
61             <div class="modal-header">
62                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
63                 <h4 class="modal-title" id="addTransformantsUsingListErrorDialog">Add Transformants Error</h4>
64             </div>
65             <div class="modal-body">
66                 <div class="container-fluid">
67                     <table>
68                         <tbody></tbody>
69                     </table>
70                 </div>
71             </div>
72             <div class="modal-footer">
73                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
74             </div>
75         </div>
76     </div>
77 </div>
80 <script>
82 jQuery(document).ready(function(){
84     var lo = new CXGN.List();
86     jQuery('#new_transformants_list_select').html(lo.listSelect('new_transformants_list_select', ['accessions'], 'Select a list', undefined, undefined));
89     jQuery('#add_transformants_using_list_link').click(function(){
90         jQuery('#add_transformants_using_list_dialog').modal('show');
91     });
93     jQuery("#new_transformants_list_submit").click(function(){
94         var transformants_list_id = jQuery('#new_transformants_list_select').val();
96         if (!transformants_list_id) {
97             alert("Please select a list");
98             return;
99         }
101         jQuery.ajax({
102             url : '/ajax/transformation/add_transformants_using_list',
103             dataType: "json",
104             type: 'POST',
105             data : {
106                 'list_id' : transformants_list_id,
107                 'transformation_name': "<%$transformation_name%>",
108             },
109             beforeSend: function(response){
110                 jQuery('#working_modal').modal('show');
111             },
112             success: function(response) {
113                 jQuery('#working_modal').modal('hide');
114                 if (response.success == 1) {
115                     jQuery("#add_transformants_using_list_dialog").modal("hide");
116                     jQuery("#add_transformants_using_list_saved_dialog_message").modal("show");
117                 }
118                 if (response.error_string) {
119                     jQuery("#add_transformants_using_list_error_dialog tbody").html('');
120                     jQuery("#add_transformants_using_list_error_dialog tbody").append(response.error_string);
121                     jQuery("#add_transformants_using_list_error_dialog").modal("show");
122                     return;
123                 }
124             },
125             error: function(response){
126                 jQuery('#working_modal').modal('hide');
127                 alert('An error occurred adding new transformants');
128             }
129         });
131     });
133     jQuery("#dismiss_add_transformants_using_list_saved_dialog").click(function(){
134         jQuery("#add_transformants_using_list_saved_dialog_message").modal("hide");
135         jQuery('#new_transformants_list_select').val('');
136         location.reload();
137     });
139     jQuery("[name = 'generate_tracking_identifiers_dismiss_button']").click(function() {
140         jQuery("#add_transformants_using_list_dialog").modal("hide");
141         jQuery('#new_transformants_list_select').val('');
142         location.reload();
143     });
149 </script>