Fix issue when user cancels the cancellation. #449
This commit is contained in:
parent
2e9a5585d4
commit
a526b7bee5
2 changed files with 17 additions and 16 deletions
|
|
@ -1181,7 +1181,6 @@ class JobOrderController extends Controller
|
|||
// ajax call
|
||||
public function cancelReasons()
|
||||
{
|
||||
error_log('start cancel_reasons');
|
||||
return $this->json([
|
||||
'cancel_reasons' => JOCancelReasons::getCollection(),
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -1764,30 +1764,32 @@ $(function() {
|
|||
inputOptions: inputOptionsPromise,
|
||||
type: 'warning',
|
||||
showCancelButton: true,
|
||||
closeOnCancel: true,
|
||||
width: '40rem',
|
||||
inputValidator: (value) => {
|
||||
return new Promise((resolve) => {
|
||||
console.log(value)
|
||||
resolve()
|
||||
})
|
||||
}
|
||||
}).then((result) => {
|
||||
$.ajax({
|
||||
method: "DELETE",
|
||||
url: url,
|
||||
data: {
|
||||
'cancel_reason': result.value
|
||||
}
|
||||
}).done(function(response) {
|
||||
swal({
|
||||
title: 'Done!',
|
||||
text: response.success,
|
||||
type: 'success',
|
||||
onClose: function() {
|
||||
window.location.href = "{{ return_url }}";
|
||||
if (result.value) {
|
||||
$.ajax({
|
||||
method: "DELETE",
|
||||
url: url,
|
||||
data: {
|
||||
'cancel_reason': result.value
|
||||
}
|
||||
}).done(function(response) {
|
||||
swal({
|
||||
title: 'Done!',
|
||||
text: response.success,
|
||||
type: 'success',
|
||||
onClose: function() {
|
||||
window.location.href = "{{ return_url }}";
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue