Bez popisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

orderdetails.js 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. async function bindOrderDetails() {
  2. let user_number = $('.User_phoneum').text();
  3. // validatesession()
  4. let cookieRes = COOKIE_HELPER_ACTIONS.getCookie();
  5. let { userId } = cookieRes;
  6. //let userId = '106631380000048';
  7. console.log(cookieRes);
  8. let port = SERVERNAME;
  9. // let port = "http://localhost:3088";
  10. let url = `${port}/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/${userId}`;
  11. // /apis/v4/bizgaze/integrations/products/salesorderdetailsbyorgid/phonenumber/
  12. // https://anwi.bizgaze.app/apis/v4/Bizgaze/integrations/products/salesorderdetailsbyorgid/organizationid/{organizationid}
  13. const config = {
  14. url,
  15. method: "get",
  16. headers: {
  17. 'Authorization': `stat ${STAT} `,
  18. 'Content-Type': 'application/json'
  19. }
  20. };
  21. let res = await axios(config);
  22. if (res.data.result == '[]' || res.data.result === null) {
  23. $(".user_order_details").append(`<div><h6 class="text-center">No orders Found</h6></div>`);
  24. return;
  25. }
  26. const orderDetailsres = JSON.parse(res.data.result);
  27. console.log(orderDetailsres,"order");
  28. let new_arrr = orderDetailsres;
  29. console.log(new_arrr);
  30. $(".user_order_details").html(``)
  31. console.log('hello')
  32. let user_order_details = ``;
  33. let order_itemTotal = '';
  34. let order_netTotal = '';
  35. let order_quantity = '';
  36. let order_taxAmount = '';
  37. for (let i = 0; i < new_arrr.length; i++) {
  38. let current = new_arrr[i]
  39. console.log(current);
  40. let updatedCurent_total = current.nettotal.toLocaleString()
  41. order_itemTotal = current.itemtotal;
  42. order_netTotal = current.nettotal;
  43. order_quantity = current.Quantity;
  44. order_taxAmount = current.taxamount;
  45. user_order_details += `<div href="" class="order_details_main_container">
  46. <div class="border-3 mb-3 card">
  47. <div class="text-dark card-body px-0 pt-0">
  48. <div class="d-none">
  49. <span class="order_itemTotal">${order_itemTotal}</span>
  50. <span class="order_netTotal">${order_netTotal}</span>
  51. <span class="order_tax">${order_taxAmount}</span>
  52. <span class="order_qty">${order_quantity}</span>
  53. </div>
  54. <div class="bg-gray-4 p-2 m-0 border-bottom">
  55. <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>
  56. </p>
  57. </div>
  58. <div class="bg-gray-4 p-2 row g-0">
  59. <div class="col-md-6 ">
  60. <div class="d-flex justify-content-between align-items-center">
  61. <div>
  62. <p class="mb-1">ORDER PLACED</p>
  63. <p class="mb-1 fw-500 order_date">${current.OrderDate}</p>
  64. </div>
  65. <div>
  66. <p class="mb-1"> TOTAL</p>
  67. <p class="mb-1 fw-500 Current_netTotal"> ₹${updatedCurent_total}</p>
  68. </div>
  69. <div>
  70. <p class="mb-1">Delivered TO </p>
  71. <p class="mb-1 fw-500">${current.OrganizationName}</p>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="col-md-4 ms-auto">
  76. <div class="d-flex justify-content-between">
  77. <div>
  78. <p class="mb-1 text-info fw-500"> View order details </p>
  79. </div>
  80. <div>
  81. <p class="mb-0 text-info fw-500 text-center">Invoice</p>
  82. <p class="mb-1 fw-500 d-flex gap-2 pt-1">
  83. <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>
  84. </p>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="border-0 card rounded-0 order-cards py-3">
  90. <div class="d-flex flex-wrap px-2 align-items-center text-center">
  91. <div class="col-md-3">
  92. <img src="https://appassets.bizgaze.app/${current.imageurl}" class="img-fluid w-75 order_item_name" />
  93. </div>
  94. <div class="col-md-9">
  95. <div class="row align-items-center">
  96. <div class="col-md-8">
  97. <div class="order_item_name">${current.itemname}</div>
  98. </div>
  99. <div class="col-md-4">
  100. <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>
  101. <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>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. </div>`;
  110. }
  111. $(".user_order_details").append(user_order_details);
  112. $('.serial_no_btn').click(function () {
  113. // order_details_main_container
  114. let current_serial_no = $(this).text();
  115. // window.localStorage.setItem('orderDate',current_order_date);
  116. // window.localStorage.setItem('orderSerialno',current_serial_no);
  117. // window.localStorage.setItem('Userphonenumber',user_number);
  118. // $(this).attr('href', `./orderdetails.html#${current_serial_no}`);
  119. window.location.href = `/orderdetails.html#${current_serial_no}`;
  120. });
  121. $('.invoicedownload').off('click').click(async function (e){
  122. let invoiceId = $(this).data('invoiceid');
  123. console.log(invoiceId);
  124. $(this).html(`<div style="width:15px;height:15px" class="spinner-border" role="status">
  125. <span class="sr-only">Loading...</span>
  126. </div>`)
  127. let res = await API_SERVICES_ACTIONS.postAPIService(`apis/v4/unibase/platform/templates/generatetemplatepdf/printprovideruniquekey/Bizgaze_Extension_Transact_Transact_PrintProvider_InvoicePrint/pkid/${invoiceId}`);
  128. if(res.isError){
  129. toasterHelper(`error`,err.errorMsg,`toast-top-right`);
  130. return;
  131. }
  132. res=JSON.parse(res.response.result);
  133. let {FilePath:fileLink} = res;
  134. let link = buildLinkWithServerName(fileLink);
  135. console.log(link);
  136. window.open(link, "_blank");
  137. $(this).html(`<i class="fa-solid fa-file-invoice p-1 "></i>`)
  138. });
  139. }
  140. function toasterOpts() {
  141. toastr.options = {
  142. "closeButton": true,
  143. "debug": false,
  144. "newestOnTop": true,
  145. "progressBar": true,
  146. "positionClass": "toast-top-center",
  147. "preventDuplicates": true,
  148. "onclick": null,
  149. "showDuration": "300",
  150. "hideDuration": "1000",
  151. "timeOut": "5000",
  152. "extendedTimeOut": "1000",
  153. "showEasing": "swing",
  154. "hideEasing": "linear",
  155. "showMethod": "fadeIn",
  156. "hideMethod": "fadeOut"
  157. }
  158. }