6 <div class="modal fade" id="upload_catalog_items_dialog" name="upload_catalog_items_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadCatalogItemsDialog">
7 <div class="modal-dialog modal-lg" role="document">
8 <div class="modal-content">
9 <div class="modal-header">
10 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
11 <h4 class="modal-title" id="uploadCatalogItemsDialog">Upload Catalog Items </h4>
13 <div class="modal-body">
14 <div class="container-fluid">
15 <&| /page/explanation.mas, title=>'Template Information' &>
17 <b>File Format Information</b>
19 <a id="upload_catalog_items_format">Spreadsheet Format</a>
23 <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_catalog_items_form" name="upload_catalog_items_form">
24 <div class="form-group">
25 <label class="col-sm-4 control-label">Upload File (.xls or .xlsx): </label>
26 <div class="col-sm-8">
27 <input type="file" name="catalog_items_upload_file" id="catalog_items_upload_file" encoding="multipart/form-data" />
33 <div class="modal-footer">
34 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
35 <button type="button" class="btn btn-primary" name="upload_catalog_items_submit" id="upload_catalog_items_submit">Upload File</button>
41 <div class="modal fade" id="upload_catalog_items_error_display" name="upload_catalog_items_error_display" tabindex="-1" role="dialog" aria-labelledby="uploadCatalogItemsErrorDialog">
42 <div class="modal-dialog modal-lg" role="document">
43 <div class="modal-content">
44 <div class="modal-header">
45 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
46 <h4 class="modal-title" id="uploadCatalogItemsErrorDialog">Upload Catalog Items File Error</h4>
48 <div class="modal-body">
49 <div class="container-fluid">
55 <div class="modal-footer">
56 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
62 <div class="modal fade" id="catalog_items_saved_dialog_message" name="catalog_items_saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="catalogItemsSavedDialog">
63 <div class="modal-dialog" role="document">
64 <div class="modal-content">
65 <div class="modal-header">
66 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
67 <h4 class="modal-title" id="catalogItemsSavedDialog">Success</h4>
69 <div class="modal-body">
70 <div class="container-fluid">
72 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
73 The catalog items were saved successfully.
77 <div class="modal-footer">
78 <button id="dismiss_catalog_items_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
84 <div class="modal fade" id="upload_catalog_items_format_dialog" name="upload_catalog_items_format_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadCatalogItemsFormatDialog">
85 <div class="modal-dialog modal-lg" role="document">
86 <div class="modal-content">
87 <div class="modal-header">
88 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
89 <h4 class="modal-title" id="uploadCatalogItemsFormatDialog">Template Information</h4>
91 <div class="modal-body">
92 <div class="container-fluid">
93 <b>Catalog Items may be uploaded in an Excel file (.xls or .xlsx)</b>
97 The first row (header) must contain the following:
99 <table class="table table-bordered table-hover">
104 <td>additional_info</td>
105 <td>material_source</td>
106 <td>breeding_program</td>
107 <td>contact_person_username</td>
111 <b>Required columns:</b>
113 <li><b>item_name:</b>Item name must be in the database, can be accession, seedlot, population or vector_construct stock type</li>
114 <li><b>category:</b>Must be one of the following (released variety, pathogen assay, control, transgenic line). This field can be customized, please contact us. </li>
115 <li><b>additional_info:</b> Required in the header, but value may be left blank.</li>
116 <li><b>material_source:</b> Required in the header, but value may be left blank.</li>
117 <li><b>breeding_program:</b>Breeding program must be in the database.</li>
118 <li><b>contact_person_username:</b>Please indicate contact person of each item. Contact person username must be in the database</li>
122 <div class="modal-footer">
123 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
132 jQuery(document).ready( function() {
134 jQuery("#upload_catalog_items_button").click(function(){
136 jQuery("#upload_catalog_items_format").click(function(){
137 jQuery("#upload_catalog_items_format_dialog").modal("show");
140 jQuery("#upload_catalog_items_dialog").modal("show");
144 jQuery("#upload_catalog_items_submit").click(function(){
145 var uploadFile = jQuery("#catalog_items_upload_file").val();
146 jQuery('#upload_catalog_items_form').attr("action", "/ajax/catalog/upload_items");
147 if (uploadFile === ''){
148 alert("Please select a file");
151 jQuery("#upload_catalog_items_form").submit();
152 jQuery("#upload_catalog_items_dialog").modal("hide");
155 jQuery("#upload_catalog_items_form").iframePostForm({
158 jQuery("#working_modal").modal("show");
160 complete: function(response){
161 jQuery("#working_modal").modal("hide");
162 if (response.error_string){
163 jQuery("#upload_catalog_items_error_display tbody").html('');
164 jQuery("#upload_catalog_items_error_display tbody").append(response.error_string);
165 jQuery("#upload_catalog_items_error_display").modal("show");
168 if (response.error) {
169 alert(response.error);
172 if (response.success) {
173 jQuery('#catalog_items_saved_dialog_message').modal("show");
178 jQuery("#dismiss_catalog_items_saved_dialog").click(function(){