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

@@ -131,7 +131,6 @@ $(function() {
var code = "";
setTimeout(function(){
var hi=getQRCode();
alert(hi);
},100);
});
@@ -231,39 +230,31 @@ $(document).on('click',".customer_tr",function(){
})
function update_sale(customer_id,sale_id) {
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer!',
buttons: {
swal({
title: "Confirmation",
text: "Are You Sure to assign this customer!",
type: "success",
showCancelButton: true,
confirmButtonColor: "green",
confirmButtonText: "Yes, delete it!",
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)
{
window.location.href = '/origami'
}else{
swal("Alert!", "Record not found!", "error");
location.reload();
}
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)
{
window.location.href = '/origami'
}else{
alert('Record not found!');
location.reload();
}
}
});
}
}
}
}
});
});
}

View File

@@ -57,56 +57,32 @@ $(document).on('click',".assign_table",function(){
if (status == "available") {
assign_table(queue_id,table_id,url);
} else {
$.confirm({
title: 'Alert!',
content: 'You cannot assign this table',
buttons: {
confirm: {
text: 'Ok',
btnClass: 'btn-green',
}
}
});
swal ( "Alert!" , "You cannot assign this table!" , "warning" );
}
})
function assign_table(id,table_id,url) {
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer!',
buttons: {
cancel: function () {
},
confirm: {
text: 'Confirm',
btnClass: 'btn-green',
keys: ['enter', 'shift'],
action: function(){
$.ajax({
type: "POST",
url: url ,
data: {id:id,table_id:table_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
window.location.href = '<%=crm_dining_queues_path%>'
}else{
alert('Record not found!');
location.reload();
}
}
});
}
}
swal({
title: "Confirm!",
text: "Are You Sure to assign this customer!",
}, function () {
$.ajax({
type: "POST",
url: url ,
data: {id:id,table_id:table_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
window.location.href = '<%=crm_dining_queues_path%>'
}else{
swal ( "Alert!" , "Record not found!" , "warning" );
location.reload();
}
}
});
});
}
</script>

View File

@@ -91,35 +91,24 @@ $('#cancel').click(function() {
function cancel_queue(id,url) {
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to cancel this Queue!',
buttons: {
cancel: function () {
},
confirm: {
text: 'Confirm',
btnClass: 'btn-green',
keys: ['enter', 'shift'],
action: function(){
$.ajax({
type: "POST",
url: url ,
data: {id:id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
location.reload();
}
swal({
title: "Confirm!",
text: "Are You Sure to cancel this Queue!",
}, function () {
$.ajax({
type: "POST",
url: url ,
data: {id:id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
location.reload();
}
}
});
}
}
}
});
}
});
});
}
</script>