5 $locations_by_program_json
9 <div class="modal fade" id="upload_cross_seedlot_dialog" name="upload_cross_seedlot_dialog" tabindex="-1" role="dialog" aria-labelledby="seedlot_upload_dialog">
10 <div class="modal-dialog modal-xl" role="document">
11 <div class="modal-content">
12 <div class="modal-header">
13 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
14 <h4 class="modal-title" id="seedlot_upload_dialog">Upload Seedlots</h4>
16 <div class="modal-body">
17 <div class="container-fluid">
18 <&| /util/workflow.mas, id=> "upload_seedlot_main_workflow" &>
19 <&| /util/workflow.mas:step, title=> "Intro" &>
20 <& /page/page_title.mas, title=>"What are seedlots?" &>
22 <li>A seedlot is a collection of seeds harvested from a cross, accession, plot or plant.</li>
23 <li>Seedlots can have a specific location, box, weight(g), and count.</li>
24 <li>Seedlots can belong to breeding programs and organizations.</li>
28 <button class="btn btn-primary" onclick="Workflow.complete(this);">Go to Next Step</button>
31 <&| /util/workflow.mas:step, title=> "File format" &>
32 <& /page/page_title.mas, title=>"Make sure your file matches the correct file format" &>
35 <div id="upload_crosses_seedlots_template_section" style="display:none">
36 <button class="btn btn-info" id ="guided_help_crosses_seedlots_upload_format_button" name ="guided_help_crosses_seedlots_upload_format_button">Information about file format for uploading seed lots harvested</button><br/><br/>
38 <button class="btn btn-primary" onclick="Workflow.complete(this);">Once you think your file matches, go to Next Step</button>
41 <&| /util/workflow.mas:step, title=> "Upload seedlots" &>
42 <& /page/page_title.mas, title=>"Provide basic information about the seedlots and upload your file" &>
43 <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_cross_seedlot_form" name="upload_cross_seedlot_form">
44 <div class="form-group">
45 <label class="col-sm-3 control-label">Breeding Program: </label>
46 <div class="col-sm-9" >
47 <input class="form-control" name="upload_seedlot_breeding_program_name" id="upload_seedlot_breeding_program_name" disabled value="<% $breeding_program_name %>">
48 <input name="upload_seedlot_breeding_program_id" id="upload_seedlot_breeding_program_id" type="hidden" value="<% $breeding_program_id %>">
51 <div class="form-group">
52 <label class="col-sm-3 control-label">Location of seedlot storage: </label>
53 <div class="col-sm-9" >
54 <select class="form-control" name="upload_seedlot_location" id="upload_seedlot_location"></select>
57 <div class="form-group">
58 <label class="col-sm-3 control-label">Organization Name: </label>
59 <div class="col-sm-9" >
60 <input class="form-control" name="upload_seedlot_organization_name" id="upload_seedlot_organization_name" placeholder="Optional">
63 <div id="upload_seedlots_harvested_section" style="display:none">
64 <div class="form-group">
65 <label class="col-sm-3 control-label">Upload File (.xls or .xlsx): </label>
66 <div class="col-sm-9" >
67 <input type="file" name="seedlot_harvested_uploaded_file" id="seedlot_harvested_uploaded_file" encoding="multipart/form-data" />
71 <div id="upload_seedlot_breeding_program_id" style="visibility:hidden">
72 <% $breeding_program_id %>
76 <button type="button" class="btn btn-lg btn-primary" onclick="Workflow.complete(this, false);" id ="upload_cross_seedlot_button" name="upload_cross_seedlot_button" >Upload Seedlots</button><br/><br/>
79 <&| /util/workflow.mas:complete, title=> "Complete" &>
80 <& /page/page_title.mas, title=>"Finished! Your seedlots are now in the database" &>
82 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
83 The seedlot file was uploaded successfully
86 <li>You may want to proceed to the seedlot detail page(s) for the seedlot(s) you just created.</li>
87 <li>You can print barcodes for the seedlots.</li>
91 <button class="btn btn-primary" name="upload_seedlot_success_complete_button">The seedlots were saved to the database with no errors! Congrats Click Here</button><br/><br/>
97 <div class="modal-footer">
98 <button id="close_seedlot_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
104 <div class="modal fade" id="crosses_seedlots_upload_spreadsheet_info_dialog" name="crosses_seedlots_upload_spreadsheet_info_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadSeedlotHarvestedInfoDialog">
105 <div class="modal-dialog modal-xl" role="document">
106 <div class="modal-content">
107 <div class="modal-header" style="text-align: center">
108 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
109 <h4 class="modal-title" id="uploadSeedlotHarvestedInfoDialog">Upload Template Information For Seedlots From Crosses</h4>
111 <div class="modal-body">
112 <div class="container-fluid">
113 <b>Seedlots may be uploaded in an Excel file (.xls or .xlsx)</b>
117 The first row (header) must contain the following:
120 <table class="table table-hover table-bordered table-condensed" >
124 <td>seedlot_name</td>
125 <td>cross_unique_id</td>
126 <td>operator_name</td>
134 <b>Required fields:</b>
136 <li>seedlot_name (must be unique)</li>
137 <li>cross_unique_id (must exist in the database. a cross_unique_id can represent a cross between accessions e.g. AxB, but a cross can also represent a cross between specific plots in the field if you have this information)</li>
138 <li>operator_name (the name of the person who oversaw the inventory process. can be any name.)</li>
139 <li>amount (number of seeds in seedlot. can be provided in conjunction with weight(g). must provide a value for amount or weight(g) or both.)
140 <br/><b>AND/OR</b><br/>
141 weight(g) (weight in grams of seedlot. can be provided in conjunction with amount. must provide a value for amount or weight(g) or both.)
143 <li>box_name (the box name that the seed is located in. can be any name.)</li>
146 <b>Optional fields:</b>
148 <li>description (additional information about each seedlot)</li>
152 <div class="modal-footer">
153 <button id="close_seedlot_harvested_info_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
159 <div class="modal fade" id="upload_cross_seedlot_error_display" name="upload_cross_seedlot_error_display" tabindex="-1" role="dialog" aria-labelledby="uploadCrossSeedlotErrorDialog">
160 <div class="modal-dialog modal-lg" role="document">
161 <div class="modal-content">
162 <div class="modal-header">
163 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
164 <h4 class="modal-title" id="uploadCrossSeedlotErrorDialog">Upload Seedlot File Error</h4>
166 <div class="modal-body">
167 <div class="container-fluid">
173 <div class="modal-footer">
174 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
182 jQuery(document).ready(function(){
184 var locations_by_program_json = <% $locations_by_program_json %>;
185 var locations_string = locations_by_program_json.toString();
186 var locations_array = locations_string.split(",");
188 jQuery('#upload_seedlots_from_crosses').click( function() {
189 jQuery('#upload_cross_seedlot_dialog').modal('show');
191 var html = '<select id = "upload_seedlot_location" >';
192 for (var i=0; i<locations_array.length; i++) {
193 html = html + '<option value='+locations_array[i]+'>'+locations_array[i]+'</option>';
195 html = html + "</select>";
197 jQuery('#upload_seedlot_location').html(html);
201 jQuery('#upload_crosses_seedlots_template_section').show();
203 jQuery('#upload_seedlots_harvested_section').show();
205 jQuery('#guided_help_crosses_seedlots_upload_format_button').click( function () {
206 jQuery('#crosses_seedlots_upload_spreadsheet_info_dialog').modal("show");
209 jQuery('#upload_cross_seedlot_button').click(function () {
210 upload_crosses_seedlots();
213 function upload_crosses_seedlots() {
214 var uploadSeedlotsHarvestedFile = jQuery("#seedlot_harvested_uploaded_file").val();
215 var location = jQuery("#upload_seedlot_location").val();
216 var breeding_program = jQuery("#upload_seedlot_breeding_program_id").val();
217 jQuery('#upload_cross_seedlot_form').attr("action", "/ajax/breeders/seedlot-upload");
218 if (breeding_program === '') {
219 alert("Please choose a breeding program");
222 if (location === '') {
223 alert("Please give a location");
226 if (uploadSeedlotsHarvestedFile == '') {
227 alert("Please select a file");
230 jQuery("#upload_cross_seedlot_form").submit();
233 jQuery('#upload_cross_seedlot_form').iframePostForm({
236 var uploadSeedlotsHarvestedFile = jQuery("#seedlot_harvested_uploaded_file").val();
237 jQuery('#working_modal').modal("show");
238 if (uploadSeedlotsHarvestedFile == '') {
239 jQuery('#working_modal').modal("hide");
240 alert("No file selected");
243 complete: function(response) {
244 jQuery("#working_modal").modal("hide");
245 if (response.error_string) {
246 jQuery('#upload_cross_seedlot_error_display').modal("show");
247 jQuery('#upload_cross_seedlot_error_display tbody').html('');
248 jQuery('#upload_cross_seedlot_error_display tbody').append(response.error_string);
251 if (response.error) {
252 alert(response.error);
255 if (response.success) {
256 Workflow.focus("#upload_seedlot_main_workflow", -1); //Go to success page
257 Workflow.check_complete("#upload_seedlot_main_workflow");
263 jQuery(document).on('click', '[name="upload_seedlot_success_complete_button"]', function(){
264 alert('Seedlots were saved in the database');
265 jQuery('#upload_seedlot_dialog').modal('hide');