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 ( $schema, $static_content_path, $username, $role, $first_name, $last_name, $sp_person_id, $timestamp, $phenotype_files, $breeding_programs, $locations, $preferred_species, $editable_stock_props );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( schema static_content_path username role first_name last_name sp_person_id timestamp ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 4 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $schema = $_[ $pos{'schema'} ];
#line 5 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $static_content_path = $_[ $pos{'static_content_path'} ];
#line 6 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $username = $_[ $pos{'username'} ];
#line 7 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $role = $_[ $pos{'role'} ];
#line 8 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $first_name = $_[ $pos{'first_name'} ];
#line 9 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $last_name = $_[ $pos{'last_name'} ];
#line 10 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $sp_person_id = $_[ $pos{'sp_person_id'} ];
#line 11 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
    $timestamp = $_[ $pos{'timestamp'} ];
#line 12 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
     $phenotype_files = exists $pos{'phenotype_files'} ? $_[ $pos{'phenotype_files'} ] :  undef;
#line 13 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
     $breeding_programs = exists $pos{'breeding_programs'} ? $_[ $pos{'breeding_programs'} ] :  undef;
#line 14 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
     $locations = exists $pos{'locations'} ? $_[ $pos{'locations'} ] :  undef;
#line 15 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
     $preferred_species = exists $pos{'preferred_species'} ? $_[ $pos{'preferred_species'} ] :  undef;
#line 16 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
     $editable_stock_props = exists $pos{'editable_stock_props'} ? $_[ $pos{'editable_stock_props'} ] :  {};
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 1 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '
' );
#line 19 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '
<div style="text-align: center">

<h3>Welcome back ' );
#line 22 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print(  $first_name  );
#line 22 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '!</h3>

Your status is currently "' );
#line 24 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print(  $role  );
#line 24 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '".

<!-- table id="manage_user_role_table" class="table table-bordered" width="100%" >
<thead>
<tr><th>User</th><th>Your currently assigned roles</th></tr>

</thead>
<tbody>
</tbody>
</table -->

' );
#line 35 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
 if ($role ne "user") {
$m->print( '
' );
#line 37 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->comp( { content => sub {
#line 37 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '

<h4>Continue where you left off:</h4>
Interval:&nbsp;

<select id="interval">
    <option>day</option>
    <option>week</option>
    <option>month</option>
    <option>year</option>
</select>

<br /><br />
<h4>10 most recently created trials:</h4>

<table id="recently_created_trial_table" style="width:100%" >
<thead>
<tr><th>Trial</th><th>Trial Type</th><th>Breeding Program</th><th>Create date</th></tr>
</thead>
</table>

<br /><br />
<h4>10 most recently modified trials:</h4>

<table id="recently_modified_trial_table" style="width:100%">
<thead>
<tr><th>Trial</th><th>Trial Type</th><th>Breeding Program</th><th>Last phenotype added</th></tr>
</thead>
</table>

<br /><br />
<h4>10 most recently added accessions:</h4>

<table id="recently_added_accessions_table" style="width:100%">
<thead>
<tr><th>Accession</th><th>Create date</th></tr>
</thead>
</table>



' );
#line 78 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
} }, '/page/info_section.mas', title => "<b><font size=\"3\">Continue where you left off</font></b>", collapsible => 1, collapsed => 1
 );
#line 78 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '

' );
#line 80 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
} # -- if ($role ne...
$m->print( '
</div>

<script>
    var interval = jQuery(\'#interval\').val()	

    update_tables(interval);

    jQuery(\'#interval\').change( function() {
        interval = jQuery(\'#interval\').val();
	update_tables(interval);
	});

    function update_tables(interval) { 
        jQuery(\'#recently_created_trial_table\').DataTable({
	    \'destroy\': true,
    	    \'columns\' : [{ width: \'300px\' }, { width: \'200px\'}, { width: \'100px\'}, null],	
            \'ajax\':\'/ajax/breeders/recent_trials/\'+interval,
            \'order\': [[ 3, \'desc\']],
	    \'paging\': false,
	    \'searching\': false,
	    \'bInfo\': false
        });

        jQuery(\'#recently_modified_trial_table\').DataTable({
	    \'destroy\' : true,
            \'columns\': [{ width: \'300px\' }, { width: \'200px\'}, { width: \'100px\'}, null],
            \'ajax\':\'/ajax/breeders/recently_modified_trials/\'+interval,
    	    \'paging\': false,
	    \'searching\': false,
	    \'bInfo\' : false
        });

        jQuery(\'#recently_added_accessions_table\').DataTable({
	    \'destroy\' : true,
            \'ajax\':\'/ajax/breeders/recently_added_accessions/\'+interval,
    	    \'paging\': false,
	    \'searching\' : false,
	    \'bInfo\': false,
    	    \'columns\': [{ width: \'680px\'}, null ],	
        });

//   jQuery(\'#manage_user_role_table\').DataTable( {
//       ajax : \'/ajax/roles/list/' );
#line 124 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print(  $sp_person_id  );
#line 124 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '\',
//       searching: false,
//       paging: false,
//   });

}

</script>


' );
#line 134 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->comp(   '/index.mas', schema => $schema, timestamp => $timestamp, static_content_path=> $static_content_path, phenotype_files => $phenotype_files, breeding_programs => $breeding_programs, locations => $locations, preferred_species => $preferred_species, editable_stock_props => $editable_stock_props   
); #line 134 "/home/production/cxgn/sgn/mason/index_logged_in_user.mas"
$m->print( '
' );
;return;
},
'declared_args' => {
  '$breeding_programs' => { default => ' undef' },
  '$editable_stock_props' => { default => ' {}' },
  '$first_name' => { default => undef },
  '$last_name' => { default => undef },
  '$locations' => { default => ' undef' },
  '$phenotype_files' => { default => ' undef' },
  '$preferred_species' => { default => ' undef' },
  '$role' => { default => undef },
  '$schema' => { default => undef },
  '$sp_person_id' => { default => undef },
  '$static_content_path' => { default => undef },
  '$timestamp' => { default => undef },
  '$username' => { default => undef }
},
'load_time' => 1763079527,

)
;