package SGN::View::Mason::Commands;
use strict;
use vars qw($m $c);
HTML::Mason::Component::FileBased->new(
'code' => sub {
use utf8; local $SGN::View::Mason::Commands::m = $HTML::Mason::Commands::m;
HTML::Mason::Exception::Params->throw
    ( error =>
      "Odd number of parameters passed to component expecting name/value pairs"
    ) if @_ % 2;
my ( $breeding_programs, $locations, $design_types );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( breeding_programs locations ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 9 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
    $breeding_programs = $_[ $pos{'breeding_programs'} ];
#line 10 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
    $locations = $_[ $pos{'locations'} ];
#line 11 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
     $design_types = exists $pos{'design_types'} ? $_[ $pos{'design_types'} ] :  ();
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 1 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '<style>
    control-label {
    width: 150px;
    text-align: right;
  }
</style>

' );
#line 13 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
' );
#line 14 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"

    my $user_role = '';
    my $email_address = '';
    if ($c->user) {
        $user_role = $c->user->get_object()->get_user_type();
        $email_address = $c->user->get_object()->get_private_email();
    }
#line 22 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
' );
#line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/util/import_javascript.mas', classes => [ 'CXGN.TrialTreeFolders' ]   
); #line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

<div class="modal fade" id="upload_trial_dialog" name="upload_trial_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadTrialDialog">
    <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content">
            <div class="modal-header" style="text-align: center">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="uploadTrialDialog">Upload Existing Trial(s)</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">

                    <!-- <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_trial_form" name="upload_trial_form"> -->

                        ' );
#line 37 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 37 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 38 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 38 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 39 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"This workflow will guide you through uploading a new trial or trials into the database"   
); #line 39 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                <p>A field trial represents plots in the field where each plot has a globally unique <i>plot_name</i>, a sequential <i>plot_number</i> that is unique in the trial (e.g. 101, 102, 103 for three separate plots), and an <i>accession_name</i> representing the genotype being tested in that plot. In cases where a cross/family is being evaluated (e.g. F1 hybrid, backcrossing), a <i>cross_unique_id</i> or a <i>family_name</i> can be used instead of an accession_name. Each plot can belong to different blocks (<i>block_number</i>) and reps (<i>rep_number</i>) depending on the experimental design you are using (e.g. complete block vs augmented design). Each plot can have a <i>row_number</i> and <i>col_number</i> indicating the relative position of the plot in the field.</p>
                                <p>If a specific accession is a check or control, you can indicate the plots that that accession is planted in as controls using <i>is_a_control</i>.</p>
                                <p>You can provide the specific <i>seedlot_name</i> planted in each plot, along with the number of seeds (<i>num_seed_per_plot</i>) and/or the weight (g) of seed (<i>weight_gram_seed_per_plot</i>) that were used.</p>
                                <p>A trial can represent a yield trial, a phenotyping trial, a crossing block, a greenhouse, a nursery, etc.</p>
                                <p>A plot can have many plants, which the database can track as separate entities, allowing you to record plant level observations and information.</p>
                                <br/><br/>
                                <center>
                                <button id="next_step_upload_intro_button" class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
                                </center>
                            ' );
#line 49 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Intro"
 );
#line 49 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 50 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 50 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                <ul class="nav nav-pills nav-justified" id="upload_trial_designs_tab_select">
                                    <li class="active" id="upload_single_trial_design_tab"><a data-toggle="tab" href="#single_tab">Single Trial Design</a></li>
                                    <li id="upload_multiple_trial_designs_tab"><a data-toggle="tab" href="#multiple_tab">Multiple Trial Designs</a></li>
                                </ul>
                                <div class="tab-content">

                                    <div id="single_tab" class="tab-pane fade in active">
                                        <hr>
                                        <center>
                                            ' );
#line 60 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 60 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                                <p>
                                                    <b>File format information</b>
                                                    <br>
                                                    <a id="upload_single_trial_design_format_info">Single trial spreadsheet</a>
                                                </p>
                                            ' );
#line 66 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/explanation.mas', title=>'Template information'
 );
#line 66 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                            <button id="next_step_file_formatting_button" class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
                                        </center>
                                        <br /><br />
                                        ' );
#line 70 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/help/file_upload_type.mas', type => "Single Trial Designs", optional_column => 1   
); #line 70 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                    </div>

                                    <div id="multiple_tab" class="tab-pane fade">
                                        <hr>
                                        <center>
                                            ' );
#line 76 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 76 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                                <p>
                                                    <b>File format information</b>
                                                    <br>
                                                    <a id="upload_multiple_trial_designs_format_info">Multiple trial spreadsheet</a>
                                                </p>
                                            ' );
#line 82 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/explanation.mas', title=>'Template information'
 );
#line 82 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                            <br>

                                            <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_multiple_trial_designs_form" name="upload_multiple_trial_designs_form">
                                              <div class="form-group">
                                                  <input type="file" name="multiple_trial_designs_upload_file" id="multiple_trial_designs_upload_file" encoding="multipart/form-data" />
                                              </div>
                                              <div class="form-group">
                                                  <div class="col-sm-4"></div>
                                                  <label class="col-sm-2 control-label">Ignore Warnings: </label>
                                                  <div class="col-sm-2" >
                                                      <input id="upload_multiple_trials_ignore_warnings" name="upload_multiple_trials_ignore_warnings" type="checkbox" data-toggle="toggle" encoding="multipart/form-data">
                                                  </div>
                                                  <div class="col-sm-4"></div>
                                              </div>
                                              <div class="form-group" style="margin-bottom: 50px;">
                                                <div class="col-sm-4"></div>
                                                <label class="col-sm-2 control-label" style="margin-left: 0px;">Email Alert: </label>
                                                <div class="col-sm-2" style="margin-left: 0;">
                                                    <input id="email_option_to_recieve_trial_upload_status" name="email_option_to_recieve_trial_upload_status" type="checkbox" data-toggle="toggle">
                                                </div>
                                                <div id="email_field" style="display: none; vertical-align: middle;">
                                                    <label id="trial_email_label_upload" class="control-label">Email: </label>
                                                    <div style="display: inline-block; width: 150px; vertical-align: middle;">
                                                        <input id="trial_email_address_upload" name="trial_email_address_upload" type="email" value="' );
