4 $trial_stock_type => undef
7 <& /page/page_title.mas, title=>"Manage Phenotyping for $trial_name" &>
8 <& /breeders_toolbox/trial/download_phenotypes_dialog.mas, trial_ids => $trial_id &>
10 <div class="well well-sm">
12 <div class="col-md-1 col-lg-1">
14 <div class="col-md-10 col-lg-10">
16 <form class="form-horizontal" role="form" action="/barcode/direct_trial_phenotyping">
17 <div class="form-group form-group-sm">
18 <label class="col-sm-4 control-label">Plot Name: </label>
19 <div class="col-sm-8" id="plot_name_1">
23 <div class="form-group form-group-sm">
24 <label id = "manage_phenotyping_stock_type" class="col-sm-4 control-label"></label>
25 <div class="col-sm-8" id="accession_name">
29 <div class="form-group form-group-sm">
30 <label class="col-sm-4 control-label">Plot No: </label>
31 <div class="col-sm-8" id="plot_no">
35 <div class="form-group form-group-sm">
36 <label class="col-sm-4 control-label">Block No: </label>
37 <div class="col-sm-8" id="block_no">
41 <div class="form-group form-group-sm">
42 <label class="col-sm-4 control-label">Rep No: </label>
43 <div class="col-sm-8" id="rep_no">
49 <div class="col-md-1 col-lg-1">
55 <div class="well well-sm">
57 <div class="col-md-1 col-lg-1">
59 <div class="col-md-10 col-lg-10">
61 <div class="form-group form-group-sm" id="all_traits">
62 <label class="col-sm-4 control-label" for="select_traits_for_trait_file">Select trait: </label>
63 <div class="col-sm-8">
64 <select class="form-control" id="select_traits_for_trait_file"></select>
68 <div class="form-group form-group-sm">
69 <label class="col-sm-4 control-label">Or Use Trait List: </label>
70 <div class="col-sm-8">
71 <input type="checkbox" id="use_trait_list" value="use_trait_list"/>
77 <div id="show_trait_textbox" style="display: none">
78 <div class="form-group form-group-sm" >
79 <label class="col-sm-4 control-label">Enter a List of Trait Names: </label>
80 <div class="col-sm-8" id="show_trait_selectbox">
87 <div id="show_trait_list_box" style="display: none">
88 <div class="form-group form-group-sm">
89 <label class="col-sm-4 control-label">Or Paste From a List: </label>
90 <div class="col-sm-8">
91 <div id="list_menu_traits"></div>
92 <script defer="defer">
93 jQuery(document).ready(function() {
94 pasteTraitListMenu('show_trait_selectbox', 'list_menu_traits', 'Paste Trait List');
96 function pasteTraitListMenu (div_name, menu_div, button_name) {
97 var list = new CXGN.List();
99 html = list.listSelect(div_name, ['traits'], undefined, undefined, undefined);
100 html = html + '<button class="btn btn-info btn-sm" type="button" id="paste_button_id" value="'+button_name+'" onclick="javascript:pasteTraitList(\''+div_name+'\')" >'+button_name+'</button>';
101 jQuery('#'+menu_div).html(html);
110 <div class="form-group form-group-sm" id = "new_pheno_input" style="display: none">
111 <label class="col-sm-4 control-label">Enter trait value: </label>
112 <div class="col-sm-3">
113 <input type="number" class="form-control" id="select_pheno_value" name="select_pheno_value"></input>
115 <div class="col-sm-5">
116 <div id="loading-trial-phenotype" style="display: none"></div>
117 <div id="success-trial-phenotype" style="display: none">
118 <span class="glyphicon glyphicon-ok" style="color: #A9AE00; font-size: 150%"></span>
120 <div id="error-trial-phenotype" style="display: none">
121 <span class="glyphicon glyphicon-remove-sign" style="color: #AE1000; font-size: 150%"></span>
125 <div class="form-group form-group-sm" id = "stored_pheno_input" style="display: none">
126 <label class="col-sm-4 control-label">Stored trait value: </label>
127 <div class="col-sm-3">
128 <input class="form-control" name="stored_pheno_value" id="stored_pheno_value" disabled ></input>
132 <div class="col-md-1 col-lg-1">
138 <!--<div id="main" class="container">
139 <div id="virtualKeyboard"></div>
142 <&| /page/info_section.mas, id=> "trial_detail_traits_assayed", title => "Traits assayed", collapsible=>1, collapsed=>1, hide_if_empty=>1, subtitle=>"[<a id='trial_download_phenotypes_button'>Download Trial Data</a>]" &>
144 <& /breeders_toolbox/trial/phenotype_summary.mas, trial_id => $trial_id, trial_stock_type => $trial_stock_type &>
151 var trial_info_object = [];
153 jQuery(document).ready(function($) {
155 var trial_id = <% $trial_id %>;
159 url: '/ajax/breeders/trial_phenotyping_info',
162 'trial_id' : trial_id,
165 success: function(response) {
166 trial_info_object = response.trial_info;
168 alert("Error Retrieving Trial Information: "+response.error);
171 var trial_plot_name_html = "<select class='form-control' id='plot_name' >";
172 var trial_accession_html = "<select class='form-control' id='trial_accession_table' disabled>";
173 var trial_plot_number_html = "<select class='form-control' id='trial_plot_number_table'>";
174 var trial_block_number_html = "<select class='form-control' id='trial_block_number_table' disabled>";
175 var trial_rep_number_html = "<select class='form-control' id='trial_rep_number_table' disabled>";
177 for (n=0; n<response.trial_info.length; n++){
178 //console.log(response.trial_info[n]);
180 trial_plot_name_html = trial_plot_name_html + "<option value=" + response.trial_info[n].plot_name + ">" + response.trial_info[n].plot_name + "</option>";
181 trial_accession_html = trial_accession_html + "<option value=" + response.trial_info[n].accession_name + ">" + response.trial_info[n].accession_name + "</option>";
182 trial_plot_number_html = trial_plot_number_html + "<option value=" + response.trial_info[n].plot_number + ">" + response.trial_info[n].plot_number + "</option>";
183 trial_block_number_html = trial_block_number_html + "<option value=" + response.trial_info[n].block_number + ">" + response.trial_info[n].block_number + "</option>";
184 trial_rep_number_html = trial_rep_number_html + "<option value=" + response.trial_info[n].rep_number + ">" + response.trial_info[n].rep_number + "</option>";
187 trial_plot_name_html = trial_plot_name_html + "</select>";
188 jQuery('#plot_name_1').empty();
189 jQuery('#plot_name_1').html(trial_plot_name_html);
191 trial_accession_html = trial_accession_html + "</select>";
192 jQuery('#accession_name').empty();
193 jQuery('#accession_name').html(trial_accession_html);
195 trial_plot_number_html = trial_plot_number_html + "</select>";
196 jQuery('#plot_no').empty();
197 jQuery('#plot_no').html(trial_plot_number_html);
199 trial_block_number_html = trial_block_number_html + "</select>";
200 jQuery('#block_no').empty();
201 jQuery('#block_no').html(trial_block_number_html);
203 trial_rep_number_html = trial_rep_number_html + "</select>";
204 jQuery('#rep_no').empty();
205 jQuery('#rep_no').html(trial_rep_number_html);
209 alert('An error occurred retrieving trial information');
214 var null_trait_value = '';
216 $("#use_trait_list").click(function () {
217 if ($('#use_trait_list').is(':checked')) {
218 $('#all_traits').hide();
219 jQuery('#select_traits_for_trait_file').empty();
220 $('#show_trait_textbox').show();
221 $('#show_trait_list_box').show();
222 jQuery("#select_pheno_value").val(null_trait_value);
225 $('#all_traits').show();
226 $('#show_trait_textbox').hide();
227 $('#show_trait_list_box').hide();
228 jQuery('#select_traits_for_trait_file_2').empty();
229 jQuery("#select_pheno_value").val(null_trait_value);
230 jQuery('#select_pheno_value').empty();
231 get_select_box('traits', 'select_traits_for_trait_file', {
232 'name': 'html_select_traits_for_trait_file',
233 'id': 'html_select_traits_for_trait_file',
239 get_select_box('traits', 'select_traits_for_trait_file', {
240 'name': 'html_select_traits_for_trait_file',
241 'id': 'html_select_traits_for_trait_file',
247 var trait_list_option_focusin;
248 jQuery( "#select_pheno_value" ).focusin(function() {
249 jQuery("#success-trial-phenotype").hide();
250 jQuery("#error-trial-phenotype").hide();
251 jQuery("#loading-trial-phenotype").hide();
252 plot_focusin = jQuery("#plot_name").val();
253 trait_focusin = jQuery("#select_traits_for_trait_file").val();
254 //var trait_list_option = '';
255 if (jQuery('#use_trait_list').is(':checked')) {
256 //trait_list_option = jQuery('#use_trait_list').val();
257 trait_list_option_focusin = jQuery('#use_trait_list').val();
259 if (trait_focusin === null){
260 trait_focusin = jQuery("#select_traits_for_trait_file_2").val();
262 console.log(plot_focusin +" and "+trait_focusin);
265 jQuery( "#select_pheno_value" ).focusout(function() {
266 //jQuery('input[name=select_pheno_value]').change(function() {
267 var trait_value = jQuery("#select_pheno_value").val();
268 var plot_name = plot_focusin;
269 var trait = trait_focusin;
270 var trait_list_option = trait_list_option_focusin;
272 jQuery("#success-trial-phenotype").hide();
273 jQuery("#error-trial-phenotype").hide();
274 jQuery("#loading-trial-phenotype").show();
277 url : '/ajax/phenotype/plot_phenotype_upload',
280 'plot_name' : plot_name,
282 'trait_value' : trait_value,
283 'trait_list_option' : trait_list_option,
284 'trial_id' : trial_id
287 success: function (response) {
288 jQuery("#loading-trial-phenotype").hide();
290 alert("Error Saving Trait Value: "+response.error);
291 jQuery("#error-trial-phenotype").show();
294 jQuery("#success-trial-phenotype").show();
298 alert('An error occurred saving trait value');
299 jQuery("#loading-trial-phenotype").hide();
300 jQuery("#error-trial-phenotype").show();
307 function Retrieve_pheno(){
308 var plot_name = jQuery("#plot_name").val();
310 trait = jQuery("#select_traits_for_trait_file").val();
312 trait = jQuery("#select_traits_for_trait_file_2").val();
315 var trait_list_option = '';
316 if ($('#use_trait_list').is(':checked')) {
317 trait_list_option = jQuery('#use_trait_list').val();
322 url : '/ajax/phenotype/plot_phenotype_retrieve',
325 'plot_name' : plot_name,
327 'trait_list_option' : trait_list_option,
329 success: function (response) {
330 var value = response.trait_value;
331 var red = {'color': 'red'};
333 alert("Error Retrieving Trait Value: "+response.error);
335 jQuery('#new_pheno_input').hide();
336 jQuery("#stored_pheno_value").css(red);
337 jQuery('#stored_pheno_input').show();
338 jQuery("#stored_pheno_value").val(value);
339 } else if ((trait || trait_list_option) && !value) {
340 jQuery('#stored_pheno_input').hide();
341 jQuery("#select_pheno_value").val(null_trait_value);
342 jQuery('#select_pheno_value').empty();
343 jQuery('#new_pheno_input').show();
347 alert('An error occurred retrieving trait value');
352 jQuery(document).on('change', '#select_traits_for_trait_file_2', function(){
353 jQuery("#select_traits_for_trait_file").empty();
357 jQuery("#select_traits_for_trait_file").on('change', function() {
358 jQuery("#select_traits_for_trait_file_2").empty();
362 jQuery(document).on('change', '#plot_name', function(){
363 var plot_infor = jQuery('#plot_name').val();
364 for (i=0; i<trial_info_object.length; i++){
365 if (trial_info_object[i].plot_name == plot_infor){
366 var plotNo = trial_info_object[i].plot_number;
367 var accessionName = trial_info_object[i].accession_name;
368 var blockNo = trial_info_object[i].block_number;
369 var repNo = trial_info_object[i].rep_number;
371 jQuery('#trial_accession_table').val(accessionName);
372 jQuery('#trial_plot_number_table').val(plotNo);
373 jQuery('#trial_block_number_table').val(blockNo);
374 jQuery('#trial_rep_number_table').val(repNo);
381 jQuery(document).on('change', '#trial_plot_number_table', function(){
382 var plot_infor = jQuery('#trial_plot_number_table').val();
383 for (i=0; i<trial_info_object.length; i++){
384 if (trial_info_object[i].plot_number == plot_infor){
385 var accessionName = trial_info_object[i].accession_name;
386 var plotName = trial_info_object[i].plot_name;
387 var blockNo = trial_info_object[i].block_number;
388 var repNo = trial_info_object[i].rep_number;
390 jQuery('#plot_name').val(plotName);
391 jQuery('#trial_accession_table').val(accessionName);
392 jQuery('#trial_block_number_table').val(blockNo);
393 jQuery('#trial_rep_number_table').val(repNo);
400 var trial_stock_type = "<% $trial_stock_type %>";
401 var manage_phenotyping_label = '';
403 if (trial_stock_type == 'family_name') {
404 manage_phenotyping_label = 'Family Name :';
405 } else if (trial_stock_type == 'cross') {
406 manage_phenotyping_label = 'Cross Unique ID :';
408 manage_phenotyping_label = 'Accession Name :';
411 jQuery('#manage_phenotyping_stock_type').text(manage_phenotyping_label);
417 #loading-trial-phenotype {
420 #loading-trial-phenotype,
421 #loading-trial-phenotype:after {
422 box-sizing: border-box;
424 #loading-trial-phenotype {
425 display: inline-block;
429 #loading-trial-phenotype:after {
436 border: 3.2px solid currentColor;
437 border-color: currentColor transparent currentColor transparent;
438 animation: loading-trial-phenotype 1.2s linear infinite;
440 @keyframes loading-trial-phenotype {
442 transform: rotate(0deg);
445 transform: rotate(360deg);