upload fieldbook from manage phenotyping
[sgn.git] / mason / breeders_toolbox / field_designs.mas
blob22ad69d72a04355befee9dd44d7371b2f27f1152
2 <%args>
3 $field_designs
4 </%args>
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>
16 </select>
17 <tr><td colspan="2">Description</td></tr>
18 <tr><td colspan="2"><textarea name="project_description" cols="60" >
19 </textarea>
20 </td></tr>
21 </table>
22 </div>
24 <div id="completely_randomized_design_dialog"  class="ui-widget" >
25 <table>
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>
31 </td></tr>
32 </table>
33 </div>
35 <div id="complete_block_design_dialog"  class="ui-widget" >
36 <table>
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>
43 </td></tr>
44 </table>
45 </div>
47 <div id="incomplete_block_design_dialog"  class="ui-widget" >
48 <table>
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>
56 </td></tr>
57 </table>
58 </div>
61 <script defer="defer" >
62     
63 jQuery(document).ready(function() {
65   jQuery('#experimental_design_dialog').dialog( {
66      autoOpen: false,
67      buttons:  { "Cancel" : function() { jQuery('#experimental_design_dialog').dialog("close"); }, 
68                      "Continue": function() { continue_design(); } },
69      modal: true,
70      width: 500,
71      height: 300,
72      title: "Field plot design"
74 });
76   jQuery('#completely_randomized_design_dialog').dialog( {
77      autoOpen: false,
78      buttons:  { "Cancel" : function() { jQuery('#completely_randomized_design_dialog').dialog("close"); }, 
79                      "Create": function() { create_design(); } },
80      modal: true,
81      width: 500,
82      height: 300,
83      title: "Completely randomized field plot design"
85 });
87   jQuery('#complete_block_design_dialog').dialog( {
88      autoOpen: false,
89      buttons:  { "Cancel" : function() { jQuery('#complete_block_design_dialog').dialog("close"); }, 
90                      "Create": function() { create_design(); } },
91      modal: true,
92      width: 500,
93      height: 300,
94      title: "Complete randomized block field plot design"
96 });
98   jQuery('#incomplete_block_design_dialog').dialog( {
99      autoOpen: false,
100      buttons:  { "Cancel" : function() { jQuery('#incomplete_block_design_dialog').dialog("close"); }, 
101                      "Create": function() { create_design(); } },
102      modal: true,
103      width: 500,
104      height: 300,
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() { 
112       
114      jQuery('#experimental_design_dialog').dialog("open");
115   }
118   function continue_design() {
119       var design = jQuery('#Design').val();
120       if (design == 'CRD') {
121            jQuery('#completely_randomized_design_dialog').dialog("open");
122       }
123       if (design == 'CBD') {
124            jQuery('#complete_block_design_dialog').dialog("open");
125       }
126       if (design == 'IBD') {
127            jQuery('#incomplete_block_design_dialog').dialog("open");
128       }
129   }
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; }
137    
138      new jQuery.ajax( {
139        type: 'GET',
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");
145   }
146   
149 </script>
153 <table>
156 <%perl>
160 foreach my $designs (@$field_designs){ 
161    print "<tr><td>$designs->[1]</td><td>$designs->[2]</td></tr>\n";
163 </%perl>
164 </table>