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 ( $timestamp, $preferred_species, $editable_stock_props, $editable_stock_props_definitions, $programs, $locations, $crossing_trials, $maintenance_enabled, $user_role, $default_seedlot_material_type );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( timestamp preferred_species programs locations crossing_trials ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 3 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
    $timestamp = $_[ $pos{'timestamp'} ];
#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
    $preferred_species = $_[ $pos{'preferred_species'} ];
#line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
     $editable_stock_props = exists $pos{'editable_stock_props'} ? $_[ $pos{'editable_stock_props'} ] :  {};
#line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
     $editable_stock_props_definitions = exists $pos{'editable_stock_props_definitions'} ? $_[ $pos{'editable_stock_props_definitions'} ] :  {};
#line 7 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
    $programs = $_[ $pos{'programs'} ];
#line 8 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
    $locations = $_[ $pos{'locations'} ];
#line 9 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
    $crossing_trials = $_[ $pos{'crossing_trials'} ];
#line 10 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
     $maintenance_enabled = exists $pos{'maintenance_enabled'} ? $_[ $pos{'maintenance_enabled'} ] :  undef;
#line 11 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
     $user_role = exists $pos{'user_role'} ? $_[ $pos{'user_role'} ] :  undef;
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
     $default_seedlot_material_type = exists $pos{'default_seedlot_material_type'} ? $_[ $pos{'default_seedlot_material_type'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 1 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 14 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 15 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/page/page_title.mas', title=>"Available Seedlots"   
); #line 15 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

<style>
.ui-autocomplete {
    z-index: 5000;
}
</style>

  ' );
#line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/util/import_javascript.mas', classes => [ 'bootstrap_min.js', 'jquery.iframe-post-form','CXGN.List','CXGN.BreedersToolbox.Accessions', 'CXGN.BreedersToolbox.UploadPedigrees', 'jquery', 'jquery.dataTables', 'CXGN.BreedersToolbox.Crosses', 'jqueryui' ]   
); #line 23 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

' );
#line 25 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp( { content => sub {
#line 25 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
    <div class="well well-sm">
        <div class="panel panel-default">
            <div class="panel-body">
                <b><p>What are seedlots?</p></b>
                <ul>
                <li>Seedlots represent physical plant materials in packets/containers.</li>
                <li>Plant material can be seed, root, clone, plant, tissue culture or gametophyte.</li>
                <li>If you would like to set a default material type for seedlots, please contact us.</li>
                <li>These materials can be from crosses or for named accessions.</li>
                <li>Seedlots can have a specific location, box, weight(g), and count.</li>
                <li>Plant material can be transferred into and out of a seedlot. Such as from a seedlot into a plot.</li>
                <li>Seedlots can belong to breeding programs and organizations.</li>
                </ul>

                <b><p>How do I inventory my seed?</p></b>
                <ul>
                <li>Make sure your seedlots are in the database. Use "Add New Seedlot" to add a single seedlot or "Upload New Seedlots" to add many.</li>
                <li>Make sure your seedlots are barcoded. You can print these barcodes from the database.</li>
                <li>The inventory app is currently not available but you can continue using it if it is installed on your tablet device.
                <!-- li>3) Use the "Inventory" Android Application to scan seedlot barcodes and record weight. Then click "Upload Inventory" on the Manage Seedlots page to upload this info into the database. If you do not want to use the Inventory Android Application you can create your own CSV file and upload that.</li --><!-- the app is currently not available - re-instate when it is available again -->
                <!-- li><b>For more info about the "Seed Inventory" Android Application go to <a href="https://play.google.com/store/apps/details?id=org.wheatgenetics.inventory/">Inventory</a>.</b></li -->
                It is also possible to manually enter a transaction by going to the seedlot detail page and clicking "Add New Transaction".</li>
                </ul>
            </div>
        </div>
    </div>
' );
#line 52 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
} }, '/page/info_section.mas', title=>"About Seedlots",  collapsible => 1, collapsed=>1
 );
#line 52 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

