Merge pull request #2754 from solgenomics/topic/fix_homepage_add_accessions_dialog
[sgn.git] / mason / breeders_toolbox / manage_phenotyping.mas
blob2e3761b6de166b777979b4522590e5dda0f7bec2
2 <%args>
3 $phenotype_files => undef
4 $deleted_phenotype_files => undef
5 $locations => undef
6 </%args>
8 <& /util/import_javascript.mas, classes => [ 'CXGN.BreedersToolbox.Trial','CXGN.BreedersToolbox.FieldBook','CXGN.BreedersToolbox.UploadPhenotype', 'CXGN.BreederSearch', 'CXGN.Trial' ] &>
10 <& /page/page_title.mas, title=>"Manage Phenotypic Data" &>
12 <div class="container-fluid">
14 <!--button class="btn btn-info" onclick=location.href="/search/stocks">Phenotype Search</button><br /><br /-->
16 <& /fieldbook/create_fieldbook_dialog.mas &>
17 <& /fieldbook/create_trait_file_dialog.mas &>
18 <& /fieldbook/upload_phenotype_fieldbook.mas &>
19 <& /breeders_toolbox/upload_phenotype_spreadsheet.mas &>
20 <& /breeders_toolbox/trial/create_spreadsheet_dialog.mas &>
22 <div class="well">
24 <&| /page/info_section.mas, title=>'Your Uploaded Files', is_subsection=>1, subtitle=>'[<a id="upload_fieldbook_phenotypes_link" >Upload Fieldbook Database File</a>]    [<a id="upload_spreadsheet_phenotypes_link" >Upload Spreadsheet</a>]<br/>[<a name="create_fieldbook_link" >Create Fieldbook Layout File</a>]    [<a id="create_new_trait_file_link" >Create Fieldbook Trait File</a>]<br/>[<a name="create_spreadsheet_link" >Create Spreadsheet</a>]' &>
25   <br/>
26   <& /breeders_toolbox/file_list.mas, files=>$phenotype_files, allow_delete=>1 &>
28 </&>
30 </div>
31 <div class="well">
33 <&| /page/info_section.mas, title=>'Your Obsoleted Files', subtitle=>'These files will not be shown anywhere else on the website', is_subsection=>1 &>
35   <& /breeders_toolbox/file_list.mas, files=>$deleted_phenotype_files, allow_delete=>0 &>
37 </&>
39 </div>
41 </div>
43 <script>
45 jQuery(document).ready(function() {
47     jQuery('button[name=delete_pheno_file_link]').click( function() {
48         var delete_phenotypes_file_id = jQuery(this).data('file_id');
49         if (confirm('Are you sure you want to delete all phenotype values related to this file from the database and make this file obsolete?')){
50             jQuery.ajax ( {
51                 url : '/ajax/breeders/phenotyping/delete/'+delete_phenotypes_file_id,
52                 beforeSend : function() {
53                     jQuery('#working_modal').modal('show');
54                 },
55                 success: function(response){
56                     jQuery('#working_modal').modal('hide');
57                     alert('Made phenotype file obsolete and deleted all related phenotype values in the database!');
58                     location.reload();
59                 },
60                 error: function(response){
61                     jQuery('#working_modal').modal('hide');
62                     alert("Error deleting file and phenotypes!");
63                 }
64             });
65         }
66     });
68 });
70 </script>