comment out large section of breeding program details - this info should be on the...
[sgn.git] / mason / breeders_toolbox / seedlots_section.mas
blob2265f31691555cb80d74bfe948027512c8488bd6
1 <%args>
2 $stock_id
3 $stock_uniquename => undef
4 $stock_type => undef
5 </%args>
7 <& /util/import_javascript.mas, classes => [] &>
9 % if ($stock_type eq 'accession'){
10     <& /breeders_toolbox/add_seedlot_dialogs.mas, accession_uniquename=>$stock_uniquename &>
11 % } elsif ($stock_type eq 'cross'){
12     <& /breeders_toolbox/add_seedlot_dialogs.mas, cross_uniquename=>$stock_uniquename &>
13 % }
15 <&| /page/info_section.mas, id=>'related_seedlots_to_accessions', title => 'Seedlots of this '.ucfirst($stock_type), collapsible=>1, collapsed=>1, subtitle=>"<button class='btn btn-sm btn-primary' style='margin:3px' name='add_seedlot_button' >Create New Seedlot</button>" &>
16     <div class="well well-sm">
17         <div class="panel panel-default">
18             <div class="panel-body" style="overflow:scroll">
19                 <table id="seedlots_of_accession_table" class="table table-hover table-striped">
20                 </table>
21             </div>
22         </div>
23         <br>
24         <&| /page/info_section.mas, title => 'Copy Seedlots to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Copy the seedlot names showing in table to a new or exisiting list</i>'&>
25             <br/>
26             <div style="text-align:right" id="accession_seedlots_to_list_menu">[LOADING...]</div>
27             <div id="accession_seedlot_names" style="display: none;"></div>
28         </&>
29     </div>
30 </&>
33 <script>
35 jQuery(document).ready(function(){
37     jQuery('#related_seedlots_to_accessions_onswitch').one("click", function(){
39         var seedlots_table = jQuery('#seedlots_of_accession_table').DataTable({
40             'destroy' : true,
41             'ordering'  : false,
42             'processing': true,
43             'serverSide': true,
44             'lengthMenu': [10,20,50,100,1000],
45             'ajax': { 'url': '/ajax/breeders/seedlots',
46                       'data': function(d) {
47 % if ($stock_type eq 'accession'){
48                          d.contents_accession = "<% $stock_uniquename %>";
49 % } elsif ($stock_type eq 'cross'){
50                         d.contents_cross = "<% $stock_uniquename %>";
51 % }
52                     }
53             },
54             columns: [
55                 { title: "Seedlot Name", "data": null, "render": function ( data, type, row ) { return "<a href='/breeders/seedlot/"+row.seedlot_stock_id+"'>"+row.seedlot_stock_uniquename+"</a>"; } },
56                 { title: "Breeding Program", "data": "breeding_program_name" },
57                 { title: "Contents", "data": "contents_html" },
58                 { title: "Seedlot Location", "data": "location" },
59                 { title: "Count", "data": "count" },
60                 { title: "Weight(g)", "data": "weight_gram" },
61                 { title: "Box Name", "data": "box" },
62                 { title: "Quality", "data": "seedlot_quality" },
63                 { title: "", "data": "seedlot_stock_uniquename"}
64             ],
65         });
67         seedlots_table.draw();
68         seedlots_table.column(8).visible(false);
70         jQuery('#seedlots_of_accession_table').on( 'draw.dt', function () {
71             var seedlot_names = seedlots_table.column(8).data();
72             var names = "";
74             for (var i = 0; i < seedlot_names.length; i++) {
75                 names += seedlot_names[i]+'\n';
76             }
78             jQuery('#accession_seedlot_names').html(names);
79             addToListMenu('accession_seedlots_to_list_menu', 'accession_seedlot_names', {
80                 listType: 'seedlots'
81             });
82         });
83     });
85 });
87 </script>