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