#line 106 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print(  $email_address  );
#line 106 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '">
                                                    </div>
                                                </div>
                                                <div class="col-sm-2"></div>
                                              </div>
                                            </form>
                                            <div style="display:none" id="upload_multiple_trials_warning_messages" class="alert-warning" role="alert">
                                            </div>
                                            <div style="display:none" id="upload_multiple_trials_error_messages" class="alert-danger" role="alert">
                                            </div>
                                            <div style="display:none" id="upload_multiple_trials_success_messages" class="alert-success" role="alert">
                                            </div>

                                            <br>
                                            <button type="button" class="btn btn-primary" id="multiple_trial_designs_upload_submit" disabled>Upload Trial Designs</button>
                                            <button style="display:none" class="btn btn-primary" id="upload_multiple_trials_success_button">Reload Page</button>
                                            <br /><br />
                                        </center>
                                        ' );
#line 124 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/help/file_upload_type.mas', type => "Multiple Trial Designs", optional_column => 1   
); #line 124 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                    </div>

                                </div>
                            ' );
#line 128 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "File Formatting"
 );
#line 128 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                            ' );
#line 130 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 130 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 131 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Enter information about the experiment and upload your trial layout"   
); #line 131 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                              <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_trial_form" name="upload_trial_form">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Trial Name: </label>
                                    <div class="col-sm-9" >
                                        <input type="text" class="form-control" id="trial_upload_name" name="trial_upload_name" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Breeding Program: </label>
                                    <div class="col-sm-9">
                                        <select class="form-control" id="trial_upload_breeding_program" name="trial_upload_breeding_program">
                                            ' );
#line 143 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"

                                            foreach my $program (@$breeding_programs) {
                                                if (@$program[3]) {
                                                    print STDERR "Selected Program is ".@$program[1]."\n";
                                                    print "<option selected=\"selected\" value='".@$program[1]."'>".@$program[1]."</option>";
                                                } else {
                                                    print "<option value='".@$program[1]."'>".@$program[1]."</option>";
                                                }
                                            }
                                            #line 153 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Location: </label>
                                    <div class="col-sm-9" >
                                        <select class="form-control" id="trial_upload_location" name="trial_upload_location">
                                        ' );
#line 160 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"

                                        foreach my $location_hashref (@$locations) {
                                            my $properties = $location_hashref->{'properties'};
                                            my $program = $properties->{'Program'};
                                            my $name = $properties->{'Name'};
                                            print "<option value=\"$name\" data-program=\"$program\">".$name."</option>";
                                        }
                                        #line 168 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Trial Type: </label>
                                    <div class="col-sm-9">
                                        <select class="form-control" id="trial_upload_trial_type" name="trial_upload_trial_type" type="text">
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Year: </label>
                                    <div class="col-sm-9" >
                                        <select class="form-control" id="trial_upload_year" name="trial_upload_year"></select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Planting Date (MM-DD-YYYY): </label>
                                    <div class="col-sm-9" >
                                        <input class="form-control" id="trial_upload_planting_date" name="trial_upload_planting_date" type="text" value="' );
#line 187 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( my$planting_date );
#line 187 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Transplanting Date(MM-DD-YYYY): </label>
                                    <div class="col-sm-9" >
                                        <input class="form-control" id="trial_upload_transplanting_date " name="trial_upload_transplanting_date" type="text" value="' );
