graphical filtering of accession search
[sgn.git] / mason / breeders_toolbox / trial.mas
blob9c8ac6efe2bd0a25695a3da2636df194cbeaf96a
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 $trial_type_id => undef
26 $planting_date => undef
27 $harvest_date => undef
28 $trial_description => undef
29 $user_can_modify => undef
30 $has_plant_entries => undef
31 $has_subplot_entries => undef
32 $hidap_enabled => undef
33 $folder_name => undef
34 $folder_id => undef
35 $plants_per_plot => undef
36 $has_expression_atlas => undef
37 $expression_atlas_url => undef
38 $site_project_name => undef
39 $trial_phenotype_files => undef
40 $sgn_session_id => undef
41 $user_name => undef
42 $design_name => undef
43 $phenotypes_fully_uploaded => undef
44 $assayed_traits => undef
45 $identifier_prefix => 'SGN'
46 $main_production_site_url
47 </%args>
49 <style>
51 @media (min-width: 1200px) {
52     .affix {
53         top:100px;
54         right:0;
55         position:fixed;
56     }
59 </style>
61 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'CXGN.Trial' , 'jstree/dist/jstree', 'CXGN.BreedersToolbox.HTMLSelect', 'moment_min', 'daterangepicker' ] &>
63 <%perl>
64   use Data::Dumper;
65 my $start_time = time();
67 #print STDERR "Check 7 (mason) : ".(time() - $start_time)."\n";
69 </%perl>
71 <br/>
74 <& /page/page_title.mas, title=>"Trial detail for ".$trial_name &>
76 <&| /page/info_section.mas, title=>"Trial details",  collapsible => 1, subtitle => '[<a id="edit_trial_details">Edit Trial Details</a>]'&>
79 <div class="panel panel-default">
80 <table class="table table-hover" >
82 <tr>
83 <td><b>Trial Name</b></td>
84 <td>
85 <div id="trial_name">
86 % if ($trial_name) {
87 %   print "$trial_name";
88 % } else {
89 %   print "[No Trial Name]";
90 % }
91 </div>
92 </td>
93 </tr>
95 <tr>
96 <td><b>Breeding Program </b></td>
97 <td>
98 <span id="breeding_program">
99 % if ($breeding_program_name) {
100 %  print "$breeding_program_name";
101 % }
102 % else {
103 %  print "No Breeding Program";
104 % }
105 </span>
106 </td>
107 </tr>
109 <tr>
110 <td><b>Trial Location</b></td>
111 <td>
112 <div id="trial_location">
113 % if ($location_name) {
114 %  print "$location_name";
115 % } else {
116 %  print "[No Location]";
117 % }
118 </div>
119 </td>
120 </tr>
122 <tr>
123 <td><b>Year</b></td>
124 <td>
125 <div id="trial_year">
126 % if ($year) {
127 %  print "$year";
128 % } else {
129 %  print "[No Year]";
130 % }
131 </div>
132 </td>
133 </tr>
135 <tr>
136 <td><b>Trial Type</b></td>
137 <td>
138 <div id="trial_type">
139 % if ($trial_type) {
140 %  print "$trial_type";
141 % } else {
142 % print "[Type not set]";
143 % }
144 </div>
145 </td>
146 </tr>
148 <tr>
149 <td><b>Planting Date</b></td>
150 <td>
151 <div id="planting_date">
152 % if ($planting_date) {
153   <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $planting_date %>" ><% $planting_date %></a>
154 % } else {
155 %  print "[No Planting Date]";
156 % }
157 </div>
158 </td>
159 </tr>
161 <tr>
162 <td><b>Harvest Date</b></td>
163 <td>
164 <div id="harvest_date">
165 % if ($harvest_date) {
166   <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $harvest_date %>" ><% $harvest_date %></a>
167 % } else {
168 %  print "[No Harvest Date]";
169 % }
170 </div>
171 </td>
172 </tr>
174 <tr><td><b>Description</b></td>
175 <td>
176 <div id="trial_description">
177 % if ($trial_description) {
178 %  print "$trial_description";
179 % } else {
180 %  print "[No Description]";
181 % }
182 </div>
183 </td>
184 </tr>
185 </table>
186 </div>
188 % my $folder_collapsed = 1;
189 % if ($folder_id) {
190 % $folder_collapsed = 0;
191 % }
193 <div class="well well-sm">
195 <&| /page/info_section.mas, title=>"Folder", collaspible=>1, collapsed=>$folder_collapsed,
196   subtitle => '[<a id="new_folder_dialog_link">New Folder</a>] | [<a id="open_folder_dialog_link">Change</a>]' &>
198   <& /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 &>
199   <& /breeders_toolbox/folder/folder_new.mas, breeding_program_id => $breeding_program_id, breeding_program_name =>$breeding_program_name &>
201   <span id="trial_folder_div"><a href="/folder/<% $folder_id %>"><% $folder_name %></a></span>
203 </&>
205 </div><!--closes well-->
207 </&>
209 <&| /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>]'&>
210     <div class="well">
211      <center><& /util/barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name", format=>"trial_qrcode"  &></center><br />
212      </div>
213      <& /breeders_toolbox/trial/generate_trial_barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name" &>
215 </&>
217 <& /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, trial_type_id => $trial_type_id, planting_date => $planting_date, harvest_date => $harvest_date, trial_description => $trial_description &>
219 % if ($hidap_enabled) {
221  <& /hidap/hidap_trial_link.mas, trial_id => $trial_id &>
223 % }
225 <& /breeders_toolbox/trial/edit_fieldMap.mas, trial_id => $trial_id, trial_name => $trial_name &>
226 <&| /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>]' &>
228   <& /breeders_toolbox/trial/trial_coords.mas, trial_id => $trial_id &>
230 </&>
232 <& /breeders_toolbox/trial/trial_coords_upload_dialogs.mas, trial_id => $trial_id, trial_name => $trial_name &>
234 <!--<style>
235   div.left {
236     float: left;
237     clear: both;
238   }
239 .ui-autocomplete {
240   max-height: 100px;
241   overflow-y: auto;
242   /* prevent horizontal scrollbar */
243   overflow-x: hidden;
246 </style> -->
250 <& /breeders_toolbox/trial/download_layout_dialog.mas, trial_id => $trial_id, trial_name => $trial_name, has_subplot_entries => $has_subplot_entries &>
252 <&| /page/info_section.mas, id => "trial_design_section", title=>"Design", collapsible=>1, collapsed=>0, subtitle=>"[<a id='trial_download_layout_button'>Download Layout</a>]"  &>
254 <div class="well well-sm">
256 <& /breeders_toolbox/trial/design.mas, trial_id => $trial_id &>
258 <&| /page/info_section.mas, id => "trial_accessions", title=>"Accessions", is_subsection => 1, collapsible=>1, collapsed=>1 &>
260 <& /breeders_toolbox/trial/trial_accessions.mas, trial_id => $trial_id &>
262 </&>
264 <& /breeders_toolbox/trial/add_trial_used_seedlots.mas, trial_id => $trial_id &>
265 <&| /page/info_section.mas, id => "trial_seedlots", title=>"Seedlots", is_subsection => 1, collapsible=>1, collapsed=>1, subtitle=>"[<a id='trial_upload_seedlot_button' >Upload Seedlots Planted In Trial</a>]" &>
267 <& /breeders_toolbox/trial/trial_seedlots.mas, trial_id => $trial_id &>
269 </&>
272 <&| /page/info_section.mas, id => "trial_controls", title=>"Controls",  is_subsection => 1, collapsible=>1, collapsed=>1 &>
274 <& /breeders_toolbox/trial/trial_controls.mas, trial_id => $trial_id &>
276 </&>
278 <& /breeders_toolbox/trial/upload_plot_gps_dialogs.mas, trial_id => $trial_id &>
279 <&| /page/info_section.mas, id => "trial_plots", title=>"Plots",  is_subsection => 1, collapsible=>1, collapsed=>1, subtitle=>"[<a id='trial_upload_plot_gps_button' >Upload GPS Coordinates</a>]" &>
281 <& /breeders_toolbox/trial/trial_plots.mas, trial_id => $trial_id &>
283 </&>
285 % if ($has_subplot_entries) {
287 <&| /page/info_section.mas, id => "trial_subplots", title=>"Subplots",  is_subsection => 1, collapsible=>1, collapsed=>1 &>
289 <& /breeders_toolbox/trial/trial_subplots.mas, trial_id => $trial_id &>
291 </&>
293 % }
295 <&| /page/info_section.mas, id => "trial_plants", title=>"Plant Entries", is_subsection => 1, collapsible=> 1, collapsed=>1 &>
297 <div id="plant_entries_section">
299 % if (!$has_plant_entries) {
300    <button class="btn btn-default" id="create_plant_entries_button">Add plant entries</button>
301    <button class="btn btn-default" id="upload_plant_entries_button">Upload plant entries</button>
302    <& /breeders_toolbox/trial/add_plants_per_plot.mas, trial_id => $trial_id, trial_name => $trial_name &>
304 % } else {
306 <& /breeders_toolbox/trial/trial_plants.mas, trial_id => $trial_id &>
308 % }
310 </div><!--closes plant_entries_section -->
312 </&>
314 <& /breeders_toolbox/trial/add_trial_treatment_dialogs.mas &>
315 <&| /page/info_section.mas, id => "trial_treatments", title=>"Field Management Factors",  is_subsection => 1, collapsible=>1, collapsed=>1, subtitle=>"[<a id='trial_detail_page_add_treatment'>Add Management Factor</a>]" &>
317 <& /breeders_toolbox/trial/trial_treatments.mas, trial_id => $trial_id &>
319 </&>
321 </div><!-- closes well -->
323 </&>
325 <& /breeders_toolbox/trial/download_phenotypes_dialog.mas, trial_ids => $trial_id, dialog_name => $trial_name, dialog_type => 'Trial' &>
327 <&| /page/info_section.mas,
328    title       => 'Weather at Trial Location',
329    collapsible => 1,
332         <& /breeders_toolbox/trial/weather.mas, location => $location_name &>
334 </&>
336 % my $download_pheno_subtitle;
337 % if (scalar(@$assayed_traits) > 0){
338 %   $download_pheno_subtitle = "[<a id='trial_download_phenotypes_button'>Download Trial Data</a>]"
339 % }
340 % else {
341 %   $download_pheno_subtitle = "Trial has no phenotype for download";
342 % }
344 <&| /page/info_section.mas, id=> "trial_detail_traits_assayed", title => "Traits assayed", collapsible=>1, collapsed=>1, hide_if_empty=>1, subtitle=> $download_pheno_subtitle &>
346 % if ($has_expression_atlas) {
347     <& /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, main_production_site_url=>$main_production_site_url &>
348 % }
350 <& /breeders_toolbox/trial/phenotype_summary.mas, trial_id => $trial_id &>
352 </&>
354 <&| /page/info_section.mas, id => "pheno_heatmap", title=>"Phenotype Heatmap", collapsible=>1, collapsed => 1 &>
356     <& /breeders_toolbox/trial/phenotype_heatmap.mas, trial_id => $trial_id &>
358 </&>
360 <&| /page/info_section.mas, id=> "compute_derived_traits", title=>'Compute Trait Phenotypes', collapsible=>1, collapsed=>1, &>
362         <& /breeders_toolbox/trial/derived_trait.mas, trial_id => $trial_id &>
364 </&>
368 <&| /page/info_section.mas,
369    title       => 'Trial JBrowse',
370    collapsible => 1,
373         <& /breeders_toolbox/trial/jbrowse_instance.mas, trial_id => $trial_id &>
375 </&>
377 <&| /page/info_section.mas, title=>"Files", collapsible=>1, collapsed=>0 &>
379 <div class="well well-sm">
381     <div class="panel panel-default">
382         <div class="panel-body">
383             <&| /page/info_section.mas, title=>"Data Collection Files", is_subsection => 1, collapsible=>1, collapsed=>0, &>
384                 <&| /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>]' &>
385                 </&>
386                 <&| /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>]' &>
387                 </&>
388                 <&| /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>]' &>
389                 </&>
390             </&><!-- closes create new phenotyping file section -->
391         </div>
392     </div>
393     <div class="panel panel-default">
394         <div class="panel-body">
395             <&| /page/info_section.mas, title=>"Upload Phenotyping Files", is_subsection => 1, collapsible=>1, collapsed=>0, &>
396                 <&| /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>]'&>
397                 </&>
398                 <&| /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>]'&>
399                 </&>
400                 <&| /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>]'&>
401                 </&>
402             </&><!-- closes upload new phenotype file section -->
403         </div>
404     </div>
405     <div class="panel panel-default">
406         <div class="panel-body">
407             <&| /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>]' &>
409                 <table class="table table-bordered files_datatables" alt="">
410                     <thead>
411                         <tr><th>Filename</th><th>Date Uploaded</th><th>Uploaded By</th><th>File Type</th><th>Options</th></tr>
412                     </thead>
413                     <tbody>
414 % foreach my $f (@$trial_phenotype_files) {
415     <tr>
416       <td><% $f->[4] %></td>
417       <td><% $f->[1] %></td>
418       <td><a href="/solpeople/profile/<% $f->[2] %>"><% $f->[3] %></a></td>
419       <td><% $f->[6] %></td>
420       <td><a href="/breeders/phenotyping/view/<% $f->[0] %>">View</a> | <a href="/breeders/phenotyping/download/<% $f->[0] %>">Download</a></td>
421     </tr>
422 % }
423                     </tbody>
424                 </table>
426             </&><!-- closes uploaded file section -->
427         </div>
428     </div>
429     <div class="panel panel-default">
430         <div class="panel-body">
431             <&| /page/info_section.mas, title=>"Uploaded Additional Files", is_subsection => 1, collapsible=>1, collapsed=>0, subtitle=>'[<a id="trial_upload_additional_files_link">Upload Additional Files</a>]' &>
433             <& /breeders_toolbox/trial/upload_additional_file.mas, trial_id => $trial_id &>
435             </&><!-- closes uploaded additional file section -->
436         </div>
437     </div>
439 </div><!-- closes well -->
441 </&><!-- closes entire phenotyping file section -->
443 <& /breeders_toolbox/upload_phenotype_spreadsheet.mas &>
444 <& /fieldbook/upload_phenotype_fieldbook.mas &>
445 <& /breeders_toolbox/upload_phenotype_datacollector.mas &>
447 <& /breeders_toolbox/trial/create_datacollector_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
448 <& /fieldbook/create_fieldbook_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
449 <& /breeders_toolbox/trial/create_spreadsheet_dialog.mas, trial_id => $trial_id, trial_name => $trial_name &>
451 <& /breeders_toolbox/trial/set_phenotypes_fully_uploaded.mas, trial_id => $trial_id &>
453 % my $data_agreement_link = "Add/edit data agreement";
454 % if ($user_can_modify) { $data_agreement_link = '[<a id="add_data_agreement">Add/edit data agreement</a>]'; }
455 <&| /page/info_section.mas, title=>"Data Agreement", is_subsection => 0, collapsible=>1, collapsed=>0,  subtitle=> $data_agreement_link  &>
457 <& /breeders_toolbox/data_agreement.mas, trial_id => $trial_id &>
459 </&>
461 <&| /page/info_section.mas, title=>'Delete trial data', subtitle=>'<font color="red" role="">Deletion cannot be undone</font>', collapsed=>1, collapsible=>1 &>
462   <& /breeders_toolbox/trial/trial_deletion.mas, trial_id => $trial_id  &>
464 </&>
466 % #print STDERR "Check 9 (mason) : ".(time() - $start_time)."\n";
468 <!-- Phenotypic correlation analysis -->
469 <& /solgs/population/correlation.mas,
470    trial_id => $trial_id
473   <!-- Population structure analysis -- PCA -->
474 <& /solgs/model/pca.mas,
475    trial_id => $trial_id
476  &>
478 % #print STDERR "Check 10 (mason) : ".(time() - $start_time)."\n";
480 <div id="trialIDDiv" class="trialIDDivClass" style="display:none;">
481 % print $trial_id;
482 </div>
484 <div data-spy="affix" data-offset-top="0" style="max-height: 100%; overflow-y: auto;">
485     <div class="panel panel-info">
486         <div class="panel-heading">Completion</div>
487         <div class="panel-body">
489 <&| /page/info_section.mas, title=>"Trial Info", collapsible=>1, collapsed=>0 &>
490 %  if ($trial_name) {
491             <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>
492 %  } else {
493             <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>
494 %  }
495 %  if ($breeding_program_name) {
496             <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>
497 %  } else {
498             <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>
499 %  }
500 %  if ($location_name) {
501             <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>
502 %  } else {
503             <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>
504 %  }
505 %  if ($year) {
506             <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>
507 %  } else {
508             <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>
509 %  }
510 %  if ($trial_type) {
511             <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>
512 %  } else {
513             <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>
514 %  }
515 %  if ($planting_date) {
516             <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>
517 %  } else {
518             <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>
519 %  }
520 %  if ($harvest_date) {
521             <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>
522 %  } else {
523             <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>
524 %  }
525 %  if ($trial_description) {
526             <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>
527 %  } else {
528             <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>
529 %  }
530 %  if ($folder_id) {
531             <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>
532 %  } else {
533             <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>
534 %  }
535 </&>
537 <&| /page/info_section.mas, id=>"trial_completion_layout_section", title=>"Field Design", collapsible=>1, collapsed=>1 &>
538 %  if ($design_name) {
539             <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>
540 %  } else {
541             <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>
542 %  }
544             <div id="trial_completion_layout_section_div">
545                 <div class="well well-sm">LOADING...</div>
546             </div>
548 %  if ($has_plant_entries) {
549             <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>
550 %  } else {
551             <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>
552 %  }
553 </&>
555 <&| /page/info_section.mas, id=>"trial_completion_phenotype_section", title=>"Phenotyping", collapsible=>1, collapsed=>1 &>
557             <div id="trial_completion_phenotype_section_div">
558                 <div class="well well-sm">LOADING...</div>
559             </div>
561 %  if ($phenotypes_fully_uploaded) {
562             <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>
563 %  } else {
564             <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>
565 %  }
566 </&>
568         </div>
569     </div>
570 </div>
572 <script defer="defer">
574 jQuery(document).ready(function () {
576   trial_detail_page_setup_dialogs();
578   jQuery('#delete_breeding_program_trial_association_link').click(
579      function() {
580         var trial_id = get_trial_id();
582         var yes = confirm("Do you really want to remove this trial from the breeding program?");
583         if (yes) {
584             jQuery.ajax( {
585                 url: '/breeders/program/remove/<% $breeding_program_id %>/'+trial_id,
586                 data: { },
587                 async: false,
588                 success: function(response) {
589                 }
590             });
591         }
592     });
594     jQuery('#trial_completion_layout_section_onswitch').click( function() {
595         jQuery.ajax ( {
596             url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_layout_section',
597             success: function(response){
598                 var html = '';
599                 if (response.has_layout == 1){
600                     html += '<p class="text-success" title="This trial has plots and their layout information saved in the database. All relationships between accessions, plots, seedlots, plants, and subplots are consistent. 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>';
601                 } else {
602                     html += '<p class="text-danger" title="There is something wrong with the layout! If this occurs please contact us because this should not occur! (click here for more info)"><span id="layout_error_button"><small>Bad Field Layout&nbsp;&nbsp;</small><span class="glyphicon glyphicon-remove-sign"></span></span></p>';
603                 }
604                 if (response.has_physical_map == 1){
605                     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>';
606                 } else {
607                     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. (click here for more info)"><span id="physical_map_error_button"><small>No Physical Map&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></span></p>';
608                 }
609                 if (response.has_seedlots == 1){
610                     html += '<p class="text-success" title="This trial has seedlots linked to plots (and the accessions are in sync). This allows us to track breeding material on the seedlots detail page. You can view this data and navigate to the seedlots on the Design section of this page."><small>Has Seedlots&nbsp;&nbsp;</small><span class="glyphicon glyphicon-ok-sign"></span></p>';
611                 } else {
612                     html += '<p class="text-info" title="This trial does not have seedlots saved. This means we cannot track your breeding material using seedlots. You can upload this information by clicking [Upload Seedlots Planted in Trial] in the Design section on this page. (click here for more info)"><span id="seedlot_error_button"><small>No Seedlot Info&nbsp;&nbsp;</small><span class="glyphicon glyphicon-info-sign"></span></span></p>';
613                 }
614                 jQuery(document).on('click', 'span[id="layout_error_button"]', function(){
615                     alert(response.layout_errors);
616                 });
617                 jQuery(document).on('click', 'span[id="physical_map_error_button"]', function(){
618                     alert(response.physical_map_errors);
619                 });
620                 jQuery(document).on('click', 'span[id="seedlot_error_button"]', function(){
621                     alert(response.seedlot_errors);
622                 });
623                 jQuery('#trial_completion_layout_section_div').html(html);
624             },
625             error: function(response){
626                 alert('Error retrieving trial completion layout section');
627             }
629         });
630     });
632     jQuery('#trial_completion_phenotype_section_onswitch').click( function() {
633         jQuery.ajax ( {
634             url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_phenotype_section',
635             success: function(response){
636                 var html = '';
637                 if (response.has_phenotypes == 1){
638                     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>';
639                 } else {
640                     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>';
641                 }
642                 jQuery('#trial_completion_phenotype_section_div').html(html);
643             },
644             error: function(response){
645                 alert('Error retrieving trial completion phenotype section');
646             }
648         });
649     });
651     jQuery('#direct_phenotyping_link').click(function () {
652         var  id = <% $trial_id %>;
653         location.href = '/breeders/trial_phenotyping?trial_id=' + id + '';
654     });
658 </script>