6 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.dataTables' ] &>
8 <& /page/page_title.mas, title=>'Search Progenies and Crosses' &>
10 <&| /page/info_section.mas, title => 'Search Progenies'&>
12 <div class="row" id="pedigree_search_form" >
13 <div class="col-sm-1">
15 <div class="col-sm-12 well">
17 <div class="col-sm-11">
18 <div class="form-horizontal">
19 <div class="form-group">
20 <label class="control-label col-sm-4">Female Parent/Population:</label>
21 <div class="col-sm-8">
22 <div class="input-group">
23 <input type="text" class="form-control" id="pedigree_female_parent" placeholder="Enter female parent/population">
24 <div class="input-group-btn">
25 <button class="btn btn-info" id="search_pedigree_male_parents"><i class="glyphicon glyphicon-search"></i> Male Parent </button>
26 <button class="btn btn-primary" id="search_all_progenies"><i class="glyphicon glyphicon-search"></i> All Progenies </button>
31 <div class="form-group">
32 <label class="control-label col-sm-4">Male Parent/Population:</label>
33 <div class="col-sm-8" >
34 <div class="input-group">
35 <select class="form-control" id="pedigree_male_parent">
36 <option value="">Choose female parent/population first</option>
39 <div class="input-group-btn">
40 <button class="btn btn-info" id="search_pedigree"><i class="glyphicon glyphicon-search"></i> Progenies </button>
48 <div class="col-sm-1">
53 <&| /page/info_section.mas, title => 'Search Results' , collapsible=>1, collapsed=>0 &>
55 <link rel="stylesheet" type="text/css" href="/documents/inc/datatables/jquery.dataTables.css">
57 <table id="pedigree_search_results" width="100%" class="table table-hover table-striped">
60 <th>Female Parent</th>
69 <&| /page/info_section.mas, title => 'Copy Progenies to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Copy the progeny names showing in table to a new or exisiting list</i>'&>
71 <div style="text-align:right" id="progenies_to_list_menu"></div>
72 <div id="progeny_names" style="display: none;"></div>
83 <&| /page/info_section.mas, title => 'Search Crosses'&>
85 <div class="row" id="cross_search_form" >
86 <div class="col-sm-1">
88 <div class="col-sm-12 well">
90 <div class="col-sm-11">
91 <div class="form-horizontal">
92 <div class="form-group">
93 <label class="control-label col-sm-4">Female Parent/Population:</label>
94 <div class="col-sm-8">
95 <div class="input-group">
96 <input type="text" class="form-control" id="female_parent" placeholder="Enter female parent/population">
97 <div class="input-group-btn">
98 <button class="btn btn-info" id="search_cross_male_parents"><i class="glyphicon glyphicon-search"></i> Male Parent </button>
99 <button class="btn btn-primary" id="search_all_crosses"><i class="glyphicon glyphicon-search"></i> All Crosses </button>
104 <div class="form-group">
105 <label class="control-label col-sm-4">Male Parent/Population:</label>
106 <div class="col-sm-8" >
107 <div class="input-group">
108 <select class="form-control" id="cross_male_parent">
109 <option value="">Choose female parent/population first</option>
112 <div class="input-group-btn">
113 <button class="btn btn-info" id="search_crosses"><i class="glyphicon glyphicon-search"></i> Cross Info </button>
122 <div class="col-sm-1">
127 <&| /page/info_section.mas, title => 'Search Results' , collapsible=>1, collapsed=>0 &>
129 <link rel="stylesheet" type="text/css" href="/documents/inc/datatables/jquery.dataTables.css">
131 <table id="cross_search_results" width="100%" class="table table-hover table-striped">
134 <th>Female Parent</th>
143 <&| /page/info_section.mas, title => 'Copy crosses to a List', collapsible=>1, collapsed=>1, subtitle=>'<i>Copy the cross names showing in table to a new or exisiting list</i>'&>
145 <div style="text-align:right" id="crosses_to_list_menu"></div>
146 <div id="cross_names" style="display: none;"></div>
156 jQuery(document).ready(function () {
158 jQuery("#pedigree_female_parent").autocomplete({
159 source:'/ajax/stock/pedigree_female_parent_autocomplete',
162 $("#search_pedigree_male_parents").click(function(){
165 url:'/ajax/search/pedigree_male_parents',
166 data:{'pedigree_female_parent':$('#pedigree_female_parent').val()},
167 success: function(response){
168 console.log(response);
169 var html = '<select id = "pedigree_male_parent" >';
170 for (var i=0; i<response.data.length; i++) {
171 html = html + "<option value='"+response.data[i][0]+ "'>" + response.data[i][0] + "</option>";
173 html = html + "</select>";
177 alert("No male parent");
181 jQuery('#pedigree_male_parent').html(html);
183 error:function(response){
184 alert("An error occurred");
190 $('#search_pedigree').click(function(){
192 var table = jQuery('#pedigree_search_results').DataTable({
197 'ajax':{'url':'/ajax/search/progenies',
198 data:{'pedigree_female_parent':$('#pedigree_female_parent').val(),
199 'pedigree_male_parent':$('#pedigree_male_parent').val()},
203 jQuery('#pedigree_search_results').on( 'draw.dt', function (){
204 var name_links = table.column(2).data();
206 //console.log("name links are: "+JSON.stringify(name_links));
207 for (var i = 0; i < name_links.length; i++) { //extract text from anchor tags
208 names.push(name_links[i].match(/<a [^>]+>([^<]+)<\/a>/)[1]+'\n');
211 jQuery('#progeny_names').html(names);
212 addToListMenu('progenies_to_list_menu', 'progeny_names',{
213 listType:'accessions'
219 $('#search_all_progenies').click(function(){
221 var table = jQuery('#pedigree_search_results').DataTable({
227 'ajax':{'url':'/ajax/search/all_progenies',
228 data:{'pedigree_female_parent':$('#pedigree_female_parent').val()},
233 jQuery('#pedigree_search_results').on( 'draw.dt', function (){
234 var name_links = table.column(2).data();
236 //console.log("name links are: "+JSON.stringify(name_links));
237 for (var i = 0; i < name_links.length; i++) { //extract text from anchor tags
238 names.push(name_links[i].match(/<a [^>]+>([^<]+)<\/a>/)[1]+'\n');
241 jQuery('#progeny_names').html(names);
242 addToListMenu('progenies_to_list_menu', 'progeny_names',{
243 listType:'accessions'
249 jQuery("#female_parent").autocomplete({
250 source:'/ajax/stock/cross_female_parent_autocomplete',
253 $("#search_cross_male_parents").click(function(){
256 url:'/ajax/search/cross_male_parents',
257 data:{'female_parent':$('#female_parent').val()},
258 success: function(response){
259 console.log(response);
260 var html = '<select id = "cross_male_parent" >';
261 for (var i=0; i<response.data.length; i++) {
262 html = html + "<option value='"+response.data[i][0]+ "'>" + response.data[i][0] + "</option>";
264 html = html + "</select>";
268 alert("No male parent");
272 jQuery('#cross_male_parent').html(html);
274 error:function(response){
275 alert("An error occurred");
281 $('#search_crosses').click(function(){
283 var table = jQuery('#cross_search_results').DataTable({
289 'ajax':{'url':'/ajax/search/cross_info',
290 data:{'female_parent':$('#female_parent').val(),
291 'male_parent':$('#cross_male_parent').val()},
296 jQuery('#cross_search_results').on( 'draw.dt', function (){
297 var name_links = table.column(2).data();
299 //console.log("name links are: "+JSON.stringify(name_links));
300 for (var i = 0; i < name_links.length; i++) { //extract text from anchor tags
301 names.push(name_links[i].match(/<a [^>]+>([^<]+)<\/a>/)[1]+'\n');
304 jQuery('#cross_names').html(names);
305 addToListMenu('crosses_to_list_menu', 'cross_names',{
312 $('#search_all_crosses').click(function(){
314 var table = jQuery('#cross_search_results').DataTable({
320 'ajax':{'url':'/ajax/search/all_crosses',
321 data:{'female_parent':$('#female_parent').val()},
326 jQuery('#cross_search_results').on( 'draw.dt', function (){
327 var name_links = table.column(2).data();
329 //console.log("name links are: "+JSON.stringify(name_links));
330 for (var i = 0; i < name_links.length; i++) { //extract text from anchor tags
331 names.push(name_links[i].match(/<a [^>]+>([^<]+)<\/a>/)[1]+'\n');
334 jQuery('#cross_names').html(names);
335 addToListMenu('crosses_to_list_menu', 'cross_names',{