#line 193 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( my$transplanting_date );
#line 193 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Plot Width (m): </label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" id="trial_upload_plot_width" name="trial_upload_plot_width" />
                                        <!-- <select class="form-control" id="trial_upload_plot_width" name="trial_upload_plot_width">
                                            <option value="">NA</option>
                                            <option value="0.1">0.1</option>
                                            <option value="0.15">0.15</option>
                                            <option value="0.2">0.2</option>
                                            <option value="0.25">0.25</option>
                                            <option value="0.3">0.3</option>
                                            <option value="0.35">0.35</option>
                                            <option value="0.4">0.4</option>
                                            <option value="0.45">0.45</option>
                                            <option value="0.5">0.5</option>
                                            <option value="0.55">0.55</option>
                                            <option value="0.6">0.6</option>
                                            <option value="0.65">0.65</option>
                                            <option value="0.7">0.7</option>
                                            <option value="0.75">0.75</option>
                                            <option value="0.8">0.8</option>
                                            <option value="0.85">0.85</option>
                                            <option value="0.9">0.9</option>
                                            <option value="0.95">0.95</option>
                                            <option value="1">1</option>
                                            <option value="1.5">1.5</option>
                                            <option value="2">2</option>
                                            <option value="2.5">2.5</option>
                                            <option value="3">3</option>
                                            <option value="3.5">3.5</option>
                                            <option value="4">4</option>
                                            <option value="4.5">4.5</option>
                                            <option value="5">5</option>
                                            <option value="5.5">5.5</option>
                                            <option value="6">6</option>
                                            <option value="6.5">6.5</option>
                                            <option value="7">7</option>
                                            <option value="7.5">7.5</option>
                                            <option value="8">8</option>
                                            <option value="8.5">8.5</option>
                                            <option value="9">9</option>
                                            <option value="9.5">9.5</option>
                                            <option value="10">10</option>
                                            <option value="10.5">10.5</option>
                                            <option value="11">11.0</option>
                                            <option value="11.5">11.5</option>
                                            <option value="12">12.0</option>
                                            <option value="12.5">12.5</option>
                                        </select> -->
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Plot Length (m): </label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" id="trial_upload_plot_length" name="trial_upload_plot_length" />
                                        <!-- <select class="form-control" id="trial_upload_plot_length" name="trial_upload_plot_length">
                                            <option value="">NA</option>
                                            <option value="0.1">0.1</option>
                                            <option value="0.15">0.15</option>
                                            <option value="0.2">0.2</option>
                                            <option value="0.25">0.25</option>
                                            <option value="0.3">0.3</option>
                                            <option value="0.35">0.35</option>
                                            <option value="0.4">0.4</option>
                                            <option value="0.45">0.45</option>
                                            <option value="0.5">0.5</option>
                                            <option value="0.55">0.55</option>
                                            <option value="0.6">0.6</option>
                                            <option value="0.65">0.65</option>
                                            <option value="0.7">0.7</option>
                                            <option value="0.75">0.75</option>
                                            <option value="0.8">0.8</option>
                                            <option value="0.85">0.85</option>
                                            <option value="0.9">0.9</option>
                                            <option value="0.95">0.95</option>
                                            <option value="1">1</option>
                                            <option value="1.5">1.5</option>
                                            <option value="2">2</option>
                                            <option value="2.5">2.5</option>
                                            <option value="3">3</option>
                                            <option value="3.5">3.5</option>
                                            <option value="4">4</option>
                                            <option value="4.5">4.5</option>
                                            <option value="5">5</option>
                                            <option value="5.5">5.5</option>
                                            <option value="6">6</option>
                                            <option value="6.5">6.5</option>
                                            <option value="7">7</option>
                                            <option value="7.5">7.5</option>
                                            <option value="8">8</option>
                                            <option value="8.5">8.5</option>
                                            <option value="9">9</option>
                                            <option value="9.5">9.5</option>
                                            <option value="10">10</option>
                                            <option value="10.5">10.5</option>
                                            <option value="11">11.0</option>
                                            <option value="11.5">11.5</option>
                                            <option value="12">12.0</option>
                                            <option value="12.5">12.5</option>
                                        </select> -->
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Field Size (ha): </label>
                                    <div class="col-sm-9">
                                        <input class="form-control" id="trial_upload_field_size" name="trial_upload_field_size" type="text" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Plants per Plot: </label>
                                    <div class="col-sm-9">
                                        <input class="form-control" id="trial_upload_plant_entries" name="trial_upload_plant_entries" type="text" />
                                        <p><i>Creates plant entries for each plot. Ignore if not adding plant entries.</i></p>
                                    </div>
                                    <label style="font-size: 80%;" class="col-sm-3 control-label">Inherits Treatment(s) From Plots: </label>
                                    <div class="col-sm-8" >
                                        <input name="trial_upload_plants_per_plot_inherit_treatments" id="trial_upload_plants_per_plot_inherit_treatments" type="checkbox" checked disabled/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Assign row and column data to plants within plots?</label>
                                        <div class="col-sm-9" >
                                            <input name="trial_upload_rows_and_columns_to_plants" id="trial_upload_rows_and_columns_to_plants" type="checkbox"/>
                                            <div id="trial_upload_plant_row_column_format_dialog" style="display:none">
                                                <p><i>One plant per (row,column) coordinate. Rows and columns will be populated in a zigzag pattern. Row and column numbers start at 1 within each plot.</i></p>
                                                <table style="width:60%">
                                                    <tr>
                                                        <td>
                                                            <label>Number of rows per plot</label>
                                                        </td>
                                                        <td>
                                                            <input name="trial_upload_rows_per_plot" id="trial_upload_rows_per_plot" type="number"/>
                                                        </td>
                                                    </tr><tr>
                                                        <td>
                                                            <label>Number of columns per plot</label>
                                                        </td>
                                                        <td>
                                                            <input name="trial_upload_cols_per_plot" id="trial_upload_cols_per_plot" type="number"/>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Description: </label>
                                    <div class="col-sm-9" >
                                        <textarea class="form-control" id="trial_upload_description" name="trial_upload_description" form="upload_trial_form" maxlength="250"></textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Stock Type Being Evaluated in Trial: </label>
                                    <div class="col-sm-9">
                                        <select class="form-control" id="trial_upload_trial_stock_type" name="trial_upload_trial_stock_type">
                                            <option value="">Select a stock type</option>
                                            <option value="accession">accession</option>
                                            <option value="cross">cross</option>
                                            <option value="family_name">family_name</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Design Type: </label>
                                    <div class="col-sm-9" >
                                        <select class="form-control" id="trial_upload_design_method" name="trial_upload_design_method">
