Merge pull request #5248 from solgenomics/topic/batch_update_trials
[sgn.git] / mason / transformation / transformants_section.mas
blob51065833e1f14864669ffdc8dbd5bb623d523846
1 <%args>
2 $transformation_id
3 </%args>
6 <&| /page/info_section.mas, title => 'Transformants (Accessions) Derived from this Transformation ', collapsible=>1, collapsed=>0 &>
7     <div class = "well well-sm">
8         <div class = "panel panel-default">
9             <div class = "panel-body">
10                 <div style="overflow:scroll">
11                     <table class="table table-hover table-bordered" id="transformants_table">
12                     </table>
13                 </div>
14                 <div class="panel panel-default">
15                     <div class="panel-body">
16                         <&| /page/info_section.mas, title => 'Add transformants (accessions) to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Adding transformants (accessions) to a new or exisiting list</i>'&>
17                             <br>
18                             <div id="transformant_to_new_list" style="display:none"></div>
19                             <div id="transformant_add_to_list"></div>
20                         </&>
21                     </div>
22                 </div>
23             </div>
24         </div>
25     </div>
26 </&>
28 <& /transformation/obsolete_stock_dialog.mas &>
31 <script>
33 jQuery(document).ready(function(){
35     const transformation_stock_id = "<%$transformation_id%>";
36     const transformants_table = jQuery('#transformants_table').DataTable({
37         'ajax': '/ajax/transformation/transformants/'+transformation_stock_id,
38         'autoWidth': false,
39         'columns': [
40             { title: "Accession", "data": null, "render": function ( data, type, row ) { return "<a href='/stock/"+row.transformant_id+"/view'>"+row.transformant_name+"</a>"; } },
41             { title: "Obsolete Accession", "data": "null", "render": function ( data, type, row ) { return "<a onclick='obsoleteStock("+row.transformant_id+",\""+row.transformant_name+"\")'>X</a>"; } },
42         ],
44         "fnInitComplete": function(oSettings, json) {
45             //console.log(json);
46             if (!isLoggedIn()) {
47                 jQuery('#transformant_add_to_list').html("<div class='well well-sm'><h3>Please login to use lists!</h3></div>");
48             } else {
49                 let html = "";
50                 for(let i=0; i<json.data.length; i++){
51                     html += json.data[i].transformant_name+"\n";
52                 }
54                 jQuery("#transformant_to_new_list").html(html);
55                 addToListMenu("transformant_add_to_list", "transformant_to_new_list", {
56                     selectText: true,
57                     listType: 'accessions',
58                 });
59             }
60         }
61     });
63 });
66 </script>