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 ( $stock_row, $stockref, $locus_add_uri, $locus_autocomplete_uri, $cvterm_add_uri, $cvterm_autocomplete_uri, $barcode_tempdir, $barcode_tempuri, $identifier_prefix, $organism_autocomplete_uri, $image, $image_url );
{
    my %pos;
    for ( my $x = 0; $x < @_; $x += 2 )
    {
        $pos{ $_[$x] } = $x + 1;
    }

    foreach my $arg ( qw( stock_row ) )
    {
        HTML::Mason::Exception::Params->throw
            ( error => "no value sent for required parameter '$arg'" )
                unless exists $pos{$arg};
    }
#line 46 "/home/production/cxgn/sgn/mason/stock/index.mas"
    $stock_row = $_[ $pos{'stock_row'} ];
#line 47 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $stockref = exists $pos{'stockref'} ? $_[ $pos{'stockref'} ] :  undef;
#line 48 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $locus_add_uri = exists $pos{'locus_add_uri'} ? $_[ $pos{'locus_add_uri'} ] :  '';
#line 49 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $locus_autocomplete_uri = exists $pos{'locus_autocomplete_uri'} ? $_[ $pos{'locus_autocomplete_uri'} ] :  undef;
#line 50 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $cvterm_add_uri = exists $pos{'cvterm_add_uri'} ? $_[ $pos{'cvterm_add_uri'} ] :  '';
#line 51 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $cvterm_autocomplete_uri = exists $pos{'cvterm_autocomplete_uri'} ? $_[ $pos{'cvterm_autocomplete_uri'} ] :  undef;
#line 52 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $barcode_tempdir = exists $pos{'barcode_tempdir'} ? $_[ $pos{'barcode_tempdir'} ] :  undef;
#line 53 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $barcode_tempuri = exists $pos{'barcode_tempuri'} ? $_[ $pos{'barcode_tempuri'} ] :  undef;
#line 54 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $identifier_prefix = exists $pos{'identifier_prefix'} ? $_[ $pos{'identifier_prefix'} ] :  'SGN';
#line 55 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $organism_autocomplete_uri = exists $pos{'organism_autocomplete_uri'} ? $_[ $pos{'organism_autocomplete_uri'} ] :  '/ajax/organism/autocomplete/';
#line 56 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $image = exists $pos{'image'} ? $_[ $pos{'image'} ] :  undef;
#line 57 "/home/production/cxgn/sgn/mason/stock/index.mas"
     $image_url = exists $pos{'image_url'} ? $_[ $pos{'image_url'} ] :  undef;
}
$m->debug_hook( $m->current_comp->path ) if ( HTML::Mason::Compiler::IN_PERL_DB() );

#line 44 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 59 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

' );
#line 61 "/home/production/cxgn/sgn/mason/stock/index.mas"


use Bio::Chado::Schema;
use CXGN::Chado::Stock;
use CXGN::Page::FormattingHelpers qw / html_optional_show info_table_html /;
use CXGN::People::Person;
use CXGN::Chado::Publication;
use CXGN::Cview::Map::SGN::Genotype;
use CXGN::Cview::MapOverviews;
use SGN::Image;

my $trial_stock_type => undef;
my $stock = $stockref->{stock};
my $stock_id = $stockref->{stock_id};
my $action = $stockref->{action} || 'view';
my $person_id = $stockref->{person_id};
my $curator = $stockref->{curator};
my $submitter = $stockref->{submitter};
my $sequencer = $stockref->{sequencer};
my $pubs = $stockref->{pubs};
my $has_pedigree = $stockref->{has_pedigree};
my $has_descendants = $stockref->{has_descendants};
my $trait_ontology_db_name = $stockref->{trait_ontology_db_name};
my $editable_stock_props_string = $stockref->{editable_stock_props};
my $schema = $stockref->{schema};
my $dbh = $stockref->{dbh};
my $is_obsolete = $stockref->{is_obsolete};
my $is_a_transgenic_line = $stockref->{is_a_transgenic_line};
my $is_in_trial = $stockref->{is_in_trial};

my @editable_stock_props = split "," , $editable_stock_props_string;


my ($type_name, $uniquename);
my $type = $stock_row ? $stock_row->type : undef;
$type_name  = $type->name() if $type;
$uniquename = $stock->get_uniquename if $type;

my @editable_vector_props;

if($type_name eq 'vector_construct'){
  my $editable_vector_props_string = $stockref->{editable_vector_props};
  @editable_vector_props = split "," , $editable_vector_props_string;
}

#################
my $is_owner = $stockref->{is_owner};

