fixed file name
[sgn.git] / mason / list / list_details.mas
blobff5af4b097ef5cdbba3b555da12e151a3d837b34
1 <%args>
3 $list_id
4 $list_name
5 $list_description => undef
6 $list_type
7 $list_size
9 </%args>
11 <& /util/import_javascript.mas, classes => [ 'jquery.iframe-post-form', 'jquery', 'jquery.dataTables', 'CXGN.List'] &>
12 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
14 <& /page/page_title.mas, title => "Details for List '$list_name'" &>
16 <&| /page/info_section.mas, title=>"Details",  collapsible => 1, collapsed=>0,&>
17     <table class="table table-bordered table-hover">
18         <tr><td><b>List Name</b></td><td><% $list_name %></td></tr>
19         <tr><td><b>List ID</b></td><td><% $list_id %></td></tr>
20         <tr><td><b>Type</b></td><td><% $list_type %></td></tr>
21         <tr><td><b>Number of Items</b></td><td><% $list_size %></td></tr>
22         <tr><td><b>Description</b></td><td><% $list_description %></td></tr>
23     </table>
24 </&>
26 <&| /page/info_section.mas, title => 'List Items', collapsible=>1, collapsed=>0 &>
27     <div class = "well well-sm">
28         <form id="download_list_details" action="/list/download_details" method="POST">
29             <button class="btn btn-primary" type="button" id="download_details_button">Download List Items</button>
30             <input type="hidden" id="list_download_token" name="list_download_token"/>
31             <input name="list_id" id="list_id" type="hidden" value="<% $list_id %>">
32         </form>
33     </div>
34     <div class = "well well-sm">
35         <div class = "panel panel-default">
36             <div class = "panel-body">
37                 <div style="overflow:scroll">
38                     <table id = "list_items_table" class="table table-hover table-striped">
39                     </table>
40                 </div>
41             </div>
42         </div>
43     </div>
44 </&>
46 <script>
48 jQuery(document).ready( function() {
50     var items_table = jQuery('#list_items_table').DataTable( {
51         'autoWidth': false,
52         'ajax': '/ajax/list/details/' + <% $list_id %>,
53         'columns': [
54             { title: "Seedlot Name", "data": null, "render": function ( data, type, row ){return "<a href='/breeders/seedlot/"+row.seedlot_id+"'>"+row.seedlot_name+"</a>"}},
55             { title: "Content Name", "data": null, "render": function ( data, type, row ) {
56                 if (row.content_type == 'accession'){
57                     return "<a href='/stock/"+row.content_id+"/view'>"+row.content_name+"</a>"
58                 } else if (row.content_type == 'cross') {
59                     return "<a href='/cross/"+row.content_id+"'>"+row.content_name+"</a>"
60                 }
61             }},
62             { title: "Content Type", "data": "content_type" },
63             { title: "Description", "data": "description" },            
64             { title: "Box Name", "data": "box_name" },
65             { title: "Current Count", "data": "current_count" },
66             { title: "Current Weight", "data": "current_weight" },
67             { title: "Quality", "data": "quality" },
68         ],
69     });
71     jQuery('#download_details_button').click(function() {
72         jQuery('#download_list_details').submit();
73     });
75 });
77 </script>