' );
#line 54 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"

    my $maintenance_button = $maintenance_enabled ? ' <button onclick="location.href=\'/breeders/seedlot/maintenance\'" class="btn btn-sm btn-primary" style="margin:3px" name="seedlot_record_maintenance">Seedlot Maintenance</button>' : '';
    my $seedlot_subtitle = !!$c->user()
        ? '<div class="btn-group"><button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Create Seedlot(s)&nbsp;<span class="caret"></span></button><ul class="dropdown-menu"><li><a href="#" name="add_seedlot_button">Add New Seedlot</a></li><li><a href="#" name="seedlot_bulk_upload">Upload Seedlots</a></li><li><a href="#" name="create_seedlots_trial_button">Create Seedlots from Trial</a></li></ul></div>
        <div class="btn-group"><button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Add/Upload Transactions&nbsp;<span class="caret"></span></button><ul class="dropdown-menu"><li><a href="#" name="transactions_upload_link">Upload a File</a></li><li><a href="#" id="add_transactions_using_list_link" name="add_transactions_using_list_link">Using a List</a></li><li></ul></div>
        <button class="btn btn-sm btn-primary" style="margin:3px" name="seedlot_upload_inventory">Upload Inventory</button>' . $maintenance_button
        : "Login to add or upload seedlots";
#line 62 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp( { content => sub {
#line 62 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

<br/>

<div class="well well-sm">
    <div class="panel panel-default">
        <div class="panel-body">

' );
#line 70 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp( { content => sub {
#line 70 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

<div class="well well-sm">
    <form class="form-horizontal" id="search_seedlot_form" name="search_seedlot_form">
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Seedlot Name: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_seedlot_name" type="text" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Breeding Program: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_breeding_program" type="text" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Contents (Accession Uniquename): </label>
            <div class="col-sm-7" >
                <input class="form-control" id="search_seedlot_form_contents_accession" type="text" />
            </div>
            <div class="col-sm-2 form-check form-check-inline align-bottom">
              <input class="form-check-input" type="checkbox" id="exact_accession" value="1">
              <label class="form-check-label" for="exact_accession">exact match</label>
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Contents (Cross Unique ID): </label>
            <div class="col-sm-7" >
                <input class="form-control" id="search_seedlot_form_contents_cross" type="text" />
            </div>
            <div class="col-sm-2 form-check form-check-inline align-bottom">
              <input class="form-check-input" type="checkbox" id="exact_cross" value="1">
              <label class="form-check-label" for="exact_cross">exact match</label>
            </div>
        </div>
' );
#line 106 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 if (!$default_seedlot_material_type) {
$m->print( '        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Material Type: </label>
            <div class="col-sm-9" >
                <div id="search_seedlot_form_material_type_div"></div>
            </div>
        </div>
' );
#line 113 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 }
$m->print( '        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Location: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_location" type="text" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Box Name: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_box_name" type="text" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Minimum Count: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_minimum_count" type="number" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Minimum Weight (g): </label>

            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_minimum_weight" type="number" />
            </div>
        </div>

        <!-- div class="form-group form-group-sm">
            <label class="col-sm-3 control-label"></label>
            <div class="col-sm-9" >
                <input id="search_seedlot_form_only_good_quality_checkbox" type="checkbox" /> Only show seedlots without quality issues
            </div>
        </div  -->

        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Quality: </label>
            <div class="col-sm-9" >
                <input class="form-control" id="search_seedlot_form_quality" type="text" />
            </div>
        </div>
        <div class="form-group form-group-sm">
            <label class="col-sm-3 control-label">Trial Usage: </label>
            <div class="col-sm-9">
                <div class="col-sm-5" style="padding-left: 0; padding-right: 5px">
                    <input class="form-control" id="search_seedlot_form_trial_name" type="text" placeholder="Trial Name" />
                </div>
                <div class="col-sm-7" style="padding-left: 5px; padding-right: 0">
                    <select class="form-control" id="search_seedlot_form_trial_usage">
                        <option value="">Select trial / seedlot usage...</option>
                        <option value="source">Trial --> Seedlot: Find seedlots that are derived from this trial</option>
                        <option value="sink">Seedlot --> Trial: Find seedlots that provided seed to this trial</option>
                        <option value="source|sink">Either of the above</option>
                    </select>
                </div>
            </div>
        </div>

    </form>
    <div style="text-align: center">
        <button class="btn btn-primary" id="submit_seedlot_search">Search</button>
    </div>
</div>
' );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
} }, '/page/info_section.mas', title=>"Search Seedlots",  collapsible => 1, collapsed=>0
 );
#line 175 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

<div style="text-align: center">
    Enter search terms and click the "Search" button to view results.