my $this_page = "/stock/$stock_id/view";

my $image_ids =  $stockref->{image_ids} || [] ;
my $related_image_ids =  $stockref->{related_image_ids} || [] ;
my $stockprops = $stockref->{props};

my @valid_image_ids;
foreach my $image (@$image_ids) {
    my $image_id = $image->[0];
    my $image_obj = SGN::Image->new($schema->storage->dbh, $image_id, $c);
    if ($image_obj->get_md5sum()) {
        push(@valid_image_ids, $image)
    }
}
$image_ids = \@valid_image_ids;

#my $pedigree= ['pedigree', 'male parent', 'female parent'];
# get pedigree of stock
#my $stock_pedigree = $stockref->{stock_pedigree};
#my $stock_descendants = $stockref->{stock_descendants};

my $allele_div = "stock_alleles";
my $new_locus_link = !$person_id ? qq|<a href="/user/login">[log-in to associate new locus]</a> | : '' ;

#owner
my $owners = $stockref->{editor_info};
my $owner_ids = $stockref->{owners};
my $owners_html = '';
my %unique_owners;
foreach my $o_id (@$owner_ids) {
    $unique_owners{$o_id}++;
}
my @owner_ids = keys %unique_owners;
foreach my $o_id (@owner_ids){
  my $person = CXGN::People::Person->new($dbh, $o_id);
  my $first_name = $person->get_first_name;
  my $last_name = $person->get_last_name;
  $owners_html .= qq|<a href="/solpeople/personal-info.pl?sp_person_id=$o_id">$first_name $last_name</a> |;
}

my $editor_link_table;
if ($is_obsolete) {
    $editor_link_table = "<table class='table table-bordered'><thead><tr><th>Editor</th><th>Timestamp</th><th>Modification Note</th><th>Obsolete Note</th></tr></thead><tbody>";
    foreach my $o_id (@$owners) {
        my $person = CXGN::People::Person->new($dbh, $o_id->[0]);
        my $first_name = $person->get_first_name;
        my $last_name = $person->get_last_name;
        $editor_link_table .= qq|<tr><td><a href="/solpeople/personal-info.pl?sp_person_id=$o_id->[0]">$first_name $last_name</a></td><td>$o_id->[1]</td><td>$o_id->[2]</td><td>$o_id->[3]</td></tr>|;
    }
} else {
    $editor_link_table = "<table class='table table-bordered'><thead><tr><th>Editor</th><th>Timestamp</th><th>Modification Note</th></tr></thead><tbody>";
    foreach my $o_id (@$owners) {
        my $person = CXGN::People::Person->new($dbh, $o_id->[0]);
        my $first_name = $person->get_first_name;
        my $last_name = $person->get_last_name;
        $editor_link_table .= qq|<tr><td><a href="/solpeople/personal-info.pl?sp_person_id=$o_id->[0]">$first_name $last_name</a></td><td>$o_id->[1]</td><td>$o_id->[2]</td></tr>|;
    }
}

$editor_link_table .= "</tbody></table>";
$editor_link_table = "<br/>".$owners_html."<br/><br/>".$editor_link_table;

#phenotypes measured directly on this stock
my $direct_phenotypes = $stockref->{direct_phenotypes} || undef;

# get all phenotypes of subjects
my $members_phenotypes = $stockref->{members_phenotypes};
my $p_download_link = '<a class="btn btn-sm btn-default" style="margin:3px" target="_blank" href = "/breeders/trials/phenotype/download?format=csv&timestamp=1&dataLevel=all&'.$type_name.'_list=['.$stock_id.']&search_type=complete&">Download All Phenotypes</a>';

############################
my $map_html = $stockref->{map_html};
my $map;
if ($stock_id) {
  $map = CXGN::Cview::Map::SGN::Genotype->new($dbh, $stock_id);
  if ($map->get_chromosome_count > 1 ) {
    my $overview = CXGN::Cview::MapOverviews::Generic->new($map,
                                                           {
                                                            dbh=> $dbh,
                                                            basepath => $stockref->{cview_basepath},
                                                            tempfiles_subdir => $stockref->{cview_tmp_dir } });
    if ($overview) {
      $overview->render_map();
      $map_html .= $overview->get_image_html();
    }
  }
}
#########################################
my $has_qtl_data = $stockref->{has_qtl_data};


my $new_pub_link = $curator || $submitter || $sequencer  ?   qq|<a class="btn btn-sm btn-default" style="margin:3px" href="/chado/add_publication.pl?type=stock&amp;type_id=$stock_id&amp;refering_page=$this_page&amp;action=new">Associate publication</a>| : qq|<span class=\"btn btn-sm btn-default ghosted\" style="margin:3px" disabled>Associate publication</span>| ;

