From 80b84eb17500eaf7c577f62f3148606b3bdf45c2 Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Sun, 1 Jul 2018 13:14:38 +0630 Subject: [PATCH] update move table --- .../origami/moveroom/move_dining.html.erb | 30 ++++++++++++------- .../origami/movetable/move_dining.html.erb | 25 +++++++++------- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/app/views/origami/moveroom/move_dining.html.erb b/app/views/origami/moveroom/move_dining.html.erb index be736919..48aa28bf 100755 --- a/app/views/origami/moveroom/move_dining.html.erb +++ b/app/views/origami/moveroom/move_dining.html.erb @@ -385,29 +385,37 @@ end $('#move_table').on('click',function(){ change_to = $('#change_table_value').val(); change_from = "<%= @dining.id %>"; + if (change_to == ""){ swal({ title: "Alert!!", text: 'Please Select Table !', type: 'warning', }); + }else{ + $("#oqs_loading_wrapper").show(); $.ajax({type: "POST", url: "<%= origami_moving_path %>", data: "change_from="+ change_from + "&change_to=" + change_to, 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") - swal({ - title: "Information!", - text: 'Moving Success', - type: 'success', - }, function (){ - if (result.get_type == 'Table'){ - window.location.href = '/origami/table/' + change_to; - }else{ - window.location.href = '/origami/room/' + change_to; - } - }); + // swal({ + // title: "Information!", + // text: 'Moving Success', + // type: 'success', + // }, function (){ + // if (result.get_type == 'Table'){ + // window.location.href = '/origami/table/' + change_to; + // }else{ + // window.location.href = '/origami/room/' + change_to; + // } + // }); } }); } diff --git a/app/views/origami/movetable/move_dining.html.erb b/app/views/origami/movetable/move_dining.html.erb index 36dfe25a..191045f7 100755 --- a/app/views/origami/movetable/move_dining.html.erb +++ b/app/views/origami/movetable/move_dining.html.erb @@ -387,7 +387,7 @@ end $('#move_table').on('click',function(){ change_to = $('#change_table_value').val(); change_from = "<%= @dining.id %>"; - $("#oqs_loading_wrapper").show(); + if (change_to == ""){ swal({ title: "Alert!!", @@ -395,23 +395,28 @@ end type: 'warning', }); }else{ - + $("#oqs_loading_wrapper").show(); $.ajax({type: "POST", url: "<%= origami_moving_path %>", data: "change_from="+ change_from + "&change_to=" + change_to, success:function(result){ - - swal({ - title: "Information!", - text: 'Moving Success', - type: 'success', - }, function (){ - if (result.get_type == 'Table'){ + if (result.get_type == 'Table'){ window.location.href = '/origami/table/' + change_to; }else{ 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; + // } + // }); } });