6 /breeders_toolbox/trial.mas - a mason component to display a trial detail page
20 $breeding_program_name
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
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
42 $phenotypes_fully_uploaded => undef
43 $identifier_prefix => 'SGN'
48 @media (min-width: 1200px) {
58 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'CXGN.Trial' , 'jstree/dist/jstree', 'CXGN.BreedersToolbox.HTMLSelect', 'moment_min', 'daterangepicker' ] &>
62 my $start_time = time();
64 #print STDERR "Check 7 (mason) : ".(time() - $start_time)."\n";
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" >
80 <td><b>Trial Name</b></td>
84 % print "$trial_name";
86 % print "[No Trial Name]";
93 <td><b>Breeding Program </b></td>
95 <span id="breeding_program">
96 % if ($breeding_program_name) {
97 % print "$breeding_program_name";
100 % print "No Breeding Program";
107 <td><b>Trial Location</b></td>
109 <div id="trial_location">
110 % if ($location_name) {
111 % print "$location_name";
113 % print "[No Location]";
122 <div id="trial_year">
133 <td><b>Trial Type</b></td>
135 <div id="trial_type">
137 % print "$trial_type";
139 % print "[Type not set]";
146 <td><b>Planting Date</b></td>
148 <div id="planting_date">
149 % if ($planting_date) {
150 <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $planting_date %>" ><% $planting_date %></a>
152 % print "[No Planting Date]";
159 <td><b>Harvest Date</b></td>
161 <div id="harvest_date">
162 % if ($harvest_date) {
163 <a href="/breeders/trial/<% $trial_id %>?currentDate=<% $harvest_date %>" ><% $harvest_date %></a>
165 % print "[No Harvest Date]";
171 <tr><td><b>Description</b></td>
173 <div id="trial_description">
174 % if ($trial_description) {
175 % print "$trial_description";
177 % print "[No Description]";
185 % my $folder_collapsed = 1;
187 % $folder_collapsed = 0;
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>
202 </div><!--closes well-->
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>]'&>
208 <center><& /util/barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name", format=>"trial_qrcode" &></center><br />
210 <& /breeders_toolbox/trial/generate_trial_barcode.mas, identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name" &>
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 &>
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 &>
231 <& /breeders_toolbox/trial/trial_coords_spreadsheet_upload_format_info.mas &>
233 <div id="upload_trial_coord_error_display" class="ui-widget">
239 <div id="trial_coord_upload_success_dialog_message" class="ui-widget">
240 The trial coord upload finished.
243 <div id="upload_trial_coord_dialog" title="Upload trial coordinates">
245 <&| /page/explanation.mas, title=>'Template information' &>
247 <b>File format information</b>
249 <a id="trial_coordinates_upload_spreadsheet_format_info">Spreadsheet format</a>
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" />
270 /* prevent horizontal scrollbar */
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 &>
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 &>
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 &>
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 &>
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 &>
323 <& /breeders_toolbox/trial/trial_plants.mas, trial_id => $trial_id &>
327 </div><!--closes plant_entries_section -->
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 &>
338 </div><!-- closes well -->
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',
349 <& /breeders_toolbox/trial/weather.mas, location => $location_name &>
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 &>
359 <& /breeders_toolbox/trial/phenotype_summary.mas, trial_id => $trial_id &>
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 &>
371 <&| /page/info_section.mas,
372 title => 'Trial JBrowse',
376 <& /breeders_toolbox/trial/jbrowse_instance.mas, trial_id => $trial_id &>
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>]' &>
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>]' &>
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>]' &>
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>]'&>
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>]'&>
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>]'&>
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="">
404 <tr><th>Filename</th><th>Date Uploaded</th><th>Uploaded By</th><th>File Type</th><th>Options</th></tr>
407 % foreach my $f (@$trial_phenotype_files) {
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>
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 &>
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 &>
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
460 % #print STDERR "Check 10 (mason) : ".(time() - $start_time)."\n";
462 <div id="trialIDDiv" class="trialIDDivClass" style="display:none;">
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 &>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-info-sign"></span></p>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>
526 <div id="trial_completion_layout_section_div">
527 <div class="well well-sm">LOADING...</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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-info-sign"></span></p>
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>
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>
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 </small><span class="glyphicon glyphicon-info-sign"></span></p>
554 <script defer="defer">
556 jQuery(document).ready(function () {
558 trial_detail_page_setup_dialogs();
560 jQuery('#delete_breeding_program_trial_association_link').click(
562 var trial_id = get_trial_id();
564 var yes = confirm("Do you really want to remove this trial from the breeding program?");
567 url: '/breeders/program/remove/<% $breeding_program_id %>/'+trial_id,
570 success: function(response) {
576 jQuery('#trial_completion_layout_section_onswitch').click( function() {
578 url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_layout_section',
579 success: function(response){
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>';
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 </small><span class="glyphicon glyphicon-remove-sign"></span></p>';
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>';
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 </small><span class="glyphicon glyphicon-info-sign"></span></p>';
591 jQuery('#trial_completion_layout_section_div').html(html);
593 error: function(response){
594 alert('Error retrieving trial completion layout section');
600 jQuery('#trial_completion_phenotype_section_onswitch').click( function() {
602 url : '/ajax/breeders/trial/'+ <% $trial_id %> + '/trial_completion_phenotype_section',
603 success: function(response){
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 </small><span class="glyphicon glyphicon-ok-sign"></span></p>';
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 </small><span class="glyphicon glyphicon-info-sign"></span></p>';
610 jQuery('#trial_completion_phenotype_section_div').html(html);
612 error: function(response){
613 alert('Error retrieving trial completion phenotype section');
619 jQuery('#direct_phenotyping_link').click(function () {
620 var id = <% $trial_id %>;
621 location.href = '/breeders/trial_phenotyping?trial_id=' + id + '';