## EUSOL, tgrc (stock_dbxref)
my $dbxrefs = $stockref->{dbxrefs};
my %source_dbs;
foreach my $db_name ( keys %$dbxrefs ) {
  foreach my $dbxref ( @{ $dbxrefs->{$db_name} } ) {
    my $url = $dbxref->db->urlprefix . $dbxref->db->url;
    $url .= $dbxref->accession if $url ;
    $source_dbs{$url} = $db_name . ": " . $dbxref->accession if $url;
  }
}

my $ontology_subtitle = $curator || $submitter || $sequencer  ?
  qq|<a class="btn btn-sm btn-default" style="margin:3px" href="javascript:Tools.toggleContent('associate_cvterm_form', 'stock_ontology')">Add ontology annotations</a> | :
  qq |<span class = "btn btn-default btn-sm ghosted" style="margin:3px" disabled>Add ontology annotations</span> |;

my $add_phenotype_link =  $curator || $submitter || $sequencer  ? qq| <a href="javascript:Tools.toggleContent('add_phenotype_form', 'stock_phenotype')" >[Add phenotype]</a> | :   qq |<span class = "ghosted"> [Add phenotype]</span> |;

my $edit_privs = $curator || $submitter || $sequencer;

my $jbrowse_path = $c->config->{jbrowse_path};
my @path_parts = split('/', $jbrowse_path);
my $basepath = $path_parts[1];
my $test_url = "/" . $basepath . "/jbrowse.conf";
my $jbrowse_url = $jbrowse_path . "%2Faccessions%2F" . $stock_id . "&tracks=DNA%2CGene%20exons%2C" . $uniquename . "_2015_V6_imputed&highlight=";


my $released_variety_link = '<button class="btn btn-default btn-sm" style="margin:3px" id="released_variety_link" disabled>Add released variety name</button>';

if ($person_id && ($submitter || $curator || $sequencer)) { $released_variety_link = qq | <button class="btn btn-default btn-sm" style="margin:3px" id="released_variety_link" >Add released variety name</button> |; }

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

' );
#line 235 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/util/import_javascript.mas',
   classes => ["bootstrap_min", "d3.d3v4Min", "jquery", "jqueryui", "jquery.dataTables-buttons-min", "thickbox", "CXGN.Page.FormattingHelpers", "jquery.cookie", "CXGN.Stock", "jquery.dataTables" ],
  entries => ["sequenced_accessions"  ]
  
); #line 238 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

<script language="javascript">
function jqueryStuff() {
   jQuery(function() {
     jQuery("#species_name").autocomplete({
        source: \'/organism/autocomplete\'
     });
  });
}
</script>


' );
#line 251 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/page_title.mas', title=> join( ': ', grep $_, ucfirst($type_name), $uniquename ) || 'Create a new stock'   
); #line 251 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '


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

    <div class="panel panel-default">
        <div class="panel-body">

            <div class="row">
                <div class="col-sm-6">

                    ' );
#line 262 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/form.mas',
                        object_type=>'stock',
                        object_id=>"$stock_id",
                        form_name=> 'stock_form',
                        server_side_script => '/phenome/stock/stock_ajax_form.pl',
                        form_div_name=>'stock_details',
                        js_object_name=> 'stockForm',
                        page_url => "/stock/$stock_id/view/" ,
                        #alternate_new_button => '<a class="btn btn-sm btn-default" href ="/stock/0/new">New</a>'
                        alternate_new_button => '',,
                        alternate_ghosted_new_button => '',
                        alternate_delete_button => '',
                        alternate_ghosted_delete_button => ''
                      
); #line 275 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '


                </div>
                ' );
#line 279 "/home/production/cxgn/sgn/mason/stock/index.mas"

                if ($type_name eq 'accession') {
                #line 282 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '                <div class="col-sm-6">
                    <div style="position: relative;">
                        <button class="btn btn-default btn-small" id="toggle_qr_code" style="position: absolute; right: 10px; top: 10px; z-index: 10;">Show QR Code</button>
                    </div>
                </div>

                <div id ="qr_code_display" style="display: none; text-align: center; margin-top: 40px;">
                    <div style="text-align: center;">
                    ' );
#line 290 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/util/barcode.mas', identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode"   
); #line 290 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
                    </div>
                </div>

                <div class="col-sm-6">
                    <br /><br />
                    <div style="display: flex; justify-content: center; align-items; height: 100%; margin-top: 20px;">
                        ' );
