update move table

This commit is contained in:
Aung Myo
2018-07-01 13:14:38 +06:30
parent 96b2be96b0
commit 80b84eb175
2 changed files with 34 additions and 21 deletions

View File

@@ -385,29 +385,37 @@ end
$('#move_table').on('click',function(){ $('#move_table').on('click',function(){
change_to = $('#change_table_value').val(); change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>"; change_from = "<%= @dining.id %>";
if (change_to == ""){ if (change_to == ""){
swal({ swal({
title: "Alert!!", title: "Alert!!",
text: 'Please Select Table !', text: 'Please Select Table !',
type: 'warning', type: 'warning',
}); });
}else{ }else{
$("#oqs_loading_wrapper").show();
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_moving_path %>", url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to, data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){ success:function(result){
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to;
}else{
window.location.href = '/origami/room/' + change_to;
}
// alert("Moving Success") // alert("Moving Success")
swal({ // swal({
title: "Information!", // title: "Information!",
text: 'Moving Success', // text: 'Moving Success',
type: 'success', // type: 'success',
}, function (){ // }, function (){
if (result.get_type == 'Table'){ // if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to; // window.location.href = '/origami/table/' + change_to;
}else{ // }else{
window.location.href = '/origami/room/' + change_to; // window.location.href = '/origami/room/' + change_to;
} // }
}); // });
} }
}); });
} }

View File

@@ -387,7 +387,7 @@ end
$('#move_table').on('click',function(){ $('#move_table').on('click',function(){
change_to = $('#change_table_value').val(); change_to = $('#change_table_value').val();
change_from = "<%= @dining.id %>"; change_from = "<%= @dining.id %>";
$("#oqs_loading_wrapper").show();
if (change_to == ""){ if (change_to == ""){
swal({ swal({
title: "Alert!!", title: "Alert!!",
@@ -395,23 +395,28 @@ end
type: 'warning', type: 'warning',
}); });
}else{ }else{
$("#oqs_loading_wrapper").show();
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_moving_path %>", url: "<%= origami_moving_path %>",
data: "change_from="+ change_from + "&change_to=" + change_to, data: "change_from="+ change_from + "&change_to=" + change_to,
success:function(result){ success:function(result){
if (result.get_type == 'Table'){
swal({
title: "Information!",
text: 'Moving Success',
type: 'success',
}, function (){
if (result.get_type == 'Table'){
window.location.href = '/origami/table/' + change_to; window.location.href = '/origami/table/' + change_to;
}else{ }else{
window.location.href = '/origami/room/' + change_to; window.location.href = '/origami/room/' + change_to;
} }
}); // swal({
// title: "Information!",
// text: 'Moving Success',
// type: 'success',
// closeOnConfirm: false
// }, function (){
// if (result.get_type == 'Table'){
// window.location.href = '/origami/table/' + change_to;
// }else{
// window.location.href = '/origami/room/' + change_to;
// }
// });
} }
}); });