graphical filtering of accession search
[sgn.git] / mason / brapiclient / studies_germplasm.mas
blob96ef577341e17f37b7a9b3d891feb379e4ab42f4
1 <%args>
2 </%args>
4 <div id="brapi_home_study_germplasm_detail_div">
6     <h4>Study Germplasm</h4>
7     <input name="brapi_home_studygermplasmdbid" id="brapi_home_studygermplasmdbid" class="form-control" type="text" placeholder="StudyDbId e.g. 139" value="139"/>
8     <button class="btn btn-primary" name="brapi_home_studygermplasmdbid_submit" id="brapi_home_studygermplasmdbid_submit">Get Germplasm</button>
9     <br/><br/>
10     <div id="brapi_studygermplasm_detail_result_div">
11     </div>
12     <div id="brapi_studygermplasm_data_result_div">
13     </div>
15 </div>
17 <script>
19 jQuery(document).ready(function() {
20     jQuery("#brapi_home_studygermplasmdbid_submit").click(function() {
21         jQuery.ajax( {
22           'url': jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studygermplasmdbid').val()+'/germplasm',
23           'method': 'GET',
24           'beforeSend': function(){
25             jQuery('#working_modal').modal('show');
26           },
27           'success': function(response) {
28             jQuery('#working_modal').modal('hide');
29             console.log(response);
30             var html = '<table class="table table-bordered"><thead><tr><th>StudyDbId</th><th>TrialName</th></tr></thead><tbody><tr><td>'+response.result.studyDbId+'</td><td>'+response.result.studyName+'</td></tr></tbody></table>';
31             jQuery('#brapi_studygermplasm_detail_result_div').empty().html(html);
32             brapi_create_paginated_table(response.result.data, response.metadata.pagination, 'brapi_studygermplasm_data_result_div', jQuery('#brapi_home_url_select').val()+'/brapi/v1/studies/'+jQuery('#brapi_home_studygermplasmdbid').val()+'/germplasm', undefined);
34           },
35           error: function(response) {
36             jQuery('#working_modal').modal('hide');
37             alert('An error occurred');
38           }
39         });
40     });
41 });
43 </script>