add more elements to interface with analysis store code.
[sgn.git] / mason / brapiclient / markerprofile_detail.mas
blobbae6830368438950a1cb25d302e03f53fc61e3d5
1 <%args>
2 </%args>
4 <div id="brapi_home_markerprofile_detail_div">
6     <h4>MarkerProfile Details</h4>
7     <input name="brapi_home_markerprofiledbid" id="brapi_home_markerprofiledbid" class="form-control" type="text" placeholder="MarkerProfileDbId e.g. 1622" value="1622"/>
8     <button class="btn btn-primary" name="brapi_home_markerprofiledbid_submit" id="brapi_home_markerprofiledbid_submit">Get Details</button>
9     <br/><br/>
10     <div id="brapi_markerprofile_detail_div">
11     </div>
12     <div id="brapi_markerprofile_detail_result_div">
13     </div>
15 </div>
17 <script>
19 jQuery(document).ready(function() {
20     jQuery("#brapi_home_markerprofiledbid_submit").click(function() {
22         jQuery.ajax( {
23           'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/markerprofiles/'+jQuery('#brapi_home_markerprofiledbid').val(),
24           'method': 'GET',
25           'success': function(response) {
26             console.log(response);
27             var html = '<table class="table table-bordered"><thead><tr><th>GermplasmDbId</th><th>UniqueDisplayName</th><th>ExtractDbId</th><th>MarkerProfileDbId</th><th>AnalysisMethod</th></tr><tbody><tr><td>'+response.result.germplasmDbId+'</td><td>'+response.result.uniqueDisplayName+'</td><td>'+response.result.extractDbId+'</td><td>'+response.result.markerprofileDbId+'</td><td>'+response.result.analysisMethod+'</td></tr></tbody></table>';
28             jQuery('#brapi_markerprofile_detail_div').empty().html(html);
29             
30             var data = [];
31             for (var i=0; i<response.result.data.length; i++) {
32                 for (var j in response.result.data[i]) {
33                     data.push({'marker':j, 'allele':response.result.data[i][j]});
34                 }
35             }
36             brapi_create_paginated_table(data, response.metadata.pagination, 'brapi_markerprofile_detail_result_div', jQuery('#brapi_home_url_select').val()+'/brapi/v1/markerprofiles/'+jQuery('#brapi_home_markerprofiledbid').val(), undefined);
38           },
39           error: function(response) {
40             alert('An error occurred');
41           }
42         });
43     });
44 });
46 </script>