#line 297 "/home/production/cxgn/sgn/mason/stock/index.mas"

                        use SGN::Image;
                        my $schema = $stockref->{schema};
                        my $stock_id = $stockref->{stock_id};

                        my $display_image_cvterm_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'selected_display_image', 'stock_property')->cvterm_id();
                        my $stockprop = $schema->resultset('Stock::Stockprop')->find({ stock_id => $stock_id, type_id => $display_image_cvterm_id });

                        if ($stockprop) {
                            my $image_id = $stockprop->value;
                            my $image = SGN::Image->new($schema->storage->dbh, $image_id, $c);
                            $image_url = $image->get_image_url('small');
                        } else {
                            my $image_id = $stockref->{image_ids}->[0]->[0];
                            my $image = SGN::Image->new($schema->storage->dbh, $image_id, $c);
                            $image_url = $image->get_image_url('small');
                        }

                        my $no_img_url = '/data/images/image_files/XX/XX/XX/XX/XXXXXXXXXXXXXXXXXXXXXXXX/small';
                        my $no_img_url_test = '/data/images/image_files_test/XX/XX/XX/XX/XXXXXXXXXXXXXXXXXXXXXXXX/small';

                        if (index($image_url, $no_img_url) != -1 || index($image_url, $no_img_url_test) != -1) {
                        #line 320 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '                        <p>No accession image to display</p>
                        ' );
#line 321 "/home/production/cxgn/sgn/mason/stock/index.mas"

                            } else {
                        #line 324 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '                        <img src="' );
#line 324 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print(  $image_url  );
#line 324 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '" class="img-responsive" style="max-width: 100%; height: auto;" />
                        ' );
#line 325 "/home/production/cxgn/sgn/mason/stock/index.mas"

                            }
                        #line 328 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
                    </div>
                    <br /><br />
                </div>
            ' );
#line 332 "/home/production/cxgn/sgn/mason/stock/index.mas"

            } else {
            #line 335 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '                <div class="col-sm-6">
                    <br /><br />
                    ' );
#line 337 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/util/barcode.mas', identifier => "$identifier_prefix"."$stock_id", text=> "$identifier_prefix stock $stock_id ($uniquename)", format=>"stock_qrcode"    
); #line 337 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
                    <br /><br />
                </div>
                ' );
#line 340 "/home/production/cxgn/sgn/mason/stock/index.mas"

                }
                #line 343 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '            </div>

	    <div class="row">
              <div class="col-sm-6">
		' );
#line 347 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp( { content => sub {
#line 347 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
		  ' );
#line 348 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/stock/stockprops.mas',
		     stock_id  =>$stock_id,
		    form_div_id => 'released_variety_link',
		    props      => ['released_variety_name'],
		    div_name   => 'released_variety_name',
		    edit_privs => $edit_privs,
		    subset     => ['released_variety_name'],
		    editable   => ['released_variety_name']    
); #line 355 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
                 ' );
#line 356 "/home/production/cxgn/sgn/mason/stock/index.mas"
} }, '/page/info_section.mas', title => "Released variety name", subtitle=>$released_variety_link, is_subsection => 1
 );
#line 356 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
	      </div>
              </div>
              <div class="row">
                <div class="col-sm-6">
	        </div>
	      </div>
          </div>
       </div>
' );
#line 365 "/home/production/cxgn/sgn/mason/stock/index.mas"
} }, '/page/info_section.mas', title=>"Stock details" , collapsible=>1, collapsed=>0, subtitle => "<button class='btn btn-sm btn-default' style='margin:3px' name='stock_new_qtl_link'>New QTL population</button> <button class='btn btn-sm btn-default' style='margin:3px' name='stock_go_to_stock_search'>Back to stock search</button>"
 );
#line 365 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

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

' );
#line 369 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name eq 'population') {
$m->print( '    ' );
#line 370 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name,  info_section_title => "<h4 style='display:inline'>Members</h4>", info_section_subtitle => 'View members in this population .', icon_class => "glyphicon glyphicon-list-alt", info_section_id => "population_members_section", info_section_collapsed => 0   
); #line 370 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 371 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name,  info_section_title => "<h4 style='display:inline'>Seedlot Info</h4>", info_section_subtitle => 'View seedlot information of each member in this population .', icon_class => "glyphicon glyphicon-retweet", info_section_id => "population_seedlot_info_section", info_section_collapsed => 1   
); #line 371 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 372 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 374 "/home/production/cxgn/sgn/mason/stock/index.mas"
 my $subtitle = $edit_privs ? "<button class=\"btn btn-sm btn-primary\" style=\"margin:3px\" id=\"stock_add_synonym\" >Add Synonym</button>" : "<button disabled class=\"btn btn-sm btn-primary\" style=\"margin:3px\" title=\"Login to add info\">Add Synonym</button>";
 my $props_subtitle = $edit_privs ? "<button class=\"btn btn-sm btn-primary\" style=\"margin:3px\" id=\"stock_add_props\" >Add Additional Info</button>" : "<button disabled class=\"btn btn-sm btn-primary\" style=\"margin:3px\" title=\"Login to add info\">Add Additional Info</button>";
