설명 없음
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.

product.js 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. async function getDataStatAxios(url) {
  2. const config = {
  3. url,
  4. method: 'get',
  5. headers: {
  6. 'Authorization': `stat 05b2f2ca510344968c65e1ebf49a5595`,
  7. }
  8. };
  9. let response = await axios(config);
  10. let item_array = JSON.parse(response.data.result);
  11. $.each(item_array, function (key, value) {
  12. let item_html = `
  13. <div class="col-lg-4 col-md-6 pb-3 items_ptoducts" data_item_search="${value.productname}">
  14. <div class="card h-100 shadow border-0 p-1">
  15. <div class="card-head text-center">
  16. <img src="../dist/assets/imgs/Navbar/Accessiories-1.png" class="img-fluid"/>
  17. </div>
  18. <div class="card-body">
  19. <ul style="list-style:none" class="h-10p p-0">
  20. <li class="border-bottom py-1 satoshi_font">${value.productname}</li>
  21. <li class="border-bottom py-1 d-none satoshi_font">${value.itemname}</li>
  22. <li class="border-bottom py-1 d-none satoshi_font">${value.sku}</li>
  23. </ul>
  24. <div>
  25. <a href="#" class="bg-black btn font-1-2 px-5 rounded-5 text-white w-100 satoshi_font" data_detail="${value.productid}">Details</a>
  26. </div>
  27. </div>
  28. </div>
  29. </div>`;
  30. // $(".product_name").html(value.productname);
  31. $(".item_details").append(item_html);
  32. })
  33. $(".item_details").find(".items_ptoducts").each(function(){
  34. $(this).find(".card_body").find("a.btn").click(function(){
  35. let product_id = $(this).find(".card-body").find("a.btn").attr("data_detail");
  36. let loc_path = '/productdetails.html'
  37. if (window.location.pathname.includes(loc_path)) {
  38. window.location.href = `?itemid=${product_id}`
  39. }
  40. else {
  41. window.location.href = `/productdetails.html?itemid=${product_id}`;
  42. }
  43. })
  44. });
  45. }
  46. let port = SERVERNAME
  47. let loc_id = window.location.search;
  48. let loc_url = loc_id.split("=");
  49. let locpath = "/products.html?products";
  50. let url;
  51. if (window.location.href.includes(locpath)) {
  52. url = `${port}/apis/v4/bizgaze/integrations/products/getallproducts`;
  53. }else{
  54. url = `${port}/apis/v4/bizgaze/integrations/products/getproductsbyid/itemgroupid/${loc_url[1]}`;
  55. }
  56. getDataStatAxios(url);
  57. $("#item_search").on("keyup", function() {
  58. var value = $(this).val().toLowerCase();
  59. $(".list_items").find(".items_ptoducts").filter(function() {
  60. $(this).toggle($(this).attr("data_item_search").toLowerCase().indexOf(value) > -1)
  61. });
  62. });