update confirm box

This commit is contained in:
Aung Myo
2017-10-19 18:17:56 +06:30
parent 034685e1e9
commit 78c6304748
21 changed files with 364 additions and 556 deletions

View File

@@ -169,13 +169,18 @@
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
alert("Payment success")
window.location.href = '/origami/sale/'+ sale_id + "/payment";
swal({
title: "Infomation!",
text: "Payment Success",
type: "success"
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
}else{
alert("Paid Amount is over!");
swal("Alert","Paid Amount is over!","error");
}
})
</script>

View File

@@ -38,7 +38,7 @@
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<input type="text" name="filter" style="margin-right:10px" id="search" placeholder="Search" class="form-control input-sm col-md-12">
<input type="hidden" name="type" id="type" value="">
<input type="hidden" name="type" id="type" value="<%= @dining_facility.type %>">
</div>
<div class="col-lg-2 col-md-2 col-sm-2 col-xs-12">
@@ -403,47 +403,37 @@
if(customer_name != ""){
customer = '(' + customer_name + ')';
}
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer' + customer + '!',
buttons: {
cancel: function () {
},
confirm: {
text: 'Confirm',
btnClass: 'btn-green',
keys: ['enter', 'shift'],
action: function(){
$.ajax({
type: "POST",
url: "update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
var id = $("#table_id").val()
var type = $("#type").val()
if (type=="Table") {
window.location.href = '/origami/table/'+id
}else{
window.location.href = '/origami/room/'+id
}
swal({
title: "Confirmation !",
text: 'Are You Sure to assign this customer' + customer + '!',
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Yes!",
cancelButtonClass: 'btn btn-danger',
closeOnConfirm: false,
}, function () {
$.ajax({
type: "POST",
url: "update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
var id = $("#table_id").val()
var type = $("#type").val()
if (type=="Table") {
window.location.href = '/origami/table/'+id
}else{
alert('Record not found!');
location.reload();
window.location.href = '/origami/room/'+id
}
}else{
swal("Alert!", "Record not found!", "error");
location.reload();
}
});
}
}
}
});
});
});
}
$('#back').on('click',function(){

View File

@@ -174,7 +174,7 @@
</div>
</div>
<div class="row">
<div class="row bottom">
<div class="col-md-3">
<div class="fluid cashier_number" data-value="30" data-type="add">30%</div>
</div>
@@ -378,25 +378,18 @@
type: "POST",
url: ajax_url,
data: params,
success:function(result){
$.confirm({
title: 'Infomation!',
content: result.status,
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
success:function(result){
swal({
title: "Infomation!",
text: result.status,
}, function () {
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
});
}
});
});
@@ -410,19 +403,8 @@
// Selected Items
var sale_items = get_selected_sale_items();
if(sale_items.length == 0){
$.confirm({
title: 'Infomation!',
content: "You have no selected item!",
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
return;
}
}
}
});
//swal("Infomation!", "You have no selected item!");
swal ( "Oops" , "You have no selected item!" , "error" );
}
for(var i=0;i < sale_items.length;i++){
@@ -430,19 +412,7 @@
discount_items.push(sale_items[i]);
}
else {
$.confirm({
title: 'Infomation!',
content: "You have selected no discount item!!",
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
return;
}
}
}
});
swal ("Oops" , "You have no selected item!" , "error" );
}
}
@@ -452,24 +422,18 @@
url: "/origami/" + sale_id + "/remove_discount_items",
data: params,
success: function(result){
$.confirm({
title: 'Infomation!',
content: result.status,
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
swal({
title: "Infomation!",
text: result.status,
type: "success",
}, function () {
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
});
}
});
});
@@ -481,24 +445,18 @@
type: "GET",
url: "/origami/" + sale_id + "/remove_all_discount",
success: function(result){
$.confirm({
title: 'Infomation!',
content: result.status,
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
swal({
title: "Infomation!",
text: result.status,
type: "success",
}, function () {
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
});
}
});
});
@@ -524,50 +482,28 @@
url: ajax_url,
data: params,
success:function(result){
console.log(result)
if (result.status == "Success") {
type = 'green'
btn_color = 'btn-green'
if (result.status == "Success") {
type = 'success'
btn_color = 'green'
}else{
type = 'red'
btn_color = 'btn-red'
type = 'error'
btn_color = 'red'
}
$.confirm({
title: result.title,
content: result.status,
columnClass: 'small',
type: type,
buttons: {
confirm: {
text: 'Ok',
btnClass: btn_color,
action: function(){
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
}
}
}
});
swal({
title: "Infomation!",
text: result.status,
confirmButtonText: 'OK',
confirmButtonColor: btn_color,
}, function () {
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
});
}
});
// }
// else{
// $.alert({
// title: 'Alert!',
// content: 'Please Select Account',
// type: 'red',
// typeAnimated: true,
// btnClass: 'btn-danger',
// });
// }
});//end member discount
});
@@ -663,18 +599,12 @@ function calculate_overall_discount(type, amount){
// For Percentage Pay
if(type == 1){
if(amount > 100 ){
$.confirm({
title: 'Infomation!',
content: "Percentage Value over 100!",
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
return;
}
}
}
swal({
title:"Oops!",
text:'Percentage Value over 100!',
type: "error",
confirmButtonText: 'OK',
confirmButtonColor:"red"
});
}
else{
@@ -740,19 +670,13 @@ function calculate_item_discount(type, amount, sale_items, account_types){
// For Percentage Pay
if(type == 1){
if(amount > 100 ){
$.confirm({
title: 'Infomation!',
content: "Percentage Value over 100!",
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
return;
}
}
}
});
swal({
title:"Oops!",
text:'Percentage Value over 100!',
type: "error",
confirmButtonText: 'OK',
confirmButtonColor:"red"
});
}
else{
// Check sale items exists

View File

@@ -494,22 +494,7 @@
// data: 'order_id='+ order_id,
success: function (result) {
if (!result.status) {
/*$.confirm({
title: 'Infomation!',
content: result.error_message,
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function () {
window.location.href = '/origami';
}
}
}
});*/
swal("Good job!", "You clicked the button!", "success");
swal("Infomation!", result.error_message);
}
else {
location.reload();
@@ -594,20 +579,17 @@
});
$('#void').on('click', function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
}
swal({
title: "Alert",
text: "Are you sure want to Void?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, void it!",
closeOnConfirm: false
}, function () {
window.location.href = '/origami/';
});
});
$('#add_order').on('click', function () {

View File

@@ -172,30 +172,17 @@ $('#jcb_pay').on('click',function(){
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
$.confirm({
title: 'Infomation!',
content: 'Payment Successfully',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
}
});
swal({
title: "Infomation!",
text: "Payment Successfully",
},function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
}else{
$.alert({
title: 'Alert!',
content: "Paid Amount is over!",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal ( "Oops" , "Paid Amount is over!" , "error" );
}
})
</script>

View File

@@ -169,30 +169,17 @@
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
$.confirm({
title: 'Infomation!',
content: 'Payment Successfully',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
}
});
swal({
title: "Infomation!",
text: "Payment Successfully",
},function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
}else{
$.alert({
title: 'Alert!',
content: "Paid Amount is over!",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal ( "Oops" , "Paid Amount is over!" , "error" );
}
})
</script>

View File

@@ -173,30 +173,17 @@
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
$.confirm({
title: 'Infomation!',
content: 'Payment Successfully',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
}
});
swal({
title: "Infomation!",
text: "Payment Successfully",
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
}else{
$.alert({
title: 'Alert!',
content: "Paid Amount is over!",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal ( "Oops" , "Paid Amount is over!" , "error" );
}
})
</script>

View File

@@ -161,7 +161,7 @@
</div>
</div>
<div class="row">
<div class="row bottom">
<div class="col-md-3">
<div class="fluid cashier_number" data-value="20000" data-type="add">20000</div>
</div>
@@ -291,13 +291,17 @@
url: ajax_url,
data: params,
success:function(result){
alert("Success!");
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
swal({
title: "Infomation!",
text: "Success",
}, function () {
if(result.table_type == "Table"){
window.location.href = "/origami/table/" + result.table_id
}
else {
window.location.href = "/origami/room/" + result.table_id
}
});
}
});
});

