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

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

<div class="container-fluid">

' );
#line 11 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->comp(   '/page/page_title.mas', title=>'Search Genes and Loci'   
); #line 11 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '

' );
#line 13 "/home/production/cxgn/sgn/mason/search/loci.mas"


use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html conditional_like_input_html simple_selectbox_html/;


my $any_name_select = conditional_like_input_html("any_name","contains", "", '30');
    

my $organism = simple_selectbox_html( 
 choices  =>  $organism_ref   ,
 id       => "common_name",
);
    
  
my $linkage_group_select = simple_selectbox_html(
   choices => $lg_names_ref,
   id      => "locus_linkage_group",
);
    
       
no warnings 'uninitialized';

my $advanced_search=  info_table_html(
  'Organism'   => $organism,
  'Chromosome / Linkage&nbsp;Group' => $linkage_group_select,
  'Locus editor' =>qq|<input class="form-control" type="text" id="locus_editor" size="20"/>|,
  'Show only genes with' => qq | <input type="checkbox" id="has_sequence"  />sequence <br />
				<input type="checkbox" id="has_marker" />markers<br />
				<input type="checkbox" id="has_annotation" />GO/PO annotation<br /> |,
	
      'Phenotype'  => qq|<input class="form-control" type="text" id="phenotype" size="30" /><a href="/search/phenotypes"> [Advanced SGN phenotype search]</a>|,
      'Ontology term' => qq|<input class="form-control" type="text" id="ontology_term" placeholder="Term name or ID: e.g. 'carotenoid' or 'PO:0007010'"/>
             <!--<br /><span class="ghosted">(Term name or ID: e.g. 'carotenoid' or 'PO:0007010')</span>-->|,
      'Genbank ID' =>qq|<input class="form-control" type="text" id="genbank_accession" placeholder="Accession or GI: e.g. 'EF091820' or '118185006'"/>
             <!--<br /><span class="ghosted">(Accession or GI: e.g. 'EF091820' or '118185006')</span>-->|,   
      __border   =>1,
      __multicol =>2,
      __tableattrs => 'width="100%"',
      );

#line 54 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '

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

<div class="well" id="locus_search_form">

  <div class="form-horizontal" >
    <div class="form-group">
      <label class="col-sm-3 control-label">Search for any gene, locus, or allele:</label>
      <div class="col-sm-9" >
        ' );
#line 64 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print(  $any_name_select  );
#line 64 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '
      </div>
    </div>
    <div class="container-fluid" align="center">
      <br/>
      <ul class="list-inline" >
        <li style="padding-bottom:5px"><button class="btn btn-primary" id="submit_locus_search" />Search</button></li>
	<li style="padding-bottom:5px"><a class="btn btn-info" href="/locus/0/new/" style="color:#fff" >Submit New Locus</a></li>
	<li style="padding-bottom:5px"><input class="btn btn-default" type="button" value="Advanced Search Options" id="show_advanced_search" /></li>
      </ul>
    </div>
  </div>

<!--
<table>
  <tr>
    <td colspan="2"><b>Search for any gene, locus, or allele</b>  (<a href="../help/gene_search_help.pl">gene search help page</a>)</td></tr>
  <tr><td>' );
#line 81 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print(  $any_name_select  );
#line 81 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '</td>
    <td><div align="center"><button id="submit_locus_search" />Search</button></div></td>
   <tr><td><a href="/locus/0/new/">[Submit new locus]</a></td></tr>
</tr></table>
<br />
-->

<div id="advanced_search_div" style="display:none;">
   ' );
#line 89 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->comp( { content => sub {
#line 89 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '
     ' );
#line 90 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print(  $advanced_search  );
#line 90 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '
   ' );
#line 91 "/home/production/cxgn/sgn/mason/search/loci.mas"
} }, '/page/info_section.mas', title    => 'Advanced Options'
 );
#line 91 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '
</div>

