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

@@ -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