View File

@@ -360,7 +360,7 @@
$( "#loading_wrapper" ).show();
if($('#balance').text() > 0){
alert(" Insufficient Amount!")
swal ( "Oops" , "Insufficient Amount!" , "error" );
$( "#loading_wrapper" ).hide();
}else{
var sale_id = $('#sale_id').text();
@@ -389,33 +389,19 @@
}
$( "#loading_wrapper" ).hide();
if($('#balance').text() < 0){
$.confirm({
title: 'Infomation!',
content: 'Changed amount ' + $('#balance').text() * (-1),
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami';
}
}
}
swal({
title: "Infomation!",
text: 'Changed amount ' + $('#balance').text() * (-1),
}, function () {
window.location.href = '/origami';
});
}else{
$('#pay').text("Pay")
$.confirm({
title: 'Infomation!',
content: 'Thank you !',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami';
}
}
}
$('#pay').text("Pay");
swal({
title: "Infomation!",
text: 'Thank You !',
}, function () {
window.location.href = '/origami';
});
}
}
@@ -424,20 +410,20 @@
});
$('#void').on('click',function () {
var sure = confirm("Are you sure want to Void");
if (sure == true) {
swal({
title: "Infomation!",
text: 'Are you sure want to Void !',
}, function () {
var sale_id = $('#sale_id').text();
var ajax_url = "/origami/sale/" + sale_id + '/void';
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
} else {
}
$.ajax({
type: 'POST',
url: ajax_url,
success: function () {
window.location.href = '/origami/';
}
})
});
});
});
@@ -472,18 +458,11 @@
$( "#loading_wrapper" ).hide();
if (cash > 0) {
$.confirm({
title: 'Infomation!',
content: 'Thank you !',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami';
}
}
}
swal({
title: "Infomation!",
text: 'Thank You !',
}, function () {
window.location.href = '/origami';
});
}

