Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/checkout/js/ drwxr-xr-x | |
| Viewing file: Select action/file-type: var shop_data;
$(function () {
var auth={
"authorization": "Basic " + btoa("Mongo_API"+":"+"jiFFMongo@2023!@!@!@")
};
var url=window.location;
var sale_id = new URL(url).searchParams.get("id");
// console.log(sale_id);
// var page_psid=url_string.split('_');
$.ajax({
type: 'GET',
url: 'https://checkout.jiff.live/api/mongo/order_details?sale_id='+sale_id,
headers:auth,
success: function (data, status, xhr) {
// console.log(data);
setView(data[0],data[1],data[2]);
}
});
});
function getShopData(page_id, callback) {
var auth = {
"authorization": "Basic " + btoa("Mongo_API" + ":" + "jiFFMongo@2023!@!@!@")
};
$.ajax({
type: 'get',
url: 'https://checkout.jiff.live/api/mongo/shop_settings?page_id=' + page_id,
dataType: 'json',
headers: auth,
success: function (data) {
shop_data = data[0];
if (typeof callback === "function") callback();
}
});
}
function setView(sale,customer,items) {
var page_id=customer.page_id;
// var auth={
// "authorization": "Basic " + btoa("Mongo_API"+":"+"jiFFMongo@2023!@!@!@")
// };
// $.ajax({
// type: 'get',
// url: 'https://checkout.jiff.live/api/mongo/shop_settings?page_id='+page_id,
// dataType: 'json',
// headers:auth,
// // beforeSend: function(xhr) {
// // xhr.setRequestHeader('authorization', 'Basic ' + btoa(username+':'+password));
// // },
// success: function (data, status, xhr) {
// shop_data=data[0];
// $("#shop_name").text(shop_data.shop_name);
// console.log(shop_data);
// }
// });
let image_folder;
getShopData(page_id, function() {
// Now shop_data is available here, but this code is outside the AJAX success!
$("#shop_name").text(shop_data.shop_name);
image_folder = shop_data.store[0].image_folder;
for (let i = 0; i < items.length; i++) {
// console.log(items[i].product[0].images[0]);
if (items[i].product[0].images.length == 0) {
var image="https://media.istockphoto.com/id/1055079680/vector/black-linear-photo-camera-like-no-image-available.webp?s=612x612&w=is&k=20&c=OB0AoxouENQqDd14Te9WpfNy2aPOXoJF8AAi3zcd7Pk=";
}else{
var image="https://jiffc.s3.ap-southeast-1.amazonaws.com/"+image_folder+"/products/"+items[i].product[0].images[0];
// var image="https://static-01.daraz.com.bd/p/7da77214581407a906196a2f879328af.jpg";
}
$("#tdata").append('<tr>\
<td id="product_info">\
<div class="product-item">\
<a class="product-thumb"><img src="'+image+'" alt="No Image"><div class="centered">Not Available</div></a>\
<div class="product-info">\
<h4 class="product-title"><a ><b>'+items[i].product_name +" "+ items[i].product[0].name+ '</span><br><span class="taka_sign">৳</span><span id="unit_price" class="unit_price">'+items[i].unit_price+'</span>\
</div>\
</div>\
</td>\
<td class="text-center" id="quantity">\
<span>X'+items[i].quantity+'</span>\
</td>\
<td class="text-right" id="item_total">\
<span>৳'+items[i].subtotal+'</span>\
</td></tr>');
}
});
var status=sale.sale_status;
var order_status;
switch(status) {
case 1:
order_status="Received";
break;
case 2:
order_status="Accepted";
break;
case 3:
order_status="Picked up";
break;
case 4:
order_status="Delivered";
break;
case 5:
order_status="Canceled";
break;
case 6:
order_status="Returned";
break;
default:
}
var order_date=sale.created_at.split("T");
var date_format=order_date[0].split("-");
$("#order_date").text(date_format[2]+"-"+date_format[1]+"-"+date_format[0]);
$("#order_status").text(order_status);
$("#payment_status").text(sale.payment_status==0 ? "Unpaid" : "Paid");
$("#re_name").text(sale.receiver_name);
$("#re_phone").text(sale.receiver_phone);
$("#re_address").text(sale.address);
$("#cus_name").text(customer.name);
$("#cus_phone").text(customer.phone);
// $("#cus_address").text(customer.address);
$("#invoice_no").text(sale.invoice_no);
$("#product_total").text(sale.total);
$("#shipping_fee").text(sale.shipping);
$("#total_amount").text(sale.grand_total);
$("#total_paid").text(sale.paid);
$("#balance").text(sale.grand_total-sale.paid);
} |
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0051 ]-- |