$m->print( '
' );
#line 377 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name eq 'plot' || $type_name eq 'plant' || $type_name eq 'subplot' || $type_name eq 'tissue_sample') {
$m->print( '    ' );
#line 378 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Experiment Usage</h4>", info_section_subtitle => 'View experiments that this stock has been used in.', icon_class => "glyphicon glyphicon-leaf", info_section_id => "stock_trials_section"   
); #line 378 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 379 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Stocks</h4>", info_section_subtitle => 'View any accession, plot, plant, and/or tissue_sample that are linked to this stock.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "stock_related_stock_section", stock_uniquename => $uniquename, type_name => $type_name   
); #line 379 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 380 "/home/production/cxgn/sgn/mason/stock/index.mas"
   my $trait_assayed_buttons = $type_name eq 'plot' ? "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link <a class='btn btn-sm btn-default' style='margin:3px' target='_blank' href = '/breeders/plot_phenotyping?stock_id=$stock_id'>Direct plot phenotyping</a>" : "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link";
$m->print( '    ' );
#line 381 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Traits Assayed</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-equalizer", info_section_id => "stock_traits_section", buttons_html => $trait_assayed_buttons   
); #line 381 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 382 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 384 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name ne 'vector_construct' ){
$m->print( '    ' );
#line 385 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name, stockref => $stockref, buttons_html => $subtitle.$props_subtitle, info_section_title => "<h4 style='display:inline'>Additional Info</h4>", info_section_subtitle => 'View and edit additional properties such as synonyms, editors, and all types of properties.', icon_class => "glyphicon glyphicon-info-sign", info_section_id => "stock_additional_info_section", stockprops => $stockprops, edit_privs => $edit_privs, editable_stock_props => \@editable_stock_props, editor_link => $editor_link_table, source_dbs => \%source_dbs, locus_add_uri => $locus_add_uri, new_locus_link => $new_locus_link, allele_div => $allele_div, is_owner => $is_owner, info_section_collapsed => 0   
); #line 385 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 386 "/home/production/cxgn/sgn/mason/stock/index.mas"
 } else {
$m->print( '    ' );
#line 387 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name, stockref => $stockref, buttons_html => $subtitle.$props_subtitle, info_section_title => "<h4 style='display:inline'>Additional Info</h4>", info_section_subtitle => 'View and edit additional properties such as synonyms, editors, and all types of properties.', icon_class => "glyphicon glyphicon-info-sign", info_section_id => "stock_additional_info_section", stockprops => $stockprops, edit_privs => $edit_privs, editable_stock_props => \@editable_vector_props, editor_link => $editor_link_table, source_dbs => \%source_dbs, locus_add_uri => $locus_add_uri, new_locus_link => $new_locus_link, allele_div => $allele_div, is_owner => $is_owner, info_section_collapsed => 1   
); #line 387 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 388 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name, stockref=> $stockref, info_section_title => "<h4 style='display:inline' >Vector Viewer</h4>", info_section_subtitle => "", info_section_id => "vector_view", edit_privs => $edit_privs,  is_owner => $is_owner, info_section_collapsed => 0   
); #line 388 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 389 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Transgenic Line Details</h4>", info_section_subtitle => 'View accessions (transgenic lines) containing this vector construct and number of transgene insertions.', icon_class => "glyphicon glyphicon-list-alt", info_section_id => "vector_transgenic_line_details_section", stock_uniquename => $uniquename, type_name => $type_name   
); #line 389 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 390 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Obsoleted Transgenic Lines</h4>", info_section_subtitle => 'View obsoleted accessions (transgenic lines) and metadata.', icon_class => "glyphicon glyphicon-remove", info_section_id => "vector_obsoleted_accessions_section", stock_uniquename => $uniquename, type_name => $type_name   
); #line 390 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 391 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Transformation Info</h4>", info_section_subtitle => 'View transformation ids related to this vector construct.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "vector_related_accessions_section", stock_uniquename => $uniquename, type_name => $type_name   
); #line 391 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 392 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 394 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($is_a_transgenic_line) {
$m->print( '    ' );
#line 395 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', info_section_collapsed => 1, stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Transformation Info</h4>", info_section_subtitle => 'View related information about transformation experiment.', icon_class => "glyphicon glyphicon-list-alt", info_section_id => "related_transformation_info_section"   
); #line 395 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 396 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 398 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name eq 'accession'){
$m->print( '    ' );
#line 399 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, type_name => $type_name, info_section_title => "<h4 style='display:inline'>Experiment Usage</h4>", info_section_subtitle => 'View experiments that this stock has been used in.', icon_class => "glyphicon glyphicon-leaf", info_section_id => "stock_trials_section"   
); #line 399 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 400 "/home/production/cxgn/sgn/mason/stock/index.mas"
    my $trait_assayed_buttons = $type_name eq 'plot' ? "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link <a class='btn btn-sm btn-default' style='margin:3px' target='_blank' href = '/breeders/plot_phenotyping?stock_id=$stock_id'>Direct plot phenotyping</a>" : "<button class='btn btn-sm btn-primary' style='margin:3px' id='stock_download_phenotypes_button'>Download Phenotypes</button> $p_download_link";
