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

    foreach my $arg ( qw( stock_id ) )
    {
        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/seedlots_section.mas"
    $stock_id = $_[ $pos{'stock_id'} ];
#line 3 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
     $stock_uniquename = exists $pos{'stock_uniquename'} ? $_[ $pos{'stock_uniquename'} ] :  undef;
#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
     $stock_type = exists $pos{'stock_type'} ? $_[ $pos{'stock_type'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
' );
#line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->comp(   '/util/import_javascript.mas', classes => []   
); #line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '

' );
#line 9 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 if ($stock_type eq 'accession'){
$m->print( '    ' );
#line 10 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->comp(   '/breeders_toolbox/add_seedlot_dialogs.mas', accession_uniquename=>$stock_uniquename   
); #line 10 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
' );
#line 11 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 } elsif ($stock_type eq 'cross'){
$m->print( '    ' );
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->comp(   '/breeders_toolbox/add_seedlot_dialogs.mas', cross_uniquename=>$stock_uniquename   
); #line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
' );
#line 13 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 }
$m->print( '
' );
#line 15 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->comp( { content => sub {
#line 15 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
    <div class="well well-sm">
        <div class="panel panel-default">
            <div class="panel-body" style="overflow:scroll">
                <table id="seedlots_of_accession_table" class="table table-hover table-striped">
                </table>
            </div>
        </div>
        <br>
        ' );
#line 24 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->comp( { content => sub {
#line 24 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
            <br/>
            <div style="text-align:right" id="accession_seedlots_to_list_menu">[LOADING...]</div>
            <div id="accession_seedlot_names" style="display: none;"></div>
        ' );
#line 28 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
} }, '/page/info_section.mas', title => 'Copy Seedlots to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Copy the seedlot names showing in table to a new or exisiting list</i>'
 );
#line 28 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '
    </div>
' );
#line 30 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
} }, '/page/info_section.mas', id=>'related_seedlots_to_accessions', title => 'Seedlots of this '.ucfirst($stock_type), collapsible=>1, collapsed=>1, subtitle=>"<button class='btn btn-sm btn-primary' style='margin:3px' name='add_seedlot_button' >Create New Seedlot</button>"
 );
#line 30 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '


<script>

jQuery(document).ready(function(){

    jQuery(\'#related_seedlots_to_accessions_onswitch\').one("click", function(){

        var seedlots_table = jQuery(\'#seedlots_of_accession_table\').DataTable({
            \'destroy\' : true,
            \'ordering\'  : false,
            \'processing\': true,
            \'serverSide\': true,
            \'lengthMenu\': [10,20,50,100,1000],
            \'ajax\': { \'url\': \'/ajax/breeders/seedlots\',
                      \'data\': function(d) {
' );
#line 47 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 if ($stock_type eq 'accession'){
$m->print( '                         d.contents_accession = "' );
#line 48 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print(  $stock_uniquename  );
#line 48 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '";
' );
#line 49 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 } elsif ($stock_type eq 'cross'){
$m->print( '                        d.contents_cross = "' );
#line 50 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print(  $stock_uniquename  );
#line 50 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
$m->print( '";
' );
#line 51 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots_section.mas"
 }
$m->print( '                    }
            },
            columns: [
                { title: "Seedlot Name", "data": null, "render": function ( data, type, row ) { return "<a href=\'/breeders/seedlot/"+row.seedlot_stock_id+"\'>"+row.seedlot_stock_uniquename+"</a>"; } },
                { title: "Breeding Program", "data": "breeding_program_name" },
                { title: "Contents", "data": "contents_html" },
                { title: "Seedlot Location", "data": "location" },
                { title: "Count", "data": "count" },
                { title: "Weight(g)", "data": "weight_gram" },
                { title: "Box Name", "data": "box" },
                { title: "Quality", "data": "seedlot_quality" },
                { title: "", "data": "seedlot_stock_uniquename"}
            ],
        });

        seedlots_table.draw();
        seedlots_table.column(8).visible(false);

        jQuery(\'#seedlots_of_accession_table\').on( \'draw.dt\', function () {
            var seedlot_names = seedlots_table.column(8).data();
            var names = "";

            for (var i = 0; i < seedlot_names.length; i++) {
                names += seedlot_names[i]+\'\\n\';
            }

            jQuery(\'#accession_seedlot_names\').html(names);
            addToListMenu(\'accession_seedlots_to_list_menu\', \'accession_seedlot_names\', {
                listType: \'seedlots\'
            });
        });
    });

});

</script>
' );
;return;
},
'declared_args' => {
  '$stock_id' => { default => undef },
  '$stock_type' => { default => ' undef' },
  '$stock_uniquename' => { default => ' undef' }
},
'load_time' => 1763089219,

)
;