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

    foreach my $arg ( qw( trial_id ) )
    {
        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/trial/trial_controls.mas"
    $trial_id = $_[ $pos{'trial_id'} ];
}
$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_controls.mas"
$m->print( '
' );
#line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_controls.mas"
$m->print( '
' );
#line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_controls.mas"
$m->comp(   '/util/import_javascript.mas', classes => [  ]   
); #line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_controls.mas"
$m->print( '


<div id="trial_controls_html">
</div>

<script>

jQuery(document).ready(function () {

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

	jQuery.ajax ( {
            url : \'/ajax/breeders/trial/\'+' );
#line 19 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_controls.mas"
$m->print(  $trial_id  );
#line 19 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/trial_controls.mas"
$m->print( '+\'/controls\',
	    beforeSend: function() {
		jQuery("#working_modal").modal("show");
	    },
	    success: function(response){
	        console.log(response);
		jQuery("#working_modal").modal("hide");
		var trial_accessions_html = "<table class=\'table table-hover table-condensed table-bordered\' id=\'trial_controls_table\'><thead><tr><th>Unique Name</th></tr></thead><tbody>";
		for (i=0; i<response.accessions[0].length; i++) {
		    trial_accessions_html = trial_accessions_html + "<tr><td><a href=\'/stock/" + response.accessions[0][i].stock_id +"/view\'>"+ response.accessions[0][i].accession_name + "</a></td></tr>";
		}
		trial_accessions_html = trial_accessions_html + "</tbody></table>";
		jQuery(\'#trial_controls_html\').empty();
		jQuery(\'#trial_controls_html\').html(trial_accessions_html);
        enable_controls_datatable();
	    },
	    error: function(response){
	        jQuery("#working_modal").modal("hide");
		alert("Error retrieving controls.");
	    }
	});
    });

});

function enable_controls_datatable() {
    jQuery(\'#trial_controls_table\').DataTable();
}

</script>
' );
;return;
},
'declared_args' => {
  '$trial_id' => { default => undef }
},
'load_time' => 1763102299,

)
;