has subplot entries layout download
[sgn.git] / mason / breeders_toolbox / trial.mas
blob70afbd85f7aa52f9d34659c3986b0052b902008c
2 <%doc>
4 =head1 NAME
6 /breeders_toolbox/trial.mas - a mason component to display a trial detail page
8 =head1 AUTHOR
10 Jeremy D. Edwards
12 =cut
14 </%doc>
16 <%args>
17 $trial_id
18 $trial_name
19 $breeding_program_id
20 $breeding_program_name
21 $location_id
22 $location_name
23 $year => undef
24 $trial_type => undef
25 $planting_date => undef
26 $harvest_date => undef
27 $trial_description => undef
28 $user_can_modify => undef
29 $has_plant_entries => undef
30 $has_subplot_entries => undef
31 $hidap_enabled => undef
32 $folder_name => undef
33 $folder_id => undef
34 $plants_per_plot => undef
35 $has_expression_atlas => undef
36 $expression_atlas_url => undef
37 $site_project_name => undef
38 $trial_phenotype_files => undef
39 $sgn_session_id => undef
40 $user_name => undef
41 $design_name => undef
42 $phenotypes_fully_uploaded => undef
43 $identifier_prefix => 'SGN'
44 </%args>
46 <style>
48 @media (min-width: 1200px) {
49     .affix {
50         top:100px;
51         right:0;
52         position:fixed;
53     }
56 </style>
58 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'CXGN.Trial' , 'jstree/dist/jstree', 'CXGN.BreedersToolbox.HTMLSelect', 'moment_min', 'daterangepicker' ] &>
60 <%perl>
61   use Data::Dumper;
62 my $start_time = time();
64 #print STDERR "Check 7 (mason) : ".(time() - $start_time)."\n";
66 </%perl>
68 <br/>
71 <& /page/page_title.mas, title=>"Trial detail for ".$trial_name &>
73 <&| /page/info_section.mas, title=>"Trial details",  collapsible => 1, subtitle => '[<a id="edit_trial_details">Edit Trial Details</a>]'&>
76 <div class="panel panel-default">
77 <table class="table table-hover" >
79 <tr>
80 <td><b>Trial Name</b></td>
81 <td>
82 <div id="trial_name">
83 % if ($trial_name) {
84 %   print "$trial_name";
85 % } else {
86 %   print "[No Trial Name]";
87 % }
88 </div>
89 </td>
90 </tr>
92 <tr>
93 <td><b>Breeding Program </b></td>
94 <td>
95 <span id="breeding_program">
96 % if ($breeding_program_name) {
97 %  print "$breeding_program_name";
98 % }
99 % else {
100 %  print "No Breeding Program";
101 % }
102 </span>
103 </td>
104 </tr>
106 <tr>
107 <td><b>Trial Location</b></td>
108 <td>
109 <div id="trial_location">
110 % if ($location_name) {
111 %  print "$location_name";
112 % } else {
113 %  print "[No Location]";
114 % }
115 </div>
116 </td>
117 </tr>
119 <tr>
120 <td><b>Year</b></td>
121 <td>
122 <div id="trial_year">
123 % if ($year) {
124 %  print "$year";
125 % } else {
126 %  print "[No Year]";
127 % }
128 </div>
129 </td>
130 </tr>
132 <tr>
133 <td><b>Trial Type</b></td>
134 <td>
135 <div id="trial_type">
136 % if ($trial_type) {
137 %  print "$trial_type";
138 % } else {
139 % print "[Type not set]";
140 % }
141 </div>
142 </td>
143 </tr>
145 <tr>
146 <td><b>Planting Date</b></td>
147 <td>
148 <div id="planting_date">
149 % if ($planting_date) {
150   <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $planting_date %>" ><% $planting_date %></a>
151 % } else {
152 %  print "[No Planting Date]";
153 % }
154 </div>
155 </td>
156 </tr>
158 <tr>
159 <td><b>Harvest Date</b></td>
160 <td>
161 <div id="harvest_date">
162 % if ($harvest_date) {
163   <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $harvest_date %>" ><% $harvest_date %></a>
164 % } else {
165 %  print "[No Harvest Date]";
166 % }
167 </div>
168 </td>
169 </tr>
171 <tr><td><b>Description</b></td>
172 <td>
173 <div id="trial_description">
174 % if ($trial_description) {
175 %  print "$trial_description";
176 % } else {
177 %  print "[No Description]";
178 % }
179 </div>
180 </td>
181 </tr>
182 </table>
183 </div>
185 % my $folder_collapsed = 1;
186 % if ($folder_id) {
187 % $folder_collapsed = 0;
188 % }
190 <div class="well well-sm">
192 <&| /page/info_section.mas, title=>"Folder", collaspible=>1, collapsed=>$folder_collapsed,
193   subtitle => '[<a id="new_folder_dialog_link">New Folder</a>] | [<a id="open_folder_dialog_link">Change</a>]' &>
195   <& /breeders_toolbox/folder/folder_set.mas, breeding_program_id => $breeding_program_id, breeding_program_name =>$breeding_program_name, trial_id => $trial_id, trial_name =>$trial_name &>
196   <& /breeders_toolbox/folder/folder_new.mas, breeding_program_id => $breeding_program_id, breeding_program_name =>$breeding_program_name &>
198   <span id="trial_folder_div"><a href="/folder/<% $folder_id %>"><% $folder_name %></a></span>
200 </&>
202 </div><!--closes well-->
204 </&>
206 <&| /page/info_section.mas, title=>"Trial barcode",  collapsible => 1, subtitle => '[<a id="generate_trial_barcode_link">Generate Barcode</a>]|[<a id="direct_phenotyping_link">Direct Phenotyping</a>]'&>
207     <div class="well">
208      <center><& /util/barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name", format=>"trial_qrcode"  &></center><br />
209      </div>
210      <& /breeders_toolbox/trial/generate_trial_barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name" &>
212 </&>
214 <& /breeders_toolbox/trial/edit_trial_details_dialog.mas, trial_name => $trial_name, breeding_program => $breeding_program_id, location => $location_id, year => $year, trial_type => $trial_type, planting_date => $planting_date, harvest_date => $harvest_date, trial_description => $trial_description &>
216 % if ($hidap_enabled) {
218  <& /hidap/hidap_trial_link.mas, trial_id => $trial_id &>
220 % }
222 <& /breeders_toolbox/trial/edit_fieldMap.mas, trial_id => $trial_id, trial_name => $trial_name &>
223 <&| /page/info_section.mas, id => "physical_layout", title=>"Physical Trial Layout", collapsible=>1, collapsed => 1, subtitle=>'[<a id="upload_trial_coords_link">Upload trial coordinates</a>] [<a id="edit_field_map_link">Edit Field Map</a>] [<button type="button" class="btn btn-link" data-toggle="modal" data-target="#fieldmap_usage_modal">Usage Help <span class="glyphicon glyphicon-question-sign"></span></button>]' &>
226   <& /breeders_toolbox/trial/trial_coords.mas, trial_id => $trial_id &>
229 </&>
231 <& /breeders_toolbox/trial/trial_coords_spreadsheet_upload_format_info.mas &>
233 <div id="upload_trial_coord_error_display" class="ui-widget">
234   <table>
235     <tbody></tbody>
236   </table>
237 </div>
239 <div id="trial_coord_upload_success_dialog_message" class="ui-widget">
240   The trial coord upload finished.
241 </div>
243 <div id="upload_trial_coord_dialog" title="Upload trial coordinates">
245   <&| /page/explanation.mas, title=>'Template information' &>
246     <p>
247       <b>File format information</b>
248       <br>
249       <a id="trial_coordinates_upload_spreadsheet_format_info">Spreadsheet format</a>
250     </p>
251   </&>
253   <form method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_trial_coordinates_form" name="upload_trial_coordinates_form">
255     <label for="trial_coordinates_uploaded_file" style="display: inline-block; width: 100px;">Upload trial coordinates file:</label>
256     <input type="file" name="trial_coordinates_uploaded_file" id="trial_coordinates_uploaded_file" encoding="multipart/form-data" />
258     </form>
260 </div>
262 <!--<style>
263   div.left {
264     float: left;
265     clear: both;
266   }
267 .ui-autocomplete {
268   max-height: 100px;
269   overflow-y: auto;
270   /* prevent horizontal scrollbar */
271   overflow-x: hidden;
274 </style> -->
277 <& /breeders_toolbox/trial/download_layout_dialog.mas, trial_id => $trial_id, trial_name => $trial_name, has_subplot_entries => $has_subplot_entries &>
279 <&| /page/info_section.mas, id => "trial_design_section", title=>"Design", collapsible=>1, collapsed=>0, subtitle=>"[<a id='trial_download_layout_button'>Download Layout</a>]"  &>
281 <div class="well well-sm">
283 <& /breeders_toolbox/trial/design.mas, trial_id => $trial_id &>
285 <&| /page/info_section.mas, id => "trial_accessions", title=>"Accessions", is_subsection => 1, collapsible=>1, collapsed=>1 &>
287 <& /breeders_toolbox/trial/trial_accessions.mas, trial_id => $trial_id &>
289 </&>
291 <&| /page/info_section.mas, id => "trial_controls", title=>"Controls",  is_subsection => 1, collapsible=>1, collapsed=>1 &>
293 <& /breeders_toolbox/trial/trial_controls.mas, trial_id => $trial_id &>
295 </&>
297 <&| /page/info_section.mas, id => "trial_plots", title=>"Plots",  is_subsection => 1, collapsible=>1, collapsed=>1 &>
299 <& /breeders_toolbox/trial/trial_plots.mas, trial_id => $trial_id &>
301 </&>
303 % if ($has_subplot_entries) {
305 <&| /page/info_section.mas, id => "trial_subplots", title=>"Subplots",  is_subsection => 1, collapsible=>1, collapsed=>1 &>
307 <& /breeders_toolbox/trial/trial_subplots.mas, trial_id => $trial_id &>
309 </&>
311 % }
313 <&| /page/info_section.mas, id => "trial_plants", title=>"Plant Entries", is_subsection => 1, collapsible=> 1, collapsed=>1 &>
315 <div id="plant_entries_section">
317 % if (!$has_plant_entries) {
318    <button class="btn btn-default" id="create_plant_entries_button">Add plant entries</button>
319    <& /breeders_toolbox/trial/add_plants_per_plot.mas, trial_id => $trial_id, trial_name => $trial_name &>
321 % } else {
323 <& /breeders_toolbox/trial/trial_plants.mas, trial_id => $trial_id &>
325 % }
327 </div><!--closes plant_entries_section -->
329 </&>
331 <& /breeders_toolbox/trial/add_trial_treatment_dialogs.mas &>
332 <&| /page/info_section.mas, id => "trial_treatments", title=>"Treatments",  is_subsection => 1, collapsible=>1, collapsed=>1, subtitle=>"[<a id='trial_detail_page_add_treatment'>Add Treatment</a>]" &>
334 <& /breeders_toolbox/trial/trial_treatments.mas, trial_id => $trial_id &>
336 </&>
338 </div><!-- closes well -->
340 </&>
342 <& /breeders_toolbox/trial/download_phenotypes_dialog.mas, trial_ids => $trial_id, dialog_name => $trial_name, dialog_type => 'Trial' &>
344 <&| /page/info_section.mas,
345    title       => 'Weather at Trial Location',
346    collapsible => 1,
349         <& /breeders_toolbox/trial/weather.mas, location => $location_name &>
351 </&>
353 <&| /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>]" &>
355 % if ($has_expression_atlas) {
356     <& /breeders_toolbox/trial/export_trial_to_expression_atlas.mas, trial_id => $trial_id, trial_name=>$trial_name, expression_atlas_url=>$expression_atlas_url, site_project_name=>$site_project_name, sgn_session_id=>$sgn_session_id, user_name=>$user_name &>
357 % }
359 <& /breeders_toolbox/trial/phenotype_summary.mas, trial_id => $trial_id &>
361 </&>
363 <&| /page/info_section.mas, id=> "compute_derived_traits", title=>'Compute Trait Phenotypes', collapsible=>1, collapsed=>1, &>
365         <& /breeders_toolbox/trial/derived_trait.mas, trial_id => $trial_id &>
367 </&>
371 <&| /page/info_section.mas,
372    title       => 'Trial JBrowse',
373    collapsible => 1,
376         <& /breeders_toolbox/trial/jbrowse_instance.mas, trial_id => $trial_id &>
378 </&>
380 <&| /page/info_section.mas, title=>"Files", collapsible=>1, collapsed=>0 &>
382 <div class="well well-sm">
384   <&| /page/info_section.mas, title=>"Data Collection Files", is_subsection => 1, collapsible=>1, collapsed=>0, &>
385     <&| /page/info_section.mas, title=>"Phenotyping Spreadsheets", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=>'[<a name="create_spreadsheet_link">Create Spreadsheet</a>]' &>
386     </&>
387     <&| /page/info_section.mas, title=>"Android Field Book Layout", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=>'[<a name="create_fieldbook_link">Create Field Book</a>]' &>
388     </&>
389     <&| /page/info_section.mas, title=>"Data Collector Spreadsheet", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=> '[<a id="create_DataCollector_link">Create DataCollector Spreadsheet</a>]' &>
390     </&>
391   </&><!-- closes create new phenotyping file section -->
392   <&| /page/info_section.mas, title=>"Upload Phenotyping Files", is_subsection => 1, collapsible=>1, collapsed=>0, &>
393     <&| /page/info_section.mas, title=>"Phenotyping Spreadsheets", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=>'[<a id="upload_spreadsheet_phenotypes_link">Upload</a>]'&>
394     </&>
395     <&| /page/info_section.mas, title=>"Android Field Book Exported", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=>'[<a id="upload_fieldbook_phenotypes_link">Upload</a>]'&>
396     </&>
397     <&| /page/info_section.mas, title=>"Data Collector Spreadsheet", empty_message=>'', is_subsection => 1, collapsible=>0, collapsed=>0, subtitle=>'[<a id="upload_datacollector_phenotypes_link">Upload</a>]'&>
398     </&>
399   </&><!-- closes upload new phenotype file section -->
400   <&| /page/info_section.mas, title=>"Uploaded Phenotyping Files", is_subsection => 1, collapsible=>1, collapsed=>0, subtitle=>'[<a id="trial_set_phenotypes_fully_link">Phenotypes Fully Uploaded?</a>]' &>
402   <table class="table table-bordered files_datatables" alt="">
403   <thead>
404     <tr><th>Filename</th><th>Date Uploaded</th><th>Uploaded By</th><th>File Type</th><th>Options</th></tr>
405   </thead>
406   <tbody>
407 % foreach my $f (@$trial_phenotype_files) {
408     <tr>
409       <td><% $f->[4] %></td>
410       <td><% $f->[1] %></td>
411       <td><a href="/solpeople/profile/<% $f->[2] %>"><% $f->[3] %></a></td>
412       <td><% $f->[6] %></td>
413       <td><a href="/breeders/phenotyping/view/<% $f->[0] %>">View</a> | <a href="/breeders/phenotyping/download/<% $f->[0] %>">Download</a></td>
414     </tr>
415 % }
416   </tbody>
417   </table>
419   </&><!-- closes uploaded file section -->
421 </div><!-- closes well -->
423 </&><!-- closes entire phenotyping file section -->
425 <& /breeders_toolbox/upload_phenotype_spreadsheet.mas &>
426 <& /fieldbook/upload_phenotype_fieldbook.mas &>
427 <& /breeders_toolbox/upload_phenotype_datacollector.mas &>
429 <& /breeders_toolbox/trial/create_datacollector_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
430 <& /fieldbook/create_fieldbook_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
431 <& /breeders_toolbox/trial/create_spreadsheet_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
433 <& /breeders_toolbox/trial/set_phenotypes_fully_uploaded.mas, trial_id => $trial_id &>
435 % my $data_agreement_link = "Add/edit data agreement";
436 % if ($user_can_modify) { $data_agreement_link = '[<a id="add_data_agreement">Add/edit data agreement</a>]'; }
437 <&| /page/info_section.mas, title=>"Data Agreement", is_subsection => 0, collapsible=>1, collapsed=>0,  subtitle=> $data_agreement_link  &>
439 <& /breeders_toolbox/data_agreement.mas, trial_id => $trial_id &>
441 </&>
443 <&| /page/info_section.mas, title=>'Delete trial data', subtitle=>'<font color="red" role="">Deletion cannot be undone</font>', collapsed=>1, collapsible=>1 &>
444   <& /breeders_toolbox/trial/trial_deletion.mas, trial_id => $trial_id  &>
446 </&>
448 % #print STDERR "Check 9 (mason) : ".(time() - $start_time)."\n";
450 <!-- Phenotypic correlation analysis -->
451 <& /solgs/population/correlation.mas,
452    trial_id => $trial_id
455   <!-- Population structure analysis -- PCA -->
456 <& /solgs/model/pca.mas,
457    trial_id => $trial_id
458  &>
460 % #print STDERR "Check 10 (mason) : ".(time() - $start_time)."\n";
462 <div id="trialIDDiv" class="trialIDDivClass" style="display:none;">
463 % print $trial_id;
464 </div>
466 <div data-spy="affix" data-offset-top="0" style="max-height: 100%; overflow-y: auto;">
467     <div class="panel panel-info">
468         <div class="panel-heading">Completion</div>
469         <div class="panel-body">
471 <&| /page/info_section.mas, title=>"Trial Info", collapsible=>1, collapsed=>0 &>
472 %  if ($trial_name) {
473             <p class="text-success" title="This trial has a name saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Trial Name&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
474 %  } else {
475             <p class="text-danger" title="This trial does not have a name. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Trial Name&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
476 %  }
477 %  if ($breeding_program_name) {
478             <p class="text-success" title="This trial has a breeding program saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Breeding Program&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
479 %  } else {
480             <p class="text-danger" title="This trial does not have a breeding program. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Breeding Program&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
481 %  }
482 %  if ($location_name) {
483             <p class="text-success" title="This trial has a location saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Location&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
484 %  } else {
485             <p class="text-danger" title="This trial does not have a location. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Location&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
486 %  }
487 %  if ($year) {
488             <p class="text-success" title="This trial has a year saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Year&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
489 %  } else {
490             <p class="text-danger" title="This trial does not have a year. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Year&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
491 %  }
492 %  if ($trial_type) {
493             <p class="text-success" title="This trial has a trial type saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Trial Type&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
494 %  } else {
495             <p class="text-danger" title="This trial does not have a trial type. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Trial Type&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
496 %  }
497 %  if ($planting_date) {
498             <p class="text-success" title="This trial has a planting date saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Planting Date&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
499 %  } else {
500             <p class="text-danger" title="This trial does not have a planting date. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Planting Date&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
501 %  }
502 %  if ($harvest_date) {
503             <p class="text-success" title="This trial has a harvest date saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Harvest Date&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
504 %  } else {
505             <p class="text-danger" title="This trial does not have a harvest date. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Harvest Date&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
506 %  }
507 %  if ($trial_description) {
508             <p class="text-success" title="This trial has a description saved. You can view and edit this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Description&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
509 %  } else {
510             <p class="text-danger" title="This trial does not have a description. Please add this information by clicking [Edit Trial Details] in the Trial Detail section on this page."><small>Description&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
511 %  }
512 %  if ($folder_id) {
513             <p class="text-success" title="This trial is saved in a folder or breeding program. You can change this by clicking [Change] in the Folder section on this page."><small>In Folder&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
514 %  } else {
515             <p class="text-info" title="This trial is not in a folder! If this happens please contact us because this should not happen. A trial should always be in a folder or breeding program."><small>Not In Folder&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></p>
516 %  }
517 </&>
519 <&| /page/info_section.mas, id=>"trial_completion_layout_section", title=>"Field Design", collapsible=>1, collapsed=>1 &>
520 %  if ($design_name) {
521             <p class="text-success" title="This trial has a design type saved. You can view and download this information in the Design section on this page."><small>Has Field Design&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
522 %  } else {
523             <p class="text-danger" title="This trial does not have a design type saved! If this happens please contact us because this should not happen!"><small>No Field Design&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>
524 %  }
526             <div id="trial_completion_layout_section_div">
527                 <div class="well well-sm">LOADING...</div>
528             </div>
530 %  if ($has_plant_entries) {
531             <p class="text-success" title="This trial has plot and plant entries saved. This means that phenotypes can be recorded on the plot and plant level."><small>Has Plots<br/>And Plants&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
532 %  } else {
533             <p class="text-info" title="This trial has plot entries saved, but no plant entries. Plant entries are needed for plant level phenotyping. You can create plant entries in Design->Plant Entries section on this page."><small>Has Plots<br/>No Plants&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></p>
534 %  }
535 </&>
537 <&| /page/info_section.mas, id=>"trial_completion_phenotype_section", title=>"Phenotyping", collapsible=>1, collapsed=>1 &>
539             <div id="trial_completion_phenotype_section_div">
540                 <div class="well well-sm">LOADING...</div>
541             </div>
543 %  if ($phenotypes_fully_uploaded) {
544             <p class="text-success" title="All recorded phenotypes for this trial are saved in the database. You can change this by clicking [Phenotypes Fully Uploaded?] in the Files section on this page."><small>Phenotyping<br/>Complete&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>
545 %  } else {
546             <p class="text-info" title="Once phenotypes are fully uploaded for a trial, you can click [Phenotypes Fully Uploaded?] in the Files section on this page."><small>Phenotyping<br/>Incomplete&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></p>
547 %  }
548 </&>
550         </div>
551     </div>
552 </div>
554 <script defer="defer">
556 jQuery(document).ready(function () {
558   trial_detail_page_setup_dialogs();
560   jQuery('#delete_breeding_program_trial_association_link').click(
561      function() {
562         var trial_id = get_trial_id();
564         var yes = confirm("Do you really want to remove this trial from the breeding program?");
565         if (yes) {
566             jQuery.ajax( {
567                 url: '/breeders/program/remove/<% $breeding_program_id %>/'+trial_id,
568                 data: { },
569                 async: false,
570                 success: function(response) {
571                 }
572             });
573         }
574     });
576     jQuery('#trial_completion_layout_section_onswitch').click( function() {
577         jQuery.ajax ( {
578             url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_layout_section',
579             success: function(response){
580                 var html = '';
581                 if (response.has_layout == 1){
582                     html += '<p class="text-success" title="This trial has plots and their layout information saved in the database. You can view and download this information in the Design section on this page."><small>Has Field Layout&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>';
583                 } else {
584                     html += '<p class="text-danger" title="This trial does not have any plot layout info saved in the trial! If this occurs please contact us because this should not occur!"><small>No Field Layout&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></p>';
585                 }
586                 if (response.has_physical_map == 1){
587                     html += '<p class="text-success" title="This trial has a physical map saved. You can view and edit the physical map in the Physical Trial Layout section on this page."><small>Has Physial Map&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>';
588                 } else {
589                     html += '<p class="text-info" title="This trial does not have physical map information. This means the map will not appear in the Physical Trial Layout section. You can add physical map info by clicking [Upload Trial Coordinates] in the Physical Trial Layout section on this page."><small>No Physical Map&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></p>';
590                 }
591                 jQuery('#trial_completion_layout_section_div').html(html);
592             },
593             error: function(response){
594                 alert('Error retrieving trial completion layout section');
595             }
597         });
598     });
600     jQuery('#trial_completion_phenotype_section_onswitch').click( function() {
601         jQuery.ajax ( {
602             url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_phenotype_section',
603             success: function(response){
604                 var html = '';
605                 if (response.has_phenotypes == 1){
606                     html = '<p class="text-success" title="This trial has phenotypes saved. You can view and download this data in the Traits Assayed section on this page."><small>Has Phenotypes&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>';
607                 } else {
608                     html = '<p class="text-info" title="This trial does not have any phenotypes stored. You can upload phenotypes in the Files section on this page."><small>No Phenotypes&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></p>';
609                 }
610                 jQuery('#trial_completion_phenotype_section_div').html(html);
611             },
612             error: function(response){
613                 alert('Error retrieving trial completion phenotype section');
614             }
616         });
617     });
619     jQuery('#direct_phenotyping_link').click(function () {
620         var  id = <% $trial_id %>;
621         location.href = '/breeders/trial_phenotyping?trial_id=' + id + '';
622     });
626 </script>