Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / mason / tracking_activities / active_tracking_identifiers.mas
blob628471434243d54f340c9f4bf7142721ee9fbc6b
1 <%args>
2 $trial_id
3 $field_headers
4 $activity_type
5 </%args>
7 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.dataTables' ] &>
8 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
10 <div style="overflow:scroll">
11     <table class="table table-hover table-bordered" id="project_active_tracking_identifiers_table">
12         <thead>
13             <tr>
14                 <th>Tracking Identifier</th>
15 % if ($activity_type eq 'transformation') {
16                 <th>Transformation ID</th>
17 % } elsif ($activity_type eq 'tissue_culture') {
18                 <th>Accession</th>
19 % }
20 % foreach my $column_header(@$field_headers){
21                 <th><%$column_header%></th>
22 % }
23             </tr>
24         </thead>
25     </table>
26 </div>
28 <div class="panel panel-default">
29     <div class="panel-body">
30         <&| /page/info_section.mas, title => 'Add Identifiers to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Adding identifiers in this project to a new or exisiting list</i>'&>
31         <br>
32         <div id="identifiers_to_new_list" style="display:none"></div>
33         <div id="identifiers_add_to_list"></div>
34         </&>
35     </div>
36 </div>
38 <script>
40 jQuery(document).ready(function(){
42     var project_id = "<%$trial_id%>";
44     jQuery('#project_active_tracking_identifiers_table').DataTable({
45         'autoWidth': false,
46         'ajax': '/ajax/tracking_activity/project_active_identifiers/'+project_id,
47         "fnInitComplete": function(oSettings, json) {
48             //console.log(json);
49             if (!isLoggedIn()) {
50                 jQuery('#identifiers_add_to_list').html("<div class='well well-sm'><h3>Please login to use lists!</h3></div>");
51             } else {
52                 var html = "";
53                 for(var i=0; i<json.data.length; i++){
54                     html += json.data[i][json.data[i].length -1]+"\n";
55                 }
56                 jQuery("#identifiers_to_new_list").html(html);
57                 addToListMenu("identifiers_add_to_list", "identifiers_to_new_list", {
58                     selectText: true,
59                     listType: 'tracking_identifiers',
60                 });
61             }
62         }
63     });
65 });
67 </script>