' );
#line 362 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
 foreach my $type(@$design_types){
    my $method;
    if ($type eq 'Completely Randomized'){
        $method = 'CRD';
    } elsif ($type eq 'Complete Block'){
        $method = 'RCBD';
    } elsif ($type eq 'Resolvable Row-Column'){
        $method = 'RRC';
    } elsif ($type eq 'DRRC'){
        $method = 'DRRC';
    } elsif ($type eq 'Un-Replicated Diagonal Design'){
        $method = 'URDD';
    } elsif ($type eq 'Augmented Row-Column'){
        $method = 'ARC';
    } elsif ($type eq 'Alpha Lattice'){
        $method = 'Alpha';
    } elsif ($type eq 'Modified Augmented Design'){
        $method = 'MAD';
    } elsif ($type eq 'Nursery/Greenhouse'){
        $method = 'greenhouse';
    } elsif ($type eq 'Split Plot'){
        $method = 'splitplot';
    } elsif ($type eq 'Strip Plot'){
        $method = 'stripplot';
    } elsif ($type eq 'Partially Replicated'){
        $method = 'p-rep';
    } else {
        $method = $type;
    }
$m->print( '    <option value="' );
#line 391 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( $method );
#line 391 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '">' );
#line 391 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( $type );
#line 391 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '</option>
' );
#line 392 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
}
$m->print( '                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">Upload File: </label>
                                    <div class="col-sm-9" >
                                        <input type="file" name="trial_uploaded_file" id="trial_uploaded_file" encoding="multipart/form-data" />
                                    </div>
                                </div>

                                <br/><br/>
                                <center>
                                <button id="next_step_trial_information_button" class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go To Next Step</button>
                                </center>
                            ' );
#line 407 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Enter trial information"
 );
#line 407 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 408 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 408 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 409 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Is your trial linked with other field trials, genotyping plates, or crossing experiments in the database? If you are unsure, you can skip this. This information can be added from the trial detail page after the trial is saved."   
); #line 409 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                                <div class="well form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">Is this trial following-up a previous field trial?: </label>
                                        <div class="col-sm-7">
                                            <select class="form-control" id="upload_trial_trial_sourced" name="upload_trial_trial_sourced">
                                                <option value="no">No</option>
                                                <option value="yes">Yes</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-group" style="display:none" id="upload_trial_source_trial_section">
                                        <label class="col-sm-5 control-label">Select the trial(s) which preceded this trial: </label>
                                        <div class="col-sm-7">
                                            <div id="upload_trial_trial_source" name="upload_trial_trial_source">
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <p>If you go on to collect tissue samples for creating a 96 well plate for genotyping, when adding the genotyping plate (96 well plate layout) to the database you can use plot names or plant names or tissue sample names from this field trial. By doing so, we can create linkage between this field trial and the genotyping plate.</p>

                                <div class="well form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">Will this trial be genotyped?: </label>
                                        <div class="col-sm-7">
                                            <select class="form-control" id="upload_trial_trial_will_be_genotyped" name="upload_trial_trial_will_be_genotyped">
                                                <option value="no">No</option>
                                                <option value="yes">Yes</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <p>If you go on to perform crosses on this field trial, each cross can be linked to specific female and male plots. When you upload these crosses we can then automatically link this field trial to the crossing experiment in the database.</p>

                                <div class="well form-horizontal">
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">Will crosses be done on this trial?: </label>
                                        <div class="col-sm-7">
                                            <select class="form-control" id="upload_trial_trial_will_be_crossed" name="upload_trial_trial_will_be_crossed">
                                                <option value="no">No</option>
                                                <option value="yes">Yes</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>

                                <br />

                                <div class="form-horizontal">
                                    <p>Check this box to ignore any possible warning messages and save the trial to the database.</p>
                                    <div class="form-group">
                                        <label class="col-sm-5 control-label">Ignore Warnings?: </label>
                                        <div class="col-sm-7">
                                            <input id="upload_trial_ignore_warnings" name="upload_trial_ignore_warnings" type="checkbox">
                                        </div>
                                    </div>
                                </div>

                                <div style="display:none; padding: 5px; text-align: center" id="upload_trial_warning_messages" class="alert-warning" role="alert"></div>

                                <br />

                                <center>
                                    <button type="button" class="btn btn-lg btn-primary" name="upload_trial_validate_form_button" id="upload_trial_validate_form_button">First validate the form</button>
                                    <button type="button" class="btn btn-lg btn-primary" disabled name="upload_trial_submit_first" onclick="Workflow.complete(this, false); return false;" >Upload Trial</button>
                                <center>
                            ' );
#line 478 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Trial Linkage"
 );
#line 478 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                            ' );
#line 480 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 480 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 481 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Fixing the missing accession(s) problem"   
); #line 481 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                                <div id="upload_trial_missing_accessions_div" style="display:none">
                                    <div class="well">
                                        <ul>
                                            <li>Accessions tested in your trial must exist in the database prior to adding your trial. The reason for this is that an accession can be tested in many trials and therefore exists as a separate entity in the database. We also want to be careful about adding new accessions into the database because we do not want incorrectly duplicated data.</li>
                                            <li>When adding accessions into the database, you can use either a list of accessions or an Excel file.</li>
                                        </ul>
                                    </div>

                                    <div id="upload_trial_add_missing_accessions_html">
                                    </div>

                                    <button class="btn btn-info" name="add_accessions_link">Add your accessions to the database</button><br/><br/>
                                    <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Once all your accessions are in the database Click Here</button><br/><br/>
                                </div>
                                <div id="upload_trial_error_display">

                                    <h3>Trial Upload Error Messages</h3>
                                    <div class="panel panel-danger">
                                        <div class="panel-body">
                                            <table>
                                                <tbody></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <center>
                                <div id="upload_trial_no_error_messages_html">
                                </div>
                                <div name="upload_trial_completed_message">
                                </div>
                                </center>
                            ' );
#line 514 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Fix missing accessions problem"
 );
