order reservation updated
This commit is contained in:
@@ -2,37 +2,56 @@
|
||||
$(function() {
|
||||
|
||||
$(".nav-item").on("click", function(){
|
||||
type = $(this).attr("data-type");
|
||||
if (type == "pending") {
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$('#accepted').text("SEND TO KITCHEN");
|
||||
$('#accepted').attr("data-value","processed");
|
||||
}else if(type == "delivery"){
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
console.log(type)
|
||||
type = $(this).attr("data-type");
|
||||
refreshDetailData();
|
||||
if (type == "pending") {
|
||||
$(".first-1").click();
|
||||
$('#accepted').text("Accepted");
|
||||
$('#accepted').attr("data-value","accepted");
|
||||
}else if(type == "processing"){
|
||||
$(".second-1").click();
|
||||
$('#accepted').text("SEND TO KITCHEN");
|
||||
$('#accepted').attr("data-value","processed");
|
||||
}else if(type == "delivery"){
|
||||
$(".third-1").click();
|
||||
$('#accepted').text("READY TO DELIVERY");
|
||||
$('#accepted').attr("data-value","delivery");
|
||||
}else if(type == "completed"){
|
||||
$(".fourth-1").click();
|
||||
$('#accepted').text("PICK-UP");
|
||||
$('#accepted').attr("data-value","completed");
|
||||
}
|
||||
// console.log(type);
|
||||
});
|
||||
|
||||
jQuery(function(){
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url);
|
||||
jQuery('.first-1').click();
|
||||
});
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url){
|
||||
$(".custom-tr").on("click", function(){
|
||||
$(".custom-tr").removeClass("tr-active");
|
||||
$(this).addClass("tr-active");
|
||||
var order_id = $(this).attr("data-id");
|
||||
var sr_no = $(this).attr("data-sr-no");
|
||||
var url = "order_reservation/get_order/"+order_id;
|
||||
show_order_detail(url,sr_no);
|
||||
});
|
||||
|
||||
function refreshDetailData(){
|
||||
$("#sr_number").text("");
|
||||
$("#delivery_info").text("");
|
||||
$("#contact_info").text("");
|
||||
$('.summary-items').html("");
|
||||
$('#sub_total').text("0.00");
|
||||
$('#delivery_fee').text("0.00");
|
||||
$('#total_charges').text("0.00");
|
||||
$('#total_tax').text("0.00");
|
||||
$('#grand_total').text("0.00");
|
||||
}
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url,sr_no){
|
||||
$('.summary-items').html("");
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
@@ -40,51 +59,70 @@ $(function() {
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var delivery = data["delivery"]
|
||||
var items = data["order_items"]
|
||||
// console.log(data);
|
||||
var delivery = data["delivery"];
|
||||
var items = data["order_items"];
|
||||
|
||||
var item_list = $('.summary-items');
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
for(var i in items) {
|
||||
var item_price = 0;
|
||||
if(items[i].price > 0){
|
||||
item_price = items[i].price;
|
||||
}else{
|
||||
item_price = items[i].unit_price;
|
||||
if(items!=undefined && items!=""){
|
||||
if(items.length > 0){
|
||||
for(var i in items) {
|
||||
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>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
|
||||
if(delivery.provider == "direct_delivery"){
|
||||
$("#delivery_info").text("(DELIVERY)");
|
||||
}else if(delivery.provider == "self_pick_up"){
|
||||
$("#delivery_info").text("(PICK-UP)");
|
||||
}
|
||||
|
||||
if(data.order_remark!=null && data.order_remark!=""){
|
||||
$("#order_remark").text(data.order_remark);
|
||||
}else if(data.reservation_remark!=null && data.reservation_remark!=""){
|
||||
$("#order_remark").text(data.reservation_remark);
|
||||
}
|
||||
$("#sr_number").text("No."+sr_no);
|
||||
$("#contact_info").text();
|
||||
}
|
||||
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>'
|
||||
+'</td>'
|
||||
+'<td width ="30%" class="body-td align-right">'+ total +'</td>'
|
||||
+'</tr>';
|
||||
$('.summary-items').append(row);
|
||||
}
|
||||
|
||||
$('#sub_total').text(data.total_amount);
|
||||
$('#delivery_fee').text(delivery.delivery_fee);
|
||||
$('#total_charges').text(0);
|
||||
$('#total_tax').text(data.total_tax);
|
||||
$('#grand_total').text(data.grand_total);
|
||||
|
||||
var address = delivery.address +', ' +delivery.township+", (" +delivery.direction_address+")"
|
||||
$('#customer_name').text(data.customer_name);
|
||||
$('#phone').text(data.phone);
|
||||
$('#address').text(address);
|
||||
$('#delivery_to').text(delivery.provider);
|
||||
|
||||
$('#ref_no').text(data.transaction_ref);
|
||||
$('#callback_url').text(data.callback_url);
|
||||
$('#order_id').text(data.order_reservation_id);
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
$("#accepted").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
var callback = $('#callback_url').text();
|
||||
@@ -92,7 +130,7 @@ $(function() {
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
var status = $(this).attr("data-value");
|
||||
var status = $(this).attr("data-value");
|
||||
var order_id = $('#order_id').text();
|
||||
var callback = $('#callback_url').text();
|
||||
var ref_no = $('#ref_no').text();
|
||||
@@ -119,7 +157,7 @@ $(function() {
|
||||
if (data.status) {
|
||||
swal({
|
||||
title: 'Information',
|
||||
text: "Order has been "+data.status,
|
||||
text: "Order has been "+data.message,
|
||||
type: 'success',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
@@ -134,7 +172,7 @@ $(function() {
|
||||
}else{
|
||||
swal({
|
||||
title: 'Oops',
|
||||
text: data.message.toString(),
|
||||
text: data.message,
|
||||
type: 'error',
|
||||
html: true,
|
||||
closeOnConfirm: false,
|
||||
@@ -147,5 +185,5 @@ $(function() {
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user