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 ( $programs, $locations );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

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

#line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '

' );
#line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp(   '/util/import_javascript.mas', classes => ['CXGN.BreedersToolbox.Crosses', 'CXGN.TrialTreeFolders']   
); #line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '

<div class="modal fade" id="create_crossingtrial_dialog" name="create_crossingtrial_dialog" tabindex="-1" role="dialog" aria-labelledby="createCrossingTrialDialog">
    <div class="modal-dialog modal-xl" role="document">
        <div class="modal-content ui-front">
            <div class="modal-header">
                <button type="reset" class="close" id="add_crossing_experiment_dismiss_button_1" name="add_crossing_experiment_dismiss_button" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <center><h4 class="modal-title" id="creatCrossingTrial">Add New Crossing Experiment</h4></center>
            </div>
            <div class="modal-body">
                <div class="container-fluid">

                    ' );
#line 19 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp( { content => sub {
#line 19 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                        ' );
#line 20 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp( { content => sub {
#line 20 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                            ' );
#line 21 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"What are crossing experiments?"   
); #line 21 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '

                            <p>Crossing experiments group crosses. The grouping can reflect crosses done in the same field trial, crosses in a breeding program in a given year, or crosses that have the same breeding objective. This grouping can be used to encapsulate all the crosses done in a crossing block field trial that you have saved in the database (e.g. in Manage Trials your crossing block will appear as a field trial with plots)</p>
                            <hr>

                            <center>
                                <button id="next_step_add_new_intro" class="btn btn-primary" onclick="Workflow.complete(this);">Go to Next Step</button>
                            </center>
                        ' );
#line 29 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Intro"
 );
#line 29 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '

                        <form class="form-horizontal" role="form" name="create_crossingtrial_form" id="create_crossingtrial_form">
                            ' );
#line 32 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp( { content => sub {
#line 32 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                                ' );
#line 33 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Enter basic information about the crossing experiment"   
); #line 33 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                                    <br/>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-lable">Crossing Experiment Name: </label>
                                        <div class="col-sm-8">
                                            <input class="form-control" type="text" id="crossingtrial_name" name="crossingtrial_name"  />
                                        </div>
                                    </div><br/><br/>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">Breeding Program: </label>
                                        <div class="col-sm-8">
                                            <select class="form-control" id="crossingtrial_program" name="crossingtrial_program">
                                                <option value="">Select Breeding Program</option>
' );
#line 46 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"

foreach my $program (@$programs) {
    if (@$program[3]) {
        print "<option selected=\"selected\" value='".@$program[0]."'>".@$program[1]."</option>";
    } else {
        print "<option value='".@$program[0]."'>".@$program[1]."</option>";
    }
}
#line 55 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '                                            </select>
                                        </div>
                                    </div><br/><br/>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">Location of crossing experiment: </label>
                                        <div class="col-sm-8">
                                            <select class="form-control" id="crossingtrial_location" name="crossingtrial_location">
                                                <option value="">Select Location</option>
' );
#line 63 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_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 71 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '                                            </select>
                                        </div>
                                    </div><br/><br/>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">Year:</label>
                                        <div class="col-sm-8">
                                            <div id="crosses_add_project_year" name="crosses_add_project_year" ></div>
                                        </div>
                                    </div><br/><br/>
                                    <div class="form-group">
                                        <label class="col-sm-4 control-label">Description:</label>
                                        <div class="col-sm-8">
                                            <textarea class="form-control" id="crosses_add_project_description" name="crosses_add_project_description" ></textarea>
                                        </div>
                                    </div>
                                <br/>
                                <br/>
                                <br/>
                                <center>
                                    <button type="button" class="btn btn-primary" onclick="Workflow.complete(this, false);" name="create_crossingtrial_submit" id="create_crossingtrial_submit">Submit</button>
                                </center>
                            ' );
#line 92 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
} }, '/util/workflow.mas:step', title=> "Add a crossing experiment"
 );
#line 92 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                        </form>

                        ' );
#line 95 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp( { content => sub {
#line 95 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                            ' );
#line 96 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->comp(   '/page/page_title.mas', title=>"Finished! Your crossing experiment is now in the database"   
); #line 96 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                            <p>
                                <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
                                Crossing experiment was added successfully
                            </p>

                            <ul>
                                <li>You may want to proceed to the crossing experiment detail page you just created.</li>
                                <li>You can add or upload crosses into your crossing experiment as they become available.</li>
                                <li>You can add crossing information as it becomes available (e.g. number of seeds, progeny, etc).</li>
                            </ul>
                            <br/>
                        ' );
#line 108 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
} }, '/util/workflow.mas:complete', title=> "Complete"
 );
#line 108 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '
                    ' );
#line 109 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
} }, '/util/workflow.mas', id=> "add_crossing_trial_workflow"
 );
#line 109 "/home/production/cxgn/sgn/mason/breeders_toolbox/cross/add_crossing_trial_dialogs.mas"
$m->print( '<!-- End of workflow -->
                </div>
            </div>
            <div class="modal-footer">
                <button id="add_crossing_experiment_dismiss_button_2" name="add_crossing_experiment_dismiss_button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
            </div>
        </div>
    </div>
</div>

<script>

jQuery(document).ready(function(){

    var selectedProgram = jQuery(\'#crossingtrial_program option:selected\').text()

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

    jQuery(\'#crossingtrial_program\').change(function() {
        filter_options(jQuery(\'#crossingtrial_program option:selected\').text(), \'program\', \'crossingtrial_location\');
    });

    jQuery("[name=\'add_crossing_experiment_dismiss_button\']").click(function() {
        jQuery(\'#create_crossingtrial_dialog\').modal(\'hide\');
        jQuery(\'#crossingtrial_name\').val(\'\');
        jQuery(\'#crossingtrial_program\').val(\'\');
        jQuery(\'#crossingtrial_location\').val(\'\');
        jQuery(\'#crosses_add_project_year\').val(\'\');
        jQuery(\'#crosses_add_project_description\').val(\'\');
    });


});

</script>
' );
;return;
},
'declared_args' => {
  '$locations' => { default => undef },
  '$programs' => { default => undef }
},
'load_time' => 1763079528,

)
;