2024-08-22 08:01:54 +00:00
|
|
|
import {formatCurrency} from "./common.js"
|
|
|
|
|
2024-08-21 21:43:16 +00:00
|
|
|
export function showInfo(api) {
|
|
|
|
let token = localStorage.getItem("token");
|
|
|
|
let id = window.location.pathname.split("/").pop();
|
|
|
|
|
|
|
|
const requestOptions = {
|
|
|
|
method: 'post',
|
|
|
|
headers: {
|
|
|
|
'Accept': `application/json`,
|
|
|
|
'Content-Type': 'application/json',
|
|
|
|
'Authorization': 'Bearer ' + token,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
fetch(api + "/api/admin/get-sale/" + id, requestOptions)
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(function (data) {
|
|
|
|
console.log(data);
|
2024-08-22 07:56:14 +00:00
|
|
|
if (data) {
|
|
|
|
document.getElementById("order-no").innerHTML = data.id
|
|
|
|
document.getElementById("customer").innerHTML = data.customer.first_name + " " + data.customer.last_name
|
|
|
|
document.getElementById("product").innerHTML = data.widget.name
|
|
|
|
document.getElementById("quantity").innerHTML = data.quantity
|
|
|
|
document.getElementById("amount").innerHTML = formatCurrency(data.transaction.amount)
|
|
|
|
}
|
2024-08-21 21:43:16 +00:00
|
|
|
});
|
|
|
|
}
|