$m->print( '    ' );
#line 401 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Traits Assayed</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-equalizer", info_section_id => "stock_traits_section", buttons_html => $trait_assayed_buttons   
); #line 401 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 402 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 404 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name eq 'accession' || $type_name eq 'plant' || $type_name eq 'plot' || $type_name eq 'tissue_sample'){
$m->print( '
' );
#line 406 "/home/production/cxgn/sgn/mason/stock/index.mas"
   my $sequencing_status_button = '';
   if ($c->user) {
       $sequencing_status_button = '<button id="show_sequencing_info_dialog_button" class="btn btn-primary btn-sm" data-toggle="modal" style="margin:3px" data-target="#edit_sequencing_info_dialog">Add sequencing info</button>';
   }
   else {
       $sequencing_status_button = '<button disabled id="show_sequencing_info_dialog_button" class="btn btn-primary btn-sm" data-toggle="modal" style="margin:3px" data-target="#edit_sequencing_info_dialog">Add sequencing info</button>';
   }
$m->print( '
      ' );
#line 414 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Sequencing Status</h4>", info_section_subtitle => 'View and edit sequencing status info for this stock.', icon_class => "glyphicon glyphicon-inbox", info_section_id => "stock_sequencing_status_section", buttons_html => "$sequencing_status_button", map_html => $map_html   
); #line 414 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

	<!-- buttons_html => \'<a class="btn btn-default btn-sm" style="margin:3px" href = "/stock/\'.$stock_id.\'/genotypes">Download All Genotypes</a>\', -->

    ' );
#line 418 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Genotype Marker Data</h4>", info_section_subtitle => 'View and download phenotypic data for this stock.', icon_class => "glyphicon glyphicon-map-marker", info_section_id => "stock_genotypes_section",  map_html => $map_html   
); #line 418 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 419 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 421 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($type_name eq 'accession'){
$m->print( '
' );
#line 423 "/home/production/cxgn/sgn/mason/stock/index.mas"

        my $collapsible = 0;
        if ($has_pedigree==1) {
            $collapsible = 1;
        }
        my $add_parent_link = '<button class="btn btn-primary btn-sm" style="margin:3px" id="add_parent_link" disabled>Add parent</button>';
        if ($person_id && ($submitter || $curator || $sequencer)) { $add_parent_link = qq | <button class="btn btn-primary btn-sm" style="margin:3px" id="add_parent_link" >Add parent</button> |; }

        my $remove_parent_link = '<button class="btn btn-default btn-sm" style="margin:3px" id="remove_parent_link" disabled>Remove parent</button>';
        if ($person_id && ($submitter || $curator || $sequencer)) { $remove_parent_link = qq | <button class="btn btn-default btn-sm" style="margin:3px" id="remove_parent_link">Remove parent</button> |; }
#line 434 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 435 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Pedigree</h4>", info_section_subtitle => 'View and edit pedigree information.', icon_class => "glyphicon glyphicon-random", info_section_id => "stock_pedigree_section", buttons_html => $add_parent_link.$remove_parent_link, has_pedigree => $has_pedigree, info_section_collapsed => 1   
); #line 435 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 436 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Related Stocks</h4>", info_section_subtitle => 'View any plots, plants, tissue_sample, and/or accessions that are linked to this stock.', icon_class => "glyphicon glyphicon-retweet", info_section_id => "stock_related_stock_section", stock_uniquename => $uniquename, type_name => $type_name   
); #line 436 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