#line 514 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 515 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 515 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 516 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Fixing the missing seedlot(s) problem"   
); #line 516 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                                <div id="upload_trial_missing_seedlots_div" style="display:none">
                                    <div class="well">
                                        <ul>
                                            <li>Seedlots tested in your experimental trial must exist in the database prior to adding your trial. The reason for this is that a seedlot can be tested in many trials and therefore exists as a separate entity in the database. We also want to be careful about adding new seedlots into the database because we do not want data to be incorrectly linked to duplicates.</li>
                                        </ul>
                                    </div>
                                    <ul>
                                    <li>When adding seedlots into the database, you can upload an Excel file or you can add seedlots one at a time.<br/><br/>
                                        <ul>
                                        <li><button class="btn btn-info" name="seedlot_bulk_upload">Upload Excel file</button><br/><br/></li>
                                        <li><button class="btn btn-info" name="add_seedlot_button">Add One Seedlot</button></li>
                                        </ul>
                                    </li>
                                    </ul><br/>
                                    <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Once all your seedlots are in the database Click Here</button><br/><br/>
                                </div>
                                <div id="upload_trial_error_display_seedlot">

                                    <h3>Trial Upload Error Messages</h3>
                                    <div class="panel panel-danger">
                                        <div class="panel-body">
                                            <table>
                                                <tbody></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <center>
                                <div id="upload_trial_no_error_messages_seedlot_html">
                                </div>
                                <div name="upload_trial_completed_message">
                                </div>
                                </center>
                            ' );
#line 551 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Fix missing seedlots problem"
 );
#line 551 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 552 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 552 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 553 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Submit your trial again. You should have corrected all errors by now, but if not please take a look at the errors in the red box below. You can continue to modify your file and then click Upload until it works."   
); #line 553 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                <div id="trial_upload_show_repeat_upload_button">
                                    <center>
                                    <button type="button" class="btn btn-lg btn-primary" name="upload_trial_submit_second" >Upload Trial</button><br/><br/>
                                    </center>
                                </div>
                                <center>
                                <div name="upload_trial_completed_message">
                                </div>
                                </center>

                                <div id="upload_trial_error_display_second_try" style="display:none">

                                    <h3>There exist these problems in your file:</h3>
                                    <div class="panel panel-danger">
                                        <div class="panel-body">
                                            <table>
                                                <tbody></tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            ' );
#line 575 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Try submitting trial again"
 );
#line 575 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                            ' );
#line 576 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 576 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                ' );
#line 577 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Finished! Your trial is now in the database"   
); #line 577 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                                <p>
                                    <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
                                    The trial file was uploaded successfully
                                </p>

                                <ul>
                                    <li>You may want to proceed to the trial detail page for the trial you just created.</li>
                                    <li>You can print barcodes for the plots or plants or tissue samples in this trial.</li>
                                    <li>You an add phenotypes for the plots or plants in this trial now.</li>
                                </ul>
                                <br/>
                                <div name="upload_trial_completed_message"></div>
                                <!--center>
                                <button class="btn btn-primary" id="upload_trial_success_complete_button">The trial was saved to the database with no errors! Congrats Click Here</button><br/><br/>
                                </center-->
                            ' );
#line 593 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas:complete', title=> "Complete"
 );
#line 593 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                        ' );
#line 594 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/util/workflow.mas', id=> "trial_upload_workflow"
 );
#line 594 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                    </form>
                </div>
            </div>
            <div class="modal-footer">
                <button id="close_trial_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="trial_upload_spreadsheet_info_dialog" name="trial_upload_spreadsheet_info_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadTrialInfoDialog">
    <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content">
            <div class="modal-header" style="text-align: center">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="uploadTrialInfoDialog">Upload Template Information</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <b>Trials may be uploaded in an Excel file (.xls or .xlsx)</b>
                    <br />
                    <hr>
                    ' );
#line 617 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 617 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                        <div class="well well-sm">
                            <b>Header:</b>
                            <br/>
                            The first row (header) must contain the following:
                            <br />
                            <table class="table table-hover table-bordered table-condensed" >
                                <thead></thead>
                                <tbody>
                                    <tr>
                                        <td>plot_name</td>
                                        <td>accession_name</td>
                                        <td>plot_number</td>
                                        <td>block_number</td>
                                        <td>is_a_control</td>
                                        <td>rep_number</td>
                                        <td>range_number</td>
                                        <td>row_number</td>
                                        <td>col_number</td>
                                        <td>seedlot_name</td>
                                        <td>num_seed_per_plot</td>
                                        <td>weight_gram_seed_per_plot</td>
                                        <td>entry_number</td>
                                    </tr>
                                </tbody>
                            </table>
                            <b>Header as a string:</b><br/>
                            <p>plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot,entry_number</p>
                        </div>
                    ' );
#line 646 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/info_section.mas', title=>"Stock type being evaluated in this trial: accession", collapsible=>1, collapsed=>1
 );
#line 646 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                    ' );
#line 648 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 648 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                        <div class="well well-sm">
                            <b>Header:</b>
                            <br/>
                            The first row (header) must contain the following:
                            <br />
                            <table class="table table-hover table-bordered table-condensed" >
                                <thead></thead>
                                <tbody>
                                    <tr>
                                        <td>plot_name</td>
                                        <td>cross_unique_id</td>
                                        <td>plot_number</td>
                                        <td>block_number</td>
                                        <td>is_a_control</td>
                                        <td>rep_number</td>
                                        <td>range_number</td>
                                        <td>row_number</td>
                                        <td>col_number</td>
                                        <td>seedlot_name</td>
                                        <td>num_seed_per_plot</td>
                                        <td>weight_gram_seed_per_plot</td>
                                        <td>entry_number</td>
                                    </tr>
                                </tbody>
                            </table>
                            <b>Header as a string:</b><br/>
                            <p>plot_name,cross_unique_id,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot,entry_number</p>
                        </div>
                    ' );
#line 677 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/info_section.mas', title=>"Stock type being evaluated in this trial: cross unique id", collapsible=>1, collapsed=>1
 );
