9 <& /util/import_javascript.mas, classes => [ 'jquery', 'jqueryui' ] &>
11 <h1>CASSAVABASE GENOTYPING TRIAL</h1>
12 <h1>Breeding program: <% $breeding_program_name %></h1>
13 <h2>Trial name: <a href='/breeders/trial/<% $trial_id %>'><% $trial_name %></a></h2>
16 <div id="trial_plate_view_html">
22 <script type="text/javascript">
24 jQuery(document).ready(function () {
27 url : '/ajax/breeders/trial/'+<% $trial_id %>+'/design',
28 beforeSend: function() {
29 jQuery("#working_modal").modal("show");
31 success: function(response){
32 console.log(response);
33 jQuery("#working_modal").modal("hide");
34 var trial_plate_view_html = "<table class='table table-hover table-condensed table-bordered' id='trial_plate_view_table'><thead><tr><th> </th>";
35 for (col=1; col<13; col++) {
36 var formatted_col = (col < 10 ? '0' : '') + col;
37 trial_plate_view_html = trial_plate_view_html + "<th bgcolor='lightblue'>"+formatted_col+"<br/><br/></th>";
40 trial_plate_view_html = trial_plate_view_html + "</thead><tbody>";
42 var rows = "ABCDEFGH".split("");
43 jQuery.each(rows, function(row) {
44 trial_plate_view_html = trial_plate_view_html + "<tr><td bgcolor = 'lightblue'><b>" + rows[row] + "</b></td>"
46 for (col=1; col<13; col++) {
47 var formatted_col = (col < 10 ? '0' : '') + col;
48 var well = rows[row] + formatted_col;
51 var bgcolor = "lightgrey";
53 if (response.design[well]) {
54 if (response.design[well].accession_name) {
55 if (response.design[well].accession_name == 'BLANK') {
60 //cell = "<br/>" + response.design[well].accession_name + "<br/><br/>";
61 cell = "<br/><a href='/stock/" + response.design[well].accession_id +"/view'>" + response.design[well].accession_name + "</a> <br/><br/>";
64 trial_plate_view_html = trial_plate_view_html + "<td bgcolor=" + bgcolor + ">" + cell + "</td>";
66 trial_plate_view_html = trial_plate_view_html + "</tr>";
69 trial_plate_view_html = trial_plate_view_html + "</tbody></table>";
70 jQuery('#trial_plate_view_html').empty();
71 jQuery('#trial_plate_view_html').html(trial_plate_view_html);
73 error: function(response){
74 jQuery("#working_modal").modal("hide");
75 alert("Error retrieving plate layout.");