6 <div class="modal fade" id="discard_seedlot_dialog" name="discard_seedlot_dialog" tabindex="-1" role="dialog" aria-labelledby="discardSeedlotDialog">
7 <div class="modal-dialog modal-lg" role="document">
8 <div class="modal-content">
9 <div class="modal-header">
10 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
11 <h4 class="modal-title" id="discardSeedlotDialog">Mark this Seedlot as DISCARDED </h4>
13 <div class="modal-body">
14 <div class="container-fluid">
15 <form class="form-horizontal" role="form" method="post" id="discard_seedlot_form" name="discard_seedlot_form">
16 <div class="form-group">
17 <label class="col-sm-4 control-label">Seedlot Name: </label>
18 <div class="col-sm-8" >
19 <input class="form-control" name="discard_seedlot_name" id="discard_seedlot_name" disabled value="<% $uniquename %>">
22 <div class="form-group">
23 <label class="col-sm-4 control-label">Reason for Discarding: </label>
24 <div class="col-sm-8" >
25 <textarea class="form-control" id="reason_for_discarding_details_page" name="reason_for_discarding_details_page" placeholder="Required"></textarea>
31 <div class="modal-footer">
32 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
33 <button type="button" class="btn btn-primary" name="discard_single_seedlot_submit" id="discard_single_seedlot_submit">Submit</button>
39 <div class="modal fade" id="saved_dialog_message" name="saved_dialog_message" tabindex="-1" role="dialog" aria-labelledby="savedDialog">
40 <div class="modal-dialog" role="document">
41 <div class="modal-content">
42 <div class="modal-header">
43 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
44 <h4 class="modal-title" id="savedDialog">Success</h4>
46 <div class="modal-body">
47 <div class="container-fluid">
49 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
50 This seedlot was marked as DISCARDED.
54 <div class="modal-footer">
55 <button id="dismiss_saved_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
61 <div class="modal fade" id="undo_dialog_message" name="undo_dialog_message" tabindex="-1" role="dialog" aria-labelledby="undoDialog">
62 <div class="modal-dialog" role="document">
63 <div class="modal-content">
64 <div class="modal-header">
65 <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
66 <h4 class="modal-title" id="undoDialog">Success</h4>
68 <div class="modal-body">
69 <div class="container-fluid">
71 <span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>
72 This seedlot was restored.
76 <div class="modal-footer">
77 <button id="dismiss_undo_dialog" type="button" class="btn btn-default" data-dismiss="modal">Close & Reload</button>
85 jQuery(document).ready(function(){
87 var seedlot_name = "<% $uniquename %>";
89 jQuery("#discard_seedlot_details_page_link").click( function() {
90 jQuery('#discard_seedlot_dialog').modal('show');
93 jQuery('#discard_single_seedlot_submit').click(function(){
95 var discard_reason = jQuery('#reason_for_discarding_details_page').val();
97 if (seedlot_name === '') {
98 alert("Error retrieving seedlot info");
102 if (discard_reason === '') {
103 alert("Please provide reason for discarding this seedlot");
108 url: '/ajax/breeders/seedlot/discard',
111 'seedlot_name' : seedlot_name,
112 'discard_reason': discard_reason,
114 beforeSend: function(response){
115 jQuery('#working_modal').modal('show');
117 success: function(response) {
118 jQuery('#working_modal').modal('hide');
119 if (response.success == 1) {
120 jQuery('#discard_seedlot_dialog').modal('hide');
121 jQuery('#saved_dialog_message').modal("show");
123 if (response.error_string) {
124 alert(response.error_string);
127 error: function(response){
128 jQuery('#working_modal').modal('hide');
129 alert('An error occurred discarding seedlot');
134 jQuery("#dismiss_saved_dialog").click( function() {
135 jQuery('#saved_dialog_message').modal('hide');
139 jQuery('#undo_discarding_seedlot_link').click(function() {
140 var seedlot_id = "<% $seedlot_id %>";
141 var confirmation = confirm("Are you sure you want to UNDO marking this seedlot as DISCARDED ?");
144 url: '/ajax/breeders/seedlot/undo_discard',
147 'seedlot_id' : seedlot_id,
149 beforeSend: function(response){
150 jQuery('#working_modal').modal('show');
152 success: function(response) {
153 jQuery('#working_modal').modal('hide');
154 if (response.success == 1) {
155 jQuery('#undo_dialog_message').modal("show");
157 if (response.error_string) {
158 alert(response.error_string);
161 error: function(response){
162 jQuery('#working_modal').modal('hide');
163 alert('An error occurred processing your request');
169 jQuery("#dismiss_undo_dialog").click( function() {
170 jQuery('#undo_dialog_message').modal('hide');