#line 677 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                    ' );
#line 679 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 679 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                        <div class="well well-sm">
                            <b>Header:</b>
                            <br/>
                            The first row (header) must contain the following:
                            <br />
                            <table class="table table-hover table-bordered table-condensed" >
                                <thead></thead>
                                <tbody>
                                    <tr>
                                        <td>plot_name</td>
                                        <td>family_name</td>
                                        <td>plot_number</td>
                                        <td>block_number</td>
                                        <td>is_a_control</td>
                                        <td>rep_number</td>
                                        <td>range_number</td>
                                        <td>row_number</td>
                                        <td>col_number</td>
                                        <td>seedlot_name</td>
                                        <td>num_seed_per_plot</td>
                                        <td>weight_gram_seed_per_plot</td>
                                        <td>entry_number</td>
                                    </tr>
                                </tbody>
                            </table>
                            <b>Header as a string:</b><br/>
                            <p>plot_name,family_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot,entry_number</p>
                        </div>
                    ' );
#line 708 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/info_section.mas', title=>"Stock type being evaluated in this trial: family name", collapsible=>1, collapsed=>1
 );
#line 708 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                    <b>Required fields:</b>
                    <ul>
                    <li>accession_name or cross_unique_id or family_name (must exist in the database. This is the accession or cross unique id or family name being tested in the plot.)</li>
                    <li>plot_number (a sequential number for the plot in the field (e.g. 1001, 1002, 2001, 2002). These numbers should be unique for the trial.)</li>
                    <li>block_number (a design parameter indicating which block the plot is in)</li>
                    </ul>

                    <b>Optional fields:</b>
                    <ul>
                    <li>plot_name (must be unique across entire database. If not provided in the file, it will be automatically generated as <code>{trial_name}-PLOT_{plot_number}</code>.)</li>
                    <li>is_a_control (type 1 in this field if the plot is a control, otherwise leave blank. generally you will have accessions/cross unique ids/family names that are controls, so you should indicate the plots of those accessions/cross unique ids/family names as a control.)</li>
                    <li>rep_number (replicate number, numeric)</li>
                    <li>range_number (range number. often synonymous with col_number, numeric)</li>
                    <li>row_number (row number. If the field is a grid, this represents the y coordinate, numeric, required for field map generation.)</li>
                    <li>col_number (column number. If the field is a grid, this represents the x coordinate. Sometimes called range_number, numeric, required for field map generation.)</li>
                    <li>seedlot_name (the seedlot from where the planted seed originated. Must exist in the database)</li>
                    <li>num_seed_per_plot (number seeds per plot. Seed is transferred from seedlot mentioned in seedlot_name. Numeric)</li>
                    <li>weight_gram_seed_per_plot (weight in gram of seeds in plot. seed is transferred from seedlot mentioned in seedlot name. Numeric)</li>
                    <li>entry_number (a trial-level entry number assigned to the stock. Numeric)</li>
                    </ul>

                    <b>Treatments:</b>
                    <ul>
                    <li>treatment columns (additional column(s) that specify the name of a treatment (e.g. inoculated, drought, etc). The value for each plot should be 1 if the treatment was applied or empty.)</li>
                    </ul>

                    <hr />
                    <p>Only the required fields are necessary to include in the upload template.  You may add any additional optional fields.  The fields can be in any order.</p>
                </div>
            </div>
            <div class="modal-footer">
                <button id="close_trial_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade" id="multiple_trial_upload_spreadsheet_info_dialog" name="multiple_trial_upload_spreadsheet_info_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadMultipleTrialInfoDialog">
    <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content">
            <div class="modal-header" style="text-align: center">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="uploadMultipleTrialInfoDialog">Upload Template Information</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <br />
                    <b>Multiple Trial Designs:</b>
                    <br />
                    <b>Header:</b>
                    <br>
                    The first row (header) must contain the following, which is an expansion of the single trial design header:
                    <br />

                    <table class="table table-hover table-bordered table-condensed" >
                        <thead></thead>
                        <tbody>
                            <tr>
                                <td>trial_name</td>
                                <td>breeding_program</td>
                                <td>location</td>
                                <td>year</td>
                                <td>transplanting_date</td>
                                <td>design_type</td>
                                <td>description</td>
                                <td>trial_type</td>
                                <td>trial_stock_type</td>
                                <td>plot_width</td>
                                <td>plot_length</td>
                                <td>field_size</td>
                                <td>planting_date</td>
                                <td>harvest_date</td>
                                <td>plot_name</td>
                                <td>accession_name</td>
                                <td>plot_number</td>
                                <td>block_number</td>
                                <td>is_a_control</td>
                                <td>rep_number</td>
                                <td>range_number</td>
                                <td>row_number</td>
                                <td>col_number</td>
                                <td>seedlot_name</td>
                                <td>num_seed_per_plot</td>
                                <td>weight_gram_seed_per_plot</td>
                                <td>entry_number</td>
                            </tr>
                        </tbody>
                    </table>

                    <b>Header as a string:</b><br/>
                    <p>trial_name,breeding_program,location,year,transplanting_date,design_type,description,trial_type,trial_stock_type,plot_width,plot_length,field_size,planting_date,harvest_date,plot_name,accession_name,plot_number,block_number,is_a_control,rep_number,range_number,row_number,col_number,seedlot_name,num_seed_per_plot,weight_gram_seed_per_plot,entry_number</p>

                    <b> Required fields:</b>
                    <ul>
                    <li>trial_name (Must be unique across entire database. It is often a concatenation of the year, transplanting_date, purpose, unique number, and location.)</li>
                    <li>breeding_program (The name of breeding program that managed the trial, must exist in the database.)</li>
                    <li>location (The <strong>name</strong> or <strong>abbreviation</strong> of the location where the trial was held, must exist in the database.)</li>
                    <li>year (The year the trial was held.)</li>

                    <li>design_type (The shorthand for the design type, must exist in the database. Possible values include CRD (Completely Randomized Design), RCBD (Randomized Complete Block Design), RRC (Resolvable Row-Column), DRRC (Doubly-Resolvable Row-Column), URDD (Un-Replicated Diagonal Design), ARC (Augmented Row-Column), Alpha (Alpha Lattice Design), Lattice (Lattice Design), Augmented (Augmented Design), MAD (Modified Augmented Design), greenhouse (undesigned Nursery/Greenhouse), splitplot (Split Plot), stripplot (Strip Plot / Split Block), p-rep (Partially Replicated), Westcott (Westcott Design))</li>
                    <li>description (Additional text with any other relevant information about the trial.)</li>
                    <li>accession_name OR cross_unique_id OR family_name (The accession, cross, or family being tested in the plot, must exist in the database.)</li>
                    <li>plot_number (A sequential number for the plot in the field (e.g. 1001, 1002, 2001, 2002). These numbers should be unique for the trial.)</li>
                    <li>block_number (A design parameter indicating which block the plot is in.)</li>
                    </ul>

                    <b>Additional optional fields:</b>
                    <ul>
                    <li>plot_name (Must be unique across entire database. If not provided in the file, it will be automatically generated as <code>{trial_name}-PLOT_{plot_number}</code>)</li>
                    <li>trial_type (The name of the trial type, must exist in the database. Possible values include Seedling Nursery, phenotyping_trial, Advanced Yield Trial, Preliminary Yield Trial, Uniform Yield Trial, Variety Release Trial, Clonal Evaluation, genetic_gain_trial, storage_trial, heterosis_trial, health_status_trial, grafting_trial, Screen House, Seed Multiplication, crossing_block_trial, Specialty Trial)</li>
                    <li>trial_stock_type (The type of stocks that are being evaluated in the trial.  Can be either \'accession\', \'cross\', or \'family_name\'.  When not provided, \'accession\' is used as the default)
                    <li>plot_width (plot width in meters)</li>
                    <li>plot_length (plot length in meters)</li>
                    <li>field_size (field size in hectares)</li>
                    <li>planting_date (Date of Planting in YYYY-MM-DD format)</li>
                    <li>transplanting_date(The transplanting_date of the trial was conducted. Date in YYYY-MM-DD format)</li>
                    <li>harvest_date (Date of Harvest in YYYY-MM-DD format)</li>
                    <li>is_a_control (type 1 in this field if the plot is a control, otherwise 0 or leave blank. generally you will have accessions that are controls, so you should indicate the plots that that accession is in as a control.)</li>
                    <li>rep_number (replicate number, must be numeric)</li>
                    <li>range_number (range number. often synonymous with col_number, must be numeric)</li>
                    <li>row_number (row number. if the field is a grid, this represents the y coordinate, numeric, required for field map generation.)</li>
                    <li>col_number (column number. if the field is a grid, this represents the x coordinate. sometimes called range_number, numeric, required for field map generation.)</li>
                    <li>seedlot_name (the seedlot from where the planted seed originated. must exist in the database)</li>
                    <li>num_seed_per_plot (number seeds per plot. seed is transferred from seedlot mentioned in seedlot_name. numeric)</li>
                    <li>weight_gram_seed_per_plot (weight in gram of seeds in plot. seed is transferred from seedlot mentioned in seedlot name. numeric)</li>
                    <li>entry_number (a trial-level entry number assigned to the stock. Numeric)</li>
                    </ul>

                    <b>Treatments:</b>
                    <ul>
                    <li>treatment columns (additional column(s) that specify the name of a treatment (e.g. inoculated, drought, etc). the value for each plot should be 1 if the treatment was applied or empty if not applied.)</li>
                    </ul>

                    <hr />
                    ' );
#line 845 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/help/file_upload_type.mas', type => "Trials", optional_column => 1   
); #line 845 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                </div>
            </div>
            <div class="modal-footer">
                <button id="close_multiple_trial_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="upload_trial_metadata_dialog" name="upload_trial_metadata_dialog" tabindex="-1" role="dialog" aria-labelledby="uploadTrialMetadataDialog">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="uploadTrialMetadataDialog">Upload Trial Metadata</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <p>This upload can be used to update the metadata of trials that have <strong>already been added to the database</strong></p>
                    <p>Any metadata provided in the upload file will replace any existing metadata.  Blank values in the upload file will leave the existing metadata unchanged.</p>

                    ' );