' );
#line 438 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
    ' );
#line 440 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Images</h4>", info_section_subtitle => 'View and add images of this stock and of related stocks.', icon_class => "glyphicon glyphicon-camera", info_section_id => "stock_images_section", image_ids => $image_ids, related_image_ids => $related_image_ids, dbh => $dbh, curator =>$curator, buttons_html => qq|<a id="add_new_image_button" class="btn btn-sm btn-default" style="margin:3px" href="/image/add?type_id=$stock_id&action=new&type=stock&refering_page=$this_page">Add new image</a><a class="btn btn-sm btn-default" style="margin:3px" id="stock_images_section_compare_images_button">Compare Images</a>|   
); #line 440 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

    ' );
#line 442 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Upload Data Files</h4>", info_section_subtitle => 'Upload any additional files for this Accession.', icon_class => "glyphicon glyphicon-cloud-upload", info_section_id => "stock_upload_files"   
); #line 442 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

    ' );
#line 444 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Literature Annotation</h4>", info_section_subtitle => 'View annotations for this stock found in literatur and ontologies.', icon_class => "glyphicon glyphicon-book", info_section_id => "stock_literature_annotation_section", buttons_html => $new_pub_link.$ontology_subtitle, pubs => $pubs, cvterm_add_uri => $cvterm_add_uri, stockref => $stockref, trait_ontology_db_name => $trait_ontology_db_name, is_owner => $is_owner, dbh=>$dbh   
); #line 444 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

    ' );
#line 446 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>JBrowse Genome Alignments</h4>", info_section_subtitle => 'View JBrowse tracks for this stock.', icon_class => "glyphicon glyphicon-align-left", info_section_id => "stock_jbrowse_section"   
); #line 446 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

    ' );
#line 448 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Comments</h4>", info_section_subtitle => 'View and add comments to this stock.', icon_class => "glyphicon glyphicon-pencil", info_section_id => "stock_comments_section", referer => $this_page   
); #line 448 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

    ' );
#line 450 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, info_section_title => "<h4 style='display:inline'>Audit Table</h4>", info_section_subtitle => 'Track audit information for this stock.', icon_class => "glyphicon glyphicon-time", info_section_id => "audit_table_section", stock_uniquename => $uniquename, referer => $this_page   
); #line 450 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

' );
#line 452 "/home/production/cxgn/sgn/mason/stock/index.mas"
 if ($edit_privs && $type_name eq 'population') {
$m->print( '    ' );
#line 453 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, stock_uniquename => $uniquename, info_section_title => "<h4 style='display:inline'>Delete This Stock</h4>", info_section_subtitle => 'Delete this population.', icon_class => "glyphicon glyphicon-trash", info_section_id => "population_delete_section"   
); #line 453 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 454 "/home/production/cxgn/sgn/mason/stock/index.mas"
 } elsif ($edit_privs && $type_name ne 'population') {
$m->print( '    ' );
#line 455 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/page/detail_page_2_col_section.mas', stock_id => $stock_id, stock_uniquename => $uniquename, is_obsolete=> $is_obsolete, is_in_trial=> $is_in_trial, info_section_title => "<h4 style='display:inline'>" . ($is_obsolete ? "Un-Obsolete This Stock" : "Obsolete This Stock") . "</h4>", info_section_subtitle => ($is_obsolete ? "Make a stock not obsolete so that it does show in searches" : "Make a stock obsolete so that it does not show in searches"), icon_class => "glyphicon glyphicon-trash", info_section_id => "stock_delete_section"   
); #line 455 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 456 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 458 "/home/production/cxgn/sgn/mason/stock/index.mas"
} }, '/page/info_section.mas', title => "Navigator" , collapsible=> 1, collapsed=>0
 );
#line 458 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

' );
#line 460 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/stock/download_stock_phenotypes_dialog.mas', stock_id => $stock_id, stock_name => $uniquename, stock_type => $type_name   
); #line 460 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

<div id="remove_parent_dialog">
    Remove a parent (this will only remove the link to the parent, not the parent accession itself).
    <br /><br />
    <div id="remove_parent_list">[loading parent list...]</div>
</div>


' );
#line 469 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp( { content => sub {
#line 469 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 470 "/home/production/cxgn/sgn/mason/stock/index.mas"
 foreach my $project (keys %$direct_phenotypes) {
   my $rs = $direct_phenotypes->{$project} ;
$m->print( '
' );
#line 473 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp( { content => sub {
#line 479 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 480 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/stock/add_phenotype.mas',
      stock_id => $stock_id ,
      trait_ontology_db_name => $trait_ontology_db_name,
      project=>$project
      
); #line 484 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
  ' );
#line 485 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/phenotypes/phenotype_data.mas',
      phenotypes=> $rs
      
); #line 487 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
  ' );
