2 package SGN
::Controller
::Seedlot
;
6 BEGIN { extends
'Catalyst::Controller'; }
8 use CXGN
::Stock
::Seedlot
;
11 sub seedlots
:Path
('/breeders/seedlots') :Args
(0) {
15 $c->stash->{timestamp
} = localtime();
16 $c->stash->{template
} = '/breeders_toolbox/seedlots.mas';
20 sub seedlot_detail
:Path
('/breeders/seedlot') Args
(1) {
23 my $seedlot_id = shift;
24 my $schema = $c->dbic_schema("Bio::Chado::Schema", "sgn_chado");
25 my $phenome_schema = $c->dbic_schema("CXGN::Phenome::Schema");
26 my $people_schema = $c->dbic_schema("CXGN::People::Schema");
28 my $sl = CXGN
::Stock
::Seedlot
->new(
30 phenome_schema
=> $phenome_schema,
31 seedlot_id
=> $seedlot_id
33 my @content_accession_names;
34 my @content_cross_names;
35 my $accessions = $sl->accession();
36 my $accessions_html = '';
38 $accessions_html .= '<a href="/stock/'.$accessions->[0].'/view">'.$accessions->[1].'</a> (accession)';
39 push @content_accession_names, $accessions->[1];
41 my $crosses = $sl->cross();
42 my $crosses_html = '';
44 $crosses_html .= '<a href="/cross/'.$crosses->[0].'">'.$crosses->[1].'</a> (cross)';
45 push @content_cross_names, $crosses->[1];
47 my $populations = $sl->populations();
48 my $populations_html = '';
49 foreach (@
$populations){
50 $populations_html .= '<a href="/stock/'.$_->[0].'/view">'.$_->[1].'</a> ';
52 my $owners = $sl->owners;
53 my $owners_string = '';
55 my $p = $people_schema->resultset("SpPerson")->find({sp_person_id
=>$_});
56 $owners_string .= '<a href="/solpeople/personal-info.pl?sp_person_id='.$p->sp_person_id.'">'.$p->username.'</a>';
58 $c->stash->{seedlot_id
} = $seedlot_id;
59 $c->stash->{uniquename
} = $sl->uniquename();
60 $c->stash->{organization_name
} = $sl->organization_name();
61 $c->stash->{box_name
} = $sl->box_name();
62 $c->stash->{population_name
} = $populations_html;
63 $c->stash->{content_html
} = $accessions_html ?
$accessions_html : $crosses_html;
64 $c->stash->{content_accession_name
} = $content_accession_names[0];
65 $c->stash->{content_cross_name
} = $content_cross_names[0];
66 $c->stash->{current_count
} = $sl->get_current_count_property();
67 $c->stash->{current_weight
} = $sl->get_current_weight_property();
68 $c->stash->{owners_string
} = $owners_string;
69 $c->stash->{timestamp
} = localtime();
70 $c->stash->{template
} = '/breeders_toolbox/seedlot_details.mas';