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">×</span></button>
11 <h4 class="modal-title" id="uploadTransactionsDialog">Upload Transactions</h4>
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>
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>
27 <button id="next_step_intro_button" class="btn btn-primary" onclick="Workflow.complete(this);">Go to Next Step</button>
30 <&| /util/workflow.mas:step, title=> "Upload Seedlot Transactions" &>
31 <& /page/page_title.mas, title=>"Select a transaction type and upload your file" &>
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>
46 <div id="seedlots_to_seedlots_section" style="display:none">
50 <h4>You want to transfer seeds from existing seedlots to other existing seedlots</h4>
52 <div class="well well-sm">
54 <div class="col-sm-4">
55 <&| /page/explanation.mas, title=>'Template information' &>
57 <b>File format information</b>
59 <a id="seedlots_to_seedlots_format">Spreadsheet format</a>
63 <div class="col-sm-8">
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" />
79 <div id="seedlots_to_new_seedlots_section" style="display:none">
83 <h4>Please provide basic information about the <b>new seedlots</b> and upload your file</h4>
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>
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">
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">
103 <div class="well well-sm">
105 <div class="col-sm-4">
106 <&| /page/explanation.mas, title=>'Template information' &>
108 <b>File format information</b>
110 <a id="seedlots_to_new_seedlots_format">Spreadsheet format</a>
114 <div class="col-sm-8">
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" />
130 <div id="seedlots_to_plots_section" style="display:none">
134 <h4>You want to use seeds from existing seedlots for plots</h4>
136 <div class="well well-sm">
138 <div class="col-sm-4">
139 <&| /page/explanation.mas, title=>'Template information' &>
141 <b>File format information</b>
143 <a id="seedlots_to_plots_format">Spreadsheet format</a>
147 <div class="col-sm-8">
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" />
163 <div id="seedlots_to_unspecified_names_section" style="display:none">
167 <h4>You want to remove seeds from existing seedlots to unspefified seedlots/plots</h4>
169 <div class="well well-sm">
171 <div class="col-sm-4">
172 <&| /page/explanation.mas, title=>'Template information' &>
174 <b>File format information</b>
176 <a id="seedlots_to_unspecified_names_format">Spreadsheet format</a>
180 <div class="col-sm-8">
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" />
197 <div id="submit_transactions_button_section" style="display:none">
199 <button type="button" onclick="Workflow.complete(this, false);" class="btn btn-primary" name="upload_transactions_submit" id="upload_transactions_submit">Upload File</button>
203 <&| /util/workflow.mas:complete, title=> "Complete" &>
204 <& /page/page_title.mas, title=>"Finished! Your transactions are now in the database" &>
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
210 </&><!-- End of workflow -->
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>
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">×</span></button>
225 <h4 class="modal-title" id="uploadTransactionsErrorDialog">Upload Transactions File Error</h4>
227 <div class="modal-body">
228 <div class="container-fluid">
234 <div class="modal-footer">
235 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
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">×</span></button>
246 <h4 class="modal-title" id="seedlotsToseedlotsInfoDialog">Upload Template Information For Existing Seedlot to Existing Seedlot Transactions </h4>
248 <div class="modal-body">
249 <div class="container-fluid">
250 <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
254 The first row (header) must contain the following:
256 <table class="table table-hover table-bordered table-condensed" >
260 <td>from_seedlot_name</td>
261 <td>to_seedlot_name</td>
264 <td>operator_name</td>
265 <td>transaction_description</td>
269 <b>Required fields:</b>
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>
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.
278 <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
280 <b>Optional fields:</b>
282 <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
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>
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">×</span></button>
298 <h4 class="modal-title" id="seedlotsToNewSeedlotsInfoDialog">Upload Template Information For Existing Seedlot to New Seedlot Transactions </h4>
300 <div class="modal-body">
301 <div class="container-fluid">
302 <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
306 The first row (header) must contain the following:
308 <table class="table table-hover table-bordered table-condensed" >
312 <td>from_seedlot_name</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>
324 <b>Required fields:</b>
326 <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</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.
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>
336 <b>Optional fields:</b>
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>
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>
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">×</span></button>
356 <h4 class="modal-title" id="seedlotsToPlotsInfoDialog">Upload Template Information For Existing Seedlot to Plot Transactions </h4>
358 <div class="modal-body">
359 <div class="container-fluid">
360 <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
364 The first row (header) must contain the following:
367 <table class="table table-hover table-bordered table-condensed" >
371 <td>from_seedlot_name</td>
372 <td>to_plot_name</td>
375 <td>operator_name</td>
376 <td>transaction_description</td>
380 <b>Required fields:</b>
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>
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.
389 <li><b>operator_name:</b> Name of the person who oversaw the transaction process. Can be any name.</li>
391 <b>Optional fields:</b>
393 <li><b>transaction_description:</b> Information about why this transaction is processed.</li>
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>
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">×</span></button>
409 <h4 class="modal-title" id="seedlotsToUnspecifiedNamesInfoDialog">Upload Template Information For Existing Seedlot to Unspecified Seedlots/Plots Transactions </h4>
411 <div class="modal-body">
412 <div class="container-fluid">
413 <b>Transactions may be uploaded in an Excel file (.xls or .xlsx)</b>
417 The first row (header) must contain the following:
419 <table class="table table-hover table-bordered table-condensed" >
423 <td>from_seedlot_name</td>
426 <td>operator_name</td>
427 <td>transaction_description</td>
431 <b>Required fields:</b>
433 <li><b>from_seedlot_name:</b> Must exist in the database. Seeds were taken from this seedlot.</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.
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>
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>
453 hr.solid { border-top: 1px solid #bbb; }
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' });
467 jQuery("#new_seedlot_location").autocomplete({
468 source: '/ajax/stock/geolocation_autocomplete',
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();
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();
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();
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();
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();
509 jQuery("#upload_transactions_submit").click(function() {
510 upload_transactions_file();
513 jQuery('#upload_transactions_form').iframePostForm({
516 jQuery("#working_modal").modal("show");
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");
527 if (response.error) {
528 alert(response.error);
531 if (response.success) {
532 Workflow.focus("#transactions_upload_workflow", -1); //Go to success page
533 Workflow.check_complete("#transactions_upload_workflow");
538 jQuery("#seedlots_to_seedlots_format").click(function() {
539 jQuery("#seedlots_to_seedlots_info_dialog").modal("show");
542 jQuery("#seedlots_to_new_seedlots_format").click(function() {
543 jQuery("#seedlots_to_new_seedlots_info_dialog").modal("show");
546 jQuery("#seedlots_to_plots_format").click(function() {
547 jQuery("#seedlots_to_plots_info_dialog").modal("show");
550 jQuery("#seedlots_to_unspecified_names_format").click(function() {
551 jQuery("#seedlots_to_unspecified_names_info_dialog").modal("show");
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('');
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");
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");
593 if (location === '') {
594 alert("Please give a location for new seedlots");
599 jQuery('#upload_transactions_form').attr("action", "/ajax/breeders/upload_transactions");
601 jQuery("#upload_transactions_form").submit();