order reservation
This commit is contained in:
@@ -47,7 +47,13 @@ $(function() {
|
||||
item_list.empty();
|
||||
|
||||
for(var i in items) {
|
||||
var total = items[i].qty*items[i].unit_price;
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
}
|
||||
var total = items[i].qty * item_price;
|
||||
row = '<tr>'
|
||||
+'<td width ="70%" class="body-td align-left">'+items[i].item_name
|
||||
+' <br><span class="font-13">'+items[i].qty+ '<span class="col-blue"> <b>X</b>'+items[i].unit_price+'</span></span>'
|
||||
@@ -78,56 +84,66 @@ $(function() {
|
||||
}
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var url = 'order_reservation/update';
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
if (data.status) {
|
||||
// callback_url(callback,data.message)
|
||||
swal("Information","Order has been +'data.status'+","success");
|
||||
window.location.href = '/origami/order_reservation';
|
||||
}
|
||||
}
|
||||
});
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var url = 'order_reservation/update';
|
||||
var callback = $('#callback_url').text();
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data)
|
||||
if (data.status) {
|
||||
console.log(data)
|
||||
// callback_url(callback,data.message)
|
||||
swal("Information","Order has been +'data.status'+","warning");
|
||||
window.location.href = '/origami/order_reservation';
|
||||
}
|
||||
}
|
||||
});
|
||||
var ref_no = $('#ref_no').text();
|
||||
callback_url(callback,ref_no,order_id,status);
|
||||
});
|
||||
|
||||
function callback_url(url,message){
|
||||
function callback_url(callback,ref_no,order_id,status){
|
||||
var url = 'order_reservation/update';
|
||||
var post_url = "order_reservation/send_status";
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {},
|
||||
url: post_url,
|
||||
data: {url: callback, ref_no: ref_no, status: status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
if(data.status){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {'order_id': order_id, 'status': status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.status,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
closeOnCancel: false,
|
||||
allowOutsideClick: false
|
||||
}, function () {
|
||||
window.location.href = '/origami/order_reservation';
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user