2 <!--button class="btn btn-primary" id="nirs_analysis_plot_spectra_show">Plot Spectra</button-->
4 <div class="modal fade" id="nirs_analysis_plot_spectra_dialog" name="nirs_analysis_plot_spectra_dialog" tabindex="-1" role="dialog" aria-labelledby="nirsAnalysisPlotSpectraDialog" data-backdrop="static">
5 <div class="modal-dialog modal-xl" role="document">
6 <div class="modal-content">
7 <div class="modal-header">
8 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
9 <h4 class="modal-title" id="nirsAnalysisPlotSpectraDialog">Plot Spectra</h4>
11 <div class="modal-body">
12 <div class="container-fluid">
14 <&| /util/workflow.mas, id=> "nirs_analysis_plot_spectra_workflow" &>
15 <&| /util/workflow.mas:step, title=> "Intro" &>
16 <& /page/page_title.mas, title=>"This workflow will guide you through querying and plotting spectral data in the database." &>
19 <button class="btn btn-primary" onclick="Workflow.complete(this); return false;">Go to Next Step</button>
22 <&| /util/workflow.mas:step, title=> "Protocol" &>
23 <& /page/page_title.mas, title=>"Select the protocol you are interested in plotting spectra:" &>
25 <div id="nirs_analysis_plot_spectra_protocol_select">
29 <button class="btn btn-primary" id="nirs_analysis_plot_spectra_protocol_select_step">Go to Next Step</button>
32 <&| /util/workflow.mas:step, title=> "Dataset" &>
33 <& /page/page_title.mas, title=>"Select the dataset you are interested in plotting spectra for (the accessions or plots or tissues samples in the dataset need to have spectra uploaded):" &>
35 <div id="nirs_analysis_plot_spectra_dataset_select_div">
39 <button class="btn btn-primary" id="nirs_analysis_plot_spectra_dataset_select_step">Go to Next Step</button>
42 <&| /util/workflow.mas:step, title=> "Search" &>
43 <& /page/page_title.mas, title=>"Search Parameters:" &>
45 <form class="form-horizontal">
46 <div class="form-group">
47 <label class="col-sm-5 control-label">Query related stocks (e.g. if you have accessions in the dataset, the query will search for spectra on associated plots, plants, etc. and vice versa): </label>
48 <div class="col-sm-7" >
49 <select class="form-control" id="nirs_analysis_plot_spectra_associated_stock_select_id" name="nirs_analysis_plot_spectra_associated_stock_select_id">
50 <option value="yes">Yes</option>
51 <option value="no">No</option>
57 <button class="btn btn-primary" id="nirs_analysis_plot_spectra_search_step">Go to Next Step</button>
60 <&| /util/workflow.mas:step, title=> "Results" &>
61 <& /page/page_title.mas, title=>"Spectral Plots" &>
63 <div id="nir_analysis_plot_spectra_result"></div>
71 <div class="modal-footer">
72 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
79 jQuery(document).ready(function(){
81 jQuery('#nirs_analysis_plot_spectra_show').click(function(){
82 jQuery('#nirs_analysis_plot_spectra_dialog').modal('show');
84 get_select_box('high_dimensional_phenotypes_protocols','nirs_analysis_plot_spectra_protocol_select', {'checkbox_name':'nirs_analysis_plot_spectra_protocol_id', 'high_dimensional_phenotype_protocol_type':'high_dimensional_phenotype_nirs_protocol'});
86 get_select_box('datasets','nirs_analysis_plot_spectra_dataset_select_div', {'checkbox_name':'nirs_analysis_plot_spectra_dataset_select_id'});
89 var nirs_analysis_plot_spectra_protocol_id;
90 jQuery('#nirs_analysis_plot_spectra_protocol_select_step').click(function(){
92 jQuery('input[name="nirs_analysis_plot_spectra_protocol_id"]:checked').each(function() {
93 selected.push(jQuery(this).val());
96 if(selected.length > 1 || selected.length == 0) {
97 alert('Please select one dataset!');
101 nirs_analysis_plot_spectra_protocol_id = selected[0];
103 Workflow.complete("#nirs_analysis_plot_spectra_protocol_select_step");
104 Workflow.focus('#nirs_analysis_plot_spectra_workflow', 2);
108 var nirs_analysis_plot_spectra_dataset_id;
109 jQuery('#nirs_analysis_plot_spectra_dataset_select_step').click(function(){
111 jQuery('input[name="nirs_analysis_plot_spectra_dataset_select_id"]:checked').each(function() {
112 selected.push(jQuery(this).val());
115 if(selected.length > 1 || selected.length == 0) {
116 alert('Please select one dataset!');
120 nirs_analysis_plot_spectra_dataset_id = selected[0];
122 Workflow.complete("#nirs_analysis_plot_spectra_dataset_select_step");
123 Workflow.focus('#nirs_analysis_plot_spectra_workflow', 3);
124 window.scrollTo(0,0);
128 jQuery('#nirs_analysis_plot_spectra_search_step').click(function(){
131 url : '/ajax/Nirs/generate_spectral_plot',
134 'dataset_id' : nirs_analysis_plot_spectra_dataset_id,
135 'nd_protocol_id': nirs_analysis_plot_spectra_protocol_id,
136 'query_associated_stocks': jQuery('#nirs_analysis_plot_spectra_associated_stock_select_id').val(),
138 beforeSend: function(){
139 jQuery('#working_modal').modal('show');
141 success: function(response){
142 console.log(response);
143 jQuery('#working_modal').modal('hide');
145 if (response.error) {
146 alert(response.error);
150 jQuery('#nir_analysis_plot_spectra_result').html('<div class="well well-sm"><h3>Plot of Spectra: </h3><img width="80%" height="80%" src="'+response.figure+'"></div>');
152 Workflow.complete("#nirs_analysis_plot_spectra_search_step");
153 Workflow.focus('#nirs_analysis_plot_spectra_workflow', 4);
154 window.scrollTo(0,0);
156 error: function(response){
157 alert('Error plotting spectra from NIRS!');
158 jQuery('#working_modal').modal('hide');