import {formatCurrency} from "./common.js" 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); 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) } }); }