</div>

<br />
<br />
<br />
<div style="overflow:scroll">
    <table id="available_seedlots_table" class="table table-hover table-striped table-bordered">
    </table>
</div>

<hr>

<div id="available_seedlots_to_list" style="display:none">
</div>
<div id="available_seedlots_add_to_list">
</div>

        </div>
    </div>
</div>
' );
#line 199 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
} }, '/page/info_section.mas', title=>"Seedlots",  collapsible => 1, subtitle => $seedlot_subtitle
 );
#line 199 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

' );
#line 201 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp( { content => sub {
#line 201 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 202 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 if ($user_role eq "curator" ) {
$m->print( '    <div class="well well-sm">
        <div class="panel panel-default">
            <div class="panel-body">
                <button class="btn btn-sm btn-default" style="margin:3px" id ="discard_seedlot_usage_info" name = "discard_seedlot_usage_info">Usage Help <span class="glyphicon glyphicon-question-sign"></span></button><button class="btn btn-sm btn-primary" style="margin:3px" id="discard_seedlot_link">Mark Seedlots as Discarded</button>
            </div>
        </div>
    </div>
' );
#line 210 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 } else {
$m->print( '    You need to be logged in or you do not have sufficient privileges to mark seedlots as DISCARDED using lists.
' );
#line 212 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 }
} }, '/page/info_section.mas', title=>"Mark seedlots as DISCARDED using a list",  collapsible => 1, collapsed=>1
 );
#line 213 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

' );
#line 215 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp( { content => sub {
#line 215 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 216 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 if ($user_role eq "curator" ) {
$m->print( '    <div class="well well-sm">
        <div class="panel panel-default">
            <div class="panel-body">
                <button class="btn btn-sm btn-primary" style="margin:3px" id="delete_seedlots_link">Delete seedlots using a list</button>
            </div>
        </div>
    </div>
' );
#line 224 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 } else {
$m->print( '    You need to be logged in or you do not have sufficient privileges to delete seedlots.
' );
#line 226 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
 }
} }, '/page/info_section.mas', title=>"Delete seedlots using a list",  collapsible => 1, collapsed=>1
 );
#line 227 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '

