From 7ead84937b5fc52535cd7cde97f18f2793a84ed0 Mon Sep 17 00:00:00 2001 From: titima15 Date: Mon, 4 Dec 2023 15:57:57 -0500 Subject: [PATCH 1/9] moved related stock section --- mason/stock/index.mas | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/mason/stock/index.mas b/mason/stock/index.mas index a9753ca662..bf2c754f04 100644 --- a/mason/stock/index.mas +++ b/mason/stock/index.mas @@ -246,7 +246,7 @@ function jqueryStuff() { alternate_ghosted_delete_button => '' &> - +


@@ -260,13 +260,13 @@ function jqueryStuff() { <&| /page/info_section.mas, title => "Released variety name", subtitle=>$released_variety_link, is_subsection => 1 &> <& /stock/stockprops.mas, stock_id =>$stock_id, - form_div_id => 'released_variety_link', + 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'] &> - +
@@ -278,18 +278,22 @@ function jqueryStuff() { - + <&| /page/info_section.mas, title => "Navigator" , collapsible=> 1, collapsed=>0 &> % my $subtitle = $edit_privs ? "" : ""; % my $props_subtitle = $edit_privs ? "" : ""; +% if ($type_name eq 'plot' || $type_name eq 'plant' || $type_name eq 'subplot' || $type_name eq 'tissue_sample') { + <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Related Stocks

", 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 &> +% } + % if ($type_name ne 'vector_construct' ){ <& /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 => "

Additional Info

", 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 &> % } else { <& /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 => "

Additional Info

", 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 &> -% } +% } % if ($type_name eq 'accession' || $type_name eq 'plant' || $type_name eq 'plot' || $type_name eq 'subplot' || $type_name eq 'tissue_sample'){ <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Experiment Usage

", info_section_subtitle => 'View experiments that this stock has been used in.', icon_class => "glyphicon glyphicon-leaf", info_section_id => "stock_trials_section" &> @@ -313,9 +317,9 @@ function jqueryStuff() { % } <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Sequencing Status

", 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 &> - + - + <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Genotype Marker Data

", 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 &> % } @@ -334,9 +338,9 @@ function jqueryStuff() { <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Pedigree

", 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 => 0 &> + <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Related Stocks

", 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 &> % } - <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Related Stocks

", 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 &> <& /page/detail_page_2_col_section.mas, stock_id => $stock_id, info_section_title => "

Images

", 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, buttons_html => qq|Add new imageCompare Images| &> From 854defe0e924953f432d36ab36c5c0a091362973 Mon Sep 17 00:00:00 2001 From: titima15 Date: Mon, 4 Dec 2023 19:39:43 -0500 Subject: [PATCH 2/9] organize different stock types --- lib/SGN/Controller/AJAX/Stock.pm | 84 ++++++++++++++++++++---- mason/stock/related_stock.mas | 5 +- t/unit_mech/AJAX/Stocks/Related_stocks.t | 8 +-- 3 files changed, 79 insertions(+), 18 deletions(-) diff --git a/lib/SGN/Controller/AJAX/Stock.pm b/lib/SGN/Controller/AJAX/Stock.pm index ccf0ac27aa..935b3e198f 100644 --- a/lib/SGN/Controller/AJAX/Stock.pm +++ b/lib/SGN/Controller/AJAX/Stock.pm @@ -1924,15 +1924,75 @@ sub get_trial_related_stock:Chained('/stock/get_stock') PathPart('datatables/tri my $trial_related_stock = CXGN::Stock::RelatedStocks->new({dbic_schema => $schema, stock_id =>$stock_id}); my $result = $trial_related_stock->get_trial_related_stock(); my @stocks; + my @accessions; + my @crosses; + my @family_names; + my @plots; + my @subplots; + my @plants; + my @tissue_samples; + my @seedlots; + my @others; foreach my $r (@$result){ - my ($stock_id, $stock_name, $cvterm_name) = @$r; - my $url; - if ($cvterm_name eq 'seedlot'){ - $url = qq{$stock_name}; - } else { - $url = qq{$stock_name}; - } - push @stocks, [$url, $cvterm_name, $stock_name]; + my ($stock_id, $stock_name, $cvterm_name) = @$r; + my $url; + if ($cvterm_name eq 'seedlot'){ + $url = qq{$stock_name}; + } elsif ($cvterm_name eq 'cross') { + $url = qq{$stock_name}; + } elsif ($cvterm_name eq 'family_name') { + $url = qq{$stock_name}; + } else { + $url = qq{$stock_name}; + } + + if ($cvterm_name eq 'accession') { + push @accessions, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'cross') { + push @crosses, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'family_name') { + push @family_names, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'plot') { + push @plots, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'subplot') { + push @subplots, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'plant') { + push @plants, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'tissue_sample') { + push @tissue_samples, [$cvterm_name, $url, $stock_name]; + } elsif ($cvterm_name eq 'seedlot') { + push @seedlots, [$cvterm_name, $url, $stock_name]; + } else { + push @others, [$cvterm_name, $url, $stock_name]; + } + } + + if (scalar(@accessions) > 0) { + push @stocks, @accessions; + } + if (scalar(@crosses) > 0) { + push @stocks, @crosses; + } + if (scalar(@family_names) > 0) { + push @stocks, @family_names; + } + if (scalar(@plots) > 0) { + push @stocks, @plots; + } + if (scalar(@subplots) > 0) { + push @stocks, @subplots; + } + if (scalar(@plants) > 0) { + push @stocks, @plants; + } + if (scalar(@tissue_samples) > 0) { + push @stocks, @tissue_samples; + } + if (scalar(@seedlots) > 0) { + push @stocks, @seedlots; + } + if (scalar(@others) > 0) { + push @stocks, @others; } $c->stash->{rest}={data=>\@stocks}; @@ -2277,7 +2337,7 @@ sub stock_additional_file_upload :Chained('/stock/get_stock') PathPart('upload_a $c->stash->{rest} = {error=>$result->{error}}; $c->detach(); } - + $c->stash->{rest} = { success => 1, file_id => $result->{file_id} }; } @@ -2294,11 +2354,11 @@ sub get_accession_additional_file_uploaded :Chained('/stock/get_stock') PathPart my @file_array; my %file_info; - my $q = "SELECT file_id, m.create_date, p.sp_person_id, p.username, basename, dirname, filetype + my $q = "SELECT file_id, m.create_date, p.sp_person_id, p.username, basename, dirname, filetype FROM phenome.stock_file - JOIN metadata.md_files using(file_id) + JOIN metadata.md_files using(file_id) LEFT JOIN metadata.md_metadata as m using(metadata_id) - LEFT JOIN sgn_people.sp_person as p ON (p.sp_person_id=m.create_person_id) + LEFT JOIN sgn_people.sp_person as p ON (p.sp_person_id=m.create_person_id) WHERE stock_id=? and m.obsolete = 0 and metadata.md_files.filetype='accession_additional_file_upload' ORDER BY file_id ASC"; my $h = $c->dbc->dbh()->prepare($q); diff --git a/mason/stock/related_stock.mas b/mason/stock/related_stock.mas index 3c2fb86a91..89aa0b080c 100644 --- a/mason/stock/related_stock.mas +++ b/mason/stock/related_stock.mas @@ -7,15 +7,15 @@ $stock_type => undef % if ($stock_type eq 'accession' || $stock_type eq 'plant' || $stock_type eq 'plot' || $stock_type eq 'subplot' || $stock_type eq 'tissue_sample'){ - <&| /page/info_section.mas, id=>'related_stocks_in_trial', title => 'Related stocks in trials', collapsible=>1, collapsed=>1 &> + <&| /page/info_section.mas, id=>'related_stocks_in_trial', title => 'Related stocks in trial', collapsible=>1, collapsed=>1 &>
- + @@ -156,6 +156,7 @@ jQuery(document).ready(function(){ jQuery('#related_stocks_in_trial_onswitch').one("click", function(){ var trial_stock_table = jQuery('#trial_related_stock').DataTable({ + 'order': false, 'ajax':'/stock/'+ <% $stock_id %> + '/datatables/trial_related_stock', "fnInitComplete": function(oSettings, json) { //console.log(json); diff --git a/t/unit_mech/AJAX/Stocks/Related_stocks.t b/t/unit_mech/AJAX/Stocks/Related_stocks.t index bb6d16935d..ec76b811cd 100644 --- a/t/unit_mech/AJAX/Stocks/Related_stocks.t +++ b/t/unit_mech/AJAX/Stocks/Related_stocks.t @@ -27,10 +27,10 @@ $response = decode_json $mech->content; #print STDERR Dumper $response; is_deeply($response, {'data'=> [ -['test_trial21', 'plot', 'test_trial21'], -['test_trial26', 'plot', 'test_trial26'], -['test_trial214', 'plot', 'test_trial214'], -['test_accession4_001','seedlot','test_accession4_001'] +['plot', 'test_trial21', 'test_trial21'], +['plot', 'test_trial26', 'test_trial26'], +['plot', 'test_trial214', 'test_trial214'], +['seedlot', 'test_accession4_001','test_accession4_001'] ]}, 'trial_related_stock'); $mech->get_ok("http://localhost:3010/stock/$accession_1_id/datatables/progenies"); From 5d81899d795fb09a9e3973b5c6990c81e8ddc033 Mon Sep 17 00:00:00 2001 From: titima15 Date: Tue, 5 Dec 2023 14:06:19 -0500 Subject: [PATCH 3/9] removed seedlot from related stocks in trial --- lib/CXGN/Stock/RelatedStocks.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CXGN/Stock/RelatedStocks.pm b/lib/CXGN/Stock/RelatedStocks.pm index d0235e5c76..746c859d33 100644 --- a/lib/CXGN/Stock/RelatedStocks.pm +++ b/lib/CXGN/Stock/RelatedStocks.pm @@ -24,14 +24,14 @@ sub get_trial_related_stock { my $plant_of_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'plant_of', 'stock_relationship')->cvterm_id(); my $subplot_of_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'subplot_of', 'stock_relationship')->cvterm_id(); my $plant_of_subplot_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'plant_of_subplot', 'stock_relationship')->cvterm_id(); - my $seed_transaction_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'seed transaction', 'stock_relationship')->cvterm_id(); +# my $seed_transaction_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'seed transaction', 'stock_relationship')->cvterm_id(); my $tissue_sample_of_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'tissue_sample_of', 'stock_relationship')->cvterm_id(); my $q = "SELECT stock.stock_id, stock.uniquename, cvterm.name FROM stock_relationship INNER JOIN stock ON (stock_relationship.subject_id = stock.stock_id) INNER JOIN cvterm ON (stock.type_id = cvterm.cvterm_id) WHERE stock_relationship.object_id = ? AND (stock_relationship.type_id = ? - OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ?) + OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? ) UNION ALL @@ -39,11 +39,11 @@ sub get_trial_related_stock { INNER JOIN stock ON (stock_relationship.object_id = stock.stock_id) INNER JOIN cvterm ON (stock.type_id = cvterm.cvterm_id) WHERE stock_relationship.subject_id = ? AND (stock_relationship.type_id = ? - OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ?) "; + OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? OR stock_relationship.type_id = ? ) "; my $h = $schema->storage->dbh()->prepare($q); - $h->execute($stock_id, $plot_of_type_id, $plant_of_type_id, $subplot_of_type_id, $plant_of_subplot_type_id, $seed_transaction_type_id, $tissue_sample_of_type_id, $stock_id, $plot_of_type_id, $plant_of_type_id, $subplot_of_type_id, $plant_of_subplot_type_id, $seed_transaction_type_id, $tissue_sample_of_type_id); + $h->execute($stock_id, $plot_of_type_id, $plant_of_type_id, $subplot_of_type_id, $plant_of_subplot_type_id, $tissue_sample_of_type_id, $stock_id, $plot_of_type_id, $plant_of_type_id, $subplot_of_type_id, $plant_of_subplot_type_id, $tissue_sample_of_type_id); my @trial_related_stock =(); while(my($stock_id, $stock_name, $cvterm_name) = $h->fetchrow_array()){ From d0f9b78843328bd66e4bfa35bcaa3e8d43d3f3d1 Mon Sep 17 00:00:00 2001 From: titima15 Date: Tue, 5 Dec 2023 15:55:51 -0500 Subject: [PATCH 4/9] seedlot section specific to plot and plant --- lib/CXGN/Stock/RelatedStocks.pm | 39 ++++++++++++++++++++++ lib/SGN/Controller/AJAX/Stock.pm | 19 +++++++++++ mason/stock/related_stock.mas | 56 ++++++++++++++++++++++++++++---- 3 files changed, 108 insertions(+), 6 deletions(-) diff --git a/lib/CXGN/Stock/RelatedStocks.pm b/lib/CXGN/Stock/RelatedStocks.pm index 746c859d33..1b02404ed8 100644 --- a/lib/CXGN/Stock/RelatedStocks.pm +++ b/lib/CXGN/Stock/RelatedStocks.pm @@ -175,4 +175,43 @@ sub get_cross_of_progeny { } +sub get_plot_plant_related_seedlots { + my $self = shift; + my $stock_id = $self->stock_id; + my $schema = $self->dbic_schema(); + my $seed_transaction_type_id = SGN::Model::Cvterm->get_cvterm_row($schema, 'seed transaction', 'stock_relationship')->cvterm_id(); + + my @related_seedlots; + + my $q1 = "SELECT distinct(stock.stock_id), stock.uniquename, cvterm.name FROM stock_relationship + INNER JOIN stock ON (stock_relationship.subject_id = stock.stock_id) + INNER JOIN cvterm ON (stock.type_id = cvterm.cvterm_id) + WHERE stock_relationship.object_id = ? AND stock_relationship.type_id = ? "; + + my $h1 = $schema->storage->dbh()->prepare($q1); + + $h1->execute($stock_id, $seed_transaction_type_id); + + while(my($stock_id, $stock_name, $stock_type) = $h1->fetchrow_array()){ + push @related_seedlots, ['source of', $stock_type, $stock_id, $stock_name] + } + + my $q2 = "SELECT distinct(stock.stock_id), stock.uniquename, cvterm.name FROM stock_relationship + INNER JOIN stock ON (stock_relationship.object_id = stock.stock_id) + INNER JOIN cvterm ON (stock.type_id = cvterm.cvterm_id) + WHERE stock_relationship.subject_id = ? AND stock_relationship.type_id = ? "; + + my $h2 = $schema->storage->dbh()->prepare($q2); + + $h2->execute($stock_id, $seed_transaction_type_id); + + while(my($stock_id, $stock_name, $stock_type) = $h2->fetchrow_array()){ + push @related_seedlots, ['derived from', $stock_type, $stock_id, $stock_name] + } + + return\@related_seedlots; + +} + + 1; diff --git a/lib/SGN/Controller/AJAX/Stock.pm b/lib/SGN/Controller/AJAX/Stock.pm index 935b3e198f..e016e54ab7 100644 --- a/lib/SGN/Controller/AJAX/Stock.pm +++ b/lib/SGN/Controller/AJAX/Stock.pm @@ -2086,6 +2086,25 @@ sub get_stock_for_tissue:Chained('/stock/get_stock') PathPart('datatables/stock_ } + +sub get_plot_plant_related_seedlots:Chained('/stock/get_stock') PathPart('datatables/plot_plant_related_seedlots') Args(0){ + my $self = shift; + my $c = shift; + my $stock_id = $c->stash->{stock_row}->stock_id(); + + my $schema = $c->dbic_schema("Bio::Chado::Schema", 'sgn_chado'); + my $progenies = CXGN::Stock::RelatedStocks->new({dbic_schema => $schema, stock_id =>$stock_id}); + my $result = $progenies->get_plot_plant_related_seedlots(); + my @stocks; + foreach my $r (@$result){ + my ($transaction_type, $stock_type, $stock_id, $stock_name) = @$r; + push @stocks, [$transaction_type, $stock_type, qq{$stock_name}, $stock_name]; + } + + $c->stash->{rest}={data=>\@stocks}; +} + + sub get_stock_datatables_genotype_data : Chained('/stock/get_stock') :PathPart('datatables/genotype_data') : ActionClass('REST') { } sub get_stock_datatables_genotype_data_GET { diff --git a/mason/stock/related_stock.mas b/mason/stock/related_stock.mas index 89aa0b080c..bff36147bb 100644 --- a/mason/stock/related_stock.mas +++ b/mason/stock/related_stock.mas @@ -6,7 +6,6 @@ $stock_type => undef % if ($stock_type eq 'accession' || $stock_type eq 'plant' || $stock_type eq 'plot' || $stock_type eq 'subplot' || $stock_type eq 'tissue_sample'){ - <&| /page/info_section.mas, id=>'related_stocks_in_trial', title => 'Related stocks in trial', collapsible=>1, collapsed=>1 &>
@@ -30,17 +29,39 @@ $stock_type => undef
- % } -% if ($stock_type eq 'accession'){ - - <& /breeders_toolbox/seedlots_section.mas, stock_id=>$stock_id, stock_type=>$stock_type, stock_uniquename=>$stock_uniquename &> +% if ($stock_type eq 'plot' || $stock_type eq 'plant'){ + <&| /page/info_section.mas, id=>'related_seedlots', title => 'Related seedlots', collapsible=>1, collapsed=>1 &> +
+
+
+ + + + + + + + + +
+
+
+ <&| /page/info_section.mas, title => 'Copy Stocks to a List', collapsible=>1, collapsed=>1, subtitle=>'Copy the seedlot names showing in table to a new or exisiting list'&> +
+
+ + +
+ % } % if ($stock_type eq 'accession'){ + <& /breeders_toolbox/seedlots_section.mas, stock_id=>$stock_id, stock_type=>$stock_type, stock_uniquename=>$stock_uniquename &> + <&| /page/info_section.mas, id=>'related_stock_progenies', title => 'Progenies of this Accession (as female or male parent)', collapsible=>1, collapsed=>1 &>
@@ -123,7 +144,7 @@ $stock_type => undef % if ($stock_type eq 'accession' || $stock_type eq 'plant' || $stock_type eq 'plot' || $stock_type eq 'subplot' || $stock_type eq 'tissue_sample'){ - <&| /page/info_section.mas, id=>'related_stock_tissues', title => 'Related stocks for tissue sample', collapsible=>1, collapsed=>1 &> + <&| /page/info_section.mas, id=>'related_stock_tissues', title => 'Related tissue samples', collapsible=>1, collapsed=>1 &>
@@ -177,6 +198,29 @@ jQuery(document).ready(function(){ }); }); + jQuery('#related_seedlots_onswitch').one("click", function(){ + var related_seedlots_table = jQuery('#plot_plant_related_seedlots').DataTable({ + 'order': false, + 'ajax':'/stock/'+ <% $stock_id %> + '/datatables/plot_plant_related_seedlots', + "fnInitComplete": function(oSettings, json) { + //console.log(json); + if (!isLoggedIn()) { + jQuery('#seedlots_to_list_menu').html("

Please login to use lists!

"); + } else { + var html = ""; + for(var i=0; i Date: Wed, 6 Dec 2023 11:06:50 -0500 Subject: [PATCH 5/9] re-organized tissue samples --- lib/SGN/Controller/AJAX/Stock.pm | 18 +++------- mason/stock/related_stock.mas | 61 +++++++++++++++++--------------- 2 files changed, 36 insertions(+), 43 deletions(-) diff --git a/lib/SGN/Controller/AJAX/Stock.pm b/lib/SGN/Controller/AJAX/Stock.pm index e016e54ab7..24d8b63c4b 100644 --- a/lib/SGN/Controller/AJAX/Stock.pm +++ b/lib/SGN/Controller/AJAX/Stock.pm @@ -1936,9 +1936,8 @@ sub get_trial_related_stock:Chained('/stock/get_stock') PathPart('datatables/tri foreach my $r (@$result){ my ($stock_id, $stock_name, $cvterm_name) = @$r; my $url; - if ($cvterm_name eq 'seedlot'){ - $url = qq{$stock_name}; - } elsif ($cvterm_name eq 'cross') { + + if ($cvterm_name eq 'cross') { $url = qq{$stock_name}; } elsif ($cvterm_name eq 'family_name') { $url = qq{$stock_name}; @@ -1958,12 +1957,6 @@ sub get_trial_related_stock:Chained('/stock/get_stock') PathPart('datatables/tri push @subplots, [$cvterm_name, $url, $stock_name]; } elsif ($cvterm_name eq 'plant') { push @plants, [$cvterm_name, $url, $stock_name]; - } elsif ($cvterm_name eq 'tissue_sample') { - push @tissue_samples, [$cvterm_name, $url, $stock_name]; - } elsif ($cvterm_name eq 'seedlot') { - push @seedlots, [$cvterm_name, $url, $stock_name]; - } else { - push @others, [$cvterm_name, $url, $stock_name]; } } @@ -1985,9 +1978,6 @@ sub get_trial_related_stock:Chained('/stock/get_stock') PathPart('datatables/tri if (scalar(@plants) > 0) { push @stocks, @plants; } - if (scalar(@tissue_samples) > 0) { - push @stocks, @tissue_samples; - } if (scalar(@seedlots) > 0) { push @stocks, @seedlots; } @@ -2079,7 +2069,7 @@ sub get_stock_for_tissue:Chained('/stock/get_stock') PathPart('datatables/stock_ my ($stock_id, $stock_name, $cvterm_name) = @$r; - push @stocks, [qq{$stock_name}, $cvterm_name, $stock_name]; + push @stocks, [$cvterm_name, qq{$stock_name}, $stock_name]; } $c->stash->{rest}={data=>\@stocks}; @@ -2098,7 +2088,7 @@ sub get_plot_plant_related_seedlots:Chained('/stock/get_stock') PathPart('datata my @stocks; foreach my $r (@$result){ my ($transaction_type, $stock_type, $stock_id, $stock_name) = @$r; - push @stocks, [$transaction_type, $stock_type, qq{$stock_name}, $stock_name]; + push @stocks, [$transaction_type, $stock_type, qq{$stock_name}, $stock_name]; } $c->stash->{rest}={data=>\@stocks}; diff --git a/mason/stock/related_stock.mas b/mason/stock/related_stock.mas index bff36147bb..31eecd68a3 100644 --- a/mason/stock/related_stock.mas +++ b/mason/stock/related_stock.mas @@ -58,9 +58,39 @@ $stock_type => undef % } -% if ($stock_type eq 'accession'){ - +% if ($stock_type eq 'accession') { <& /breeders_toolbox/seedlots_section.mas, stock_id=>$stock_id, stock_type=>$stock_type, stock_uniquename=>$stock_uniquename &> +% } + +% if ($stock_type eq 'accession' || $stock_type eq 'plant' || $stock_type eq 'plot' || $stock_type eq 'subplot' || $stock_type eq 'tissue_sample'){ + + <&| /page/info_section.mas, id=>'related_stock_tissues', title => 'Related tissue samples', collapsible=>1, collapsed=>1 &> +
+
+
+ + + + + + + +
TypeName
+
+
+ +
+ <&| /page/info_section.mas, title => 'Copy Stocks to a List', collapsible=>1, collapsed=>1, subtitle=>'Copy the stock names showing in table to a new or exisiting list'&> +
+
+ + +
+ + +% } + +% if ($stock_type eq 'accession'){ <&| /page/info_section.mas, id=>'related_stock_progenies', title => 'Progenies of this Accession (as female or male parent)', collapsible=>1, collapsed=>1 &>
@@ -142,33 +172,6 @@ $stock_type => undef % } -% if ($stock_type eq 'accession' || $stock_type eq 'plant' || $stock_type eq 'plot' || $stock_type eq 'subplot' || $stock_type eq 'tissue_sample'){ - - <&| /page/info_section.mas, id=>'related_stock_tissues', title => 'Related tissue samples', collapsible=>1, collapsed=>1 &> -
-
-
- - - - - - - -
NameType
-
-
- -
- <&| /page/info_section.mas, title => 'Copy Stocks to a List', collapsible=>1, collapsed=>1, subtitle=>'Copy the stock names showing in table to a new or exisiting list'&> -
-
- - -
- - -% }