Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / mason / breeders_toolbox / add_vectors_dialogs.mas
blobe46b4b168535b52f6ec598be067d6734114da753
1 <%args>
2 $preferred_species => ""
3 $editable_vector_props => {}
4 $editable_stock_props_definitions
5 </%args>
7 <%perl>
8     my $user_role = '';
9     if ($c->user) {
10         $user_role = $c->user->get_object()->get_user_type();
11     }
12 </%perl>
14 <div class="modal fade" id="add_vectors_dialog" name="add_vectors_dialog" tabindex="-1" role="dialog" aria-labelledby="addVectorsDialog" data-backdrop="static" data-keyboard="false">
15   <div class="modal-dialog modal-lg" role="document">
16     <div class="modal-content">
17       <div class="modal-header">
18         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
19         <h4 class="modal-title" id="addVectorsDialog">Add Vectors</h4>
20       </div>
21       <div class="modal-body">
22         <div class="container-fluid">
24             <div class="tab-content">
26                 <div id="with_file_tab" class="tab-pane fade in active">
27                     <hr>
28                     <&| /page/explanation.mas, title=>'Template information' &>
29                         <p>
30                             <b>File format information</b>
31                             <br>
32                             <a id="vectors_upload_spreadsheet_format_info">Spreadsheet format</a>
33                         </p>
34                     </&>
36                     <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_new_vectors_form" name="upload_new_vectors_form">
37                         <div class="form-group">
38                             <label class="col-sm-4 control-label">Upload File: </label>
39                             <div class="col-sm-8" >
40                                 <input type="file" name="new_vectors_upload_file" id="new_vectors_upload_file" encoding="multipart/form-data" />
41                             </div>
42                         </div>
43                         <div class="form-group">
44                             <label class="col-sm-4 control-label">Use Fuzzy Search: </label>
45                             <div class="col-sm-8">
46 % if ( $user_role eq 'curator' ) {
47                                 <input type="checkbox" id="fuzzy_check_upload_vectors" name="fuzzy_check_upload_vectors" checked></input>
48 % } else {
49                                 <input type="checkbox" id="fuzzy_check_upload_vectors" name="fuzzy_check_upload_vectors" checked disabled></input>
50 % }
51                                 <br/>
52                                 <small>Note: Use the fuzzy search to match similar names to prevent uploading of duplicate vectors. Fuzzy searching is much slower than regular search. Only a curator can disable the fuzzy search.</small>
53                             </div>
54                         </div>
55                         <div class="form-group">
56                             <label class="col-sm-4 control-label"> Auto generate uniquename</label><br>
57                             <div class="col-sm-8">
58                                 <input type="checkbox" id="autogenerate_uniquename" name="autogenerate_uniquename">
59                             </div>
60                         </div>
61                     </form>
62                 </div>
63             </div>
64         </div>
65       </div>
66       <div class="modal-footer">
67         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
68         <button type="button" class="btn btn-primary" name="new_vectors_submit" id="new_vectors_submit">Continue</button>
69       </div>
70     </div>
71   </div>
72 </div>
74 <div class="modal fade" id="vectors_upload_spreadsheet_format_modal" name="vectors_upload_spreadsheet_format_modal" tabindex="-1" role="dialog" aria-labelledby="uploadVectorsInfoDialog">
75     <div class="modal-dialog modal-xl" role="document">
76         <div class="modal-content">
77             <div class="modal-header" style="text-align: center">
78                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
79                 <h4 class="modal-title" id="uploadVectorsInfoDialog">Upload Vectors Template Information</h4>
80             </div>
81             <div class="modal-body">
82                 <div class="container-fluid">
83                     <b>Vectors may be uploaded in an Excel file (.xls or .xlsx)</b>
84                     <br /><br />
85                     <b>Header:</b>
86                     <br>
87                     The first row (header) should contain the following:
88                     <br />
90                     <table class="table table-hover table-bordered table-condensed" >
91                         <thead></thead>
92                         <tbody>
93                             <tr>
94                                 <td>uniquename </td>
95                                 <td>species_name</td>
96 %  foreach my $editable_stockprop (@$editable_vector_props) {
97 %                               print "<td>$editable_stockprop</td>";
98 % }
99                             </tr>
100                         </tbody>
101                     </table>
103                     <b>Comma Separated Fields:</b>
104                     <ul>
105                     <li>The following fields can take comma-separated values to indicate there are several values for the accession: 
106                     </li>
107                     </ul>
109                     <b>Required Fields:</b>
110                     <ul>
111                     <li>name (must be unique)</li>
112                     <li>species_name (must exist in the database)</li>
113                     </ul>
114                     <b>Optional Fields:</b>
115                     <ul>
116 %  foreach my $editable_stockprop (@$editable_vector_props) {
117 %    if (exists($editable_stock_props_definitions->{$editable_stockprop})) {
118 %                   print "<li>$editable_stockprop (".$editable_stock_props_definitions->{$editable_stockprop}.")</li>";
119 %    } else {
120 %                   print "<li>$editable_stockprop (no definition available)</li>";
121 %    }
122 %  }
123                     </ul>
124                 </div>
125             </div>
126             <div class="modal-footer">
127                 <button id="close_trial_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
128             </div>
129         </div>
130     </div>
131 </div>
133 <div class="modal fade" id="review_absent_dialog" name="review_absent_dialog" tabindex="-1" role="dialog" aria-labelledby="reviewAbsentDialog" data-backdrop="static" data-keyboard="false">
134   <div class="modal-dialog modal-xl" role="document">
135     <div class="modal-content ui-front">
136       <div class="modal-header">
137         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
138         <h4 class="modal-title" id="reviewAbsentDialog">Vectors to be Added</h4>
139       </div>
140       <div class="modal-body">
141         <div class="container-fluid">
142             <div id="add_vectors_using_list_inputs" style="display:none">
143                 <label for="species_name_input">Species name for added vectors</label>
144                 <input class="form-control" type="text" id="species_name_input" value="<% $preferred_species %>"></input>
145                 <br><br>
146                 <label for="population_name_input">Population name for added vectors (optional)</label>
147                 <input class="form-control" type="text" id="population_name_input"></input>
148                 <br><br>
149                 <label for="organization_name_input">Organization name for added vectors (optional)</label>
150                 <input class="form-control" type="text" id="organization_name_input"></input>
151                 <br><br>
152                 <b>The following vectors are new and will be added to the database:</b>
153                 <div id="count_of_absent_vectors"></div>
154                 <br>
155                 <div id="view_absent"></div>
156             </div>
157             <div id="view_infoToAdd"></div>
158         </div>
159       </div>
160       <div class="modal-footer">
161         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
162         <button type="button" class="btn btn-primary" name="review_absent_vectors_submit" id="review_absent_vectors_submit">Add Vectors</button>
163       </div>
164     </div>
165   </div>
166 </div>
168 <div class="modal fade" id="review_fuzzy_matches_dialog" name="review_fuzzy_matches_dialog" tabindex="-1" role="dialog" aria-labelledby="reviewFuzzyDialog" data-backdrop="static" data-keyboard="false">
169   <div class="modal-dialog modal-xl" role="document">
170     <div class="modal-content">
171       <div class="modal-header">
172         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
173         <h4 class="modal-title" id="reviewFuzzyDialog">Fuzzy Matches</h4>
174       </div>
175       <div class="modal-body">
176         <div class="container-fluid">
177           <b>Vectors were found with similar names.</b>
178           <br/><br/>
179           <div id="view_fuzzy_matches"></div>
180         </div>
181       </div>
182       <div class="modal-footer">
183         <button type="button" class="btn btn-default" name="review_fuzzy_matches_download" id="review_fuzzy_matches_download">Download Fuzzy Matches</button>
184         <button type="button" class="btn btn-primary" name="review_fuzzy_matches_continue" id="review_fuzzy_matches_continue" data-dismiss="modal">Make Changes and Continue</button>
185       </div>
186     </div>
187   </div>
188 </div>
190 <div class="modal fade" id="review_found_matches_dialog" name="review_found_matches_dialog" tabindex="-1" role="dialog" aria-labelledby="reviewFoundDialog" data-backdrop="static" data-keyboard="false">
191   <div class="modal-dialog modal-xl" role="document">
192     <div class="modal-content">
193       <div class="modal-header">
194         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
195         <h4 class="modal-title" id="reviewFoundDialog">Found Vectors</h4>
196       </div>
197       <div class="modal-body">
198         <div class="container-fluid">
199           <b>The following vectors already exist in the database:</b>
200           <div id="count_of_found_vectors"></div>
201           <br/>
202           <div id="view_found_matches"></div>
203         </div>
204       </div>
205       <div class="modal-footer">
206         <button type="button" class="btn btn-primary" name="review_found_matches_hide" id="review_found_matches_hide" data-dismiss="modal">Continue</button>
207       </div>
208     </div>
209   </div>
210 </div>
212 <div class="modal fade" id="add_vectors_saved_message_modal" name="add_vectors_saved_message_modal" tabindex="-1" role="dialog" aria-labelledby="addVectorsSavedDialog">
213     <div class="modal-dialog" role="document">
214         <div class="modal-content">
215             <div class="modal-header" style="text-align: center">
216                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
217                 <h4 class="modal-title" id="addVectorsSavedDialog">Vectors Saved</h4>
218             </div>
219             <div class="modal-body">
220                 <div class="container-fluid">
221                     <div id="add_vectors_saved_message"></div>
222                 </div>
223             </div>
224             <div class="modal-footer">
225                 <button id="close_add_vectors_saved_message_modal" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
226             </div>
227         </div>
228     </div>
229 </div>
231 <form id="add_vector_fuzzy_match_download" method="post" action="/ajax/accession_list/fuzzy_download" target="TheWindow">
232     <input type="hidden" name="fuzzy_response" value="" />
233 </form>
235 <style>
236 .ui-autocomplete {
237   max-height: 100px;
238   overflow-y: auto;
239   /* prevent horizontal scrollbar */
240   overflow-x: hidden;
243 /* IE 6 doesn't support max-height
244 * we use height instead, but this forces the menu to always be this tall
246 * html .ui-autocomplete {
247   height: 100px;
249 </style>