' );
#line 229 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/upload_seedlots_inventory_dialogs.mas'  
); #line 229 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 230 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/upload_seedlots_dialogs.mas', default_seedlot_material_type=>$default_seedlot_material_type  
); #line 230 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 231 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/add_seedlot_dialogs.mas', timestamp=>$timestamp, default_seedlot_material_type=>$default_seedlot_material_type   
); #line 231 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 232 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/add_accessions_dialogs.mas', preferred_species=>$preferred_species, editable_stock_props=>$editable_stock_props, editable_stock_props_definitions=>$editable_stock_props_definitions   
); #line 232 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 233 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/cross/upload_crosses_dialogs.mas', programs=>$programs, locations=>$locations, crossing_trials=>$crossing_trials   
); #line 233 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 234 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/cross/add_cross_dialogs.mas', programs=>$programs, locations=>$locations, crossing_trials=>$crossing_trials   
); #line 234 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 235 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/cross/add_crossing_trial_dialogs.mas', programs=>$programs, locations=>$locations   
); #line 235 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 236 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/create_seedlots_from_trial_dialogs.mas', default_seedlot_material_type=>$default_seedlot_material_type  
); #line 236 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 237 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/delete_seedlots.mas', user_role => $user_role   
); #line 237 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 238 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/discard_seedlots.mas', user_role => $user_role   
); #line 238 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 239 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/discard_undo_seedlot_usage.mas'  
); #line 239 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 240 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/upload_transactions_dialogs.mas'  
); #line 240 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '
' );
#line 241 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->comp(   '/breeders_toolbox/add_transactions_using_list.mas'  
); #line 241 "/home/production/cxgn/sgn/mason/breeders_toolbox/seedlots.mas"
$m->print( '


<script>
jQuery(document).ready(function(){
    jQuery("#search_seedlot_form_seedlot_name").autocomplete({
       source: \'/ajax/stock/seedlot_name_autocomplete\',
    });
    jQuery("#search_seedlot_form_trial_name").autocomplete({
        source: \'/ajax/trials/trial_autocomplete\'
    });

    get_select_box(\'material_types\', \'search_seedlot_form_material_type_div\', { \'name\' : \'search_seedlot_form_material_type\', \'id\' : \'search_seedlot_form_material_type\', \'empty\': 1 });


    var seedlots_table;

    //run the query only when the search button is clicked
    jQuery(\'#submit_seedlot_search\').click( function() {
        if (seedlots_table) { seedlots_table.destroy() };
        seedlots_table = jQuery(\'#available_seedlots_table\').DataTable({
            \'searching\' : false,
            \'ordering\'  : false,
            \'processing\': true,
            \'serverSide\': true,
            \'lengthMenu\': [10,20,50,100,1000],

            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: "Material Type", "data": "material_type" },
                { title: "Location", "data": "location" },
                { title: "Count", "data": "count" },
                { title: "Weight (g)", "data": "weight_gram" },
                { title: "Submitters", "data": "owners_string" },
                { title: "Organization", "data": "organization" },
                { title: "Box", "data": "box" },
                { title: "Quality", "data": "seedlot_quality" },
                { title: "Delete", "data": "null", "render": function ( data, type, row ) { return "<a onclick=\'removeSeedlot("+row.seedlot_stock_id+")\' >X</a>"; } },
                { title: "", "data": "seedlot_stock_uniquename"}
            ],
            \'ajax\': { \'url\': \'/ajax/breeders/seedlots\',
                \'data\': function(d) {
                    d.seedlot_name  = jQuery(\'#search_seedlot_form_seedlot_name\').val();
                    d.breeding_program = jQuery(\'#search_seedlot_form_breeding_program\').val();
                    d.minimum_count   = jQuery(\'#search_seedlot_form_minimum_count\').val();
                    d.minimum_weight   = jQuery(\'#search_seedlot_form_minimum_weight\').val();
                    d.location     = jQuery(\'#search_seedlot_form_location\').val();
                    d.box_name = jQuery(\'#search_seedlot_form_box_name\').val();
                    d.contents_accession = jQuery(\'#search_seedlot_form_contents_accession\').val();
                    d.contents_cross = jQuery(\'#search_seedlot_form_contents_cross\').val();
                    d.exact_accession = jQuery(\'#exact_accession\').is(":checked") ? 1 : 0;
                    d.exact_cross = jQuery(\'#exact_cross\').is(":checked") ? 1 : 0;
                    d.quality = jQuery(\'#search_seedlot_form_quality\').val();
                    d.only_good_quality = jQuery(\'#search_seedlot_form_only_good_quality_checkbox\').is(":checked") ? 1 : 0;
                    d.trial_name = jQuery(\'#search_seedlot_form_trial_name\').val();
                    d.trial_usage = jQuery(\'#search_seedlot_form_trial_usage\').val();
                    d.material_type = jQuery(\'#search_seedlot_form_material_type\').val();
                }
            },
        });

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

    });


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

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

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

    jQuery(\'#search_seedlot_form\').keypress( function( e ) {
        var code = e.keyCode || e.which;
        if( code == 13 ) {
            jQuery(\'#submit_seedlot_search\').click();
        }
    });
});

function removeSeedlot(seedlot_stock_id){
    if (confirm("Are you sure you want to delete this seedlot?")){
        jQuery.ajax({
            url: \'/ajax/breeders/seedlot/\'+seedlot_stock_id+\'/delete\',
            beforeSend: function(){
                jQuery(\'#working_modal\').modal(\'show\');
            },
            success: function(response) {
                jQuery(\'#working_modal\').modal(\'hide\');
                if (response.success == 1) {
                    alert("The seedlot has been deleted.");
                    location.reload();
                }
                if (response.error) {
                    alert(response.error);
                }
            },
            error: function(response){
                jQuery(\'#working_modal\').modal(\'hide\');
                alert(\'An error occurred deleting seed lot\');
            }
        });
    }
}

</script>
' );
;return;
},
'declared_args' => {
  '$crossing_trials' => { default => undef },
  '$default_seedlot_material_type' => { default => ' undef' },
  '$editable_stock_props' => { default => ' {}' },
  '$editable_stock_props_definitions' => { default => ' {}' },
  '$locations' => { default => undef },
  '$maintenance_enabled' => { default => ' undef' },
  '$preferred_species' => { default => undef },
  '$programs' => { default => undef },
  '$timestamp' => { default => undef },
  '$user_role' => { default => ' undef' }
},
'load_time' => 1763131595,

)
;