@perevorot/shop 2.0.88 → 2.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/Account.js +1 -1
- package/dist/components/account/Account.js.map +1 -1
- package/dist/components/account/Orders.js +1 -1
- package/dist/components/account/Orders.js.map +1 -1
- package/dist/components/shop/Search.js +1 -1
- package/dist/components/shop/Search.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),n={name:"account",setup:function(){var n=t.useStore(),
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),n={name:"account",setup:function(){var n=t.useStore(),o=e.computed((function(){return n.getters["auth/account"]})),r=e.computed((function(){return n.getters["auth/me"]})),l=e.computed((function(){return console.log(o.value.find((function(e){return e.path===window.location.href}))),o.value.find((function(e){return e.path===window.location.href}))}));return{routes:o,logout:function(){n.dispatch("auth/logout")},current:l,user:r}}},o={class:"columns account"},r={class:"column is-3"},l={class:"user-wrapper"},c=e.createElementVNode("div",{class:"icon"},null,-1),u={class:"user"},a={class:"email"},s=e.createElementVNode("hr",null,null,-1),i={class:"menu"},m={class:"menu-list"},d=["href"],p={key:0,class:"icon"},f=["xlink:href"],k={key:1,class:"badge"},E={key:1},g=e.createElementVNode("hr",null,null,-1),N=e.createElementVNode("svg",{class:"icon"},[e.createElementVNode("use",{"xlink:href":"#icon-logout"})],-1),V={class:"column"};n.render=function(t,n,h,v,B,y){return e.renderSlot(t.$slots,"default",{routes:v.routes,logout:v.logout,current:v.current,user:v.user},(function(){return[e.createElementVNode("div",o,[e.createElementVNode("div",r,[e.renderSlot(t.$slots,"user",{user:v.user},(function(){return[e.createElementVNode("div",l,[c,e.createElementVNode("div",u,e.toDisplayString(v.user.name),1),e.createElementVNode("div",a,e.toDisplayString(v.user.email),1)]),s]})),e.createElementVNode("aside",i,[e.createElementVNode("ul",m,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.routes,(function(t,n){return e.openBlock(),e.createElementBlock("li",{key:n},[t.text?(e.openBlock(),e.createElementBlock("a",{key:0,href:t.path,class:e.normalizeClass({"is-active":v.current.path===t.path})},[t.icon?(e.openBlock(),e.createElementBlock("svg",p,[e.createElementVNode("use",{"xlink:href":"#"+t.icon},null,8,f)])):e.createCommentVNode("v-if",!0),e.createElementVNode("span",null,e.toDisplayString(t.text),1),t.badge?(e.openBlock(),e.createElementBlock("span",k,e.toDisplayString(t.badge),1)):e.createCommentVNode("v-if",!0)],10,d)):(e.openBlock(),e.createElementBlock("hr",E))])})),128)),g,e.createElementVNode("li",null,[e.createElementVNode("a",{onClick:n[0]||(n[0]=function(){return v.logout&&v.logout.apply(v,arguments)})},[N,e.createElementVNode("span",null,e.toDisplayString(t.__("auth.user.menu.logout")),1)])])])])]),e.createElementVNode("div",V,[v.current.component?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.current.component),{key:0})):e.createCommentVNode("v-if",!0)])])]}))},module.exports=n;
|
|
2
2
|
//# sourceMappingURL=Account.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.js","sources":["../../../src/components/account/Account.vue","../../../src/components/account/Account.vue?vue&type=template&id=
|
|
1
|
+
{"version":3,"file":"Account.js","sources":["../../../src/components/account/Account.vue","../../../src/components/account/Account.vue?vue&type=template&id=7ef11264&lang.js"],"sourcesContent":["<template>\n <slot :routes=\"routes\" :logout=\"logout\" :current=\"current\" :user=\"user\">\n <div class=\"columns account\">\n <div class=\"column is-3\">\n <slot name=\"user\" :user=\"user\">\n <div class=\"user-wrapper\">\n <div class=\"icon\"></div>\n <div class=\"user\">{{ user.name }}</div>\n <div class=\"email\">{{ user.email }}</div>\n </div>\n <hr />\n </slot>\n <aside class=\"menu\">\n <ul class=\"menu-list\">\n <li v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" v-bind:class=\"{ 'is-active': current.path === item.path }\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr v-else />\n </li>\n <hr />\n <li>\n <a @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </li>\n </ul>\n </aside>\n </div>\n <div class=\"column\">\n <component :is=\"current.component\" v-if=\"current.component\"></component>\n </div>\n </div>\n </slot>\n</template>\n<script>\nimport { computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'account',\n setup() {\n const store = useStore();\n const routes = computed(() => store.getters['auth/account']);\n const user = computed(() => store.getters['auth/me']);\n const current = computed(() => {\n console.log(routes.value.find((route) => route.path === window.location.href));\n return routes.value.find((route) => route.path === window.location.href);\n });\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n return {\n routes,\n logout,\n current,\n user\n };\n }\n};\n</script>","<template>\n <slot :routes=\"routes\" :logout=\"logout\" :current=\"current\" :user=\"user\">\n <div class=\"columns account\">\n <div class=\"column is-3\">\n <slot name=\"user\" :user=\"user\">\n <div class=\"user-wrapper\">\n <div class=\"icon\"></div>\n <div class=\"user\">{{ user.name }}</div>\n <div class=\"email\">{{ user.email }}</div>\n </div>\n <hr />\n </slot>\n <aside class=\"menu\">\n <ul class=\"menu-list\">\n <li v-for=\"(item, key) in routes\" v-bind:key=\"key\">\n <a :href=\"item.path\" v-if=\"item.text\" v-bind:class=\"{ 'is-active': current.path === item.path }\">\n <svg class=\"icon\" v-if=\"item.icon\">\n <use :xlink:href=\"'#' + item.icon\" />\n </svg>\n <span>{{ item.text }}</span>\n <span class=\"badge\" v-if=\"item.badge\">{{ item.badge }}</span>\n </a>\n <hr v-else />\n </li>\n <hr />\n <li>\n <a @click=\"logout\">\n <svg class=\"icon\">\n <use xlink:href=\"#icon-logout\" />\n </svg>\n <span>{{ __('auth.user.menu.logout') }}</span>\n </a>\n </li>\n </ul>\n </aside>\n </div>\n <div class=\"column\">\n <component :is=\"current.component\" v-if=\"current.component\"></component>\n </div>\n </div>\n </slot>\n</template>\n<script>\nimport { computed } from 'vue';\nimport { useStore } from 'vuex';\n\nexport default {\n name: 'account',\n setup() {\n const store = useStore();\n const routes = computed(() => store.getters['auth/account']);\n const user = computed(() => store.getters['auth/me']);\n const current = computed(() => {\n console.log(routes.value.find((route) => route.path === window.location.href));\n return routes.value.find((route) => route.path === window.location.href);\n });\n\n const logout = () => {\n store.dispatch('auth/logout');\n };\n\n return {\n routes,\n logout,\n current,\n user\n };\n }\n};\n</script>"],"names":["name","setup","store","useStore","routes","computed","getters","user","current","console","log","value","find","route","path","window","location","href","logout","dispatch","_createElementVNode","_renderSlot","$setup","_hoisted_1","_hoisted_2","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","email","_hoisted_7","_hoisted_8","_hoisted_9","_createElementBlock","item","key","text","icon","_hoisted_11","badge","_hoisted_13","_hoisted_15","onClick","_hoisted_16","_ctx","_hoisted_17","component","_createBlock"],"mappings":"sDA8Ce,CACXA,KAAM,UACNC,qBACUC,EAAQC,aACRC,EAASC,YAAS,kBAAMH,EAAMI,QAAQ,mBACtCC,EAAOF,YAAS,kBAAMH,EAAMI,QAAQ,cACpCE,EAAUH,YAAS,kBACrBI,QAAQC,IAAIN,EAAOO,MAAMC,MAAK,SAACC,UAAUA,EAAMC,OAASC,OAAOC,SAASC,SACjEb,EAAOO,MAAMC,MAAK,SAACC,UAAUA,EAAMC,OAASC,OAAOC,SAASC,iBAOhE,CACHb,OAAAA,EACAc,OANW,WACXhB,EAAMiB,SAAS,gBAMfX,QAAAA,EACAD,KAAAA,cC/DO,4BACI,wBAEQ,kBACPa,kCAAW,0BACA,iBACA,WAEfA,iDAES,iBACC,uCAGa,wCAIC,qBAIpBA,0CAGQA,kCAAW,SACPA,yCAAgB,+BAQ7B,gDAnCnBC,iCAAOjB,OAAQkB,SAASJ,OAAQI,SAASd,QAASc,UAAUf,KAAMe,SAAlE,kBACIF,2BAAAG,GACIH,2BAAAI,GACIH,8BAAmBd,KAAMe,SAAzB,kBACIF,2BAAAK,GACIC,EACAN,2BAAAO,oBAAqBL,OAAKtB,SAC1BoB,2BAAAQ,oBAAsBN,OAAKO,YAE/BC,MAEJV,6BAAAW,GACIX,0BAAAY,oBACIC,kDAA0BX,mBAAdY,EAAMC,wBAAlBF,2BAAyCE,IAAKA,IACfD,EAAKE,oBAAhCH,gCAAIhB,KAAMiB,EAAKpB,yCAAoDQ,UAAQR,OAASoB,EAAKpB,SAC7DoB,EAAKG,oBAA7BJ,2BAAAK,GACIlB,6CAAwBc,EAAKG,mDAEjCjB,mDAASc,EAAKE,SACYF,EAAKK,qBAA/BN,4BAAAO,oBAAyCN,EAAKK,kEAElDN,yCAEJQ,EACArB,gCACIA,0BAAIsB,sCAAOpB,0CACPqB,EAGAvB,mDAASwB,4CAM7BxB,2BAAAyB,GAC6CvB,UAAQwB,yBAAjDC,wCAAgBzB,UAAQwB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("v-calendar"),a=require("dayjs"),r=require("vue-toastification"),n=require("vuex"),l=require("secure-ls");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(a),s=o(l),c=e.defineComponent({props:{item:Object},setup:function(t){var a=n.useStore(),l=r.useToast(),o=t.item,i=e.ref(!1);return{item:o,isOpen:i,toggle:function(){i.value=!i.value},pluralize:function(e,t){return e+" "+t[e%100>4&&e%100<20?2:[2,0,1,1,1,2][Math.min(e%10,5)]]},addressName:function(e){return e?(e.shipping_postcode?e.shipping_postcode+", ":"")+(e.shipping_city?e.shipping_city:"")+(e.shipping_street?", "+e.shipping_street:"")+(e.shipping_house?" "+e.shipping_house:"")+(e.shipping_building?", "+__("shop.address.building")+" "+e.shipping_building:"")+(e.shipping_flat?", "+__("shop.address.apartment")+" "+e.shipping_flat:"")+(e.shipping_floor?", "+e.shipping_floor+__("shop.address.floor"):""):""},repeat:function(){$http.post($ziggy("account.forward.orders"),{action:"repeat",id:o.id}).then((function(e){l(__("shop.cart.repeated"),{type:"success"}),a.dispatch("cart/get",{finally:function(){}})})).catch((function(){l(__("shop.cart.repeated_error"),{type:"error"})}))}}}}),d={class:"history-order-title"},p=["innerHTML"],u={class:"history-order-body"},m={class:"history-order-table"},y={class:"product"},g={class:"product-photo"},h=["src"],f={key:1,src:"/images/blank.png"},v={class:"product-info"},_=["href"],E=["href"],V={class:"cell-title"},N=["innerHTML"],k={class:"cell-title"},D={class:"cell-title"},b=["innerHTML"],S={class:"history-order-summary"},B={key:0,class:"history-order-delivery-payment"},M={class:"delivery-group"},T=e.createElementVNode("br",null,null,-1),C=["innerHTML"],x=["innerHTML"],L=["innerHTML"],H=["innerHTML"],Y={class:"payment-group"},R={class:"history-order-total"},q={class:"total-item products-amount"},$={class:"total-item summ-regular"},z=["innerHTML"];c.render=function(t,a,r,n,l,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["history-order",{"is-open":t.isOpen}])},[e.createElementVNode("div",{class:"history-order-head",onClick:a[0]||(a[0]=function(){return t.toggle&&t.toggle.apply(t,arguments)})},[e.createElementVNode("div",d,[e.createTextVNode(" №"+e.toDisplayString(t.item.id)+" "+e.toDisplayString(t.__("shop.cart.bydate"))+" "+e.toDisplayString(t.item.date)+" ",1),e.createElementVNode("span",null,[e.createTextVNode(e.toDisplayString(t.pluralize(t.item.positions.length,t.__("shop.pluralize.products")))+" "+e.toDisplayString(t.__("shop.cart.bysum"))+" ",1),e.createElementVNode("span",{innerHTML:t.$filters.price(t.item.total)},null,8,p)])]),e.createElementVNode("div",{class:"history-order-status",style:e.normalizeStyle("color:"+t.item.status.color)},e.toDisplayString(t.item.status.name),5)]),e.createElementVNode("div",u,[e.createElementVNode("table",m,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[e.createElementVNode("th",null,e.toDisplayString(t.__("shop.cart.table.product")),1),e.createElementVNode("th",null,e.toDisplayString(t.__("shop.cart.table.price")),1),e.createElementVNode("th",null,e.toDisplayString(t.__("shop.cart.table.quantity")),1),e.createElementVNode("th",null,e.toDisplayString(t.__("shop.cart.table.sum")),1)])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.item.positions,(function(a,r){return e.openBlock(),e.createElementBlock("tr",{key:r},[e.createElementVNode("td",null,[e.createElementVNode("div",y,[e.createElementVNode("div",g,[a.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:a.image},null,8,h)):(e.openBlock(),e.createElementBlock("img",f))]),e.createElementVNode("div",v,[e.createElementVNode("a",{href:a.category.href,class:"product-category"},e.toDisplayString(a.category.name),9,_),e.createElementVNode("a",{href:a.href,class:"product-title"},e.toDisplayString(a.name),9,E)])])]),e.createElementVNode("td",null,[e.createElementVNode("div",V,e.toDisplayString(t.__("shop.cart.table.price")),1),e.createElementVNode("div",{innerHTML:t.$filters.price(a.price)},null,8,N)]),e.createElementVNode("td",null,[e.createElementVNode("div",k,e.toDisplayString(t.__("shop.cart.table.quantity")),1),e.createElementVNode("div",null,e.toDisplayString(a.quantity),1)]),e.createElementVNode("td",null,[e.createElementVNode("div",D,e.toDisplayString(t.__("shop.cart.table.sum")),1),e.createElementVNode("div",{innerHTML:t.$filters.price(a.quantity*a.price)},null,8,b)])])})),128))])]),e.createElementVNode("div",S,[t.item.delivery&&t.item.payment?(e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",M,[e.createElementVNode("div",null,e.toDisplayString(t.__("shop.cart.shipment_info")),1),e.createElementVNode("div",null,[e.createTextVNode(e.toDisplayString(t.item.delivery)+" ",1),T,e.createElementVNode("span",{innerHTML:t.item.property.pickup_name?t.item.property.pickup_name+"<br>":""},null,8,C),e.createElementVNode("span",{innerHTML:t.item.property.novaposhta_city?t.item.property.novaposhta_city+"<br>"+t.item.property.novaposhta_warehouse+"<br>":""},null,8,x),e.createElementVNode("span",{innerHTML:t.addressName(t.item.property)+"<br>"},null,8,L),e.createElementVNode("span",{innerHTML:t.item.property.shipping_time?t.item.property.shipping_time+"<br />":""},null,8,H)])]),e.createElementVNode("div",Y,[e.createElementVNode("div",null,e.toDisplayString(t.__("shop.cart.payment_info")),1),e.createElementVNode("div",null,e.toDisplayString(t.item.payment),1)])])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",R,[e.createElementVNode("div",q,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.products"))+": ",1),e.createElementVNode("span",null,e.toDisplayString(t.item.positions.length),1)]),e.createElementVNode("div",$,[e.createTextVNode(e.toDisplayString(t.__("shop.cart.table.sum"))+": ",1),e.createElementVNode("span",{innerHTML:t.$filters.price(t.item.total)},null,8,z)]),e.createElementVNode("a",{onClick:a[1]||(a[1]=function(){return t.repeat&&t.repeat.apply(t,arguments)}),class:"repeat-checkout-btn"},e.toDisplayString(t.__("shop.cart.repeat")),1)])])])],2)};var O=e.defineComponent({components:{"date-picker":t.DatePicker,item:c},setup:function(){var t=new s.default({isCompression:!1}),a=t.get("order-history");(!a||i.default().diff(a.expires,"day")>1)&&(a={start:i.default().startOf("month").toDate(),end:i.default().toDate(),expires:i.default().add(1,"day").toDate()},t.set("order-history",a));var r="ua"==$env.locale.current?"uk":$env.locale.current,n=e.ref(null),l=e.ref(""),o=e.ref({start:a.start,end:a.end}),c=e.ref(2),d=e.ref(!1),p=e.ref(null),u=[{text:"today",range:{start:i.default().toDate(),end:i.default().toDate()}},{text:"yesterday",range:{start:i.default().subtract(1,"day").toDate(),end:i.default().subtract(1,"day").toDate()}},{text:"currentmonth",range:{start:i.default().startOf("month").toDate(),end:i.default().toDate()}},{text:"lastmonth",range:{start:i.default().subtract(1,"month").startOf("month").toDate(),end:i.default().subtract(1,"month").endOf("month").toDate()}},{text:"lastyear",range:{start:i.default().startOf("year").toDate(),end:i.default().toDate()}}],m=e.ref([i.default(o.value.start).format("DD.MM.YYYY"),i.default(o.value.end).format("DD.MM.YYYY")]),y=function(){$http.post($ziggy("account.orders"),{start:o.value.start,end:o.value.end}).then((function(e){p.value=e.data.orders}))};return y(),{date:l,range:o,rangeReadable:m,onDayClick:function(){c.value=null},locale:r,calendar:n,setRange:function(e,t){c.value=t,o.value=e,n.value.move(o.value.start)},activeRange:c,presets:u,calendarToggled:d,applyRange:function(){m.value=[i.default(o.value.start).format("DD.MM.YYYY"),i.default(o.value.end).format("DD.MM.YYYY")],d.value=!1,t.set("order-history",{start:o.value.start,end:o.value.end,expires:i.default().add(1,"day").toDate()}),e.nextTick(y)},toggleCalendar:function(){d.value=!d.value},orders:p}}}),w={class:"account-content"},j={class:"block-head"},F={class:"block-title"},P={class:"selector-item"},U={class:"selector-item-label"},A={class:"selector-item-inner"},G={class:"calendar-dropdown-head"},I={class:"presets"},J=["textContent","onClick"],K={class:"calendar-dropdown-body"},Q={class:"content-blocks orders-blocks"},W={class:"content-column"},X={key:0,class:"content-block group-orders"},Z={key:0,class:"content-block-list"},ee={key:1};O.render=function(t,a,r,n,l,o){var i=e.resolveComponent("date-picker"),s=e.resolveComponent("item");return e.openBlock(),e.createElementBlock("div",w,[e.createElementVNode("div",j,[e.createElementVNode("h1",F,e.toDisplayString(t.__("shop.account.orders.title")),1),e.createElementVNode("div",P,[e.createElementVNode("div",U,e.toDisplayString(t.__("shop.account.orders.period"))+":",1),e.createElementVNode("div",A,[e.createElementVNode("div",{class:"select-placeholder",onClick:a[0]||(a[0]=function(){return t.toggleCalendar&&t.toggleCalendar.apply(t,arguments)})},e.toDisplayString(t.rangeReadable[0])+e.toDisplayString(t.rangeReadable[1]!=t.rangeReadable[0]?" — "+t.rangeReadable[1]:""),1),e.createElementVNode("div",{class:e.normalizeClass(["calendar-dropdown",{"is-hidden":!t.calendarToggled}]),onMouseleave:a[3]||(a[3]=function(e){return t.calendarToggled=!1})},[e.createElementVNode("div",G,[e.createElementVNode("div",I,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.presets,(function(a,r){return e.openBlock(),e.createElementBlock("a",{key:r,textContent:e.toDisplayString(t.__("shop.account.calendar.preset."+a.text)),class:e.normalizeClass({"is-active":t.activeRange==r}),onClick:function(e){return t.setRange(a.range,r)}},null,10,J)})),128))])]),e.createElementVNode("div",K,[e.createVNode(i,{ref:"calendar",modelValue:t.range,"onUpdate:modelValue":a[1]||(a[1]=function(e){return t.range=e}),"title-position":"left",columns:2,mode:"date","max-date":new Date,locale:t.locale,onDayclick:t.onDayClick,"is-range":""},null,8,["modelValue","max-date","locale","onDayclick"]),e.createElementVNode("button",{class:"calendar-submit",onClick:a[2]||(a[2]=function(){return t.applyRange&&t.applyRange.apply(t,arguments)})},e.toDisplayString(t.__("shop.account.calendar.choose")),1)])],34)])])]),e.createElementVNode("div",Q,[e.createElementVNode("div",W,[t.orders?(e.openBlock(),e.createElementBlock("div",X,[t.orders.length?(e.openBlock(),e.createElementBlock("div",Z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.orders,(function(t){return e.openBlock(),e.createBlock(s,{item:t,key:t.id},null,8,["item"])})),128))])):(e.openBlock(),e.createElementBlock("div",ee,e.toDisplayString(t.__("shop.account.orders.no")),1))])):e.createCommentVNode("v-if",!0)])])])},module.exports=O;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("v-calendar/dist/es/index.js"),a=require("dayjs"),n=require("@perevorot/shop/dist/components/account/OrderItem"),r=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=l(a),c=l(n),d=l(r),s={components:{"date-picker":t.DatePicker,item:c.default},props:{isCalendar:{type:Boolean,default:!0}},setup:function(){var t=new d.default({isCompression:!1}),a=t.get("order-history");(!a||o.default().diff(a.expires,"day")>1)&&(a={start:o.default().startOf("month").toDate(),end:o.default().toDate(),expires:o.default().add(1,"day").toDate()},t.set("order-history",a));var n="ua"==$env.locale.current?"uk":$env.locale.current,r=e.ref(null),l=e.ref(""),c=e.ref({start:a.start,end:a.end}),s=e.ref(2),u=e.ref(!1),i=e.ref(null),m=[{text:"today",range:{start:o.default().toDate(),end:o.default().toDate()}},{text:"yesterday",range:{start:o.default().subtract(1,"day").toDate(),end:o.default().subtract(1,"day").toDate()}},{text:"currentmonth",range:{start:o.default().startOf("month").toDate(),end:o.default().toDate()}},{text:"lastmonth",range:{start:o.default().subtract(1,"month").startOf("month").toDate(),end:o.default().subtract(1,"month").endOf("month").toDate()}},{text:"lastyear",range:{start:o.default().startOf("year").toDate(),end:o.default().toDate()}}],f=e.ref([o.default(c.value.start).format("DD.MM.YYYY"),o.default(c.value.end).format("DD.MM.YYYY")]),p=function(){$http.post($ziggy("account.orders"),{start:c.value.start,end:c.value.end}).then((function(e){i.value=e.data.orders}))};return p(),{date:l,range:c,rangeReadable:f,onDayClick:function(){s.value=null},locale:n,calendar:r,setRange:function(e,t){s.value=t,c.value=e,r.value.move(c.value.start)},activeRange:s,presets:m,calendarToggled:u,applyRange:function(){f.value=[o.default(c.value.start).format("DD.MM.YYYY"),o.default(c.value.end).format("DD.MM.YYYY")],u.value=!1,t.set("order-history",{start:c.value.start,end:c.value.end,expires:o.default().add(1,"day").toDate()}),e.nextTick(p)},toggleCalendar:function(){u.value=!u.value},orders:i}}},u={class:"account-content"},i={class:"block-head"},m={class:"block-title"},f={key:0,class:"selector-item"},p={class:"selector-item-label"},v={class:"selector-item-inner"},g={class:"calendar-dropdown-head"},k={class:"presets"},y=["textContent","onClick"],D={class:"calendar-dropdown-body"},h={class:"content-blocks orders-blocks"},b={class:"content-column"},C={key:0,class:"content-block group-orders"},E={key:0,class:"content-block-list"},B={key:1};s.render=function(t,a,n,r,l,o){var c=e.resolveComponent("date-picker"),d=e.resolveComponent("item");return e.openBlock(),e.createElementBlock("div",u,[e.createElementVNode("div",i,[e.createElementVNode("h1",m,e.toDisplayString(t.__("shop.account.orders.title")),1),n.isCalendar?(e.openBlock(),e.createElementBlock("div",f,[e.createElementVNode("div",p,e.toDisplayString(t.__("shop.account.orders.period"))+":",1),e.createElementVNode("div",v,[e.createElementVNode("div",{class:"select-placeholder",onClick:a[0]||(a[0]=function(){return r.toggleCalendar&&r.toggleCalendar.apply(r,arguments)})},e.toDisplayString(r.rangeReadable[0])+e.toDisplayString(r.rangeReadable[1]!=r.rangeReadable[0]?" — "+r.rangeReadable[1]:""),1),e.createElementVNode("div",{class:e.normalizeClass(["calendar-dropdown",{"is-hidden":!r.calendarToggled}]),onMouseleave:a[3]||(a[3]=function(e){return r.calendarToggled=!1})},[e.createElementVNode("div",g,[e.createElementVNode("div",k,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.presets,(function(a,n){return e.openBlock(),e.createElementBlock("a",{key:n,textContent:e.toDisplayString(t.__("shop.account.calendar.preset."+a.text)),class:e.normalizeClass({"is-active":r.activeRange==n}),onClick:function(e){return r.setRange(a.range,n)}},null,10,y)})),128))])]),e.createElementVNode("div",D,[e.createVNode(c,{ref:"calendar",modelValue:r.range,"onUpdate:modelValue":a[1]||(a[1]=function(e){return r.range=e}),"title-position":"left",columns:2,mode:"date","max-date":new Date,locale:r.locale,onDayclick:r.onDayClick,"is-range":""},null,8,["modelValue","max-date","locale","onDayclick"]),e.createElementVNode("button",{class:"calendar-submit",onClick:a[2]||(a[2]=function(){return r.applyRange&&r.applyRange.apply(r,arguments)})},e.toDisplayString(t.__("shop.account.calendar.choose")),1)])],34)])])):e.createCommentVNode("v-if",!0)]),e.createElementVNode("div",h,[e.createElementVNode("div",b,[r.orders?(e.openBlock(),e.createElementBlock("div",C,[r.orders.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.orders,(function(t){return e.openBlock(),e.createBlock(d,{item:t,key:t.id},null,8,["item"])})),128))])):(e.openBlock(),e.createElementBlock("div",B,e.toDisplayString(t.__("shop.account.orders.no")),1))])):e.createCommentVNode("v-if",!0)])])])},module.exports=s;
|
|
2
2
|
//# sourceMappingURL=Orders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Orders.js","sources":["../../../src/components/account/OrderItem.vue","../../../src/components/account/OrderItem.vue?vue&type=template&id=6346c9d4&lang.js","../../../src/components/account/Orders.vue","../../../src/components/account/Orders.vue?vue&type=template&id=2c8a4bd4&lang.js"],"sourcesContent":["<template>\n <div class=\"history-order\" v-bind:class=\"{ 'is-open': isOpen }\">\n <div class=\"history-order-head\" @click=\"toggle\">\n <div class=\"history-order-title\">\n №{{ item.id }} {{ __('shop.cart.bydate') }} {{ item.date }} <span>{{ pluralize(item.positions.length, __('shop.pluralize.products')) }} {{ __('shop.cart.bysum') }} <span v-html=\"$filters.price(item.total)\"></span></span>\n </div>\n <div class=\"history-order-status\" v-bind:style=\"'color:' + item.status.color\">{{ item.status.name }}</div>\n </div>\n <div class=\"history-order-body\">\n <table class=\"history-order-table\">\n <thead>\n <tr>\n <th>{{ __('shop.cart.table.product') }}</th>\n <th>{{ __('shop.cart.table.price') }}</th>\n <th>{{ __('shop.cart.table.quantity') }}</th>\n <th>{{ __('shop.cart.table.sum') }}</th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(p, key) in item.positions\" v-bind:key=\"key\">\n <td>\n <div class=\"product\">\n <div class=\"product-photo\">\n <img :src=\"p.image\" v-if=\"p.image\" />\n <img src=\"/images/blank.png\" v-else />\n </div>\n <div class=\"product-info\">\n <a :href=\"p.category.href\" class=\"product-category\">{{ p.category.name }}</a>\n <a :href=\"p.href\" class=\"product-title\">{{ p.name }}</a>\n </div>\n </div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.price') }}</div>\n <div v-html=\"$filters.price(p.price)\"></div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.quantity') }}</div>\n <div>{{ p.quantity }}</div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.sum') }}</div>\n <div v-html=\"$filters.price(p.quantity * p.price)\"></div>\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"history-order-summary\">\n <div class=\"history-order-delivery-payment\" v-if=\"item.delivery && item.payment\">\n <div class=\"delivery-group\">\n <div>{{ __('shop.cart.shipment_info') }}</div>\n <div>\n {{ item.delivery }} <br />\n <span v-html=\"item.property.pickup_name ? item.property.pickup_name + '<br>' : ''\"></span>\n <span v-html=\"item.property.novaposhta_city ? item.property.novaposhta_city + '<br>' + item.property.novaposhta_warehouse + '<br>' : ''\"></span>\n <span v-html=\"addressName(item.property) + '<br>'\"></span>\n <span v-html=\"item.property.shipping_time ? item.property.shipping_time + '<br />' : ''\"></span>\n </div>\n </div>\n <div class=\"payment-group\">\n <div>{{ __('shop.cart.payment_info') }}</div>\n <div>{{ item.payment }}</div>\n </div>\n </div>\n <div class=\"history-order-total\">\n <div class=\"total-item products-amount\">\n {{ __('shop.cart.products') }}: <span>{{ item.positions.length }}</span>\n </div>\n <div class=\"total-item summ-regular\">{{ __('shop.cart.table.sum') }}: <span v-html=\"$filters.price(item.total)\"></span></div>\n <a @click=\"repeat\" class=\"repeat-checkout-btn\">{{ __('shop.cart.repeat') }}</a>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\nimport { useToast } from \"vue-toastification\";\nimport { useStore } from 'vuex';\n\nexport default defineComponent({\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const toast = useToast();\n const item = props.item;\n const isOpen = ref(false);\n\n const toggle = () => {\n isOpen.value = !isOpen.value;\n };\n\n const pluralize = (count, words) => {\n let cases = [2, 0, 1, 1, 1, 2];\n\n return count + ' ' + words[count % 100 > 4 && count % 100 < 20 ? 2 : cases[Math.min(count % 10, 5)]];\n };\n\n const addressName = (item) => {\n if (!item) {\n return '';\n }\n\n return (item.shipping_postcode ? item.shipping_postcode + ', ' : '') + (item.shipping_city ? item.shipping_city : '') + (item.shipping_street ? ', ' + item.shipping_street : '') + (item.shipping_house ? ' ' + item.shipping_house : '') + (item.shipping_building ? ', ' + __('shop.address.building') + ' ' + item.shipping_building : '') + (item.shipping_flat ? ', ' + __('shop.address.apartment') + ' ' + item.shipping_flat : '') + (item.shipping_floor ? ', ' + item.shipping_floor + __('shop.address.floor') : '');\n };\n\n const repeat = () => {\n $http\n .post($ziggy('account.forward.orders'), {\n action: 'repeat',\n id: item.id\n })\n .then((response) => {\n toast(__('shop.cart.repeated'), {\n type: 'success'\n });\n\n store.dispatch('cart/get', {\n finally: () => {}\n });\n })\n .catch(() => {\n toast(__('shop.cart.repeated_error'), {\n type: 'error'\n });\n });\n };\n\n return {\n item,\n isOpen,\n toggle,\n pluralize,\n addressName,\n repeat\n };\n }\n});\n</script>\n","<template>\n <div class=\"history-order\" v-bind:class=\"{ 'is-open': isOpen }\">\n <div class=\"history-order-head\" @click=\"toggle\">\n <div class=\"history-order-title\">\n №{{ item.id }} {{ __('shop.cart.bydate') }} {{ item.date }} <span>{{ pluralize(item.positions.length, __('shop.pluralize.products')) }} {{ __('shop.cart.bysum') }} <span v-html=\"$filters.price(item.total)\"></span></span>\n </div>\n <div class=\"history-order-status\" v-bind:style=\"'color:' + item.status.color\">{{ item.status.name }}</div>\n </div>\n <div class=\"history-order-body\">\n <table class=\"history-order-table\">\n <thead>\n <tr>\n <th>{{ __('shop.cart.table.product') }}</th>\n <th>{{ __('shop.cart.table.price') }}</th>\n <th>{{ __('shop.cart.table.quantity') }}</th>\n <th>{{ __('shop.cart.table.sum') }}</th>\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"(p, key) in item.positions\" v-bind:key=\"key\">\n <td>\n <div class=\"product\">\n <div class=\"product-photo\">\n <img :src=\"p.image\" v-if=\"p.image\" />\n <img src=\"/images/blank.png\" v-else />\n </div>\n <div class=\"product-info\">\n <a :href=\"p.category.href\" class=\"product-category\">{{ p.category.name }}</a>\n <a :href=\"p.href\" class=\"product-title\">{{ p.name }}</a>\n </div>\n </div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.price') }}</div>\n <div v-html=\"$filters.price(p.price)\"></div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.quantity') }}</div>\n <div>{{ p.quantity }}</div>\n </td>\n <td>\n <div class=\"cell-title\">{{ __('shop.cart.table.sum') }}</div>\n <div v-html=\"$filters.price(p.quantity * p.price)\"></div>\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"history-order-summary\">\n <div class=\"history-order-delivery-payment\" v-if=\"item.delivery && item.payment\">\n <div class=\"delivery-group\">\n <div>{{ __('shop.cart.shipment_info') }}</div>\n <div>\n {{ item.delivery }} <br />\n <span v-html=\"item.property.pickup_name ? item.property.pickup_name + '<br>' : ''\"></span>\n <span v-html=\"item.property.novaposhta_city ? item.property.novaposhta_city + '<br>' + item.property.novaposhta_warehouse + '<br>' : ''\"></span>\n <span v-html=\"addressName(item.property) + '<br>'\"></span>\n <span v-html=\"item.property.shipping_time ? item.property.shipping_time + '<br />' : ''\"></span>\n </div>\n </div>\n <div class=\"payment-group\">\n <div>{{ __('shop.cart.payment_info') }}</div>\n <div>{{ item.payment }}</div>\n </div>\n </div>\n <div class=\"history-order-total\">\n <div class=\"total-item products-amount\">\n {{ __('shop.cart.products') }}: <span>{{ item.positions.length }}</span>\n </div>\n <div class=\"total-item summ-regular\">{{ __('shop.cart.table.sum') }}: <span v-html=\"$filters.price(item.total)\"></span></div>\n <a @click=\"repeat\" class=\"repeat-checkout-btn\">{{ __('shop.cart.repeat') }}</a>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, defineComponent } from 'vue';\nimport { useToast } from \"vue-toastification\";\nimport { useStore } from 'vuex';\n\nexport default defineComponent({\n props: {\n item: Object\n },\n setup(props) {\n const store = useStore();\n const toast = useToast();\n const item = props.item;\n const isOpen = ref(false);\n\n const toggle = () => {\n isOpen.value = !isOpen.value;\n };\n\n const pluralize = (count, words) => {\n let cases = [2, 0, 1, 1, 1, 2];\n\n return count + ' ' + words[count % 100 > 4 && count % 100 < 20 ? 2 : cases[Math.min(count % 10, 5)]];\n };\n\n const addressName = (item) => {\n if (!item) {\n return '';\n }\n\n return (item.shipping_postcode ? item.shipping_postcode + ', ' : '') + (item.shipping_city ? item.shipping_city : '') + (item.shipping_street ? ', ' + item.shipping_street : '') + (item.shipping_house ? ' ' + item.shipping_house : '') + (item.shipping_building ? ', ' + __('shop.address.building') + ' ' + item.shipping_building : '') + (item.shipping_flat ? ', ' + __('shop.address.apartment') + ' ' + item.shipping_flat : '') + (item.shipping_floor ? ', ' + item.shipping_floor + __('shop.address.floor') : '');\n };\n\n const repeat = () => {\n $http\n .post($ziggy('account.forward.orders'), {\n action: 'repeat',\n id: item.id\n })\n .then((response) => {\n toast(__('shop.cart.repeated'), {\n type: 'success'\n });\n\n store.dispatch('cart/get', {\n finally: () => {}\n });\n })\n .catch(() => {\n toast(__('shop.cart.repeated_error'), {\n type: 'error'\n });\n });\n };\n\n return {\n item,\n isOpen,\n toggle,\n pluralize,\n addressName,\n repeat\n };\n }\n});\n</script>\n","<template>\n <div class=\"account-content\">\n <div class=\"block-head\">\n <h1 class=\"block-title\">{{ __('shop.account.orders.title') }}</h1>\n <div class=\"selector-item\">\n <div class=\"selector-item-label\">{{ __('shop.account.orders.period') }}:</div>\n <div class=\"selector-item-inner\">\n <div class=\"select-placeholder\" @click=\"toggleCalendar\">{{ rangeReadable[0] }}{{ rangeReadable[1] != rangeReadable[0] ? ' — ' + rangeReadable[1] : '' }}</div>\n\n <div class=\"calendar-dropdown\" v-bind:class=\"{ 'is-hidden': !calendarToggled }\" @mouseleave=\"calendarToggled = false\">\n <div class=\"calendar-dropdown-head\">\n <div class=\"presets\">\n <a\n v-for=\"(item, key) in presets\"\n :key=\"key\"\n v-text=\"__('shop.account.calendar.preset.' + item.text)\"\n :class=\"{\n 'is-active': activeRange == key\n }\"\n @click=\"setRange(item.range, key)\"\n ></a>\n </div>\n </div>\n <div class=\"calendar-dropdown-body\">\n <date-picker ref=\"calendar\" v-model=\"range\" :title-position=\"'left'\" :columns=\"2\" :mode=\"'date'\" :max-date=\"new Date()\" :locale=\"locale\" @dayclick=\"onDayClick\" is-range> </date-picker>\n <button class=\"calendar-submit\" @click=\"applyRange\">{{ __('shop.account.calendar.choose') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"content-blocks orders-blocks\">\n <div class=\"content-column\">\n <div class=\"content-block group-orders\" v-if=\"orders\">\n <div class=\"content-block-list\" v-if=\"orders.length\">\n <item v-for=\"item in orders\" :item=\"item\" v-bind:key=\"item.id\"></item>\n </div>\n <div v-else>{{ __('shop.account.orders.no') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\nimport { DatePicker } from 'v-calendar';\nimport dayjs from 'dayjs';\nimport OrderItem from './OrderItem.vue';\nimport SecureLS from 'secure-ls';\n\nexport default defineComponent({\n components: {\n 'date-picker': DatePicker,\n item: OrderItem\n },\n setup() {\n let ls = new SecureLS({\n isCompression: false\n });\n\n let dates = ls.get('order-history');\n\n if (!dates || dayjs().diff(dates.expires, 'day') > 1) {\n dates = {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate(),\n expires: dayjs().add(1, 'day').toDate()\n };\n\n ls.set('order-history', dates);\n }\n\n const locale = $env.locale.current == 'ua' ? 'uk' : $env.locale.current;\n const calendar = ref(null);\n const date = ref('');\n const range = ref({\n start: dates.start,\n end: dates.end\n });\n const activeRange = ref(2);\n const calendarToggled = ref(false);\n const orders = ref(null);\n\n const presets = [\n {\n text: 'today',\n range: {\n start: dayjs().toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'yesterday',\n range: {\n start: dayjs().subtract(1, 'day').toDate(),\n end: dayjs().subtract(1, 'day').toDate()\n }\n },\n {\n text: 'currentmonth',\n range: {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'lastmonth',\n range: {\n start: dayjs().subtract(1, 'month').startOf('month').toDate(),\n end: dayjs().subtract(1, 'month').endOf('month').toDate()\n }\n },\n {\n text: 'lastyear',\n range: {\n start: dayjs().startOf('year').toDate(),\n end: dayjs().toDate()\n }\n }\n ];\n\n const rangeReadable = ref([dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')]);\n\n const onDayClick = () => {\n activeRange.value = null;\n };\n\n const setRange = (newRange, key) => {\n activeRange.value = key;\n range.value = newRange;\n\n calendar.value.move(range.value.start);\n };\n\n const applyRange = () => {\n rangeReadable.value = [dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')];\n\n calendarToggled.value = false;\n\n ls.set('order-history', {\n start: range.value.start,\n end: range.value.end,\n expires: dayjs().add(1, 'day').toDate()\n });\n\n nextTick(get);\n };\n\n const toggleCalendar = () => {\n calendarToggled.value = !calendarToggled.value;\n };\n\n const get = () => {\n $http\n .post($ziggy('account.orders'), {\n start: range.value.start,\n end: range.value.end\n })\n .then((response) => {\n orders.value = response.data.orders;\n });\n };\n get();\n\n return {\n date,\n range,\n rangeReadable,\n onDayClick,\n locale,\n calendar,\n setRange,\n activeRange,\n presets,\n calendarToggled,\n applyRange,\n toggleCalendar,\n orders\n };\n }\n});\n</script>","<template>\n <div class=\"account-content\">\n <div class=\"block-head\">\n <h1 class=\"block-title\">{{ __('shop.account.orders.title') }}</h1>\n <div class=\"selector-item\">\n <div class=\"selector-item-label\">{{ __('shop.account.orders.period') }}:</div>\n <div class=\"selector-item-inner\">\n <div class=\"select-placeholder\" @click=\"toggleCalendar\">{{ rangeReadable[0] }}{{ rangeReadable[1] != rangeReadable[0] ? ' — ' + rangeReadable[1] : '' }}</div>\n\n <div class=\"calendar-dropdown\" v-bind:class=\"{ 'is-hidden': !calendarToggled }\" @mouseleave=\"calendarToggled = false\">\n <div class=\"calendar-dropdown-head\">\n <div class=\"presets\">\n <a\n v-for=\"(item, key) in presets\"\n :key=\"key\"\n v-text=\"__('shop.account.calendar.preset.' + item.text)\"\n :class=\"{\n 'is-active': activeRange == key\n }\"\n @click=\"setRange(item.range, key)\"\n ></a>\n </div>\n </div>\n <div class=\"calendar-dropdown-body\">\n <date-picker ref=\"calendar\" v-model=\"range\" :title-position=\"'left'\" :columns=\"2\" :mode=\"'date'\" :max-date=\"new Date()\" :locale=\"locale\" @dayclick=\"onDayClick\" is-range> </date-picker>\n <button class=\"calendar-submit\" @click=\"applyRange\">{{ __('shop.account.calendar.choose') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"content-blocks orders-blocks\">\n <div class=\"content-column\">\n <div class=\"content-block group-orders\" v-if=\"orders\">\n <div class=\"content-block-list\" v-if=\"orders.length\">\n <item v-for=\"item in orders\" :item=\"item\" v-bind:key=\"item.id\"></item>\n </div>\n <div v-else>{{ __('shop.account.orders.no') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, defineComponent, nextTick } from 'vue';\nimport { DatePicker } from 'v-calendar';\nimport dayjs from 'dayjs';\nimport OrderItem from './OrderItem.vue';\nimport SecureLS from 'secure-ls';\n\nexport default defineComponent({\n components: {\n 'date-picker': DatePicker,\n item: OrderItem\n },\n setup() {\n let ls = new SecureLS({\n isCompression: false\n });\n\n let dates = ls.get('order-history');\n\n if (!dates || dayjs().diff(dates.expires, 'day') > 1) {\n dates = {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate(),\n expires: dayjs().add(1, 'day').toDate()\n };\n\n ls.set('order-history', dates);\n }\n\n const locale = $env.locale.current == 'ua' ? 'uk' : $env.locale.current;\n const calendar = ref(null);\n const date = ref('');\n const range = ref({\n start: dates.start,\n end: dates.end\n });\n const activeRange = ref(2);\n const calendarToggled = ref(false);\n const orders = ref(null);\n\n const presets = [\n {\n text: 'today',\n range: {\n start: dayjs().toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'yesterday',\n range: {\n start: dayjs().subtract(1, 'day').toDate(),\n end: dayjs().subtract(1, 'day').toDate()\n }\n },\n {\n text: 'currentmonth',\n range: {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'lastmonth',\n range: {\n start: dayjs().subtract(1, 'month').startOf('month').toDate(),\n end: dayjs().subtract(1, 'month').endOf('month').toDate()\n }\n },\n {\n text: 'lastyear',\n range: {\n start: dayjs().startOf('year').toDate(),\n end: dayjs().toDate()\n }\n }\n ];\n\n const rangeReadable = ref([dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')]);\n\n const onDayClick = () => {\n activeRange.value = null;\n };\n\n const setRange = (newRange, key) => {\n activeRange.value = key;\n range.value = newRange;\n\n calendar.value.move(range.value.start);\n };\n\n const applyRange = () => {\n rangeReadable.value = [dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')];\n\n calendarToggled.value = false;\n\n ls.set('order-history', {\n start: range.value.start,\n end: range.value.end,\n expires: dayjs().add(1, 'day').toDate()\n });\n\n nextTick(get);\n };\n\n const toggleCalendar = () => {\n calendarToggled.value = !calendarToggled.value;\n };\n\n const get = () => {\n $http\n .post($ziggy('account.orders'), {\n start: range.value.start,\n end: range.value.end\n })\n .then((response) => {\n orders.value = response.data.orders;\n });\n };\n get();\n\n return {\n date,\n range,\n rangeReadable,\n onDayClick,\n locale,\n calendar,\n setRange,\n activeRange,\n presets,\n calendarToggled,\n applyRange,\n toggleCalendar,\n orders\n };\n }\n});\n</script>"],"names":["defineComponent","props","item","Object","setup","store","useStore","toast","useToast","isOpen","ref","toggle","value","pluralize","count","words","Math","min","addressName","shipping_postcode","shipping_city","shipping_street","shipping_house","shipping_building","__","shipping_flat","shipping_floor","repeat","$http","post","$ziggy","action","id","then","response","type","dispatch","src","_createElementVNode","_createElementBlock","_ctx","onClick","_hoisted_1","date","positions","length","innerHTML","price","total","style","status","color","name","_hoisted_3","_hoisted_4","p","key","_hoisted_5","_hoisted_6","image","_hoisted_8","_hoisted_9","href","category","_hoisted_12","_hoisted_14","quantity","_hoisted_15","_hoisted_17","delivery","payment","_hoisted_18","_hoisted_19","_hoisted_20","property","pickup_name","novaposhta_city","novaposhta_warehouse","shipping_time","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","components","DatePicker","OrderItem","ls","SecureLS","isCompression","dates","get","dayjs","diff","expires","start","startOf","toDate","end","add","set","locale","$env","current","calendar","range","activeRange","calendarToggled","orders","presets","text","subtract","endOf","rangeReadable","format","data","onDayClick","setRange","newRange","move","applyRange","nextTick","toggleCalendar","_hoisted_2","onMouseleave","_hoisted_7","_toDisplayString","_hoisted_10","_createVNode","columns","mode","Date","onDayclick","_hoisted_11","_hoisted_13","_createBlock"],"mappings":"kPAgFeA,kBAAgB,CAC3BC,MAAO,CACHC,KAAMC,QAEVC,eAAMH,OACII,EAAQC,aACRC,EAAQC,aACRN,EAAOD,EAAMC,KACbO,EAASC,OAAI,SA0CZ,CACHR,KAAAA,EACAO,OAAAA,EACAE,OA3CW,WACXF,EAAOG,OAASH,EAAOG,OA2CvBC,UAxCc,SAACC,EAAOC,UAGfD,EAAQ,IAAMC,EAAMD,EAAQ,IAAM,GAAKA,EAAQ,IAAM,GAAK,EAFrD,CAAC,EAAG,EAAG,EAAG,EAAG,EAAG,GAE+CE,KAAKC,IAAIH,EAAQ,GAAI,MAsChGI,YAnCgB,SAAChB,UACZA,GAIGA,EAAKiB,kBAAoBjB,EAAKiB,kBAAoB,KAAO,KAAOjB,EAAKkB,cAAgBlB,EAAKkB,cAAgB,KAAOlB,EAAKmB,gBAAkB,KAAOnB,EAAKmB,gBAAkB,KAAOnB,EAAKoB,eAAiB,IAAMpB,EAAKoB,eAAiB,KAAOpB,EAAKqB,kBAAoB,KAAOC,GAAG,yBAA2B,IAAMtB,EAAKqB,kBAAoB,KAAOrB,EAAKuB,cAAgB,KAAOD,GAAG,0BAA4B,IAAMtB,EAAKuB,cAAgB,KAAOvB,EAAKwB,eAAiB,KAAOxB,EAAKwB,eAAiBF,GAAG,sBAAwB,IAHlf,IAkCXG,OA5BW,WACXC,MACKC,KAAKC,O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8B,gDAE/DO,gDAAeC"}
|
|
1
|
+
{"version":3,"file":"Orders.js","sources":["../../../src/components/account/Orders.vue","../../../src/components/account/Orders.vue?vue&type=template&id=7270796e&lang.js"],"sourcesContent":["<template>\n <div class=\"account-content\">\n <div class=\"block-head\">\n <h1 class=\"block-title\">{{ __('shop.account.orders.title') }}</h1>\n <div class=\"selector-item\" v-if=\"isCalendar\">\n <div class=\"selector-item-label\">{{ __('shop.account.orders.period') }}:</div>\n <div class=\"selector-item-inner\">\n <div class=\"select-placeholder\" @click=\"toggleCalendar\">{{ rangeReadable[0] }}{{ rangeReadable[1] != rangeReadable[0] ? ' — ' + rangeReadable[1] : '' }}</div>\n\n <div class=\"calendar-dropdown\" v-bind:class=\"{ 'is-hidden': !calendarToggled }\" @mouseleave=\"calendarToggled = false\">\n <div class=\"calendar-dropdown-head\">\n <div class=\"presets\">\n <a v-for=\"(item, key) in presets\" :key=\"key\" v-text=\"__('shop.account.calendar.preset.' + item.text)\" :class=\"{\n 'is-active': activeRange == key\n }\" @click=\"setRange(item.range, key)\"></a>\n </div>\n </div>\n <div class=\"calendar-dropdown-body\">\n <date-picker ref=\"calendar\" v-model=\"range\" :title-position=\"'left'\" :columns=\"2\" :mode=\"'date'\" :max-date=\"new Date()\" :locale=\"locale\" @dayclick=\"onDayClick\" is-range> </date-picker>\n <button class=\"calendar-submit\" @click=\"applyRange\">{{ __('shop.account.calendar.choose') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"content-blocks orders-blocks\">\n <div class=\"content-column\">\n <div class=\"content-block group-orders\" v-if=\"orders\">\n <div class=\"content-block-list\" v-if=\"orders.length\">\n <item v-for=\"item in orders\" :item=\"item\" v-bind:key=\"item.id\"></item>\n </div>\n <div v-else>{{ __('shop.account.orders.no') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, nextTick } from 'vue';\nimport { DatePicker } from 'v-calendar/dist/es/index.js';\nimport dayjs from 'dayjs';\nimport OrderItem from '@perevorot/shop/dist/components/account/OrderItem';\nimport SecureLS from 'secure-ls';\n\nexport default {\n components: {\n 'date-picker': DatePicker,\n item: OrderItem\n },\n props: {\n isCalendar: {\n type: Boolean,\n default: true\n }\n },\n setup() {\n let ls = new SecureLS({\n isCompression: false\n });\n\n let dates = ls.get('order-history');\n\n if (!dates || dayjs().diff(dates.expires, 'day') > 1) {\n dates = {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate(),\n expires: dayjs().add(1, 'day').toDate()\n };\n\n ls.set('order-history', dates);\n }\n\n const locale = $env.locale.current == 'ua' ? 'uk' : $env.locale.current;\n const calendar = ref(null);\n const date = ref('');\n const range = ref({\n start: dates.start,\n end: dates.end\n });\n const activeRange = ref(2);\n const calendarToggled = ref(false);\n const orders = ref(null);\n\n const presets = [\n {\n text: 'today',\n range: {\n start: dayjs().toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'yesterday',\n range: {\n start: dayjs().subtract(1, 'day').toDate(),\n end: dayjs().subtract(1, 'day').toDate()\n }\n },\n {\n text: 'currentmonth',\n range: {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'lastmonth',\n range: {\n start: dayjs().subtract(1, 'month').startOf('month').toDate(),\n end: dayjs().subtract(1, 'month').endOf('month').toDate()\n }\n },\n {\n text: 'lastyear',\n range: {\n start: dayjs().startOf('year').toDate(),\n end: dayjs().toDate()\n }\n }\n ];\n\n const rangeReadable = ref([dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')]);\n\n const onDayClick = () => {\n activeRange.value = null;\n };\n\n const setRange = (newRange, key) => {\n activeRange.value = key;\n range.value = newRange;\n\n calendar.value.move(range.value.start);\n };\n\n const applyRange = () => {\n rangeReadable.value = [dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')];\n\n calendarToggled.value = false;\n\n ls.set('order-history', {\n start: range.value.start,\n end: range.value.end,\n expires: dayjs().add(1, 'day').toDate()\n });\n\n nextTick(get);\n };\n\n const toggleCalendar = () => {\n calendarToggled.value = !calendarToggled.value;\n };\n\n const get = () => {\n $http\n .post($ziggy('account.orders'), {\n start: range.value.start,\n end: range.value.end\n })\n .then((response) => {\n orders.value = response.data.orders;\n });\n };\n\n get();\n\n return {\n date,\n range,\n rangeReadable,\n onDayClick,\n locale,\n calendar,\n setRange,\n activeRange,\n presets,\n calendarToggled,\n applyRange,\n toggleCalendar,\n orders\n };\n }\n};\n</script>","<template>\n <div class=\"account-content\">\n <div class=\"block-head\">\n <h1 class=\"block-title\">{{ __('shop.account.orders.title') }}</h1>\n <div class=\"selector-item\" v-if=\"isCalendar\">\n <div class=\"selector-item-label\">{{ __('shop.account.orders.period') }}:</div>\n <div class=\"selector-item-inner\">\n <div class=\"select-placeholder\" @click=\"toggleCalendar\">{{ rangeReadable[0] }}{{ rangeReadable[1] != rangeReadable[0] ? ' — ' + rangeReadable[1] : '' }}</div>\n\n <div class=\"calendar-dropdown\" v-bind:class=\"{ 'is-hidden': !calendarToggled }\" @mouseleave=\"calendarToggled = false\">\n <div class=\"calendar-dropdown-head\">\n <div class=\"presets\">\n <a v-for=\"(item, key) in presets\" :key=\"key\" v-text=\"__('shop.account.calendar.preset.' + item.text)\" :class=\"{\n 'is-active': activeRange == key\n }\" @click=\"setRange(item.range, key)\"></a>\n </div>\n </div>\n <div class=\"calendar-dropdown-body\">\n <date-picker ref=\"calendar\" v-model=\"range\" :title-position=\"'left'\" :columns=\"2\" :mode=\"'date'\" :max-date=\"new Date()\" :locale=\"locale\" @dayclick=\"onDayClick\" is-range> </date-picker>\n <button class=\"calendar-submit\" @click=\"applyRange\">{{ __('shop.account.calendar.choose') }}</button>\n </div>\n </div>\n </div>\n </div>\n </div>\n <div class=\"content-blocks orders-blocks\">\n <div class=\"content-column\">\n <div class=\"content-block group-orders\" v-if=\"orders\">\n <div class=\"content-block-list\" v-if=\"orders.length\">\n <item v-for=\"item in orders\" :item=\"item\" v-bind:key=\"item.id\"></item>\n </div>\n <div v-else>{{ __('shop.account.orders.no') }}</div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, nextTick } from 'vue';\nimport { DatePicker } from 'v-calendar/dist/es/index.js';\nimport dayjs from 'dayjs';\nimport OrderItem from '@perevorot/shop/dist/components/account/OrderItem';\nimport SecureLS from 'secure-ls';\n\nexport default {\n components: {\n 'date-picker': DatePicker,\n item: OrderItem\n },\n props: {\n isCalendar: {\n type: Boolean,\n default: true\n }\n },\n setup() {\n let ls = new SecureLS({\n isCompression: false\n });\n\n let dates = ls.get('order-history');\n\n if (!dates || dayjs().diff(dates.expires, 'day') > 1) {\n dates = {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate(),\n expires: dayjs().add(1, 'day').toDate()\n };\n\n ls.set('order-history', dates);\n }\n\n const locale = $env.locale.current == 'ua' ? 'uk' : $env.locale.current;\n const calendar = ref(null);\n const date = ref('');\n const range = ref({\n start: dates.start,\n end: dates.end\n });\n const activeRange = ref(2);\n const calendarToggled = ref(false);\n const orders = ref(null);\n\n const presets = [\n {\n text: 'today',\n range: {\n start: dayjs().toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'yesterday',\n range: {\n start: dayjs().subtract(1, 'day').toDate(),\n end: dayjs().subtract(1, 'day').toDate()\n }\n },\n {\n text: 'currentmonth',\n range: {\n start: dayjs().startOf('month').toDate(),\n end: dayjs().toDate()\n }\n },\n {\n text: 'lastmonth',\n range: {\n start: dayjs().subtract(1, 'month').startOf('month').toDate(),\n end: dayjs().subtract(1, 'month').endOf('month').toDate()\n }\n },\n {\n text: 'lastyear',\n range: {\n start: dayjs().startOf('year').toDate(),\n end: dayjs().toDate()\n }\n }\n ];\n\n const rangeReadable = ref([dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')]);\n\n const onDayClick = () => {\n activeRange.value = null;\n };\n\n const setRange = (newRange, key) => {\n activeRange.value = key;\n range.value = newRange;\n\n calendar.value.move(range.value.start);\n };\n\n const applyRange = () => {\n rangeReadable.value = [dayjs(range.value.start).format('DD.MM.YYYY'), dayjs(range.value.end).format('DD.MM.YYYY')];\n\n calendarToggled.value = false;\n\n ls.set('order-history', {\n start: range.value.start,\n end: range.value.end,\n expires: dayjs().add(1, 'day').toDate()\n });\n\n nextTick(get);\n };\n\n const toggleCalendar = () => {\n calendarToggled.value = !calendarToggled.value;\n };\n\n const get = () => {\n $http\n .post($ziggy('account.orders'), {\n start: range.value.start,\n end: range.value.end\n })\n .then((response) => {\n orders.value = response.data.orders;\n });\n };\n\n get();\n\n return {\n date,\n range,\n rangeReadable,\n onDayClick,\n locale,\n calendar,\n setRange,\n activeRange,\n presets,\n calendarToggled,\n applyRange,\n toggleCalendar,\n orders\n };\n }\n};\n</script>"],"names":["components","DatePicker","item","OrderItem","props","isCalendar","type","Boolean","setup","ls","SecureLS","isCompression","dates","get","dayjs","diff","expires","start","startOf","toDate","end","add","set","locale","$env","current","calendar","ref","date","range","activeRange","calendarToggled","orders","presets","text","subtract","endOf","rangeReadable","value","format","$http","post","$ziggy","then","response","data","onDayClick","setRange","newRange","key","move","applyRange","nextTick","toggleCalendar","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","_ctx","$props","_hoisted_4","_hoisted_5","_hoisted_6","onClick","$setup","onMouseleave","_hoisted_7","_hoisted_8","_toDisplayString","_hoisted_10","_createVNode","columns","mode","Date","onDayclick","_hoisted_11","_hoisted_12","_hoisted_13","length","_hoisted_14","_createBlock","id"],"mappings":"uRA4Ce,CACXA,WAAY,eACOC,aACfC,KAAMC,WAEVC,MAAO,CACHC,WAAY,CACRC,KAAMC,iBACG,IAGjBC,qBACQC,EAAK,IAAIC,UAAS,CAClBC,eAAe,IAGfC,EAAQH,EAAGI,IAAI,mBAEdD,GAASE,YAAQC,KAAKH,EAAMI,QAAS,OAAS,KAC/CJ,EAAQ,CACJK,MAAOH,YAAQI,QAAQ,SAASC,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EAAeN,uFAM3EH,2BAAAoB,GACIpB,2BAAAqB,GACkDZ,wBAA9CX,2BAAAwB,GAC0Cb,SAAOc,sBAA7CzB,2BAAA0B,oBACI1B,kDAAqBW,mBAAR/D,wBAAb+E,iBAA8B/E,KAAMA,EAAa+C,IAAK/C,EAAKgF,gDAE/D5B,+CAAeK"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var i=document.createElement("textarea");i.innerHTML=l,l=i.value}var s=e.ref(!1),d=e.ref(l),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),w=e.ref([]),E=t.useStore(),B=e.computed((function(){return E.getters["auth/me"]})),V=[],N=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(s.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(e){e.data&&(C(),u.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new a.default(g.value))})).finally((function(){s.value=!1}))):(u.value=[],s.value=!1)},C=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,N()}));var _=e.computed((function(){return d.value?$env.locale.url+"/search"+S.value:$env.locale.url+"/search"})),S=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1),h.value=-1)};window.addEventListener("click",D);var L,b=e.computed((function(){return d.value.length>3?w.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),x=(L=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;w.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&N(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(L.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",x,!1);var H=e.ref(o.placeholder);if(o.placeholderMobile){var M=function(){var e=window.matchMedia("(max-width: 768px)").matches;H.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",M),M()}return{isLoading:s,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){v.value=!0,h.value=-1},total:m,searchUrl:_,searchHrefWithParameter:S,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=_.value},categories:b,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",f.value.focus()},placeholderMobilized:H}}}),s={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:0,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},w={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},B=["href"],V={key:0,class:"dropdown-divider"},N={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},_=["href"],S={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),b=["href"],x={key:3,class:"products-list"},H={class:"dropdown-item products-list-title"},M={class:"columns"},q={class:"column"},T={class:"title"},P=["href"],K=["innerHTML"],$={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},F={key:1,class:"quantity"},R={key:2,class:"no-quantity"},U={key:0,class:"column is-narrow"},W={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];i.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[e.createElementVNode("div",{class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})}),e.createElementVNode("div",s,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open.apply(t,arguments)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",k,[e.withDirectives(e.createElementVNode("div",w,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(t,r){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:r},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:t.href},e.toDisplayString(t.name),9,B)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",V)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",C,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,_)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("p",D,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),L,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",x,[e.createElementVNode("div",H,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs},(function(){return[e.createElementVNode("div",M,[e.createElementVNode("div",q,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,K),r.price_old?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))])):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
|
|
1
|
+
"use strict";var e=require("vue"),t=require("vuex"),r=require("@perevorot/shop/dist/api"),o=require("simplebar"),n=require("secure-ls");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=l(o),c=l(n);var i=e.defineComponent({name:"search",props:{q:{type:String,default:""},placeholder:{type:String,default:""},placeholderMobile:{type:String,default:""},parameter:{type:String,default:"/q{separator}"},isHistory:{type:Boolean,default:!0},isToggleDropdownOnClose:{type:Boolean,default:!0},htmlClass:{type:String,default:""}},setup:function(o){var n=new c.default({isCompression:!1}),l=o.q;if(l){var i=document.createElement("textarea");i.innerHTML=l,l=i.value}var s=e.ref(!1),d=e.ref(l),u=e.ref([]),p=e.ref([]),m=e.ref(0),h=e.ref(-1),v=e.ref(!1),f=e.ref(),y=e.ref(""),g=e.ref(),k=e.ref(n.get("search")),w=e.ref([]),E=t.useStore(),B=e.computed((function(){return E.getters["auth/me"]})),V=[],N=function(){clearTimeout(void 0),h.value=-1,d.value.trim()?(s.value=!0,d.value.trim()&&r.shop.search(d.value).then((function(e){e.data&&(C(),u.value=e.data.products,m.value=e.data.total,y.value=e.data.separator,p.value=e.data.byCategory,new a.default(g.value))})).finally((function(){s.value=!1}))):(u.value=[],s.value=!1)},C=function(){if(d.value.length>1){var e=n.get("search")?n.get("search"):[];-1!==e.indexOf(d.value)&&(e=e.filter((function(e){return e!==d.value}))),e.length>4&&(e=e.slice(0,4)),e.unshift(d.value),n.set("search",e),k.value=e}};e.onBeforeUpdate((function(){V=[]})),e.watch((function(){return d.value}),(function(){v.value=!0,h.value=-1,N()}));var S=e.computed((function(){return d.value?$env.locale.url+"/search"+_.value:$env.locale.url+"/search"})),_=e.computed((function(){return o.parameter.replace("{separator}",y.value)+d.value.toLowerCase()})),D=function(e){e.target.closest(".cart")||(o.isToggleDropdownOnClose&&(v.value=!1,document.querySelector("html").classList.remove(o.htmlClass)),h.value=-1)};window.addEventListener("click",D);var L,b=e.computed((function(){return d.value.length>3?w.value.filter((function(e){return-1!==e.search.indexOf(d.value)})):[]})),q=(L=function(){var e,t,r,n=document.getElementById("menu");return n&&n.querySelectorAll("[data-search]").forEach((function(e){var t=e.textContent.trim(),r=e.dataset.search;w.value.push({name:(r?r+" / ":"")+t,search:t.toLowerCase(),href:e.closest("a").href})})),o.q&&N(),r?t?t(e):e:(e&&e.then||(e=Promise.resolve(e)),t?e.then(t):e)},function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{return Promise.resolve(L.apply(this,e))}catch(e){return Promise.reject(e)}});document.addEventListener("DOMContentLoaded",q,!1);var x=e.ref(o.placeholder);if(o.placeholderMobile){var H=function(){var e=window.matchMedia("(max-width: 768px)").matches;x.value=e?o.placeholderMobile:o.placeholder};window.addEventListener("resize",H),H()}return{isLoading:s,term:d,results:u,next:function(){h.value<u.value.length-1&&h.value++},prev:function(){h.value>=0&&h.value--},current:h,add:function(e){h.value>=0&&(e.preventDefault(),V[h.value].add())},cartRefs:function(e){e&&V.push(e)},isDropdown:v,preventCaret:function(e){(38==e.which||40==e.which||32==e.which&&h.value>=0)&&e.preventDefault()},esc:function(e){f.value.blur(),D(e)},input:f,dropdown:function(){v.value=!0,h.value=-1,document.querySelector("html").classList.add(o.props.htmlClass)},total:m,searchUrl:S,searchHrefWithParameter:_,open:function(){h.value>=0?window.location.href=u.value[h.value].href:window.location.href=S.value},categories:b,byCategory:p,dropdownContent:g,history:k,clearSearchHistory:function(e){n.remove("search"),k.value=[],f.value.focus()},setSearchHistory:function(e){e.value=e},user:B,clear:function(){d.value="",f.value.focus()},placeholderMobilized:x}}}),s={class:"dropdown-trigger"},d=["placeholder"],u={class:"icon is-small is-right"},p=[e.createElementVNode("i",{class:"fas fa-search"},null,-1)],m={key:1,class:"dropdown-menu"},h={class:"dropdown-content"},v={class:"history-list"},f={class:"dropdown-item history-list-title"},y=["onClick"],g={class:"dropdown-item history-list-clear"},k={class:"dropdown-menu"},w={class:"dropdown-content",style:{"max-height":"600px",overflow:"auto"},ref:"dropdownContent"},E={key:0,class:"results-list"},B=["href"],V={key:0,class:"dropdown-divider"},N={key:1,class:"results-list-category"},C={class:"dropdown-item categories-list-title"},S=["href"],_={key:2,class:"results-list-total"},D={class:"dropdown-item mb-3 mt-2"},L=e.createElementVNode("br",null,null,-1),b=["href"],q={key:3,class:"products-list"},x={class:"dropdown-item products-list-title"},H={class:"columns"},M={class:"column"},T={class:"title"},P=["href"],K=["innerHTML"],$={key:0,class:"price_old"},z=["innerHTML"],O={class:"code"},F={key:1,class:"quantity"},R={key:2,class:"no-quantity"},U={key:0,class:"column is-narrow"},W={key:1,class:"column is-eol"},j={key:0,class:"dropdown-content"},A={class:"dropdown-item"},I=["innerHTML"];i.render=function(t,r,o,n,l,a){var c=e.resolveComponent("cart-add");return e.openBlock(),e.createElementBlock("div",{class:"shop-search",onClick:r[10]||(r[10]=function(e){return e.stopPropagation()})},[e.createElementVNode("div",{class:e.normalizeClass(["dropdown",{"is-active":t.isDropdown,"is-dropdown-visible":t.isDropdown&&(t.history.length&&!t.term||t.results.length||t.categories.length||t.term&&!t.isLoading&&!t.results.length&&!t.categories.length)}])},[t.htmlClass?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay search-overlay",onClick:r[0]||(r[0]=function(e){return t.esc(e)})})),e.createElementVNode("div",s,[e.createElementVNode("div",{class:e.normalizeClass(["control has-icons-right",{"is-loading":t.isLoading}])},[e.withDirectives(e.createElementVNode("input",{class:"input",type:"text","onUpdate:modelValue":r[1]||(r[1]=function(e){return t.term=e}),ref:"input",placeholder:t.placeholderMobilized,onKeyup:[r[2]||(r[2]=e.withKeys((function(){return t.next&&t.next.apply(t,arguments)}),["arrow-down"])),r[3]||(r[3]=e.withKeys((function(){return t.prev&&t.prev.apply(t,arguments)}),["arrow-up"])),r[4]||(r[4]=e.withKeys((function(e){return t.add(e)}),["space"])),r[5]||(r[5]=e.withKeys((function(){return t.open&&t.open.apply(t,arguments)}),["enter"])),r[6]||(r[6]=e.withKeys((function(e){return t.esc(e)}),["esc"]))],onClick:r[7]||(r[7]=function(){return t.dropdown&&t.dropdown.apply(t,arguments)}),onKeydown:r[8]||(r[8]=function(e){return t.preventCaret(e)})},null,40,d),[[e.vModelText,t.term]]),e.renderSlot(t.$slots,"clear",{clear:t.clear,term:t.term}),e.renderSlot(t.$slots,"icon",{isLoading:t.isLoading},(function(){return[e.withDirectives(e.createElementVNode("span",u,p,512),[[e.vShow,!t.isLoading]])]}))],2)]),t.isHistory&&t.isDropdown&&t.history.length&&!t.term?(e.openBlock(),e.createElementBlock("div",m,[e.createElementVNode("div",h,[e.createElementVNode("div",v,[e.createElementVNode("div",f,[e.createElementVNode("p",null,e.toDisplayString(t.__("shop.search.history")),1)]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.history,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.createElementVNode("a",{onClick:function(e){return t.term=r}},e.toDisplayString(r),9,y)])})),128)),e.createElementVNode("div",g,[e.createElementVNode("a",{onClick:r[9]||(r[9]=function(e){return t.clearSearchHistory(e)})},e.toDisplayString(t.__("shop.search.history_clear")),1)])])])])):e.createCommentVNode("v-if",!0),e.withDirectives(e.createElementVNode("div",k,[e.withDirectives(e.createElementVNode("div",w,[e.renderSlot(t.$slots,"results-header"),t.categories.length?(e.openBlock(),e.createElementBlock("div",E,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.categories,(function(t,r){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:r},[e.createElementVNode("div",null,[e.createElementVNode("a",{href:t.href},e.toDisplayString(t.name),9,B)])])})),128)),t.byCategory.length?(e.openBlock(),e.createElementBlock("hr",V)):e.createCommentVNode("v-if",!0)])):e.createCommentVNode("v-if",!0),t.byCategory.length?(e.openBlock(),e.createElementBlock("div",N,[e.createElementVNode("div",C,e.toDisplayString(t.__("shop.search.categories")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.byCategory,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:"dropdown-item",key:o},[e.renderSlot(t.$slots,"item-category",{item:r,searchHrefWithParameter:t.searchHrefWithParameter},(function(){return[e.createElementVNode("div",null,[e.createElementVNode("a",{href:r.href+t.searchHrefWithParameter},e.toDisplayString(r.name),9,S)]),e.createElementVNode("div",null,e.toDisplayString(t.__("shop.search.category_found",{count:r.count})),1)]}))])})),128))])):e.createCommentVNode("v-if",!0),t.total?(e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("p",D,[e.createTextVNode(e.toDisplayString(t.__("shop.search.total_found",{total:t.total}))+" ",1),L,e.createElementVNode("a",{href:t.searchUrl},e.toDisplayString(t.__("shop.search.open_results")),9,b)])])):e.createCommentVNode("v-if",!0),t.results.length?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",x,e.toDisplayString(t.__("shop.search.products")),1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.results,(function(r,o){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["dropdown-item",{"is-active":t.current==o}]),key:r.id},[e.renderSlot(t.$slots,"item",{user:t.user,item:r,cartRefs:t.cartRefs},(function(){return[e.createElementVNode("div",H,[e.createElementVNode("div",M,[e.createElementVNode("div",T,[e.createElementVNode("a",{href:r.href},e.toDisplayString(r.name),9,P)]),e.createElementVNode("div",{class:"price",innerHTML:r.price},null,8,K),r.price_old?(e.openBlock(),e.createElementBlock("div",$,[e.createElementVNode("span",{innerHTML:r.price_old},null,8,z)])):e.createCommentVNode("v-if",!0),e.createElementVNode("div",O,e.toDisplayString(r.code),1),r.quantity?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(t.__("shop.search.in_stock")),1)):(e.openBlock(),e.createElementBlock("span",R,e.toDisplayString(t.__("shop.search.out_stock")),1))]),r.is_eol?(e.openBlock(),e.createElementBlock("div",W,e.toDisplayString(t.__("shop.search.eol")),1)):(e.openBlock(),e.createElementBlock("div",U,[e.createVNode(c,{id:r.id,"is-change-quantity":!1,"is-already-in-cart":!1,ref_for:!0,ref:t.cartRefs},null,8,["id"])]))])]}))],2)})),128))])):e.createCommentVNode("v-if",!0)],512),[[e.vShow,t.results.length||t.categories.length]]),t.isLoading||t.results.length||t.categories.length?e.createCommentVNode("v-if",!0):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",A,[e.createElementVNode("div",{class:"no-results",innerHTML:t.__("shop.search.no_results")},null,8,I)])]))],512),[[e.vShow,t.results.length||t.term]])],2)])},module.exports=i;
|
|
2
2
|
//# sourceMappingURL=Search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=0039dab4&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","refs","search","clearTimeout","timeout","trim","api","then","response","data","saveSearch","products","SimpleBar","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","window","addEventListener","categories","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","i","arguments","e","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","remove","focus","setSearchHistory","clear","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,eACG,iBAEbI,UAAW,CACPL,KAAMM,iBACG,GAEbC,wBAAyB,CACrBP,KAAMM,iBACG,IAGjBE,eAAMV,OACIW,EAAK,IAAIC,UAAS,CACpBC,eAAe,IAGfZ,EAAID,EAAMC,KAEVA,EAAG,KACCa,EAAUC,SAASC,cAAc,YACrCF,EAAQG,UAAYhB,EACpBA,EAAIa,EAAQI,UAGVC,EAAYC,OAAI,GAChBC,EAAOD,MAAInB,GACXqB,EAAUF,MAAI,IACdG,EAAaH,MAAI,IACjBI,EAAQJ,M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uCAEQrB,wDAIJsB,EACA5B,0BAAI3B,KAAMiC,+BAAcA,4EAGCA,UAAQlE,sBAAzC8D,2BAAA2B,GACI7B,2BAAA8B,oBACOxB,kDAEPJ,kDAAmDI,oBAAhB/D,EAAMyE,wBAAzCd,oDAAW,6BAAmGI,WAAWU,KAAtDC,IAAK1E,EAAKwF,KACzErB,8BAAmBrF,KAAMiF,OAAO/D,KAAMA,EAAO2C,SAAWoB,aAAxD,kBACIN,2BAAAgC,GACIhC,2BAAAiC,GACIjC,2BAAAkC,GACIlC,0BAAI3B,KAAM9B,EAAK8B,wBACR9B,EAAKtD,aAGhB+G,kCAAW,QAAQ7F,UAAQoC,EAAK4F,iBACH5F,EAAK6F,yBAAlClC,2BAAAmC,GACIrC,6BAAM7F,UAAQoC,EAAK6F,wDAEvBpC,2BAAAsC,oBAAqB/F,EAAKgG,SACEhG,EAAKiG,wBAAjCtC,2BAAAuC,oBACOnC,iDAEPJ,4BAAAwC,oBACOpC,qCAG0B/D,EAAKoG,sBAG1CzC,2BAAA0C,oBACOtC,4CAJPJ,2BAAA2C,GACIC,iBAAWf,GAAIxF,EAAKwF,yBAAyB,wBAA4B,aAAQzH,IAAKgG,oGA9DxEA,UAAQlE,QAAUkE,aAAWlE,UAwE9BkE,aAAcA,UAAQlE,QAAWkE,aAAWlE,sDAAjF8D,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAa7F,UAAQmG,+DA3ETA,UAAQlE,QAAUkE"}
|
|
1
|
+
{"version":3,"file":"Search.js","sources":["../../../src/components/shop/Search.vue","../../../src/components/shop/Search.vue?vue&type=template&id=34c0656f&lang.js"],"sourcesContent":["<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n document.querySelector('html').classList.add(props.props.htmlClass);\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>","<template>\n <div class=\"shop-search\" @click=\"$event.stopPropagation()\">\n <div class=\"dropdown\" v-bind:class=\"{\n 'is-active': isDropdown,\n 'is-dropdown-visible': isDropdown && ((history.length && !term) || results.length || categories.length || (term && !isLoading && !results.length && !categories.length))\n }\">\n <div class=\"overlay search-overlay\" @click=\"esc($event)\" v-if=\"!htmlClass\"></div>\n <div class=\"dropdown-trigger\">\n <div class=\"control has-icons-right\" v-bind:class=\"{ 'is-loading': isLoading }\">\n <input class=\"input\" type=\"text\" v-model=\"term\" ref=\"input\" :placeholder=\"placeholderMobilized\" @keyup.arrow-down=\"next\" @keyup.arrow-up=\"prev\" @keyup.space=\"add($event)\" @keyup.enter=\"open\" @keyup.esc=\"esc($event)\" @click=\"dropdown\" @keydown=\"preventCaret($event)\" />\n <slot name=\"clear\" :clear=\"clear\" :term=\"term\"></slot>\n <slot name=\"icon\" :isLoading=\"isLoading\">\n <span class=\"icon is-small is-right\" v-show=\"!isLoading\">\n <i class=\"fas fa-search\"></i>\n </span>\n </slot>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-if=\"isHistory && isDropdown && history.length && !term\">\n <div class=\"dropdown-content\">\n <div class=\"history-list\">\n <div class=\"dropdown-item history-list-title\">\n <p>{{ __('shop.search.history') }}</p>\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in history\" v-bind:key=\"index\">\n <a @click=\"term = item\">{{ item }}</a>\n </div>\n <div class=\"dropdown-item history-list-clear\">\n <a @click=\"clearSearchHistory($event)\">{{ __('shop.search.history_clear') }}</a>\n </div>\n </div>\n </div>\n </div>\n <div class=\"dropdown-menu\" v-show=\"results.length || term\">\n <div class=\"dropdown-content\" v-show=\"results.length || categories.length\" style=\"max-height: 600px; overflow: auto\" ref=\"dropdownContent\">\n <slot name=\"results-header\"></slot>\n <div class=\"results-list\" v-if=\"categories.length\">\n <div class=\"dropdown-item\" v-for=\"(item, index) in categories\" v-bind:key=\"index\">\n <div>\n <a :href=\"item.href\">{{ item.name }}</a>\n </div>\n </div>\n <hr class=\"dropdown-divider\" v-if=\"byCategory.length\" />\n </div>\n <div class=\"results-list-category\" v-if=\"byCategory.length\">\n <div class=\"dropdown-item categories-list-title\">\n {{ __('shop.search.categories') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in byCategory\" v-bind:key=\"index\">\n <slot name=\"item-category\" :item=\"item\" :searchHrefWithParameter=\"searchHrefWithParameter\">\n <div>\n <a :href=\"item.href + searchHrefWithParameter\">{{ item.name }}</a>\n </div>\n <div>\n {{ __('shop.search.category_found', { count: item.count }) }}\n </div>\n </slot>\n </div>\n </div>\n <div class=\"results-list-total\" v-if=\"total\">\n <p class=\"dropdown-item mb-3 mt-2\">\n {{\n __('shop.search.total_found', {\n total: total\n })\n }}\n <br />\n <a :href=\"searchUrl\">{{ __('shop.search.open_results') }}</a>\n </p>\n </div>\n <div class=\"products-list\" v-if=\"results.length\">\n <div class=\"dropdown-item products-list-title\">\n {{ __('shop.search.products') }}\n </div>\n <div class=\"dropdown-item\" v-for=\"(item, index) in results\" v-bind:key=\"item.id\" v-bind:class=\"{ 'is-active': current == index }\">\n <slot name=\"item\" :user=\"user\" :item=\"item\" :cart-refs=\"cartRefs\">\n <div class=\"columns\">\n <div class=\"column\">\n <div class=\"title\">\n <a :href=\"item.href\">\n {{ item.name }}\n </a>\n </div>\n <div class=\"price\" v-html=\"item.price\"></div>\n <div class=\"price_old\" v-if=\"item.price_old\">\n <span v-html=\"item.price_old\"></span>\n </div>\n <div class=\"code\">{{ item.code }}</div>\n <div class=\"quantity\" v-if=\"item.quantity\">\n {{ __('shop.search.in_stock') }}\n </div>\n <span class=\"no-quantity\" v-else>\n {{ __('shop.search.out_stock') }}\n </span>\n </div>\n <div class=\"column is-narrow\" v-if=\"!item.is_eol\">\n <cart-add :id=\"item.id\" :is-change-quantity=\"false\" :is-already-in-cart=\"false\" :ref=\"cartRefs\"></cart-add>\n </div>\n <div v-else class=\"column is-eol\">\n {{ __('shop.search.eol') }}\n </div>\n </div>\n </slot>\n </div>\n </div>\n </div>\n <div class=\"dropdown-content\" v-if=\"!isLoading && !results.length && !categories.length\">\n <div class=\"dropdown-item\">\n <div class=\"no-results\" v-html=\"__('shop.search.no_results')\"></div>\n </div>\n </div>\n </div>\n </div>\n </div>\n</template>\n<script>\nimport { ref, watch, onBeforeUpdate, defineComponent, computed } from 'vue';\nimport { useStore } from 'vuex';\nimport { shop as api } from '@perevorot/shop/dist/api';\nimport SimpleBar from 'simplebar';\nimport SecureLS from 'secure-ls';\n\nexport default /*#__PURE__*/ defineComponent({\n name: 'search',\n props: {\n q: {\n type: String,\n default: ''\n },\n placeholder: {\n type: String,\n default: ''\n },\n placeholderMobile: {\n type: String,\n default: ''\n },\n parameter: {\n type: String,\n default: '/q{separator}'\n },\n isHistory: {\n type: Boolean,\n default: true\n },\n isToggleDropdownOnClose: {\n type: Boolean,\n default: true\n },\n htmlClass: {\n type: String,\n default: ''\n }\n },\n setup(props) {\n const ls = new SecureLS({\n isCompression: false\n });\n\n let q = props.q;\n\n if (q) {\n let encoder = document.createElement('textarea');\n encoder.innerHTML = q;\n q = encoder.value;\n }\n\n const isLoading = ref(false);\n const term = ref(q);\n const results = ref([]);\n const byCategory = ref([]);\n const total = ref(0);\n const current = ref(-1);\n const isDropdown = ref(false);\n const input = ref();\n const separator = ref('');\n const dropdownContent = ref();\n const history = ref(ls.get('search'));\n const menu = ref([]);\n const store = useStore();\n const user = computed(() => store.getters['auth/me']);\n\n let refs = [];\n let timeout;\n\n const search = () => {\n clearTimeout(timeout);\n\n current.value = -1;\n\n if (!term.value.trim()) {\n results.value = [];\n isLoading.value = false;\n } else {\n isLoading.value = true;\n\n //timeout = setTimeout(() => {\n if (term.value.trim()) {\n api.search(term.value)\n .then((response) => {\n if (response.data) {\n saveSearch();\n\n results.value = response.data.products;\n total.value = response.data.total;\n separator.value = response.data.separator;\n byCategory.value = response.data.byCategory;\n\n const scrollBar = new SimpleBar(dropdownContent.value);\n }\n })\n .finally(() => {\n isLoading.value = false;\n });\n }\n //}, 500);\n }\n };\n\n const saveSearch = () => {\n if (term.value.length > 1) {\n let search = ls.get('search') ? ls.get('search') : [];\n\n if (search.indexOf(term.value) !== -1) {\n search = search.filter((item) => item !== term.value);\n }\n\n if (search.length > 4) {\n search = search.slice(0, 4);\n }\n\n search.unshift(term.value);\n\n ls.set('search', search);\n\n history.value = search;\n }\n };\n\n const setSearchHistory = (term) => {\n term.value = term;\n };\n\n const clearSearchHistory = (event) => {\n ls.remove('search');\n\n history.value = [];\n\n input.value.focus();\n };\n\n onBeforeUpdate(() => {\n refs = [];\n });\n\n watch(\n () => term.value,\n () => {\n isDropdown.value = true;\n current.value = -1;\n search();\n }\n );\n\n const searchUrl = computed(() => {\n return term.value ? $env.locale.url + '/search' + searchHrefWithParameter.value : $env.locale.url + '/search';\n });\n\n const searchHrefWithParameter = computed(() => {\n return props.parameter.replace('{separator}', separator.value) + term.value.toLowerCase();\n });\n\n const preventCaret = (event) => {\n if (event.which == 38 || event.which == 40 || (event.which == 32 && current.value >= 0)) {\n event.preventDefault();\n }\n };\n\n const next = () => {\n if (current.value < results.value.length - 1) {\n current.value++;\n }\n };\n\n const prev = () => {\n if (current.value >= 0) {\n current.value--;\n }\n };\n\n const add = (event) => {\n if (current.value >= 0) {\n event.preventDefault();\n\n refs[current.value].add();\n }\n };\n\n const open = () => {\n if (current.value >= 0) {\n window.location.href = results.value[current.value].href;\n } else {\n window.location.href = searchUrl.value;\n }\n };\n\n const esc = (event) => {\n input.value.blur();\n close(event);\n };\n\n const cartRefs = (el) => {\n if (el) {\n refs.push(el);\n }\n };\n\n const close = (event) => {\n if (!event.target.closest('.cart')) {\n if (props.isToggleDropdownOnClose) {\n isDropdown.value = false;\n document.querySelector('html').classList.remove(props.htmlClass);\n }\n\n current.value = -1;\n }\n };\n\n const dropdown = () => {\n isDropdown.value = true;\n current.value = -1;\n document.querySelector('html').classList.add(props.props.htmlClass);\n };\n\n window.addEventListener('click', close);\n\n const categories = computed(() => {\n return term.value.length > 3 ? menu.value.filter((item) => item.search.indexOf(term.value) !== -1) : [];\n });\n\n const load = async () => {\n const menuElement = document.getElementById('menu');\n\n if (menuElement) {\n menuElement.querySelectorAll('[data-search]').forEach((element) => {\n const name = element.textContent.trim();\n const data = element.dataset.search;\n\n menu.value.push({\n name: (data ? data + ' / ' : '') + name,\n search: name.toLowerCase(),\n href: element.closest('a').href\n });\n });\n }\n\n if (props.q) {\n search();\n }\n };\n\n document.addEventListener('DOMContentLoaded', load, false);\n\n const clear = () => {\n term.value = '';\n input.value.focus();\n };\n\n const placeholderMobilized = ref(props.placeholder);\n\n if (props.placeholderMobile) {\n const switchPlaceholder = () => {\n const isMobile = window.matchMedia('(max-width: 768px)').matches;\n\n placeholderMobilized.value = isMobile ? props.placeholderMobile : props.placeholder;\n };\n\n window.addEventListener('resize', switchPlaceholder);\n\n switchPlaceholder();\n }\n\n return {\n isLoading,\n term,\n results,\n next,\n prev,\n current,\n add,\n cartRefs,\n isDropdown,\n preventCaret,\n esc,\n input,\n dropdown,\n total,\n searchUrl,\n searchHrefWithParameter,\n open,\n categories,\n byCategory,\n dropdownContent,\n history,\n clearSearchHistory,\n setSearchHistory,\n user,\n clear,\n placeholderMobilized,\n };\n }\n});\n</script>"],"names":["defineComponent","name","props","q","type","String","placeholder","placeholderMobile","parameter","isHistory","Boolean","isToggleDropdownOnClose","htmlClass","setup","ls","SecureLS","isCompression","encoder","document","createElement","innerHTML","value","isLoading","ref","term","results","byCategory","total","current","isDropdown","input","separator","dropdownContent","history","get","menu","store","useStore","user","computed","getters","refs","search","clearTimeout","timeout","trim","api","then","response","data","saveSearch","products","SimpleBar","length","indexOf","filter","item","slice","unshift","set","onBeforeUpdate","watch","searchUrl","$env","locale","url","searchHrefWithParameter","replace","toLowerCase","close","event","target","closest","querySelector","classList","remove","window","addEventListener","f","categories","load","direct","menuElement","getElementById","querySelectorAll","forEach","element","textContent","dataset","push","href","arguments","i","resolve","apply","this","placeholderMobilized","switchPlaceholder","isMobile","matchMedia","matches","next","prev","add","preventDefault","cartRefs","el","preventCaret","which","esc","blur","dropdown","open","location","clearSearchHistory","focus","setSearchHistory","clear","_createElementVNode","style","_createElementBlock","onClick","$event","stopPropagation","_ctx","_hoisted_1","onKeyup","onKeydown","_renderSlot","_hoisted_3","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","index","key","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_hoisted_16","_hoisted_17","_hoisted_18","count","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_24","_hoisted_25","id","_hoisted_26","_hoisted_27","_hoisted_28","price","price_old","_hoisted_31","_hoisted_33","code","quantity","_hoisted_34","_hoisted_35","is_eol","_hoisted_37","_hoisted_36","_createVNode","_hoisted_38","_hoisted_39"],"mappings":"kOA0HA,MAA6BA,kBAAgB,CACzCC,KAAM,SACNC,MAAO,CACHC,EAAG,CACCC,KAAMC,eACG,IAEbC,YAAa,CACTF,KAAMC,eACG,IAEbE,kBAAmB,CACfH,KAAMC,eACG,IAEbG,UAAW,CACPJ,KAAMC,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BAAyB,wBAA4B,aAAQ9H,IAAKqG,oGA9DxEA,UAAQvE,QAAUuE,aAAWvE,UAwE9BuE,aAAcA,UAAQvE,QAAWuE,aAAWvE,sDAAjFmE,2BAAA6C,GACI/C,2BAAAgD,GACIhD,kCAAW,aAAalG,UAAQwG,+DA3ETA,UAAQvE,QAAUuE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perevorot/shop",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.90",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/*"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"secure-ls": "^1.2.6",
|
|
31
31
|
"simplebar": "^5.3.6",
|
|
32
32
|
"swiper": "^7.3.2",
|
|
33
|
-
"v-calendar": "^3.0.
|
|
33
|
+
"v-calendar": "^3.0.3",
|
|
34
34
|
"vanilla-lazyload": "^17.5.0",
|
|
35
35
|
"vee-validate": "^4.2.4",
|
|
36
36
|
"vue": "^3.0.11",
|