#line 868 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp( { content => sub {
#line 868 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                        <p>
                            <b>File format information</b>
                            <br>
                            <a id="trial_metadata_upload_spreadsheet_format_info">Spreadsheet format</a>
                        </p>
                    ' );
#line 874 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
} }, '/page/explanation.mas', title=>'Template information'
 );
#line 874 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '

                    <form method="post" enctype="multipart/form-data" encoding="multipart/form-data" id="upload_trial_metadata_form" name="upload_trial_metadata_form">
                        <label for="trial_metadata_upload_file" style="display: inline-block;">Trial Metadata File:</label>
                        <input type="file" name="trial_metadata_upload_file" id="trial_metadata_upload_file" encoding="multipart/form-data" />
                    </form>

                    <div style="display:none; margin: 15px; padding: 15px" id="upload_trial_metadata_warning_messages" class="alert-warning" role="alert"></div>
                    <div style="display:none; margin: 15px; padding: 15px" id="upload_trial_metadata_error_messages" class="alert-danger" role="alert"></div>
                    <div style="display:none; margin: 15px; padding: 15px" id="upload_trial_metadata_success_messages" class="alert-success" role="alert"></div>

                    <div style="margin: 15px; text-align: center">
                        <button style="display:none" class="btn btn-primary" id="upload_trial_metadata_success_button">Reload Page</button>
                    </div>

                    ' );
