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

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

#line 4 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/weather.mas"
$m->print( '
<p id="trial_weather_check">[loading...]</p>

<script type="text/javascript" defer="defer">
jQuery(document).ready(function () {

  jQuery.getJSON("https://weather.rtbbase.org/rest/locations",function(data){
    console.log("got data back, here it is: "+data);
    var trial_location = "' );
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/weather.mas"
$m->print(  $location  );
#line 12 "/home/production/cxgn/sgn/mason/breeders_toolbox/trial/weather.mas"
$m->print( '";
    var locations = data;
    var location_status;
    for (var i=0; i < locations.length; i++) {
      if (locations[i] == trial_location) {
        location_status = \'found\';
        jQuery(\'#trial_weather_check\').html(\'<a href="https://weather.rtbbase.org?location=\'+trial_location+\'">Weather for \'+trial_location+\'</a>\')
      }
    }
    if (location_status != \'found\') {
      jQuery(\'#trial_weather_check\').html(\'<p><i> No weather data available for location \'+trial_location+\'</i></p>\')
    }
  });

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

)
;