9 <div class="modal fade" id="generate_tracking_identifiers_dialog" name="generate_tracking_identifiers_dialog" tabindex="-1" role="dialog" aria-labelledby="generateTrackingIdentifiersDialog">
10 <div class="modal-dialog modal-xl" role="document">
11 <div class="modal-content ui-front">
12 <div class="modal-header">
13 <button type="reset" class="close" id="generate_tracking_identifiers_dismiss_button_1" name="generate_tracking_identifiers_dismiss_button" aria-label="Close"><span aria-hidden="true">×</span></button>
14 <center><h4 class="modal-title" id="addTransactions">Generate Tracking Identifiers</h4></center>
16 <div class="modal-body">
17 <div class="container-fluid">
19 <&| /util/workflow.mas, id=> "add_transactions_workflow" &>
20 <&| /util/workflow.mas:step, title=> "Intro" &>
21 <& /page/page_title.mas, title=>"Tracking Identifiers" &>
22 <p>Tracking identifier is a globally unique name assigned to each material for capturing tracking information. By providing a list of materials, tracking identifier for each item is auto-generated by combining project name, item name and an incrementing number suffix. All items in a list must be the same stock type.</p>
25 <button id="next_step_add_new_intro" class="btn btn-primary" onclick="Workflow.complete(this);">Go to Next Step</button>
29 <form class="form-horizontal" role="form" name="generate_tracking_identifiers_form" id="generate_tracking_identifiers_form">
30 <&| /util/workflow.mas:step, title=> "Generate Tracking Identifiers" &>
31 <& /page/page_title.mas, title=>"" &>
33 <div class="form-horizontal">
34 <div class="form-group">
35 <label class="col-sm-4 control-label">Material Type: </label>
36 <div class="col-sm-8">
37 <div class="input-group">
38 <select class="form-control" id="material_type">
39 <option value="">Please select a material type </option>
40 <option value="accessions">accession</option>
41 <option value="seedlots">seedlot</option>
46 <div class="form-group" id="get_list_of_items" style="display: none">
47 <label class="control-label col-sm-4">List of Items:</label>
48 <div class="col-sm-8" >
49 <div class="input-group">
50 <select class="form-control" id="item_list_select"></select>
56 <div id="form_footer" >
58 <button type="button" class="btn btn-primary" onclick="Workflow.complete(this, false);" name="generate_tracking_identifiers_submit" id="generate_tracking_identifiers_submit">Submit</button>
64 <&| /util/workflow.mas:complete, title=> "Complete" &>
65 <& /page/page_title.mas, title=>"Finished! Tracking Identifiers were stored" &>
67 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
68 New tracking identifiers were generated successfully
72 </&><!-- End of workflow -->
75 <div class="modal-footer">
76 <button id="generate_tracking_identifiers_dismiss_button_2" name="generate_tracking_identifiers_dismiss_button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
82 <div class="modal fade" id="generate_tracking_identifiers_saved_dialog_message" name="generate_tracking_identifiers_saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="generateTrackingIdentifiersSavedDialog">
83 <div class="modal-dialog" role="document">
84 <div class="modal-content">
85 <div class="modal-header">
86 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
87 <h4 class="modal-title" id="generateTrackingIdentifiersSavedDialog">Success</h4>
89 <div class="modal-body">
90 <div class="container-fluid">
92 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
93 The tracking identifier for you materials were generated successfully.
97 <div class="modal-footer">
98 <button id="dismiss_generate_tracking_identifiers_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
104 <div class="modal fade" id="tracking_identifiers_saved_dialog_message" name="tracking_identifiers_saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="trackingIdentifiersSavedDialog">
105 <div class="modal-dialog" role="document">
106 <div class="modal-content">
107 <div class="modal-header">
108 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
109 <h4 class="modal-title" id="trackingIdentifiersSavedDialog">Success</h4>
111 <div class="modal-body">
112 <div class="container-fluid">
114 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
115 New tracking identifiers were saved.
119 <div class="modal-footer">
120 <button id="dismiss_tracking_identifiers_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
128 jQuery(document).ready(function(){
130 var lo = new CXGN.List();
131 var project_name = "<%$trial_name%>";
132 var program_name = "<%$breeding_program_name%>";
134 jQuery("#generate_identifiers_link").click(function(){
135 jQuery("#generate_tracking_identifiers_dialog").modal("show");
138 jQuery("#material_type").change(function() {
139 var selected_material_type = jQuery('#material_type').val();
140 jQuery('#item_list_select').html(lo.listSelect('item_list_select', [selected_material_type], 'Select a list of materials', undefined, undefined));
141 jQuery("#get_list_of_items").modal("show");
144 jQuery("#generate_tracking_identifiers_submit").click(function(){
145 var selected_material_type = jQuery('#material_type').val();
146 var item_list_id = jQuery('#item_list_select').val();
148 if (!selected_material_type) {
149 alert("Material type is required");
154 alert("Please select a list");
158 var item_validation = 1;
159 item_validation = lo.legacy_validate(item_list_id, selected_material_type, true);
160 if (item_validation != 1) {
161 alert("This list did not pass validation. Names in the list must exist in the database and are the selected material type.");
166 url: '/ajax/tracking_activity/generate_tracking_identifiers',
170 'list_id' : item_list_id,
171 'project_name': project_name,
172 'program_name': program_name,
174 beforeSend: function(response){
175 jQuery('#working_modal').modal('show');
177 success: function(response) {
178 jQuery('#working_modal').modal('hide');
179 if (response.success == 1) {
180 jQuery("#generate_tracking_identifiers_dialog").modal("hide");
181 jQuery("#tracking_identifiers_saved_dialog_message").modal("show");
183 if (response.error) {
184 alert(response.error);
187 error: function(response){
188 jQuery('#working_modal').modal('hide');
189 alert('An error occurred generating identifiers');
195 jQuery("#dismiss_tracking_identifiers_saved_dialog").click(function(){
196 jQuery("#tracking_identifiers_saved_dialog_message").modal("hide");
197 jQuery('#material_type').val('');
198 jQuery('#item_list_select').val('');
202 jQuery("[name = 'generate_tracking_identifiers_dismiss_button']").click(function() {
203 jQuery("#generate_tracking_identifiers_dialog").modal("hide");
204 jQuery("#material_type").val('');
205 jQuery('#item_list_select').val('');