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 ( $trial_id, $trial_name, $breeding_program_name, $breeding_program_id, $location_name, $country_name, $year, $trial_type, $planting_date, $transplanting_date, $harvest_date, $trial_description, $folder_name, $folder_id, $identifier_prefix, $plot_width, $plot_length, $field_size, $field_trial_is_planned_to_be_genotyped, $field_trial_is_planned_to_cross, $trial_stock_type, $trial_stock_count, $trial_owner, $latest_trial_activity );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( trial_id trial_name breeding_program_name breeding_program_id location_name country_name year trial_type planting_date transplanting_date harvest_date trial_description folder_name folder_id identifier_prefix plot_width plot_length field_size field_trial_is_planned_to_be_genotyped field_trial_is_planned_to_cross trial_stock_type trial_stock_count trial_owner ) )
    {
        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/trial/trial_details.mas"
    $trial_id = $_[ $pos{'trial_id'} ];
#line 3 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_name = $_[ $pos{'trial_name'} ];
#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $breeding_program_name = $_[ $pos{'breeding_program_name'} ];
#line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $breeding_program_id = $_[ $pos{'breeding_program_id'} ];
#line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $location_name = $_[ $pos{'location_name'} ];
#line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $country_name = $_[ $pos{'country_name'} ];
#line 8 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $year = $_[ $pos{'year'} ];
#line 9 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_type = $_[ $pos{'trial_type'} ];
#line 10 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $planting_date = $_[ $pos{'planting_date'} ];
#line 11 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $transplanting_date = $_[ $pos{'transplanting_date'} ];
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $harvest_date = $_[ $pos{'harvest_date'} ];
#line 13 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_description = $_[ $pos{'trial_description'} ];
#line 14 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $folder_name = $_[ $pos{'folder_name'} ];
#line 15 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $folder_id = $_[ $pos{'folder_id'} ];
#line 16 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $identifier_prefix = $_[ $pos{'identifier_prefix'} ];
#line 17 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $plot_width = $_[ $pos{'plot_width'} ];
#line 18 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $plot_length = $_[ $pos{'plot_length'} ];
#line 19 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $field_size = $_[ $pos{'field_size'} ];
#line 20 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $field_trial_is_planned_to_be_genotyped = $_[ $pos{'field_trial_is_planned_to_be_genotyped'} ];
#line 21 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $field_trial_is_planned_to_cross = $_[ $pos{'field_trial_is_planned_to_cross'} ];
#line 22 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_stock_type = $_[ $pos{'trial_stock_type'} ];
#line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_stock_count = $_[ $pos{'trial_stock_count'} ];
#line 24 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
    $trial_owner = $_[ $pos{'trial_owner'} ];
#line 25 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
     $latest_trial_activity = exists $pos{'latest_trial_activity'} ? $_[ $pos{'latest_trial_activity'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 28 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '

<div class="row">
    <div class="col-sm-8">

        <table class="table table-hover table-bordered" >

            <tr>
                <td><b>Trial Name</b></td>
                <td>
                    <div id="trial_name">
' );
#line 39 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_name) {
   print "$trial_name";
 } else {
   print "<span class='text-danger'>[No Trial Name]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Breeding Program </b></td>
                <td>
                    <span id="breeding_program">
' );
#line 52 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($breeding_program_name) {
$m->print( '                    <a href="/breeders/program/' );
#line 53 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $breeding_program_id  );
#line 53 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '">' );
#line 53 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $breeding_program_name  );
#line 53 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '</a>
' );
#line 54 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 }
 else {
  print "<span class='text-danger'>[No Breeding Program]</span>";
 }
$m->print( '                    </span>
                </td>
            </tr>

            <tr>
                <td><b>Trial Location</b></td>
                <td>
                    <div id="trial_location">
' );
#line 66 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($location_name) {
  print "$location_name ( $country_name )";
 } else {
  print "<span class='text-danger'>[No Location]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Year</b></td>
                <td>
                    <div id="trial_year">
' );
#line 79 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($year) {
  print "$year";
 } else {
  print "<span class='text-danger'>[No Year]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Stock Type Being Evaluated in This Trial</b></td>
                <td>
                    <div id="stock_type_in_trial">
' );
#line 92 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_stock_type) {
     print "$trial_stock_type";
 } else {
     print "accession";
 }
$m->print( '                    </div>
                </td>
            </tr>

	    <tr>
                <td><b>Number of Stocks in This Trial</b></td>
                <td>
                    <div id="stock_number_in_trial">
' );
#line 105 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_stock_count) {
     print "$trial_stock_count";
 } else {
 print "<span class='text-danger'>[No Stocks in Trial]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Trial Type</b></td>
                <td>
                    <div id="trial_type">
' );
#line 118 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_type) {
  print "$trial_type";
 } else {
 print "<span class='text-danger'>[Type not set]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Planting Date</b></td>
                <td>
                    <div id="planting_date">
' );
#line 131 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($planting_date) {
$m->print( '<a href="/breeders/trial/' );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $trial_id  );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '?currentDate=' );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $planting_date  );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '" >' );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $planting_date  );
#line 132 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '</a>
' );
#line 133 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 } else {
  print "<span class='text-danger'>[No Planting Date]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>
