12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
-
- async function getDataStatAxios(url) {
- const config = {
- url,
- method: 'get',
- headers: {
- 'Authorization': `stat 05b2f2ca510344968c65e1ebf49a5595`,
- }
- };
-
- let response = await axios(config);
- let item_array = JSON.parse(response.data.result);
- $.each(item_array, function (key, value) {
- let item_html = `
- <div class="col-lg-4 col-md-6 pb-3 items_ptoducts" data_item_search="${value.productname}">
- <div class="card h-100 shadow border-0 p-1">
- <div class="card-head text-center">
- <img src="../dist/assets/imgs/Navbar/Accessiories-1.png" class="img-fluid"/>
- </div>
- <div class="card-body">
- <ul style="list-style:none" class="h-10p p-0">
- <li class="border-bottom py-1 satoshi_font">${value.productname}</li>
- <li class="border-bottom py-1 d-none satoshi_font">${value.itemname}</li>
- <li class="border-bottom py-1 d-none satoshi_font">${value.sku}</li>
- </ul>
- <div>
- <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>
- </div>
- </div>
- </div>
- </div>`;
- // $(".product_name").html(value.productname);
- $(".item_details").append(item_html);
- })
- $(".item_details").find(".items_ptoducts").each(function(){
- $(this).find(".card_body").find("a.btn").click(function(){
- let product_id = $(this).find(".card-body").find("a.btn").attr("data_detail");
- let loc_path = '/productdetails.html'
- if (window.location.pathname.includes(loc_path)) {
- window.location.href = `?itemid=${product_id}`
- }
- else {
- window.location.href = `/productdetails.html?itemid=${product_id}`;
- }
- })
- });
- }
- let port = SERVERNAME
- let loc_id = window.location.search;
- let loc_url = loc_id.split("=");
- let locpath = "/products.html?products";
- let url;
- if (window.location.href.includes(locpath)) {
- url = `${port}/apis/v4/bizgaze/integrations/products/getallproducts`;
- }else{
- url = `${port}/apis/v4/bizgaze/integrations/products/getproductsbyid/itemgroupid/${loc_url[1]}`;
- }
- getDataStatAxios(url);
-
- $("#item_search").on("keyup", function() {
- var value = $(this).val().toLowerCase();
- $(".list_items").find(".items_ptoducts").filter(function() {
- $(this).toggle($(this).attr("data_item_search").toLowerCase().indexOf(value) > -1)
- });
- });
-
|