6 <& /util/import_javascript.mas, classes => [ 'jquery', 'jquery.dataTables' ] &>
7 <& /util/import_css.mas, paths => ['/documents/inc/datatables/jquery.dataTables.css'] &>
9 <div class="modal fade" id="set_default_plant_material_dialog" tabindex="-1" role="dialog" aria-labelledby="setDefaultPlantMaterialDialog">
10 <div class="modal-dialog modal-lg" role="document">
11 <div class="modal-content ui-front">
12 <div class="modal-header text-center">
13 <button type="reset" class="close" id="set_default_plant_material_dismiss_button_1" name="set_default_plant_material_dismiss_button" aria-label="Close"><span aria-hidden="true">×</span></button>
14 <h4 class="modal-title" id="setDefaultPlantMaterialDialog">Set Default Plant Material for Transformation</h4>
16 <div class="modal-body" id="set_default_plant_material_body">
17 <div class="container-fluid">
18 <form class="form-horizontal" role="form" method="post" enctype="multipart/form-data" encoding="multipart/form-data">
19 <div class="form-group">
20 <label class="col-sm-5 control-label" >Plant Material (accession name): </label>
21 <div class="col-sm-7">
22 <input class="form-control" type="text" id="default_plant_material_input" name="default_plant_material_input" />
28 <div class="modal-footer">
29 <button id="set_default_plant_material_dismiss_button_2" name="set_default_plant_material_dismiss_button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
30 <button type="button" class="btn btn-primary" id="set_default_plant_material_submit">Submit</button>
36 <div class="modal fade" id="default_plant_material_saved_dialog_message" name="default_plant_material_saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="defaultPlantMaterialSavedDialog">
37 <div class="modal-dialog" role="document">
38 <div class="modal-content">
39 <div class="modal-header">
40 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
41 <h4 class="modal-title" id="defaultPlantMaterialSavedDialog">Success</h4>
43 <div class="modal-body">
44 <div class="container-fluid">
46 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
47 The default plant material was set successfully.
51 <div class="modal-footer">
52 <button id="dismiss_default_plant_material_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
61 jQuery(document).ready(function(){
63 jQuery('#set_plant_material_link').click(function() {
64 jQuery("#set_default_plant_material_dialog").modal("show");
67 var transformation_project_id = "<%$project_id%>";
68 var program_name = "<%$breeding_program_name%>";
70 jQuery("#default_plant_material_input").autocomplete({
71 source: '/ajax/stock/only_accession_autocomplete',
75 jQuery('#set_default_plant_material_submit').click(function() {
77 var default_plant_material = jQuery("#default_plant_material_input").val();
78 if (!default_plant_material) {
79 alert("Plant material is required");
84 url: '/ajax/transformation/set_default_plant_material',
88 'default_plant_material': default_plant_material,
89 'transformation_project_id': transformation_project_id,
90 'program_name': program_name
92 beforeSend: function(response){
93 jQuery('#working_modal').modal('show');
95 success: function(response) {
96 jQuery('#working_modal').modal('hide');
97 if (response.success == 1) {
98 jQuery('#set_default_plant_material_dialog').modal('hide');
99 jQuery('#default_plant_material_saved_dialog_message').modal("show");
101 if (response.error) {
102 alert(response.error);
105 error: function(response){
106 jQuery('#working_modal').modal('hide');
107 alert('An error occurred saving default plant material');
113 jQuery("[name='set_default_plant_material_dismiss_button']").click(function() {
114 jQuery('#set_default_plant_material_dialog').modal('hide');
115 jQuery('#default_plant_material').val('');
118 jQuery("#dismiss_default_plant_material_saved_dialog").click(function(){
119 jQuery('#default_plant_material_input').val('');