#line 889 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/help/file_upload_type.mas', type => "Trial Metadata" , optional_column => 1   
); #line 889 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" class="btn btn-primary" name="upload_trial_metadata_dialog_submit" id="upload_trial_metadata_dialog_submit">Upload</button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="trial_metadata_upload_spreadsheet_format_modal" name="trial_metadata_upload_spreadsheet_format_modal" tabindex="-1" role="dialog" aria-labelledby="uploadTrialMetadataInfoDialog">
    <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content">
            <div class="modal-header" style="text-align: center">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="uploadTrialMetadataInfoDialog">Upload Trial Metadata Template Information</h4>
            </div>
            <div class="modal-body">
                <div class="container-fluid">
                    <b>Header:</b>
                    <br>
                    The first row (header) should contain the following:
                    <br />

                    <table class="table table-hover table-bordered table-condensed" >
                        <thead></thead>
                        <tbody>
                            <tr>
                                <td>trial_name</td>
                                <td>breeding_program</td>
                                <td>location</td>
                                <td>year</td>
                                <td>transplanting_date</td>
                                <td>planting_date</td>
                                <td>harvest_date</td>
                                <td>design_type</td>
                                <td>description</td>
                                <td>trial_type</td>
                                <td>plot_width</td>
                                <td>plot_length</td>
                                <td>field_size</td>
                            </tr>
                        </tbody>
                    </table>

                    <b>Required Fields:</b>
                    <ul>
                        <li><b>trial_name:</b> the name of the trial (must already exist in the database)</li>
                    </ul>
                    <br><b>Optional values:</b><br>
                    <ul>
                        <li>new_trial_name (A new name for the trial, must not already exist in the database)</li>
                        <li>breeding_program (The name of breeding program that managed the trial, must exist in the database.)</li>
                        <li>location (The <strong>name</strong> or <strong>abbreviation</strong> of the location where the trial was held, must exist in the database.)</li>
                        <li>year (The year the trial was held.)</li>
                        <li>transplanting_date (The transplanting_date of the trial was conducted. Date in YYYY-MM-DD format or \'remove\' to remove the date)</li>
                        <li>planting_date (Date of Planting in YYYY-MM-DD format or \'remove\' to remove the date)</li>
                        <li>harvest_date (Date of Harvest in YYYY-MM-DD format or \'remove\' to remove the date)</li>
                        <li>design_type (The shorthand for the design type, must exist in the database. Possible values include CRD (Completely Randomized Design), RCBD (Randomized Complete Block Design), RRC (Resolvable Row-Column), DRRC (Doubly-Resolvable Row-Column), URDD (Un-Replicated Diagonal Design), ARC (Augmented Row-Column), Alpha (Alpha Lattice Design), Lattice (Lattice Design), Augmented (Augmented Design), MAD (Modified Augmented Design), greenhouse (undesigned Nursery/Greenhouse), splitplot (Split Plot), p-rep (Partially Replicated), Westcott (Westcott Design))</li>
                        <li>description (Additional text with any other relevant information about the trial.)</li>
                        <li>trial_type (The name of the trial type, must exist in the database. Possible values include Seedling Nursery, phenotyping_trial, Advanced Yield Trial, Preliminary Yield Trial, Uniform Yield Trial, Variety Release Trial, Clonal Evaluation, genetic_gain_trial, storage_trial, heterosis_trial, health_status_trial, grafting_trial, Screen House, Seed Multiplication, crossing_block_trial, Specialty Trial)</li>
                        <li>plot_width (plot width in meters)</li>
                        <li>plot_length (plot length in meters)</li>
                        <li>field_size (field size in hectares)</li>
                    </ul>
                </div>
                ' );
#line 956 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->comp(   '/help/file_upload_type.mas', type => "Trial Metadata", optional_column => 1   
); #line 956 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_upload_dialogs.mas"
$m->print( '
            </div>
            <div class="modal-footer">
                <button id="close_trial_metadata_upload_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>



<script>
jQuery(document).ready(function(){

    jQuery(\'#trial_upload_rows_and_columns_to_plants\').click( function () {
        if (jQuery(\'#trial_upload_rows_and_columns_to_plants\').is(\':checked\')){
            jQuery(\'#trial_upload_plant_row_column_format_dialog\').show();
        } else {
            jQuery(\'#trial_upload_plant_row_column_format_dialog\').hide();
        }

    });

    var selectedProgram = jQuery(\'#trial_upload_breeding_program\').val()

    filter_options(selectedProgram, \'program\', \'trial_upload_location\');

    jQuery(\'#trial_upload_breeding_program\').change(function() {
        filter_options(jQuery(this).val(), \'program\', \'trial_upload_location\');
    });

    jQuery(\'#multiple_trial_designs_upload_file\').change(function() {
        if (jQuery(this).val()) {
          jQuery(\'#multiple_trial_designs_upload_submit\').prop("disabled",false);
        } else {
          jQuery(\'#multiple_trial_designs_upload_submit\').prop("disabled",true);
        }
    });

    jQuery(\'#upload_multiple_trials_ignore_warnings\').change(function() {
      if (this.checked) {
        jQuery(\'#upload_multiple_trials_warning_messages\').hide();
      }
    });
});
</script>
' );
;return;
},
'declared_args' => {
  '$breeding_programs' => { default => undef },
  '$design_types' => { default => ' ()' },
  '$locations' => { default => undef }
},
'load_time' => 1763079527,

)
;