123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- async function bindOrderDetails() {
- let user_number = $('.User_phoneum').text();
- // validatesession()
-
- let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
- let { userId } = cookieRes;
- //let userId = '106631380000048';
-
- console.log(cookieRes);
- let port = SERVERNAME;
- // let port = "http://localhost:3088";
- let url = `${port}/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/${userId}`;
- // /apis/v4/bizgaze/integrations/products/salesorderdetailsbyorgid/phonenumber/
- // https://anwi.bizgaze.app/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/{organizationid}
- const config = {
- url,
- method: "get",
- headers: {
- 'Authorization': `stat ${STAT} `,
- 'Content-Type': 'application/json'
- }
- };
-
- let res = await axios(config);
- if (res.data.result == '[]' || res.data.result === null) {
- $(".user_order_details").append(`<div><h6 class="text-center">No orders Found</h6></div>`);
- return;
- }
- const orderDetailsres = JSON.parse(res.data.result);
- console.log(orderDetailsres,"order");
- let new_arrr = orderDetailsres;
- console.log(new_arrr);
- $(".user_order_details").html(``)
- console.log('hello')
- let user_order_details = ``;
- let order_itemTotal = '';
- let order_netTotal = '';
- let order_quantity = '';
- let order_taxAmount = '';
-
- for (let i = 0; i < new_arrr.length; i++) {
- let current = new_arrr[i]
- console.log(current);
- let updatedCurent_total = current.nettotal.toLocaleString()
- order_itemTotal = current.itemtotal;
- order_netTotal = current.nettotal;
- order_quantity = current.Quantity;
- order_taxAmount = current.taxamount;
- user_order_details += `<div href="" class="order_details_main_container">
- <div class="border-3 mb-3 card">
- <div class="text-dark card-body px-0 pt-0">
- <div class="d-none">
- <span class="order_itemTotal">${order_itemTotal}</span>
- <span class="order_netTotal">${order_netTotal}</span>
- <span class="order_tax">${order_taxAmount}</span>
- <span class="order_qty">${order_quantity}</span>
- </div>
- <div class="bg-gray-4 p-2 m-0 border-bottom">
- <p class="m-0 fw-600 text-secondary">ORDER NO: <span class="text-blue fs-9 serial_no serial_no_btn "><u class="cursor-pointer">${current.OrderNo}</u></span>
- </p>
- </div>
- <div class="bg-gray-4 p-2 row g-0">
- <div class="col-md-6 ">
- <div class="d-flex justify-content-between align-items-center">
- <div>
- <p class="mb-1">ORDER PLACED</p>
- <p class="mb-1 fw-500 order_date">${current.OrderDate}</p>
- </div>
- <div>
- <p class="mb-1"> TOTAL</p>
- <p class="mb-1 fw-500 Current_netTotal"> ₹${updatedCurent_total}</p>
- </div>
- <div>
- <p class="mb-1">Delivered TO </p>
- <p class="mb-1 fw-500">${current.OrganizationName}</p>
- </div>
- </div>
- </div>
- <div class="col-md-4 ms-auto">
-
- <div class="d-flex justify-content-between">
- <div>
- <p class="mb-1 text-info fw-500"> View order details </p>
-
- </div>
- <div>
- <p class="mb-0 text-info fw-500 text-center">Invoice</p>
- <p class="mb-1 fw-500 d-flex gap-2 pt-1">
- <span data-invoiceid="${current.invoiceid}" class="invoicedownload w-100 cursor-pointer bg-white rounded p-1 d-flex align-items-center justify-content-around"> <i class="fa-solid fa-file-invoice p-1 "></i></span>
-
- </p>
- </div>
- </div>
- </div>
- </div>
- <div class="border-0 card rounded-0 order-cards py-3">
- <div class="d-flex flex-wrap px-2 align-items-center text-center">
- <div class="col-md-3">
- <img src="https://appassets.bizgaze.app/${current.imageurl}" class="img-fluid w-75 order_item_name" />
- </div>
- <div class="col-md-9">
- <div class="row align-items-center">
- <div class="col-md-8">
- <div class="order_item_name">${current.itemname}</div>
- </div>
- <div class="col-md-4">
- <button type="button" class="btn btn-sm rounded order_details_btn bg-gradient-anwi-outline py-0 mb-3" onClick="event.preventDefault();">Track Package</button>
- <button type="button" class="btn btn-sm btn-light rounded order_details_btn py-0 mb-3 shadow-sm" onClick="event.preventDefault();">Cancel Item</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>`;
- }
- $(".user_order_details").append(user_order_details);
- $('.serial_no_btn').click(function () {
- // order_details_main_container
- let current_serial_no = $(this).text();
- // window.localStorage.setItem('orderDate',current_order_date);
- // window.localStorage.setItem('orderSerialno',current_serial_no);
- // window.localStorage.setItem('Userphonenumber',user_number);
- // $(this).attr('href', `./orderdetails.html#${current_serial_no}`);
-
- window.location.href = `/orderdetails.html#${current_serial_no}`;
- });
-
- $('.invoicedownload').off('click').click(async function (e){
- let invoiceId = $(this).data('invoiceid');
- console.log(invoiceId);
- $(this).html(`<div style="width:15px;height:15px" class="spinner-border" role="status">
- <span class="sr-only">Loading...</span>
- </div>`)
- let res = await API_SERVICES_ACTIONS.postAPIService(`apis/v4/unibase/platform/templates/generatetemplatepdf/printprovideruniquekey/Bizgaze_Extension_Transact_Transact_PrintProvider_InvoicePrint/pkid/${invoiceId}`);
-
- if(res.isError){
- toasterHelper(`error`,err.errorMsg,`toast-top-right`);
- return;
- }
-
- res=JSON.parse(res.response.result);
- let {FilePath:fileLink} = res;
- let link = buildLinkWithServerName(fileLink);
- console.log(link);
- window.open(link, "_blank");
-
- $(this).html(`<i class="fa-solid fa-file-invoice p-1 "></i>`)
-
- });
- }
- function toasterOpts() {
- toastr.options = {
- "closeButton": true,
- "debug": false,
- "newestOnTop": true,
- "progressBar": true,
- "positionClass": "toast-top-center",
- "preventDuplicates": true,
- "onclick": null,
- "showDuration": "300",
- "hideDuration": "1000",
- "timeOut": "5000",
- "extendedTimeOut": "1000",
- "showEasing": "swing",
- "hideEasing": "linear",
- "showMethod": "fadeIn",
- "hideMethod": "fadeOut"
- }
- }
|