Files
nademitex_user/dist/assets/CatalogDetailView-CMyOKjOQ.js
T
2026-09-14 16:59:21 +03:30

1 line
12 KiB
JavaScript

import{A as e,Ct as t,D as n,Et as r,I as i,L as a,M as ee,N as o,O as s,P as c,R as l,St as u,Tt as d,Y as f,Z as p,_ as m,g as te,j as h,mt as g,n as ne,q as re,t as ie,tt as ae,z as _}from"./BasicIcon-C6boaehV.js";import{o as v}from"./format-BHJptHdF.js";import{t as oe}from"./catalog-s7nVUdlj.js";import{T as se,l as ce,o as le}from"./index-B6MlTGUp.js";import{t as ue}from"./IconChevronBack-DORV2H0q.js";import{t as de}from"./PageSkeleton-uO-jhbNm.js";import{t as fe}from"./IconShare-1kao-fAR.js";import{t as pe}from"./crm-CtglbPsN.js";import{t as me}from"./useGoBack-CgNp0uP9.js";import{i as he,o as ge,r as _e,t as y}from"./catalogGallery-DMNB35I1.js";import{n as ve}from"./colorSwatch-BgOH1LE5.js";var b=[{id:`demo-milano`,companyId:``,name:`میلانو`,title:`کالیته میلانو`,latinName:`Milano`,subtitle:`پارچه‌های کت‌وشلواری`,imageUrl:`/assets/milano-DWfm45LN.jpg`,patternCount:16,badge:`new`,season:`all_season`,isNew:!0,isPopular:!1},{id:`demo-najran`,companyId:``,name:`نجران`,title:`کالیته نجران`,latinName:`Najran`,subtitle:`پارچه‌های پیراهنی`,imageUrl:`/assets/najran-BcpOdgRK.jpg`,patternCount:14,season:`all_season`,isNew:!1,isPopular:!1},{id:`demo-payizeh`,companyId:``,name:`پاییزه`,title:`کالیته پاییزه`,latinName:`Payizeh`,subtitle:`پارچه‌های شلواری`,imageUrl:`/assets/payizeh-CeElyeeF.jpg`,patternCount:18,season:`all_season`,isNew:!1,isPopular:!1},{id:`demo-classic`,companyId:``,name:`کلاسیک`,title:`کالیته کلاسیک`,latinName:`Classic`,subtitle:`پارچه‌های کت‌وشلواری`,imageUrl:`/assets/classic-DiIciTEG.jpg`,patternCount:16,season:`all_season`,isNew:!1,isPopular:!1},{id:`demo-tarhdar`,companyId:``,name:`طرح‌دار`,title:`کالیته طرح‌دار`,latinName:`Tarhdar`,subtitle:`پارچه‌های مجلسی`,imageUrl:`/assets/tarhdar-ryfL3rgV.jpg`,patternCount:20,badge:`popular`,season:`winter`,isNew:!1,isPopular:!0},{id:`demo-fastoni`,companyId:``,name:`فاستونی`,title:`کالیته فاستونی`,latinName:`Fastoni`,subtitle:`پارچه‌های مناسب چهار فصل`,imageUrl:`/assets/fastoni-BdaZFVHx.jpg`,patternCount:20,season:`all_season`,isNew:!1,isPopular:!1}];function x(e){return b.find(t=>t.id===e)}function S(e){let t=[`${e.name} ۱۰۱`,`${e.name} ۱۰۲`,`${e.name} ۱۰۳`,`${e.name} ۱۰۴`],n=[`plain`,`melange`,`patterned`,`plain`];return t.map((t,r)=>({id:`${e.id}-${r+1}`,name:t,code:`${e.latinName||e.name}-${101+r}`,categoryId:e.subtitle.includes(`پیراهن`)?`shirt`:e.subtitle.includes(`شلوار`)?`trousers`:`suit`,season:e.season,widthCm:150,composition:`پشم و پلی‌استر`,weaveType:n[r]===`plain`?`ساده`:n[r]===`melange`?`ملانژ`:`طرح‌دار`,colors:[`#111827`,`#6b7280`,`#d6d3d1`,`#1e3a5f`].slice(0,3+r%2),tags:[n[r]===`patterned`?`طرح‌دار`:n[r]===`melange`?`ملانژ`:`ساده`],isNew:r===0,imageUrl:e.imageUrl,subtitle:e.subtitle,rollMeters:50}))}var C={class:`page calite-detail`},w={class:`page__scroll page__scroll--with-nav calite-detail__scroll`},T={class:`calite-hero`},E={class:`calite-hero__nav`},D={key:0,class:`calite-hero__copy`},O={class:`calite-hero__usage`},k={key:0,class:`calite-hero__latin`},A={class:`calite-hero__tagline`},j={class:`calite-detail__body`},M={key:1,class:`calite-detail__error`},N={class:`attr-row`},P={class:`attr`},F={class:`attr`},ye={class:`physical-cta__icon`,"aria-hidden":`true`},be={class:`physical-cta__chevron`,"aria-hidden":`true`},xe={class:`pattern-tabs`,role:`tablist`,"aria-label":`نوع طرح`},Se=[`onClick`],Ce={class:`pattern-grid`},we=[`onClick`],Te=[`aria-pressed`,`aria-label`,`onClick`],Ee={viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,"aria-hidden":`true`},De=[`fill`],Oe={class:`pattern-card__meta`},I={class:`pattern-card__colors`},ke={class:`swatches`},Ae={key:0,class:`calite-detail__error`},je={key:0,class:`sticky-footer calite-detail__footer`},Me=[`disabled`],Ne={key:1,class:`toast`},L=ne(_({__name:`CatalogDetailView`,setup(ne){let _=te(),b=m(),{goBack:L}=me(`/catalogs`),R=oe(),Pe=pe(),Fe=se(),z=ce(),B=e(()=>String(_.params.catalogId??``)),V=g(null),H=g([]),U=g(!0),W=g(null),G=g(!1),K=g(``),q=g(`all`),J=e(()=>_e(V.value?.name||`کالیته`)),Y=e(()=>V.value?.imageUrl||(V.value?x(V.value.id)?.imageUrl:void 0)||H.value.find(e=>e.imageUrl)?.imageUrl),X=e(()=>{let e=V.value?x(V.value.id):void 0;return e?.latinName?e.latinName:V.value?he(V.value):``}),Ie=e(()=>{let e=V.value?x(V.value.id):void 0;if(e?.subtitle)return e.subtitle;let t=H.value[0]?.categoryId;return t===`trousers`?`پارچه‌های شلواری`:t===`shirt`?`پارچه‌های پیراهنی`:`پارچه‌های کت‌وشلواری`}),Z=e(()=>ge(H.value)),Q=e(()=>q.value===`all`?Z.value:Z.value.filter(e=>e.kind===q.value)),Le=e(()=>{let e=V.value?x(V.value.id):void 0;if(e)return y[e.season];let t={};for(let e of H.value)t[e.season]=(t[e.season]??0)+1;let n=Object.entries(t).sort((e,t)=>t[1]-e[1])[0]?.[0];return n?y[n]:y.all_season}),Re=e(()=>[{id:`all`,label:`همه طرح‌ها`,count:Z.value.length},{id:`plain`,label:`ساده`,count:Z.value.filter(e=>e.kind===`plain`).length},{id:`melange`,label:`ملانژ`,count:Z.value.filter(e=>e.kind===`melange`).length},{id:`patterned`,label:`طرح‌دار`,count:Z.value.filter(e=>e.kind===`patterned`).length}]);async function $(){U.value=!0,W.value=null,V.value=null,H.value=[],q.value=`all`;try{let e=await R.loadCompanies();R.getCatalog(B.value)||await Promise.all(e.map(e=>R.loadCatalogs(e.id))),V.value=R.getCatalog(B.value)??null;let t=x(B.value);if(!V.value&&t){V.value={id:t.id,companyId:``,name:t.name,code:t.latinName||t.name,description:`ترکیبی از اصالت، کیفیت و استایل مدرن`,displayOrder:0,isActive:!0},H.value=S(t);return}if(!V.value){W.value=`کالیته مورد نظر یافت نشد.`;return}H.value=await Pe.loadBrowseProducts({catalogId:V.value.id,companyId:V.value.companyId}),!H.value.length&&t&&(H.value=S(t))}catch(e){W.value=e instanceof Error?e.message:`بارگذاری کالیته ناموفق بود.`}finally{U.value=!1}}re(async()=>{await z.hydrate(),await $()}),ae(B,$);function ze(e){e.startsWith(`demo-`)||b.push({path:`/product`,query:{id:e}})}function Be(e){z.toggle(e)}function Ve(){b.push({path:`/catalog-request`,query:{catalogId:B.value}})}function He(){let e=window.location.href;if(navigator.share){navigator.share({title:J.value,url:e}).catch(()=>void 0);return}navigator.clipboard?.writeText(e)}function Ue(e){return{id:e.id,companyId:e.companyId||V.value?.companyId||``,catalogId:e.catalogId||B.value,name:e.name,code:e.code,color:e.color||e.colors[0]||`—`,minMeterage:e.minMeterage??30,orderMultiplier:e.orderMultiplier??10,basePrice:e.basePrice,isActive:!0}}async function We(){if(!H.value.length||G.value)return;G.value=!0,K.value=``;let e=0,t=``;try{for(let n of H.value){let r=Ue(n),i=await Fe.addItem(r,V.value?.code||n.catalogCode||n.code,r.minMeterage);i.success?e+=1:t=i.message||t}K.value=e?`${v(e)} طرح به سبد استعلام اضافه شد.`:t||`افزودن به سبد ناموفق بود.`,e&&window.setTimeout(()=>b.push(`/cart`),650)}finally{G.value=!1}}return(e,m)=>(f(),c(`div`,C,[h(`div`,w,[h(`section`,T,[h(`div`,{class:`calite-hero__photo`,style:d(Y.value?{backgroundImage:`url(${Y.value})`}:void 0)},null,4),h(`header`,E,[h(`button`,{type:`button`,class:`icon-btn`,"aria-label":`بازگشت`,onClick:m[0]||=(...e)=>u(L)&&u(L)(...e)},[l(ue,{size:22,color:`#ffffff`})]),h(`h1`,null,r(U.value?`کالیته`:J.value),1),h(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اشتراک‌گذاری`,onClick:He},[l(fe,{size:20,color:`#ffffff`})])]),!U.value&&!W.value?(f(),c(`div`,D,[h(`h2`,null,r(J.value),1),h(`p`,O,r(Ie.value),1),X.value?(f(),c(`strong`,k,r(X.value),1)):o(``,!0),h(`span`,A,r(V.value?.description||`ترکیبی از اصالت، کیفیت و استایل مدرن`),1)])):o(``,!0)]),h(`div`,j,[U.value?(f(),ee(de,{key:0,variant:`cards`,rows:5})):W.value?(f(),c(`p`,M,r(W.value),1)):(f(),c(s,{key:2},[h(`div`,N,[h(`span`,P,[m[1]||=h(`svg`,{class:`attr__icon`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[h(`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),h(`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`}),h(`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`})],-1),a(` `+r(u(v)(Z.value.length))+` طرح `,1)]),h(`span`,F,[m[2]||=h(`svg`,{class:`attr__icon`,viewBox:`0 0 24 24`,fill:`none`,"aria-hidden":`true`},[h(`circle`,{cx:`12`,cy:`12`,r:`4`,stroke:`currentColor`,"stroke-width":`1.5`}),h(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`})],-1),a(` `+r(Le.value),1)]),m[3]||=i(`<span class="attr" data-v-e342d3a5><svg class="attr__icon" viewBox="0 0 24 24" fill="none" aria-hidden="true" data-v-e342d3a5><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" data-v-e342d3a5></path></svg> پرطرفدار </span><span class="attr" data-v-e342d3a5><svg class="attr__icon" viewBox="0 0 24 24" fill="none" aria-hidden="true" data-v-e342d3a5><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z" stroke="currentColor" stroke-width="1.5" stroke-linejoin="round" data-v-e342d3a5></path></svg> کیفیت ممتاز </span>`,2)]),h(`button`,{type:`button`,class:`physical-cta`,onClick:Ve},[h(`span`,ye,[l(ie,{icon:`vuesax-linear:truck-time`,size:20,color:`#ffffff`})]),m[4]||=a(` درخواست دریافت فیزیکی کالیته `,-1),h(`span`,be,[l(le,{size:18,color:`#ffffff`})])]),h(`div`,xe,[(f(!0),c(s,null,p(Re.value,e=>(f(),c(`button`,{key:e.id,type:`button`,class:t([`pattern-tab`,{"is-on":q.value===e.id}]),onClick:t=>q.value=e.id},[a(r(e.label),1),e.id===`all`?(f(),c(s,{key:0},[a(` (`+r(u(v)(e.count))+`)`,1)],64)):o(``,!0)],10,Se))),128))]),h(`div`,Ce,[(f(!0),c(s,null,p(Q.value,e=>(f(),c(`article`,{key:e.id,class:`pattern-card`,onClick:t=>ze(e.id)},[h(`div`,{class:`pattern-card__photo`,style:d(e.imageUrl?{backgroundImage:`url(${e.imageUrl})`}:void 0)},[h(`button`,{type:`button`,class:`pattern-card__fav`,"aria-pressed":u(z).isFavorite(e.id),"aria-label":u(z).isFavorite(e.id)?`حذف از علاقه‌مندی‌ها`:`افزودن به علاقه‌مندی‌ها`,onClick:n(t=>Be(e.id),[`stop`])},[(f(),c(`svg`,Ee,[h(`path`,{d:`M12.1 20.3s-6.6-4.1-8.4-8.1c-1.4-3.1.1-6.7 3.4-7.5 1.9-.5 3.7.3 4.9 1.8 1.2-1.5 3-2.3 4.9-1.8 3.3.8 4.8 4.4 3.4 7.5-1.8 4-8.2 8.1-8.2 8.1Z`,fill:u(z).isFavorite(e.id)?`var(--color-primary)`:`none`,stroke:`var(--color-primary)`,"stroke-width":`1.5`,"stroke-linejoin":`round`},null,8,De)]))],8,Te)],4),h(`div`,Oe,[h(`strong`,null,r(e.name),1),h(`div`,I,[h(`span`,null,r(u(v)(e.colorCount))+` رنگ`,1),h(`div`,ke,[(f(!0),c(s,null,p(e.colors,(t,n)=>(f(),c(`i`,{key:n,style:d(u(ve)(t,e.colorImages[n]))},null,4))),128))])])])],8,we))),128))]),Q.value.length?o(``,!0):(f(),c(`p`,Ae,`طرحی در این دسته نیست.`))],64))])]),!U.value&&H.value.length?(f(),c(`div`,je,[h(`button`,{type:`button`,class:`inquiry-bar`,disabled:G.value,onClick:We},[a(r(G.value?`در حال افزودن...`:`افزودن همه به سبد استعلام`)+` `,1),h(`small`,null,r(u(v)(Z.value.length))+` طرح انتخاب می‌شود`,1)],8,Me)])):o(``,!0),K.value?(f(),c(`p`,Ne,r(K.value),1)):o(``,!0)]))}}),[[`__scopeId`,`data-v-e342d3a5`]]);export{L as default};