</div>

' );
#line 96 "/home/production/cxgn/sgn/mason/search/loci.mas"
} }, '/page/info_section.mas', title => 'Search', collapsible=>1, collapsed=>0, subtitle=>'[<a href="../help/gene_search_help.pl">Gene Search Help</a>]'
 );
#line 96 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '

</div>


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


<div class="well">
<table id="locus_search_results" class="display">
<thead>
  <tr>
    <th>Organism</th>
    <th>Locus Name</th>
    <th>Locus Symbol</th>
    <th>Alleles</th>
  </tr>
</thead>
</table>
</div>

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


' );
#line 120 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->comp(   '/util/import_css.mas', paths => ['/documents/inc/datatables/jquery.dataTables.css']   
); #line 120 "/home/production/cxgn/sgn/mason/search/loci.mas"
$m->print( '



<script>

jQuery(document).ready(function () {

   var table = jQuery(\'#locus_search_results\').DataTable( { 
   
     \'searching\' : false,
     \'ordering\'  : false,
     \'processing\': true,
     \'serverSide\': true,
     \'ajax\': { \'url\':  \'/ajax/search/loci\',
               \'data\': function(d) { 
                  d.any_name  = jQuery(\'#any_name\').val();
                  d.any_name_matchtype = jQuery(\'#any_name_matchtype\').val();
                  d.common_name  = jQuery(\'#common_name\').val(); 
                  d.phenotype  = jQuery(\'#phenotype\').val(); 
                  d.linkage_group  = jQuery(\'#locus_linkage_group\').val(); 
                  d.ontology_term  = jQuery(\'#ontology_term\').val(); 
                  d.locus_editor  = jQuery(\'#locus_editor\').val(); 
                  d.genbank_accession  = jQuery(\'#genbank_accession\').val();
                  d.has_sequence  = jQuery(\'#has_sequence\').is(\':checked\');
                  d.has_marker  = jQuery(\'#has_marker\').is(\':checked\'); 
                  d.has_annotation  = jQuery(\'#has_annotation\').is(\':checked\'); 
             }
         }
     });


   jQuery(\'#submit_locus_search\').click( function() { 
         var common_name  = jQuery(\'#common_name\').val(); 
         var phenotype    = jQuery(\'#phenotype\').val(); 
         var linkage      = jQuery(\'#locus_linkage_group\').val(); 
         var ontology     = jQuery(\'#ontology_term\').val(); 
         var editor       = jQuery(\'#locus_editor\').val(); 
         var genbank      = jQuery(\'#genbank_accession\').val();
         var has_sequence     = jQuery(\'#has_sequence\').is(\':checked\');
         var has_marker       = jQuery(\'#has_marker\').is(\':checked\'); 
         var has_annotation   = jQuery(\'#has_annotation\').is(\':checked\'); 
       
         if (  phenotype.trim().length  || common_name.length || ontology.trim().length || editor.trim().length || genbank.trim().length || has_sequence || has_marker || has_annotation ) {
             jQuery(\'#advanced_search_div\').show();
         } else {
             jQuery(\'#advanced_search_div\').hide()
         }
         table.search("locus_search_results").draw();
   });
  
   jQuery(\'#locus_search_form\').keypress( function( e ) {
           var code = e.keyCode || e.which;
           if( code == 13 ) {
                jQuery(\'#submit_locus_search\').click();
           }
    } );


   jQuery(\'#show_advanced_search\').click( function() {
        if (false == jQuery(\'#advanced_search_div\').is(\':visible\')) {
             jQuery(\'#advanced_search_div\').show();
        }
        else {
             jQuery(\'#advanced_search_div\').hide();
       }
   } );
 
  
    
});
  
</script>
' );
;return;
},
'declared_args' => {
  '$lg_names_ref' => { default => ' undef' },
  '$organism_ref' => { default => ' undef' }
},
'load_time' => 1763231603,

)
;