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

    foreach my $arg ( qw( program_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/program/program_locations.mas"
    $program_id = $_[ $pos{'program_id'} ];
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( '
' );
#line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->comp(   '/util/import_javascript.mas', classes => [ 'jquery', 'jquery.dataTables' ]   
); #line 5 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( '
' );
#line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->comp(   '/util/import_css.mas', paths => ['/documents/inc/datatables/jquery.dataTables.css']   
); #line 6 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( '


<div class="well well-sm">
    <div class="panel panel-default">
        <div class="panel-body">
            ' );
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->comp( { content => sub {
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( '
                <table class="table table-hover table-bordered" id="program_location_table">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Abbreviation</th>
                            <th>Country</th>
                            <th>Type</th>
                            <th>Altitude(m)</th>
                            <th>Trials</th>
                            <th>Nearest NOAA Station ID</th>
                        </tr>
                    </thead>
                </table>
            ' );
#line 27 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
} }, '/page/info_section.mas', title=>"Location Info", is_subsection => 1, collapsible=>1, collapsed=>0
 );
#line 27 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( '
        </div>
    </div>
</div>

<script>

jQuery(document).ready(function (){

    jQuery.ajax( {
        url: \'/ajax/breeders/program/\'+ ' );
#line 37 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print(  $program_id  );
#line 37 "/home/production/cxgn/sgn/mason/breeders_toolbox/program/program_locations.mas"
$m->print( ' + \'/locations\',
        beforeSend: function() {
            // put working animation handling here
        },
        success: function(response){
            var export_message = window.location.href + \' location data.\';
            locationJSON = JSON.parse(response.data);
            //console.log("Data is "+JSON.stringify(locationJSON, null, 2));

            var table = jQuery(\'#program_location_table\').DataTable({
                \'autoWidth\': false,
                data: locationJSON,
                dom: \'Bfrtip\',
                select: true,
                rowId: \'properties.Id\',
                "columns": [
                    { "data": "properties.Id" },
                    { "data": "properties.Name" },
                    { "data": "properties.Abbreviation" },
                    { "data": "properties.Code",
                        "render":function(data, type, full, meta){
                            return full.properties.Code + \' \' + full.properties.Country;
                        }
                    },
                    { "data": "properties.Type" },
                    { "data": "properties.Altitude" },
                    { "data": "properties.Trials" },
                    { "data": "properties.NOAAStationID",
                        "render":function(data, type, full, meta) {
                            return full.properties.NOAAStationID ? "<a href=\'https://www.ncdc.noaa.gov/cdo-web/datasets/GHCND/stations/" + full.properties.NOAAStationID + "/detail\' target=_blank>"+ full.properties.NOAAStationID + "</a>" : "";
                        }
                    }
                ],
            });
        }
    });
});


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

)
;