' );
#line 139 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($transplanting_date && $transplanting_date ne '') {
$m->print( '<tr>
    <td><b>Transplanting Date</b></td>
    <td>
        <div id="transplanting_date">
            <a href="/breeders/trial/' );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $trial_id  );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '?currentDate=' );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $transplanting_date  );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '" >' );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $transplanting_date  );
#line 144 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '</a>
        </div>
    </td>
</tr>
' );
#line 148 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 }
$m->print( '            <tr>
                <td><b>Harvest Date</b></td>
                <td>
                    <div id="harvest_date">
' );
#line 153 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($harvest_date) {
$m->print( '<a href="/breeders/trial/' );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $trial_id  );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '?currentDate=' );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $harvest_date  );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '" >' );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $harvest_date  );
#line 154 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '</a>
' );
#line 155 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 } else {
  print "<span class='text-danger'>[No Harvest Date]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr><td><b>Description</b></td>
                <td>
' );
#line 164 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_description) {
  print "<div id='trial_description' style='white-space: pre-wrap;'>$trial_description</div>";
 } else {
  print "<div id='trial_description'><span class='text-danger'>[No Description]</span></div>";
 }
$m->print( '                </td>
            </tr>

            <tr>
                <td><b>Folder</b></td>
                <td>
                    <span id="trial_folder_div"><a href="/folder/' );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $folder_id  );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '">' );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print(  $folder_name  );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '</a></span>
                    <br/><br/>
                    <button class="btn btn-sm btn-default" style="margin:3px" id="new_folder_dialog_link">New Folder</button> <button class="btn btn-sm btn-default" style="margin:3px" id="open_folder_dialog_link">Change Folder</button>
                </td>
            </tr>

	    <tr><td><b>Created by</b></td>
                <td>
                    <div id="trial_owner">
' );
#line 184 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($trial_owner) {
  print "$trial_owner";
 } else {
  print "<span class='text-danger'>[N/A]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>

            <tr>
                <td><b>Latest Trial Activity</b></td>
                <td>
                        <div id="latest_trial_activity">
' );
#line 197 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($latest_trial_activity) {
  print "<span class='text-success'>$latest_trial_activity</span>";
 } else {
  print "<span class='text-danger'>[No Record]</span>";
 }
$m->print( '                        </div>
                    </td>
                </tr>

        </table>

    </div>
    <div class="col-sm-4">
        <div class="well well-sm">
            ' );
#line 211 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->comp(   '/util/barcode.mas', identifier => "$identifier_prefix"."$trial_id", trial_id=> "$trial_id", trial_name=> "$trial_name", format=>"trial_qrcode"    
); #line 211 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
$m->print( '
        </div>

        <table class="table table-hover table-bordered">
            <tr><td><b>Plot Width (m)</b></td>
                <td>
                    <div id="plot_width">
' );
#line 218 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($plot_width) {
  print "$plot_width";
 } else {
  print "<span class='text-default'>[No Plot Width]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>
            <tr><td><b>Plot Length (m)</b></td>
                <td>
                    <div id="plot_length">
' );
#line 229 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($plot_length) {
  print "$plot_length";
 } else {
  print "<span class='text-default'>[No Plot Length]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>
            <tr><td><b>Field Size (ha)</b></td>
                <td>
                    <div id="field_size">
' );
#line 240 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($field_size) {
  print "$field_size";
 } else {
  print "<span class='text-default'>[No Field Size]</span>";
 }
$m->print( '                    </div>
                </td>
            </tr>
            <tr><td><b>Trial Will Be Genotyped</b></td>
                <td>
                    <div id="planned_to_be_genotyped">
' );
#line 251 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($field_trial_is_planned_to_be_genotyped) {
  print "$field_trial_is_planned_to_be_genotyped";
 } else {
  print "no";
 }
$m->print( '                    </div>
                </td>
            </tr>
            <tr><td><b>Trial Will Be In Crosses</b></td>
                <td>
                    <div id="planned_to_cross">
' );
#line 262 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_details.mas"
 if ($field_trial_is_planned_to_cross) {
  print "$field_trial_is_planned_to_cross";
 } else {
  print "no";
 }
$m->print( '                    </div>
                </td>
            </tr>
        </table>
    </div>
</div>
' );
;return;
},
'declared_args' => {
  '$breeding_program_id' => { default => undef },
  '$breeding_program_name' => { default => undef },
  '$country_name' => { default => undef },
  '$field_size' => { default => undef },
  '$field_trial_is_planned_to_be_genotyped' => { default => undef },
  '$field_trial_is_planned_to_cross' => { default => undef },
  '$folder_id' => { default => undef },
  '$folder_name' => { default => undef },
  '$harvest_date' => { default => undef },
  '$identifier_prefix' => { default => undef },
  '$latest_trial_activity' => { default => ' undef' },
  '$location_name' => { default => undef },
  '$planting_date' => { default => undef },
  '$plot_length' => { default => undef },
  '$plot_width' => { default => undef },
  '$transplanting_date' => { default => undef },
  '$trial_description' => { default => undef },
  '$trial_id' => { default => undef },
  '$trial_name' => { default => undef },
  '$trial_owner' => { default => undef },
  '$trial_stock_count' => { default => undef },
  '$trial_stock_type' => { default => undef },
  '$trial_type' => { default => undef },
  '$year' => { default => undef }
},
'load_time' => 1763102299,

)
;