#line 488 "/home/production/cxgn/sgn/mason/stock/index.mas"
} }, '/page/info_section.mas',
    id       => "stock_phenotype",
    title    =>"Experiment: $project",
    subtitle => $add_phenotype_link,
    is_subsection => 1,
    collapsible => 1
 );
#line 488 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 489 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
$m->print( '
' );
#line 491 "/home/production/cxgn/sgn/mason/stock/index.mas"
 foreach my $key (keys %$members_phenotypes) {
 my $m_rs = $members_phenotypes->{$key};
$m->comp( { content => sub {
#line 498 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
    ' );
#line 499 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/phenotypes/phenotype_data.mas',
         phenotypes => $m_rs,
         object_id  => $stock_id,
         has_qtl    => $has_qtl_data,
       
); #line 503 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
  ' );
#line 504 "/home/production/cxgn/sgn/mason/stock/index.mas"
} }, '/page/info_section.mas',
     title         => "Member phenotypes",
     subtitle      => $key,
     is_subsection => 1,
     collapsible   => 1,
 );
#line 504 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '
' );
#line 505 "/home/production/cxgn/sgn/mason/stock/index.mas"
 }
} }, '/page/info_section.mas', title=>"Phenotype data " ,  subtitle=>$p_download_link ,  collapsible => 1, collapsed => 1
 );
#line 506 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

<div id="stock_trials_info_popup">
    <table id="stock_trials_info_table" >
        <thead>
            <tr><th>Trait</th><th>Average</th><th>Std dev</th><th>Count</th></tr>
        </thead>
    </table>
</div>

' );
#line 516 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->comp(   '/transformation/obsolete_stock_dialog.mas'  
); #line 516 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '

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

        jQuery(\'[name="stock_new_qtl_link"]\').click(function(){
            window.location.href = \'/phenome/qtl_form.pl\';
        });

        jQuery(\'[name="stock_go_to_stock_search"]\').click(function(){
            window.location.href = \'/search/stocks/\';
        });

        jQuery(\'#remove_parent_link\').click( function() {
            jQuery(\'#remove_parent_dialog\').dialog("open");
            get_remove_parents_list(' );
#line 532 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print(  $stock_id  );
#line 532 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( ');
        });

        jQuery.ajax({
            url: "' );
#line 536 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print(  $test_url  );
#line 536 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '",
            success: function(response) {
                if ( response.indexOf("Accession_' );
#line 538 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( $stock_id );
#line 538 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '") > -1 ) {  // if dataset is found, create and display link
                    jQuery(\'#jbrowse_check\').replaceWith(\'<a id="jbrowse_link" href="' );
#line 539 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print(  $jbrowse_url  );
#line 539 "/home/production/cxgn/sgn/mason/stock/index.mas"
$m->print( '">View the tracks for this accession in JBrowse</a>\');
                }
                else { // if not found, display message that dataset doesn\'t exist
                    jQuery(\'#jbrowse_check\').html(" <i>This accession does not have any data in Jbrowse.</i>");
                }
            },
            error: function() {
                jQuery(\'#jbrowse_check\').html(" <i>Jbrowse has not been set up for this database.</i>");
            }
        });

        jQuery(\'#toggle_qr_code\').click(function() {
            var qrCodeDisplay = jQuery(\'#qr_code_display\');
            var buttonText = jQuery(this).text();

            qrCodeDisplay.toggle();
            if (qrCodeDisplay.is(\':visible\')) {
                jQuery(this).text(\'Hide QR Code\');
            } else {
                jQuery(this).text(\'Show QR Code\');
            }
        });


  });



</script>
' );
;return;
},
'declared_args' => {
  '$barcode_tempdir' => { default => ' undef' },
  '$barcode_tempuri' => { default => ' undef' },
  '$cvterm_add_uri' => { default => ' \'\'' },
  '$cvterm_autocomplete_uri' => { default => ' undef' },
  '$identifier_prefix' => { default => ' \'SGN\'' },
  '$image' => { default => ' undef' },
  '$image_url' => { default => ' undef' },
  '$locus_add_uri' => { default => ' \'\'' },
  '$locus_autocomplete_uri' => { default => ' undef' },
  '$organism_autocomplete_uri' => { default => ' \'/ajax/organism/autocomplete/\'' },
  '$stock_row' => { default => undef },
  '$stockref' => { default => ' undef' }
},
'load_time' => 1763448494,

)
;