View File

@@ -153,10 +153,9 @@ $("#redeem").click(function(){
membership_id = $("#valid_amount").attr('data-member-value');
redeem_amount = parseFloat($("#used_amount").text());
if(redeem_amount<=0 ){
alert("Please type valid amount");
swal ( "Oops" , "Please type valid amount!" , "warning" );
}else if(valid_amount< redeem_amount){
alert(" Insufficient Amount!")
swal ( "Oops" , "Insufficient Amount!" , "warning" );
}else{
if(redeem_amount <= "<%= @redeem_prices %>"){
$.ajax({
@@ -165,14 +164,20 @@ $("#redeem").click(function(){
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){
if(result.status == true){
window.location.href = '/origami/sale/'+ sale_id + "/payment"
swal({
title: "Infomation!",
text: result.status,
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment"
});
}else{
alert(result.message);
swal ( "Information" , result.message);
}
}
})
}else {
alert("Redeem Amount is over!");
swal ( "Oops" , "Redeem Amount is over!" , "warning" );
}
}
});

View File

@@ -142,21 +142,12 @@
url: ajax_url,
data: 'sale_item_id=' + sale_item_id + "&update_qty=" + qty + "&update_price=" + price,
success: function (result) {
$.confirm({
title: 'Alert!',
content: 'Qty and Price was successfully Updated',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green btn-lg',
action: function () {
location.reload();
}
}
}
swal({
title: "Infomation!",
text: "Qty and Price was successfully Updated",
}, function () {
location.reload();
});
}
});
});

View File

@@ -169,30 +169,17 @@
data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){
if(result){
$.confirm({
title: 'Infomation!',
content: 'Payment Successfully',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
action: function(){
window.location.href = '/origami/sale/'+ sale_id + "/payment";
}
}
}
swal({
title: "Infomation!",
text: "Payment Successfully",
}, function () {
window.location.href = '/origami/sale/'+ sale_id + "/payment";
});
}
}
});
}else{
$.alert({
title: 'Alert!',
content: "Paid Amount is over!",
type: 'red',
typeAnimated: true,
btnClass: 'btn-danger',
});
swal ( "Oops" , "Paid Amount is over!" , "error" );
}
})
</script>