Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / mason / breeders_toolbox / upload_transactions_dialogs.mas
blobed5bb1aa371464d63ef9ae617b31d3768c7af9f5
1 <%args>
3 </%args>
6 <div class="modal fade" id="upload_transactions_dialog" name="upload_transactions_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadTransactionsDialog">
7     <div class="modal-dialog modal-xl" role="document">
8         <div class="modal-content">
9             <div class="modal-header">
10                 <button type="reset" class="close" id="upload_transactions_dismiss_button_1" name="upload_transactions_dismiss_button" aria-label="Close"><span aria-hidden="true">&times;</span></button>
11                 <h4 class="modal-title" id="uploadTransactionsDialog">Upload Transactions</h4>
12             </div>
13             <div class="modal-body">
14                 <div class="container-fluid">
15                     <&| /util/workflow.mas, id=> "transactions_upload_workflow" &>
16                         <&| /util/workflow.mas:step, title=> "Intro" &>
17                             <& /page/page_title.mas, title=>"Upload Seedlot Transactions" &>
18                             <center>You can upload 4 different types of seedlot transactions. All of the transactions in each file have to be the same type.</center>
19                             <ul>
20                                 <li>Transferring seeds from existing seedlot to another existing seedlot.</li>
21                                 <li>Transferring seeds from existing seedlot to a new seedlot. A new seedlot is created beforing adding new transaction.</li>
22                                 <li>Transferring seeds from existing seedlot to a previously stored plot</li>
23                                 <li>Removing seeds from existing seedlot to unspecified seedlot name or plot name</li>
24                             </ul>
25                             <br/><br/>
26                             <center>
27                                 <button id="next_step_intro_button" class="btn btn-primary" onclick="Workflow.complete(this);">Go to Next Step</button>
28                             </center>
29                         </&>
30                         <&| /util/workflow.mas:step, title=> "Upload Seedlot Transactions" &>
31                             <& /page/page_title.mas, title=>"Select a transaction type and upload your file" &>
32                             <br/>
33                             <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_transactions_form" name="upload_transactions_form">
34                                 <div class="form-group">
35                                     <label class="col-sm-3 control-label">Transaction Type: </label>
36                                     <div class="col-sm-9">
37                                         <select class="form-control" id="transaction_type_option">
38                                             <option value="">Select a transaction type that you want to upload</option>
39                                             <option value="seedlots_to_seedlots">From existing seedlots to other existing seedlots</option>
40                                             <option value="seedlots_to_new_seedlots">From existing seedlots to new seedlots</option>
41                                             <option value="seedlots_to_plots">From existing seedlots to plots</option>
42                                             <option value="seedlots_to_unspecified_names">From existing seedlots to unpecified seedlots/plots</option>
43                                         </select>
44                                     </div>
45                                 </div>
46                                 <div id="seedlots_to_seedlots_section" style="display:none">
47                                     <br/>
48                                     <hr class ="solid">
49                                     <center>
50                                         <h4>You want to transfer seeds from existing seedlots to other existing seedlots</h4>
51                                     </center>
52                                     <div class="well well-sm">
53                                         <div class="row">
54                                             <div class="col-sm-4">
55                                                 <&| /page/explanation.mas, title=>'Template information' &>
56                                                     <p>
57                                                         <b>File format information</b>
58                                                         <br>
59                                                         <a id="seedlots_to_seedlots_format">Spreadsheet format</a>
60                                                     </p>
61                                                 </&>
62                                             </div>
63                                             <div class="col-sm-8">
64                                                 <br/>
65                                                 <div class="panel panel-default">
66                                                     <div class="panel-body">
67                                                         <div class="form-group">
68                                                             <label class="col-sm-6 control-label">Select an .xls or .xlsx File: </label>
69                                                             <div class="col-sm-6">
70                                                                 <input type="file" name="seedlots_to_seedlots_file" id="seedlots_to_seedlots_file" encoding="multipart/form-data" />
71                                                             </div>
72                                                         </div>
73                                                     </div>
74                                                 </div>
75                                             </div>
76                                         </div>
77                                     </div>
78                                 </div>
79                                 <div id="seedlots_to_new_seedlots_section" style="display:none">
80                                     <br/>
81                                     <hr class ="solid">
82                                     <center>
83                                         <h4>Please provide basic information about the <b>new seedlots</b> and upload your file</h4>
84                                     </center>
85                                         <div class="form-group">
86                                             <label class="col-sm-4 control-label">Breeding Program: </label>
87                                             <div class="col-sm-8" >
88                                                 <div id="new_seedlot_breeding_program_div"></div>
89                                             </div>
90                                         </div>
91                                         <div class="form-group">
92                                             <label class="col-sm-4 control-label">Location of seedlot storage: </label>
93                                             <div class="col-sm-8" >
94                                                 <input class="form-control" name="new_seedlot_location" id="new_seedlot_location" placeholder="Required">
95                                             </div>
96                                         </div>
97                                         <div class="form-group">
98                                             <label class="col-sm-4 control-label">Organization Name: </label>
99                                             <div class="col-sm-8" >
100                                                 <input class="form-control" name="new_seedlot_organization_name" id="new_seedlot_organization_name" placeholder="Optional">
101                                             </div>
102                                         </div>
103                                     <div class="well well-sm">
104                                         <div class="row">
105                                             <div class="col-sm-4">
106                                                 <&| /page/explanation.mas, title=>'Template information' &>
107                                                     <p>
108                                                         <b>File format information</b>
109                                                         <br>
110                                                         <a id="seedlots_to_new_seedlots_format">Spreadsheet format</a>
111                                                     </p>
112                                                 </&>
113                                             </div>
114                                             <div class="col-sm-8">
115                                                 <br/>
116                                                 <div class="panel panel-default">
117                                                     <div class="panel-body">
118                                                         <div class="form-group">
119                                                             <label class="col-sm-6 control-label">Select an .xls or .xlsx File: </label>
120                                                             <div class="col-sm-6">
121                                                                 <input type="file" name="seedlots_to_new_seedlots_file" id="seedlots_to_new_seedlots_file" encoding="multipart/form-data" />
122                                                             </div>
123                                                         </div>
124                                                     </div>
125                                                 </div>
126                                             </div>
127                                         </div>
128                                     </div>
129                                 </div>
130                                 <div id="seedlots_to_plots_section" style="display:none">
131                                     <br/>
132                                     <hr class ="solid">
133                                     <center>
134                                         <h4>You want to use seeds from existing seedlots for plots</h4>
135                                     </center>
136                                     <div class="well well-sm">
137                                         <div class="row">
138                                             <div class="col-sm-4">
139                                                 <&| /page/explanation.mas, title=>'Template information' &>
140                                                     <p>
141                                                         <b>File format information</b>
142                                                         <br>
143                                                         <a id="seedlots_to_plots_format">Spreadsheet format</a>
144                                                     </p>
145                                                 </&>
146                                             </div>
147                                             <div class="col-sm-8">
148                                                 <br/>
149                                                 <div class="panel panel-default">
150                                                     <div class="panel-body">
151                                                         <div class="form-group">
152                                                             <label class="col-sm-6 control-label">Select an .xls or .xlsx File: </label>
153                                                             <div class="col-sm-6">
154                                                                 <input type="file" name="seedlots_to_plots_file" id="seedlots_to_plots_file" encoding="multipart/form-data" />
155                                                             </div>
156                                                         </div>
157                                                     </div>
158                                                 </div>
159                                             </div>
160                                         </div>
161                                     </div>
162                                 </div>
163                                 <div id="seedlots_to_unspecified_names_section" style="display:none">
164                                     <br/>
165                                     <hr class ="solid">
166                                     <center>
167                                         <h4>You want to remove seeds from existing seedlots to unspefified seedlots/plots</h4>
168                                     </center>
169                                     <div class="well well-sm">
170                                         <div class="row">
171                                             <div class="col-sm-4">
172                                                 <&| /page/explanation.mas, title=>'Template information' &>
173                                                     <p>
174                                                         <b>File format information</b>
175                                                         <br>
176                                                         <a id="seedlots_to_unspecified_names_format">Spreadsheet format</a>
177                                                     </p>
178                                                 </&>
179                                             </div>
180                                             <div class="col-sm-8">
181                                                 <br/>
182                                                 <div class="panel panel-default">
183                                                     <div class="panel-body">
184                                                         <div class="form-group">
185                                                             <label class="col-sm-6 control-label">Select an .xls or .xlsx File: </label>
186                                                             <div class="col-sm-6">
187                                                                 <input type="file" name="seedlots_to_unspecified_names_file" id="seedlots_to_unspecified_names_file" encoding="multipart/form-data" />
188                                                             </div>
189                                                         </div>
190                                                     </div>
191                                                 </div>
192                                             </div>
193                                         </div>
194                                     </div>
195                                 </div>
196                             </form>
197                             <div id="submit_transactions_button_section" style="display:none">
198                                 <center>
199                                     <button type="button" onclick="Workflow.complete(this, false);" class="btn btn-primary" name="upload_transactions_submit" id="upload_transactions_submit">Upload File</button>
200                                 </center>
201                             </div>
202                         </&>
203                         <&| /util/workflow.mas:complete, title=> "Complete" &>
204                             <& /page/page_title.mas, title=>"Finished! Your transactions are now in the database" &>
205                             <p>
206                                 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
207                                 The transactions file was uploaded successfully
208                             </p>
209                         </&>
210                     </&><!-- End of workflow -->
211                 </div>
212             </div>
213             <div class="modal-footer">
214                 <button id="upload_transactions_dismiss_button_2" name="upload_transactions_dismiss_button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
215             </div>
216         </div>
217     </div>
218 </div>
220 <div class="modal fade" id="upload_transactions_error_display" name="upload_transactions_error_display" tabindex="-1" role="dialog" aria-labelledby="uploadTransactionsErrorDialog">
221     <div class="modal-dialog modal-lg" role="document">
222         <div class="modal-content">
223             <div class="modal-header">
224                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
225                 <h4 class="modal-title" id="uploadTransactionsErrorDialog">Upload Transactions File Error</h4>
226             </div>
227             <div class="modal-body">
228                 <div class="container-fluid">
229                     <table>
230                         <tbody></tbody>
231                     </table>
232                 </div>
233             </div>
234             <div class="modal-footer">
235                 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
236             </div>
237         </div>
238     </div>
239 </div>
241 <div class="modal fade" id="seedlots_to_seedlots_info_dialog" name="seedlots_to_seedlots_info_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlotsToseedlotsInfoDialog">
242     <div class="modal-dialog modal-xl" role="document">
243         <div class="modal-content">
244             <div class="modal-header" style="text-align: center">
245                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
246                 <h4 class="modal-title" id="seedlotsToseedlotsInfoDialog">Upload Template Information For Existing Seedlot to Existing Seedlot Transactions  </h4>
247             </div>
248             <div class="modal-body">
249                 <div class="container-fluid">
250                     <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
251                     <br />
252                     <b>Header:</b>
253                     <br>
254                     The first row (header) must contain the following:
255                     <br />
256                     <table class="table table-hover table-bordered table-condensed" >
257                         <thead></thead>
258                         <tbody>
259                             <tr>
260                                 <td>from_seedlot_name</td>
261                                 <td>to_seedlot_name</td>
262                                 <td>amount</td>
263                                 <td>weight(g)</td>
264                                 <td>operator_name</td>
265                                 <td>transaction_description</td>
266                             </tr>
267                         </tbody>
268                     </table>
269                     <b>Required fields:</b>
270                     <ul>
271                         <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</li>
272                         <li><b>to_seedlot_name:</b> Must exist in the database. Seeds were added to this seedlot.</li>
273                         <li>
274                             <b>amount:</b> Number of seeds being transaferred. Can be provided in conjunction with weight(g). Must provide a value for amount or weight(g) or both.
275                             <br/><b>AND/OR</b><br/>
276                             <b>weight(g):</b> Weight in grams of seedlot being transferred. Can be provided in conjunction with amount. Must provide a value for amount or weight(g) or both.
277                         </li>
278                         <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
279                     </ul>
280                     <b>Optional fields:</b>
281                     <ul>
282                         <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
283                     </ul>
284                 </div>
285             </div>
286             <div class="modal-footer">
287                 <button id="close_seedlots_to_seedlots_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
288             </div>
289         </div>
290     </div>
291 </div>
293 <div class="modal fade" id="seedlots_to_new_seedlots_info_dialog" name="seedlots_to_new_seedlots_info_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlotsToNewSeedlotsInfoDialog">
294     <div class="modal-dialog modal-xl" role="document">
295         <div class="modal-content">
296             <div class="modal-header" style="text-align: center">
297                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
298                 <h4 class="modal-title" id="seedlotsToNewSeedlotsInfoDialog">Upload Template Information For Existing Seedlot to New Seedlot Transactions  </h4>
299             </div>
300             <div class="modal-body">
301                 <div class="container-fluid">
302                     <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
303                     <br />
304                     <b>Header:</b>
305                     <br>
306                     The first row (header) must contain the following:
307                     <br />
308                     <table class="table table-hover table-bordered table-condensed" >
309                         <thead></thead>
310                         <tbody>
311                             <tr>
312                                 <td>from_seedlot_name</td>
313                                 <td>amount</td>
314                                 <td>weight(g)</td>
315                                 <td>operator_name</td>
316                                 <td>transaction_description</td>
317                                 <td>to_new_seedlot_name</td>
318                                 <td>new_seedlot_box_name</td>
319                                 <td>new_seedlot_description</td>
320                                 <td>new_seedlot_quality</td>
321                             </tr>
322                         </tbody>
323                     </table>
324                     <b>Required fields:</b>
325                     <ul>
326                         <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</li>
327                         <li>
328                             <b>amount:</b> Number of seeds being transaferred. Can be provided in conjunction with weight(g). Must provide a value for amount or weight(g) or both.
329                             <br/><b>AND/OR</b><br/>
330                             <b>weight(g):</b> Weight in grams of seedlot being transferred. Can be provided in conjunction with amount. Must provide a value for amount or weight(g) or both.
331                         </li>
332                         <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
333                         <li><b>to_new_seedlot_name:</b> Must NOT exist in the database. New seedlot will be created using amount/weight of seeeds from existing seedlot.</li>
334                         <li><b>new_seedlot_box_name:</b> Box name that this new seedlot is stored. Can be any name.</li>
335                     </ul>
336                     <b>Optional fields:</b>
337                     <ul>
338                         <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
339                         <li><b>new_seedlot_description:</b> Information about this new seedlot.</li>
340                         <li><b>new_seedlot_quality:</b> Status or condition of the seedlot, for example "ok", "moldy", "insect damage" etc.</li>
341                     </ul>
342                 </div>
343             </div>
344             <div class="modal-footer">
345                 <button id="close_seedlots_to_new_seedlots_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
346             </div>
347         </div>
348     </div>
349 </div>
351 <div class="modal fade" id="seedlots_to_plots_info_dialog" name="seedlots_to_plots_info_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlotsToPlotsInfoDialog">
352     <div class="modal-dialog modal-xl" role="document">
353         <div class="modal-content">
354             <div class="modal-header" style="text-align: center">
355                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
356                 <h4 class="modal-title" id="seedlotsToPlotsInfoDialog">Upload Template Information For Existing Seedlot to Plot Transactions  </h4>
357             </div>
358             <div class="modal-body">
359                 <div class="container-fluid">
360                     <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
361                     <br />
362                     <b>Header:</b>
363                     <br>
364                     The first row (header) must contain the following:
365                     <br />
367                     <table class="table table-hover table-bordered table-condensed" >
368                         <thead></thead>
369                         <tbody>
370                             <tr>
371                                 <td>from_seedlot_name</td>
372                                 <td>to_plot_name</td>
373                                 <td>amount</td>
374                                 <td>weight(g)</td>
375                                 <td>operator_name</td>
376                                 <td>transaction_description</td>
377                             </tr>
378                         </tbody>
379                     </table>
380                     <b>Required fields:</b>
381                     <ul>
382                         <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</li>
383                         <li><b>to_plot_name:</b> Must exist in the database. Seeds were used for this plot. You can also record seedlot used for each plot during uploading existing trial on the Manage Trials page</li>
384                         <li>
385                             <b>amount:</b> Number of seeds being transaferred. Can be provided in conjunction with weight(g). Must provide a value for amount or weight(g) or both.
386                             <br/><b>AND/OR</b><br/>
387                             <b>weight(g):</b> Weight in grams of seedlot being transferred. Can be provided in conjunction with amount. Must provide a value for amount or weight(g) or both.
388                         </li>
389                         <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
390                     </ul>
391                     <b>Optional fields:</b>
392                     <ul>
393                         <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
394                     </ul>
395                 </div>
396             </div>
397             <div class="modal-footer">
398                 <button id="close_seedlots_to_plots_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
399             </div>
400         </div>
401     </div>
402 </div>
404 <div class="modal fade" id="seedlots_to_unspecified_names_info_dialog" name="seedlots_to_unspecified_names_info_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlotsToUnspecifiedNamesInfoDialog">
405     <div class="modal-dialog modal-xl" role="document">
406         <div class="modal-content">
407             <div class="modal-header" style="text-align: center">
408                 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
409                 <h4 class="modal-title" id="seedlotsToUnspecifiedNamesInfoDialog">Upload Template Information For Existing Seedlot to Unspecified Seedlots/Plots Transactions  </h4>
410             </div>
411             <div class="modal-body">
412                 <div class="container-fluid">
413                     <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
414                     <br />
415                     <b>Header:</b>
416                     <br>
417                     The first row (header) must contain the following:
418                     <br />
419                     <table class="table table-hover table-bordered table-condensed" >
420                         <thead></thead>
421                         <tbody>
422                             <tr>
423                                 <td>from_seedlot_name</td>
424                                 <td>amount</td>
425                                 <td>weight(g)</td>
426                                 <td>operator_name</td>
427                                 <td>transaction_description</td>
428                             </tr>
429                         </tbody>
430                     </table>
431                     <b>Required fields:</b>
432                     <ul>
433                         <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</li>
434                         <li>
435                             <b>amount:</b> Number of seeds being transaferred. Can be provided in conjunction with weight(g). Must provide a value for amount or weight(g) or both.
436                             <br/><b>AND/OR</b><br/>
437                             <b>weight(g):</b> Weight in grams of seedlot being transferred. Can be provided in conjunction with amount. Must provide a value for amount or weight(g) or both.
438                         </li>
439                         <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
440                         <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
441                     </ul>
442                 </div>
443             </div>
444             <div class="modal-footer">
445                 <button id="close_seedlots_to_unspecified_names_info_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
446             </div>
447         </div>
448     </div>
449 </div>
451 <style>
453 hr.solid { border-top: 1px solid #bbb; }
455 </style>
457 <script>
459 jQuery(document).ready(function(){
461     jQuery("[name='transactions_upload_link']").click(function() {
462         jQuery('#upload_transactions_dialog').modal("show");
463         get_select_box('breeding_programs', 'new_seedlot_breeding_program_div', { 'name' : 'new_seedlot_breeding_program_id', 'id' : 'new_seedlot_breeding_program_id' });
465     });
467     jQuery("#new_seedlot_location").autocomplete({
468        source: '/ajax/stock/geolocation_autocomplete',
469     });
471     jQuery("#transaction_type_option").change(function(){
472         if (jQuery(this).val() == ""){
473             jQuery("#seedlots_to_seedlots_section").hide();
474             jQuery("#seedlots_to_new_seedlots_section").hide();
475             jQuery("#seedlots_to_plots_section").hide();
476             jQuery("#seedlots_to_unspecified_names_section").hide();
477             jQuery("#submit_transactions_button_section").hide();
478         }
479         if (jQuery(this).val() == "seedlots_to_seedlots"){
480             jQuery("#seedlots_to_seedlots_section").show();
481             jQuery("#seedlots_to_new_seedlots_section").hide();
482             jQuery("#seedlots_to_plots_section").hide();
483             jQuery("#seedlots_to_unspecified_names_section").hide();
484             jQuery("#submit_transactions_button_section").show();
485         }
486         if(jQuery(this).val() == "seedlots_to_new_seedlots"){
487             jQuery("#seedlots_to_seedlots_section").hide();
488             jQuery("#seedlots_to_new_seedlots_section").show();
489             jQuery("#seedlots_to_plots_section").hide();
490             jQuery("#seedlots_to_unspecified_names_section").hide();
491             jQuery("#submit_transactions_button_section").show();
492         }
493         if (jQuery(this).val() == "seedlots_to_plots" ){
494             jQuery("#seedlots_to_seedlots_section").hide();
495             jQuery("#seedlots_to_new_seedlots_section").hide();
496             jQuery("#seedlots_to_plots_section").show();
497             jQuery("#seedlots_to_unspecified_names_section").hide();
498             jQuery("#submit_transactions_button_section").show();
499         }
500         if (jQuery(this).val() == "seedlots_to_unspecified_names" ){
501             jQuery("#seedlots_to_seedlots_section").hide();
502             jQuery("#seedlots_to_new_seedlots_section").hide();
503             jQuery("#seedlots_to_plots_section").hide();
504             jQuery("#seedlots_to_unspecified_names_section").show();
505             jQuery("#submit_transactions_button_section").show();
506         }
507     });
509     jQuery("#upload_transactions_submit").click(function() {
510         upload_transactions_file();
511     });
513     jQuery('#upload_transactions_form').iframePostForm({
514         json: true,
515         post: function() {
516             jQuery("#working_modal").modal("show");
517         },
518         complete: function(response) {
519             jQuery("#working_modal").modal("hide");
520             if (response.error_string) {
521                 jQuery("#upload_transactions_error_display tbody").html('');
522                 jQuery("#upload_transactions_error_display tbody").append(response.error_string);
523                 jQuery("#upload_transactions_error_display").modal("show");
525                 return;
526             }
527             if (response.error) {
528                 alert(response.error);
529                 return;
530             }
531             if (response.success) {
532                 Workflow.focus("#transactions_upload_workflow", -1); //Go to success page
533                 Workflow.check_complete("#transactions_upload_workflow");
534             }
535         }
536     });
538     jQuery("#seedlots_to_seedlots_format").click(function() {
539         jQuery("#seedlots_to_seedlots_info_dialog").modal("show");
540     });
542     jQuery("#seedlots_to_new_seedlots_format").click(function() {
543         jQuery("#seedlots_to_new_seedlots_info_dialog").modal("show");
544     });
546     jQuery("#seedlots_to_plots_format").click(function() {
547         jQuery("#seedlots_to_plots_info_dialog").modal("show");
548     });
550     jQuery("#seedlots_to_unspecified_names_format").click(function() {
551         jQuery("#seedlots_to_unspecified_names_info_dialog").modal("show");
552     });
555     jQuery("[name='upload_transactions_dismiss_button']").click(function() {
556         jQuery('#upload_transactions_dialog').modal('hide');
557         jQuery('#transaction_type_option').val('');
558         jQuery('#seedlots_to_seedlots_file').val('');
559         jQuery('#seedlots_to_plots_file').val('');
560         jQuery('#seedlots_to_new_seedlots_file').val('');
561         jQuery('#seedlots_to_unspecified_names_file').val('');
562         jQuery('#new_seedlot_location').val('');
563         jQuery('#new_seedlot_organization_name').val('');
564         location.reload();
565     });
569 function upload_transactions_file() {
571     var uploadSeedlotsToSeedlots = jQuery("#seedlots_to_seedlots_file").val();
572     if (uploadSeedlotsToSeedlots === ''){
573         var uploadSeedlotsToNewSeedlots = jQuery("#seedlots_to_new_seedlots_file").val();
574         if (uploadSeedlotsToNewSeedlots === ''){
575             var uploadSeedlotsToPlots = jQuery("#seedlots_to_plots_file").val();
576             if (uploadSeedlotsToPlots === ''){
577                 var uploadSeedlotsToUnspecified = jQuery("#seedlots_to_unspecified_names_file").val();
578                 if (uploadSeedlotsToUnspecified === '') {
579                     alert("Please select a file");
580                     return;
581                 }
582             }
583         }
584     }
586     if (uploadSeedlotsToNewSeedlots) {
587         var breeding_program = jQuery("#new_seedlot_breeding_program_id").val();
588         var location = jQuery("#new_seedlot_location").val();
589         if (breeding_program === '') {
590             alert("Please choose a breeding program for new seedlots");
591             return;
592         }
593         if (location === '') {
594             alert("Please give a location for new seedlots");
595             return;
596         }
597     }
599     jQuery('#upload_transactions_form').attr("action", "/ajax/breeders/upload_transactions");
601     jQuery("#upload_transactions_form").submit();
605 </script>