6 <& /util/import_javascript.mas, classes => [ 'jquery', 'jqueryui' ] &>
8 <div id="experimental_design_dialog" class="ui-widget" >
9 <table><tr><td>Experiment name</td><td><input name="project_name" /></td></tr>
10 <tr><td>Year</td><td><input id="project_year" name="year" /></td></tr>
11 <tr><td>Design</td><td>
12 <select id="Design" name="design">
13 <option value=CRD>Completely Randomized</option>
14 <option value=CBD>Complete Block</option>
15 <option value=IBD>Incomplete Block</option>
17 <tr><td colspan="2">Description</td></tr>
18 <tr><td colspan="2"><textarea name="project_description" cols="60" >
24 <div id="completely_randomized_design_dialog" class="ui-widget" >
26 <tr><td>Number of breeding lines</td><td><input id="line_count" name="line_count" /></td></tr>
27 <tr><td>Replications per line</td><td><input id="rep_count" name="rep_count" /></td></tr>
28 <tr><td>Prefix</td><td><input id="prefix" name="prefix" /></td></tr>
29 <tr><td>Start number</td><td><input id="start_number" name="start_number" /></td></tr>
30 <tr><td>Increment</td><td><input id="increment" name="increment" /></td></tr>
35 <div id="complete_block_design_dialog" class="ui-widget" >
37 <tr><td>Number of breeding lines</td><td><input id="line_count" name="line_count" /></td></tr>
38 <tr><td>Replications per line in each block</td><td><input id="rep_count" name="rep_count" /></td></tr>
39 <tr><td>Number of blocks</td><td><input id="blocks" name="blocks" /></td></tr>
40 <tr><td>Prefix</td><td><input id="prefix" name="prefix" /></td></tr>
41 <tr><td>Start number</td><td><input id="start_number" name="start_number" /></td></tr>
42 <tr><td>Increment</td><td><input id="increment" name="increment" /></td></tr>
47 <div id="incomplete_block_design_dialog" class="ui-widget" >
49 <tr><td>Number of breeding lines</td><td><input id="line_count" name="line_count" /></td></tr>
50 <tr><td>Replications per line in each block</td><td><input id="rep_count" name="rep_count" /></td></tr>
51 <tr><td>Number of blocks</td><td><input id="blocks" name="blocks" /></td></tr>
52 <tr><td>Number of lines per block</td><td><input id="blocks" name="blocks" /></td></tr>
53 <tr><td>Prefix</td><td><input id="prefix" name="prefix" /></td></tr>
54 <tr><td>Start number</td><td><input id="start_number" name="start_number" /></td></tr>
55 <tr><td>Increment</td><td><input id="increment" name="increment" /></td></tr>
61 <script defer="defer" >
63 jQuery(document).ready(function() {
65 jQuery('#experimental_design_dialog').dialog( {
67 buttons: { "Cancel" : function() { jQuery('#experimental_design_dialog').dialog("close"); },
68 "Continue": function() { continue_design(); } },
72 title: "Field plot design"
76 jQuery('#completely_randomized_design_dialog').dialog( {
78 buttons: { "Cancel" : function() { jQuery('#completely_randomized_design_dialog').dialog("close"); },
79 "Create": function() { create_design(); } },
83 title: "Completely randomized field plot design"
87 jQuery('#complete_block_design_dialog').dialog( {
89 buttons: { "Cancel" : function() { jQuery('#complete_block_design_dialog').dialog("close"); },
90 "Create": function() { create_design(); } },
94 title: "Complete randomized block field plot design"
98 jQuery('#incomplete_block_design_dialog').dialog( {
100 buttons: { "Cancel" : function() { jQuery('#incomplete_block_design_dialog').dialog("close"); },
101 "Create": function() { create_design(); } },
105 title: "Incomplete randomized block field plot design"
109 jQuery('#experimental_design_link').click( function() { open_experimental_design_dialog() } );
111 function open_experimental_design_dialog() {
114 jQuery('#experimental_design_dialog').dialog("open");
118 function continue_design() {
119 var design = jQuery('#Design').val();
120 if (design == 'CRD') {
121 jQuery('#completely_randomized_design_dialog').dialog("open");
123 if (design == 'CBD') {
124 jQuery('#complete_block_design_dialog').dialog("open");
126 if (design == 'IBD') {
127 jQuery('#incomplete_block_design_dialog').dialog("open");
131 function create_design() {
132 var name = jQuery('#project_name').val();
133 var year = jQuery('#project_year').val();
134 var desc = jQuery('#project_description').val();
136 if (name == '' || year == '') { alert('Name and year are required.'); return; }
140 url: '/breeders/project/insert',
141 data: { 'project_name': name, 'project_description': desc, 'year': year },
143 }).done(alert("Done saving project info"));
144 jQuery('#add_project_dialog').dialog("close");
160 foreach my $designs (@$field_designs){
161 print "<tr><td>$designs->[1]</td><td>$designs->[2]</td></tr>\n";