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 ( $organisms, $feature_types );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }
#line 2 "/home/production/cxgn/sgn/mason/search/features.mas"
     $organisms = exists $pos{'organisms'} ? $_[ $pos{'organisms'} ] :  undef;
#line 3 "/home/production/cxgn/sgn/mason/search/features.mas"
     $feature_types = exists $pos{'feature_types'} ? $_[ $pos{'feature_types'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 5 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '
' );
#line 6 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->comp(   '/util/import_javascript.mas', classes => 'SGN.Search.Feature'   
); #line 6 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '


' );
#line 9 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->comp(   '/util/import_javascript.mas', classes => [ 'jquery', 'jquery.dataTables' ]   
); #line 9 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '

<div class="container-fluid">

' );
#line 13 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->comp(   '/page/page_title.mas', title=>'Search genomic sequences and annotations'   
); #line 13 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '

' );
#line 15 "/home/production/cxgn/sgn/mason/search/features.mas"


use CXGN::Page::FormattingHelpers qw / simple_selectbox_html/;

my $f_type_select = simple_selectbox_html(
  choices   => $feature_types,
  id        => "feature_type_select",
);

my $organism_select = simple_selectbox_html(
  choices  =>  $organisms   ,
  id       => "organism_select",
);

#line 30 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '
' );
#line 31 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->comp( { content => sub {
#line 31 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '
  <div id="feature_search_form" class="form-horizontal well">
    <div class="row">
      <div class="col-sm-6">
	<div class="form-group form-group-sm">
	  <label class="col-sm-3 control-label">Organism: </label>
	  <div class="col-sm-9" >
            ' );
#line 38 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print(  $organism_select  );
#line 38 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '
	  </div>
	</div>
      </div>
      <div class="col-sm-6">
	<div class="form-group form-group-sm">
	  <label class="col-sm-3 control-label">Type: </label>
	  <div class="col-sm-9" >
            ' );
#line 46 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print(  $f_type_select  );
#line 46 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '
	  </div>
	</div>
      </div>
    </div>
    <div class="row">
      <div class="col-sm-6">
	<div class="form-group form-group-sm">
	  <label class="col-sm-3 control-label">Name: </label>
	  <div class="col-sm-9" >
            <input type="text" class="form-control" id="name" />
	  </div>
	</div>
      </div>
      <div class="col-sm-6">
	<div class="form-group form-group-sm">
	  <label class="col-sm-3 control-label">Description: </label>
	  <div class="col-sm-9" >
            <input type="text" class="form-control" id="description" />
	  </div>
	</div>
      </div>
    </div>
 <button style="float:right" class="btn btn-primary" id="submit_feature_search" />Search</button>
    <br/><br/>
  </div>
  
' );
#line 73 "/home/production/cxgn/sgn/mason/search/features.mas"
} }, '/page/info_section.mas', title => 'Search', collapsible=>1, collapsed=>0
 );
#line 73 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '


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


<div class="well">
<table id="feature_search_results" class="display">
<thead>
  <tr>
    <th>Organism</th>
    <th>Type</th>
    <th>Name</th>
    <th>Description</th>
    <th>Location</th>
  </tr>
</thead>
</table>
</div>

' );
#line 93 "/home/production/cxgn/sgn/mason/search/features.mas"
} }, '/page/info_section.mas', title => 'Search Results', collapsible=>1, collapsed=>0
 );
#line 93 "/home/production/cxgn/sgn/mason/search/features.mas"
$m->print( '

<script>
  
jQuery(document).ready(function () {

   var table = jQuery(\'#feature_search_results\').DataTable( { 
   
     \'searching\' : false,
     \'ordering\'  : false,
     \'processing\': true,
     \'serverSide\': true,
     \'ajax\': { \'url\':  \'/ajax/search/features\',
               \'data\': function(d) { 
                  d.organism    = jQuery(\'#organism_select\').val();
                  d.type_id     = jQuery(\'#feature_type_select\').val();
                  d.name        = jQuery(\'#name\').val(); 
                  d.description = jQuery(\'#description\').val(); 
                  
             }
         }
     });


   jQuery(\'#submit_feature_search\').click( function() { 
        var organism    = jQuery(\'#organism_select\').val();
        var type_id     = jQuery(\'#feature_type_select\').val();
        var name        = jQuery(\'#name\').val(); 
        var description = jQuery(\'#description\').val(); 
       
        table.search("feature_search_results").draw();
   });
  
   jQuery(\'#feature_search_form\').keypress( function( e ) {
           var code = e.keyCode || e.which;
           if( code == 13 ) {
                jQuery(\'#submit_feature_search\').click();
           }
    } );


    
});
  
</script>
' );
;return;
},
'declared_args' => {
  '$feature_types' => { default => ' undef' },
  '$organisms' => { default => ' undef' }
},
'load_time' => 1763344365,

)
;