Files
nademitex_user/dist/assets/ProductsView-D4PIrFI3.js
T
2026-09-30 09:54:04 +03:30

1 line
14 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{A as e,At as t,F as n,G as r,M as i,Nt as a,Pt as o,R as s,U as c,_ as l,c as u,d,f,g as p,h as ee,i as m,k as te,l as h,nt as g,o as ne,t as re,u as _,ut as v,v as y}from"./_plugin-vue_export-helper-1xMDlcEE.js";import{n as ie,u as b}from"./BasicIcon-ba1FsUKx.js";import{A as ae,C as oe,k as se,r as x,s as ce,u as le}from"./index-BPUhS8CY.js";import{t as ue}from"./IconFilter-Br-Ixz6t.js";import{t as de}from"./IconDiamond-CCzZ7nPM.js";import{t as fe}from"./PageHeader-CG1ktltl.js";import"./SearchField-dVDn9y5S.js";import{t as pe}from"./PageSkeleton-DYdjm4l9.js";import{t as me}from"./crm-BKPKhzCX.js";import{n as S,r as he,t as ge}from"./useSlotBanners-DB1JMbZH.js";import{t as _e}from"./IconHeart-CvzbNH_T.js";import{n as ve}from"./colorSwatch-BgOH1LE5.js";import{t as C}from"./AppSelect-CYw47n7-.js";var ye={class:`page products-page`},be=[`aria-expanded`],xe={class:`desktop-page__head desktop-only products-desk-head`},Se={class:`products-desk-head__copy`},Ce={class:`desktop-page__title`},we={class:`desktop-page__subtitle`},Te={key:0,class:`products-filter-desk desktop-only`},Ee={class:`products-filter-sheet products-filter-sheet--desk`},De={class:`products-filter-actions products-filter-actions--desk`},Oe={class:`products-filter-actions`},ke={class:`page__scroll page__scroll--with-nav products-scroll`},Ae={key:0},je={class:`cat-banner__content`},Me={key:0,class:`cat-banner__lead`},Ne={key:1,class:`cat-banner__title-row`},Pe={key:0,class:`cat-banner__icon-ring`,"aria-hidden":`true`},Fe={key:1,class:`cat-banner__title`},Ie={key:2,class:`cat-banner__title`},Le={key:3,class:`cat-banner__tagline`},Re={key:0,class:`cat-banner__icon-ring cat-banner__icon-ring--aside`,"aria-hidden":`true`},ze={key:0,class:`chips-row scroll-x`},Be=[`aria-label`],Ve=[`onClick`],He=[`onClick`],Ue={class:`list-meta`},We=[`aria-label`],Ge={class:`products-list`},Ke=[`onClick`],qe={class:`product-item__body`},Je={class:`product-item__head`},Ye={class:`product-item__title`},Xe={key:0,class:`new-tag`},Ze=[`aria-label`,`aria-pressed`,`onClick`],Qe={class:`product-item__specs`},$e={class:`swatches`},et=[`onClick`],tt={key:1,class:`empty-list`},w=re(y({__name:`ProductsView`,setup(re){let y=se(),w=ae(),T=me(),E=le(),{banners:nt}=ge(`products_hero`),D=u(()=>O.value||j.value||k.value?null:nt.value[0]??null),O=u(()=>String(y.query.categoryId??``)),k=u(()=>String(y.query.catalogId??``)),A=u(()=>String(y.query.companyId??``)),j=u(()=>String(y.query.season??``)),M=u(()=>String(y.query.filterAxis??``)),N=u(()=>String(y.query.q??``)),rt=g(String(y.query.q??``)),P=g([]),F=g(``),I=g(!0),L=g(null),R=g(`newest`),z=g(!1),B=g(``),V=g(``),H=u(()=>!k.value),U=u(()=>[{value:``,label:`همه دسته‌ها`},...T.usageCategories.map(e=>({value:e.id,label:e.title}))]),W=u(()=>[{value:``,label:`همه فصول`},...T.seasonCategories.map(e=>({value:e.id,label:e.title}))]),G=u(()=>!!O.value||!!j.value),K=u(()=>k.value&&F.value?F.value:O.value?T.usageCategories.find(e=>e.id===O.value)?.title??`محصولات`:j.value?T.seasonCategories.find(e=>e.id===j.value)?.title??`محصولات`:N.value?`جستجو: ${N.value}`:`محصولات`);function it(e){let t=e.trim();return t.startsWith(`پارچه‌های `)?{lead:`پارچه‌های`,headline:t.slice(10)}:{lead:void 0,headline:t}}function at(e){return e.icon||(e.id===`summer`?`bolt`:e.id===`winter`?`feather`:`diamond`)}function ot(){let e=q.value.ctaLink?.trim();if(e){if(/^https?:\/\//i.test(e)){window.location.assign(e);return}w.push(e)}}let q=u(()=>{let e=D.value;if(e)return{lead:void 0,headline:e.showTitle===!1?void 0:e.title,tagline:e.showSubtitle===!1?void 0:e.subtitle||void 0,showIcon:!1,ctaLabel:e.showCta===!1?void 0:e.ctaLabel||void 0,ctaLink:e.ctaLink||void 0};if(O.value){let e=T.usageCategories.find(e=>e.id===O.value),t=it(e?.title??K.value);return{lead:e?.showTitle===!1?void 0:t.lead,headline:e?.showTitle===!1?void 0:t.headline,tagline:e?.showSubtitle===!1?void 0:e?.subtitle,showIcon:e?.showIcon!==!1}}if(j.value){let e=T.seasonCategories.find(e=>e.id===j.value);return{lead:void 0,headline:e?.showTitle===!1?void 0:e?.title??K.value,tagline:e?.showDescription===!1?void 0:e?.description||void 0,showIcon:e?.showIcon!==!1}}return k.value?{lead:`کالیته`,headline:F.value||K.value,tagline:`انتخاب محصول از کالیته`,showIcon:!0}:{lead:void 0,headline:K.value,tagline:N.value?`نتایج جستجو`:`مشاهده و ثبت سفارش`,showIcon:!1}}),J=u(()=>{if(D.value||q.value.showIcon===!1)return null;if(O.value){let e=T.usageCategories.find(e=>e.id===O.value);if(e)return S(he(e),oe)}if(j.value){let e=T.seasonCategories.find(e=>e.id===j.value);if(e)return S(at(e),de)}return null}),Y=u(()=>{let e=D.value?.imageUrl?.trim();if(e)return e;if(O.value){let e=T.usageCategories.find(e=>e.id===O.value);if(e?.imageUrl)return e.imageUrl}if(j.value){let e=T.seasonCategories.find(e=>e.id===j.value);if(e?.imageUrl)return e.imageUrl}if(k.value)return P.value.find(e=>e.imageUrl)?.imageUrl}),st=u(()=>Y.value?{backgroundImage:`url(${Y.value})`}:void 0);u(()=>!O.value&&!k.value);let ct=u(()=>M.value===`usage`||O.value?`season`:M.value===`season`||j.value?`usage`:`season`),lt=u(()=>ct.value===`season`?`فصل`:`دسته کاربرد`),X=u(()=>{let e=N.value.trim().toLowerCase(),t=[...P.value];return e&&(t=t.filter(t=>t.name.toLowerCase().includes(e)||t.code.toLowerCase().includes(e)||(t.composition||``).toLowerCase().includes(e))),R.value===`name`?t.sort((e,t)=>e.name.localeCompare(t.name,`fa`)):t.sort((e,t)=>Number(t.isNew)-Number(e.isNew)||e.name.localeCompare(t.name,`fa`))});function ut(){R.value=R.value===`newest`?`name`:`newest`}let dt=u(()=>R.value===`newest`?`مرتب‌سازی: جدیدترین`:`مرتب‌سازی: نام`);async function ft(){I.value=!0,L.value=null;try{await T.loadCategories(),P.value=await T.loadBrowseProducts({categoryId:O.value||void 0,season:j.value||void 0,catalogId:k.value||void 0,companyId:A.value||void 0});let e=P.value[0];F.value=e?.catalogName||e?.catalogCode||``}catch(e){L.value=e instanceof Error?e.message:`بارگذاری محصولات ناموفق بود.`,P.value=[]}finally{I.value=!1}}te(async()=>{await E.hydrate(),await ft()}),c([O,j,k,A],ft),c(N,e=>{rt.value=e});function pt(e){let t=O.value,n=t?`usage`:e?`season`:void 0;w.replace({path:`/products`,query:{...t?{categoryId:t}:{},...k.value?{catalogId:k.value}:{},...A.value?{companyId:A.value}:{},...e?{season:e}:{},...n?{filterAxis:n}:{},...N.value?{q:N.value}:{}}})}function mt(e){let t=j.value,n=t?`season`:e?`usage`:void 0;w.replace({path:`/products`,query:{...e?{categoryId:e}:{},...k.value?{catalogId:k.value}:{},...A.value?{companyId:A.value}:{},...t?{season:t}:{},...n?{filterAxis:n}:{},...N.value?{q:N.value}:{}}})}function Z(e){w.push({path:`/product`,query:{id:e}})}function ht(e){return T.seasonCategories.find(t=>t.id===e)?.title??e}function gt(e){E.toggle(e)}function _t(){B.value=O.value,V.value=j.value,z.value=!0}function Q(){z.value=!1}function vt(e,t){if(e)return`usage`;if(t)return`season`}function yt(e,t){let n=vt(e,t);return{...e?{categoryId:e}:{},...t?{season:t}:{},...n?{filterAxis:n}:{},...A.value?{companyId:A.value}:{},...N.value?{q:N.value}:{}}}function bt(){w.replace({path:`/products`,query:yt(B.value,V.value)}),Q()}function $(){B.value=``,V.value=``,w.replace({path:`/products`,query:yt(``,``)}),Q()}return c(z,e=>{typeof window<`u`&&window.matchMedia(`(min-width: 768px)`).matches||(document.body.style.overflow=e?`hidden`:``)}),e(()=>{document.body.style.overflow=``}),(e,c)=>(i(),f(`div`,ye,[l(fe,{class:`mobile-only`,title:K.value,"show-back":``,centered:``,onBack:c[0]||=e=>v(w).back()},{trailing:r(()=>[H.value?(i(),f(`button`,{key:0,type:`button`,class:t([`nav-filter`,{"nav-filter--active":G.value}]),"aria-label":`فیلتر محصولات`,"aria-expanded":z.value,onClick:_t},[l(ue,{size:18})],10,be)):d(``,!0)]),_:1},8,[`title`]),h(`header`,xe,[h(`div`,Se,[h(`h1`,Ce,o(K.value),1),h(`p`,we,o(q.value.tagline||(N.value?`نتایج جستجو`:`مشاهده و ثبت سفارش`)),1)])]),H.value?(i(),f(`div`,Te,[h(`div`,Ee,[c[10]||=h(`header`,{class:`products-filter-sheet__head`},[h(`h2`,null,`فیلتر محصولات`)],-1),l(C,{modelValue:B.value,"onUpdate:modelValue":c[1]||=e=>B.value=e,class:`products-filter-section`,label:`دسته کاربرد`,"aria-label":`دسته کاربرد`,options:U.value},null,8,[`modelValue`,`options`]),l(C,{modelValue:V.value,"onUpdate:modelValue":c[2]||=e=>V.value=e,class:`products-filter-section`,label:`فصل`,"aria-label":`فصل`,options:W.value},null,8,[`modelValue`,`options`]),h(`div`,De,[l(x,{onClick:bt},{default:r(()=>[...c[9]||=[p(`اعمال فیلتر`,-1)]]),_:1}),G.value?(i(),f(`button`,{key:0,type:`button`,class:`products-filter-clear`,onClick:$},` پاک کردن فیلترها `)):d(``,!0)])])])):d(``,!0),(i(),_(ne,{to:`body`},[l(ie,{name:`products-filter-sheet`},{default:r(()=>[z.value&&H.value?(i(),f(`div`,{key:0,class:`products-filter-panel mobile-only`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`products-filter-title`,onClick:b(Q,[`self`])},[h(`div`,{class:`products-filter-sheet`,onClick:c[6]||=b(()=>{},[`stop`])},[c[13]||=h(`div`,{class:`products-filter-sheet__handle`,"aria-hidden":`true`},null,-1),h(`header`,{class:`products-filter-sheet__head`},[c[11]||=h(`h2`,{id:`products-filter-title`},`فیلتر محصولات`,-1),h(`button`,{type:`button`,class:`products-filter-sheet__close`,"aria-label":`بستن`,onClick:Q},` × `)]),l(C,{modelValue:B.value,"onUpdate:modelValue":c[3]||=e=>B.value=e,class:`products-filter-section`,label:`دسته کاربرد`,"aria-label":`دسته کاربرد`,options:U.value},null,8,[`modelValue`,`options`]),l(C,{modelValue:V.value,"onUpdate:modelValue":c[4]||=e=>V.value=e,class:`products-filter-section`,label:`فصل`,"aria-label":`فصل`,options:W.value},null,8,[`modelValue`,`options`]),h(`div`,Oe,[l(x,{block:``,onClick:bt},{default:r(()=>[...c[12]||=[p(`اعمال فیلتر`,-1)]]),_:1}),G.value?(i(),f(`button`,{key:0,type:`button`,class:`products-filter-clear`,onClick:$},` پاک کردن فیلترها `)):d(``,!0),h(`button`,{type:`button`,class:`products-filter-link`,onClick:c[5]||=e=>{v(w).push(`/categories`),Q()}},` مشاهده همه دسته‌بندی‌ها `)])])])):d(``,!0)]),_:1})])),h(`div`,ke,[L.value?(i(),f(`p`,Ae,o(L.value),1)):I.value?(i(),_(pe,{key:1,variant:`grid`})):(i(),f(m,{key:2},[h(`section`,{class:t([`cat-banner`,{"cat-banner--photo":!!Y.value}]),style:a(st.value)},[h(`div`,je,[q.value.lead?(i(),f(`p`,Me,o(q.value.lead),1)):d(``,!0),q.value.headline||J.value&&Y.value?(i(),f(`div`,Ne,[J.value&&Y.value?(i(),f(`span`,Pe,[(i(),_(s(J.value),{size:22,color:`#ffffff`}))])):d(``,!0),q.value.headline?(i(),f(`h2`,Fe,o(q.value.headline),1)):d(``,!0)])):q.value.headline?(i(),f(`h2`,Ie,o(q.value.headline),1)):d(``,!0),q.value.tagline?(i(),f(`p`,Le,o(q.value.tagline),1)):d(``,!0),q.value.ctaLabel?(i(),f(`button`,{key:4,type:`button`,class:`cat-banner__cta`,onClick:ot},o(q.value.ctaLabel),1)):d(``,!0)]),J.value&&!Y.value?(i(),f(`span`,Re,[(i(),_(s(J.value),{size:26,color:`#ffffff`}))])):d(``,!0)],6),H.value?(i(),f(`div`,ze,[h(`div`,{class:`chips`,role:`tablist`,"aria-label":lt.value},[ct.value===`season`?(i(),f(m,{key:0},[h(`button`,{type:`button`,class:t([`chip`,{"chip--active":!j.value}]),onClick:c[7]||=e=>pt(``)},` همه `,2),(i(!0),f(m,null,n(v(T).seasonCategories,e=>(i(),f(`button`,{key:e.id,type:`button`,class:t([`chip`,{"chip--active":j.value===e.id}]),onClick:t=>pt(e.id)},o(e.title),11,Ve))),128))],64)):(i(),f(m,{key:1},[h(`button`,{type:`button`,class:t([`chip`,{"chip--active":!O.value}]),onClick:c[8]||=e=>mt(``)},` همه `,2),(i(!0),f(m,null,n(v(T).usageCategories,e=>(i(),f(`button`,{key:e.id,type:`button`,class:t([`chip`,{"chip--active":O.value===e.id}]),onClick:t=>mt(e.id)},o(e.title),11,He))),128))],64))],8,Be)])):d(``,!0),h(`div`,Ue,[h(`span`,null,`تعداد محصولات: `+o(X.value.length.toLocaleString(`fa-IR`)),1),h(`button`,{type:`button`,class:`list-meta__sort`,"aria-label":dt.value,onClick:ut},[...c[14]||=[ee(`<span class="list-meta__sort-icon" aria-hidden="true" data-v-71e80086><svg width="15" height="12" viewBox="0 0 15 12" fill="none" xmlns="http://www.w3.org/2000/svg" data-v-71e80086><path d="M4.5 2.5V9.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" data-v-71e80086></path><path d="M2.5 7.5L4.5 9.5L6.5 7.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" data-v-71e80086></path><path d="M10.5 9.5V2.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" data-v-71e80086></path><path d="M8.5 4.5L10.5 2.5L12.5 4.5" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" data-v-71e80086></path></svg></span><span class="list-meta__sort-badge" data-v-71e80086>۱</span><span class="list-meta__sort-label" data-v-71e80086>مرتب‌سازی</span>`,3)]],8,We)]),h(`div`,Ge,[(i(!0),f(m,null,n(X.value,e=>(i(),f(`article`,{key:e.id,class:`product-item`,onClick:t=>Z(e.id)},[h(`div`,{class:`product-item__image`,style:a(e.imageUrl?{backgroundImage:`url(${e.imageUrl})`}:void 0)},null,4),h(`div`,qe,[h(`div`,Je,[h(`div`,Ye,[h(`strong`,null,o(e.name),1),e.isNew?(i(),f(`span`,Xe,`جدید`)):d(``,!0)]),h(`button`,{type:`button`,class:`bookmark`,"aria-label":v(E).isFavorite(e.id)?`حذف از علاقه‌مندی‌ها`:`افزودن به علاقه‌مندی‌ها`,"aria-pressed":v(E).isFavorite(e.id),onClick:b(t=>gt(e.id),[`stop`])},[l(_e,{size:18,filled:v(E).isFavorite(e.id),color:v(E).isFavorite(e.id)?`var(--color-primary)`:`#9ca3af`},null,8,[`filled`,`color`])],8,Ze)]),h(`ul`,Qe,[h(`li`,null,`عرض: `+o(e.widthCm.toLocaleString(`fa-IR`))+` سانتی‌متر`,1),h(`li`,null,`ترکیب: `+o(e.composition||`—`),1),h(`li`,null,`مناسب: `+o(ht(e.season)),1)]),h(`div`,$e,[(i(!0),f(m,null,n(e.colors.slice(0,6),(t,n)=>(i(),f(`span`,{key:n,class:`swatch`,style:a(v(ve)(t,e.colorImages?.[n]||e.imageUrls?.[n]))},null,4))),128))]),h(`button`,{type:`button`,class:`details-link`,onClick:b(t=>Z(e.id),[`stop`])},[c[15]||=p(` مشاهده جزئیات `,-1),l(ce,{size:14})],8,et)])],8,Ke))),128))]),X.value.length?d(``,!0):(i(),f(`p`,tt,`محصولی در این دسته یافت نشد.`))],64))])]))}}),[[`__scopeId`,`data-v-71e80086`]]);export{w as default};