update doemal ordering
This commit is contained in:
135
app/assets/javascripts/order_reservation.js
Normal file
135
app/assets/javascripts/order_reservation.js
Normal file
@@ -0,0 +1,135 @@
|
||||
|
||||
$(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)
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
//show order list
|
||||
function show_order_detail(url){
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var delivery = data["delivery"]
|
||||
var items = data["order_items"]
|
||||
|
||||
var item_list = $('.summary-items');
|
||||
item_list.empty();
|
||||
|
||||
for(var i in items) {
|
||||
var total = items[i].qty*items[i].unit_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 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) {
|
||||
// callback_url(callback,data.message)
|
||||
swal("Information","Order has been +'data.status'+","success");
|
||||
window.location.href = '/origami/order_reservation';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#cancel").on("click", function(){
|
||||
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';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function callback_url(url,message){
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: url,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
88
app/assets/stylesheets/order_reservation.scss
Normal file
88
app/assets/stylesheets/order_reservation.scss
Normal file
@@ -0,0 +1,88 @@
|
||||
.nav-tabs > li.active > a,
|
||||
.nav-tabs > li.active > a:hover,
|
||||
.nav-tabs > li.active > a:focus {
|
||||
border-bottom: 2px solid #2196F3 ;
|
||||
bottom: 2px ;
|
||||
}
|
||||
|
||||
.nav-tabs .nav-link {
|
||||
padding: 0.5286em .33em;
|
||||
}
|
||||
.nav-tabs li a.active {
|
||||
color: #111 !important;
|
||||
border-bottom: 0px solid #fff !important;
|
||||
}
|
||||
.nav-tabs .nav-link.active {
|
||||
color: #111;
|
||||
border-color: #fff;
|
||||
}
|
||||
.nav-tabs > li > a {
|
||||
margin-right: 0px;
|
||||
color:#fff !important;
|
||||
}
|
||||
|
||||
.nav-tabs > li > a {
|
||||
border-bottom: 2px solid #2196F3;
|
||||
bottom: 2px;
|
||||
}
|
||||
.nav-tabs.tab-col-teal > li > a:before {
|
||||
border-bottom: 0px solid #009688;
|
||||
}
|
||||
.nav-tabs .nav-item{
|
||||
margin-bottom: 2px ;
|
||||
}
|
||||
.num{
|
||||
color:#fff;
|
||||
text-align: center;
|
||||
margin-bottom: -1px !important;
|
||||
}
|
||||
.nav-tabs .nav-link.active > p{
|
||||
color: #111;
|
||||
border-color: #fff;
|
||||
}
|
||||
|
||||
/*Custosm Class*/
|
||||
.table .header-td{
|
||||
border-top:0px solid !important;
|
||||
border-bottom: 0px solid !important;
|
||||
padding:3px 7px !important;
|
||||
border-top:0px solid !important;
|
||||
border-bottom: 0px solid !important;
|
||||
}
|
||||
.custom-card-block .table td:first-child,
|
||||
.custom-card-block .table td:nth-child(2),
|
||||
.custom-card-footer .table td:first-child,
|
||||
.custom-card-footer .table td:nth-child(2){
|
||||
border-top:0px solid !important;
|
||||
}
|
||||
|
||||
.custom-card-footer .footer-td ,
|
||||
.grand-card-footer .footer-td {
|
||||
border-top:0px solid !important;
|
||||
border-bottom:0px solid !important;
|
||||
font-weight: bold;
|
||||
padding:6px 10px;
|
||||
}
|
||||
.custom-card-header{
|
||||
border-bottom: 1px solid #F8BBD0 !important;
|
||||
padding:13px 5px !important;
|
||||
}
|
||||
.custom-card-footer{
|
||||
border-top: 1px solid #F8BBD0 !important;
|
||||
}
|
||||
.custom-card-block,
|
||||
.grand-card-footer,
|
||||
.custom-card-footer{
|
||||
padding :5px !important;
|
||||
}
|
||||
.custom-table{
|
||||
background-color:#F3E5F5;
|
||||
}
|
||||
.custom-table tbody tr td,
|
||||
.custom-table tbody tr th{
|
||||
border-top: 1px solid #FFEBEE;
|
||||
border-bottom: 1px solid #FFEBEE;
|
||||
}
|
||||
.tr-active{
|
||||
background-color : #FFCDD2;
|
||||
}
|
||||
Reference in New Issue
Block a user