Files
nademitex_user/dist/assets/ProductDetailView-BUGwmJWw.js
T
safavimohadeseh78 418039303c Fix production build and refresh dist output.
Restore catalog cover assets, resolve TypeScript issues in TimeInput and catalogGallery, and rebuild the production bundle.
2026-09-15 21:47:31 +03:30

1 line
8.9 KiB
JavaScript

import{A as e,Ct as t,Et as n,L as r,N as i,O as a,P as o,R as s,St as c,Tt as l,Y as u,Z as d,_ as f,g as ee,j as p,mt as m,n as te,q as ne,tt as re,z as h}from"./BasicIcon-C6boaehV.js";import{o as g}from"./format-BHJptHdF.js";import{t as ie}from"./catalog-s7nVUdlj.js";import{C as ae,T as oe,l as se}from"./index-fdhs4HNc.js";import{t as ce}from"./IconChevronBack-DORV2H0q.js";import{t as le}from"./PageSkeleton-sKuEY4NI.js";import{t as ue}from"./IconShare-1kao-fAR.js";import{a as de,o as fe,t as pe}from"./crm-DmqasSZ_.js";import{t as me}from"./useGoBack-CgNp0uP9.js";import{n as _,t as he}from"./colorSwatch-BgOH1LE5.js";import{t as ge}from"./IconShoppingBag-Bq21_Txe.js";import{t as _e}from"./quick-catalog-request-Di7-t6Ua.js";import{t as ve}from"./IconHeart-CZMe29Nz.js";var v={key:0,class:`page product-detail`},y={class:`pd-header`},b={class:`pd-header__actions`},x=[`aria-label`,`aria-pressed`],S={class:`page__scroll pd-scroll`},C={class:`gallery`},w={class:`gallery__count`},T={class:`gallery__thumbs`},E=[`onClick`],D={class:`pd-body`},O={class:`title-row`},k={key:0,class:`new-badge`},A={class:`code`},j={class:`specs`},M={class:`spec-cell`},N={class:`spec-cell`},P={class:`spec-cell`},F={class:`spec-icon`,"aria-hidden":`true`},ye={class:`spec-cell`},be={key:0,class:`specs-extra`},xe={class:`pd-section pd-section--boxed`},Se={class:`section-head`},Ce={class:`colors`},we=[`onClick`],Te={class:`pd-section`},Ee={class:`tags`,role:`list`},De=[`onClick`],Oe={class:`pd-section`},ke={class:`roll-field`},Ae={class:`pd-footer`},je={class:`pd-footer__primary`},Me=[`disabled`],Ne={class:`min-note`},Pe=[`src`],Fe={key:1,class:`page empty`},Ie={key:2,class:`page empty`},I=te(h({__name:`ProductDetailView`,setup(te){let h={suit:`پارچه کت‌شلواری`,trousers:`پارچه شلواری`,shirt:`پارچه پیراهنی`},I={summer:`پارچه تابستانه`,winter:`پارچه زمستانه`,all_season:`پارچه چهارفصل`},Le=ee(),L=f(),{goBack:R}=me(`/products`),Re=pe(),z=se(),ze=oe(),Be=ie(),B=e(()=>String(Le.query.id??``)),V=m(null),H=m(!0),U=m(null),W=m(0),G=m(1),K=m(!1),q=m(!1),J=e(()=>V.value?.rollMeters??50),Y=e(()=>{let e=V.value;return e?he(e.colors,e.colorImages,e.imageUrls,W.value,e.imageUrl):``}),Ve=e(()=>V.value?.colors[W.value]??``),X=e(()=>G.value*J.value),He=e(()=>{let e=V.value?.minMeterage;return e&&e>0?e:J.value}),Z=e(()=>Math.max(1,Math.ceil(He.value/J.value))),Q=e(()=>h[V.value?.categoryId??``]||`—`),Ue=e(()=>I[V.value?.season??``]||`—`),We=e(()=>{let e=V.value;if(!e)return[];let t=[],n=fe.some(t=>t.id===e.categoryId)?e.categoryId:``,r=n?h[n]:``;r&&t.push({key:`usage-${n}`,label:r,to:{path:`/products`,query:{categoryId:n}}});let i=de.some(t=>t.id===e.season)?e.season:``,a=i?I[i]:``;a&&t.push({key:`season-${i}`,label:a,to:{path:`/products`,query:{season:i}}});let o=new Set(t.flatMap(e=>[e.label,e.label.replace(/^پارچه\s*/,``)]));for(let n of e.tags){let e=n.replace(/^پارچه‌?های?\s*/,``).trim();if(!e||o.has(e)||t.some(t=>t.label.includes(e)))continue;let r=n.startsWith(`پارچه`)?n:`پارچه ${e}`;o.add(e),t.push({key:`tag-${n}`,label:r})}return t});async function $(){if(!B.value){V.value=null,H.value=!1;return}H.value=!0,U.value=null;try{await Promise.all([z.hydrate(),Be.loadCompanies()]),V.value=await Re.loadProductById(B.value),W.value=0,G.value=Z.value}catch(e){V.value=null,U.value=e instanceof Error?e.message:`محصول یافت نشد.`}finally{H.value=!1}}ne($),re(B,$);function Ge(e){let t=e.rollMeters||50,n=e.orderMultiplier&&e.orderMultiplier>0?e.orderMultiplier:t,r=e.minMeterage&&e.minMeterage>0?e.minMeterage:t;return{id:e.id,companyId:e.companyId||``,catalogId:e.catalogId||``,name:e.name,code:e.code,color:e.color||e.colors[W.value]||`—`,minMeterage:r,orderMultiplier:n,basePrice:e.basePrice,isActive:!0}}function Ke(e,t,n){let r=t>0?t:1,i=Math.ceil(e/r)*r,a=Math.ceil(n/r)*r;return Math.max(i,a)}async function qe(){if(!V.value)return;let e=Ge(V.value);K.value=!0;try{let t=Ke(X.value,e.orderMultiplier,e.minMeterage);await ze.addItem(e,V.value.catalogCode||V.value.code,t)}finally{K.value=!1}}function Je(){V.value&&z.toggle(V.value.id)}function Ye(){let e=window.location.href;if(navigator.share){navigator.share({title:V.value?.name,url:e}).catch(()=>void 0);return}navigator.clipboard?.writeText(e)}return(e,f)=>V.value?(u(),o(`div`,v,[p(`header`,y,[p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`بازگشت`,onClick:f[0]||=(...e)=>c(R)&&c(R)(...e)},[s(ce,{size:20})]),p(`div`,b,[p(`button`,{type:`button`,class:`icon-btn`,"aria-label":c(z).isFavorite(V.value.id)?`حذف از علاقه‌مندی‌ها`:`افزودن به علاقه‌مندی‌ها`,"aria-pressed":c(z).isFavorite(V.value.id),onClick:Je},[s(ve,{size:20,filled:c(z).isFavorite(V.value.id),color:c(z).isFavorite(V.value.id)?`#0a353c`:void 0},null,8,[`filled`,`color`])],8,x),p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`اشتراک‌گذاری`,onClick:Ye},[s(ue,{size:20})])])]),p(`div`,S,[p(`div`,C,[p(`div`,{class:`gallery__main`,style:l(Y.value?{backgroundImage:`url(${Y.value})`,backgroundSize:`cover`,backgroundPosition:`center`}:c(_)(Ve.value))},[p(`span`,w,n(c(g)(W.value+1))+`/`+n(c(g)(Math.max(V.value.colors.length,1))),1)],4),p(`div`,T,[(u(!0),o(a,null,d(V.value.colors,(e,n)=>(u(),o(`button`,{key:n,type:`button`,class:t([`thumb`,{"thumb--active":W.value===n}]),onClick:e=>W.value=n},[p(`span`,{class:`thumb__swatch`,style:l(c(_)(e,V.value.colorImages?.[n]||V.value.imageUrls?.[n]))},null,4)],10,E))),128))])]),p(`div`,D,[p(`div`,O,[p(`h1`,null,n(V.value.name),1),V.value.isNew?(u(),o(`span`,k,`جدید`)):i(``,!0)]),p(`p`,A,`کد محصول: `+n(V.value.code),1),p(`div`,j,[p(`div`,M,[f[4]||=p(`span`,{class:`spec-icon`,"aria-hidden":`true`},[p(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.6`},[p(`rect`,{x:`4`,y:`8`,width:`16`,height:`8`,rx:`2`})])],-1),f[5]||=p(`span`,null,`عرض`,-1),p(`strong`,null,n(c(g)(V.value.widthCm))+` سانتی‌متر`,1)]),p(`div`,N,[f[6]||=p(`span`,{class:`spec-icon`,"aria-hidden":`true`},[p(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.6`},[p(`path`,{d:`M12 3.5 20 8v8l-8 4.5L4 16V8l8-4.5Z`})])],-1),f[7]||=p(`span`,null,`جنس`,-1),p(`strong`,null,n(V.value.composition||`—`),1)]),p(`div`,P,[p(`span`,F,[s(ge,{size:22,color:`#98a2ad`})]),f[8]||=p(`span`,null,`وزن`,-1),p(`strong`,null,n(V.value.weightGrams?`${c(g)(V.value.weightGrams)} گرم`:`—`),1)]),p(`div`,ye,[f[9]||=p(`span`,{class:`spec-icon`,"aria-hidden":`true`},[p(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.6`},[p(`circle`,{cx:`12`,cy:`12`,r:`8`}),p(`path`,{d:`M12 8a6 6 0 0 1 0 8`})])],-1),f[10]||=p(`span`,null,`نوع بافت`,-1),p(`strong`,null,n(V.value.weaveType||`—`),1)])]),p(`button`,{type:`button`,class:`specs-more`,onClick:f[1]||=e=>q.value=!q.value},[r(n(q.value?`بستن مشخصات`:`مشاهده همه مشخصات`)+` `,1),(u(),o(`svg`,{class:t([`specs-more__chevron`,{"is-open":q.value}]),viewBox:`0 0 12 12`,"aria-hidden":`true`},[...f[11]||=[p(`path`,{d:`M3 4.5 6 8l3-3.5`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`},null,-1)]],2))]),q.value?(u(),o(`div`,be,[p(`p`,null,`فصل: `+n(Ue.value),1),p(`p`,null,`دسته: `+n(Q.value),1),p(`p`,null,`جمع سفارش: `+n(c(g)(X.value))+` متر`,1)])):i(``,!0),p(`section`,xe,[p(`div`,Se,[f[12]||=p(`h2`,null,`رنگ‌بندی`,-1),p(`span`,null,`(`+n(c(g)(V.value.colors.length))+` رنگ موجود)`,1)]),p(`div`,Ce,[(u(!0),o(a,null,d(V.value.colors,(e,n)=>(u(),o(`button`,{key:n,type:`button`,class:t([`color-dot`,{"color-dot--active":W.value===n}]),style:l(c(_)(e,V.value.colorImages?.[n]||V.value.imageUrls?.[n])),onClick:e=>W.value=n},null,14,we))),128))])]),p(`section`,Te,[f[13]||=p(`h2`,{class:`section-title`},`دسته‌بندی`,-1),p(`div`,Ee,[(u(!0),o(a,null,d(We.value,e=>(u(),o(`button`,{key:e.key,type:`button`,class:t([`tag`,{"tag--link":!!e.to}]),role:`listitem`,onClick:t=>e.to&&c(L).push(e.to)},n(e.label),11,De))),128))])]),p(`section`,Oe,[f[14]||=p(`h2`,{class:`section-title`},`متراژ هر ساقه (طاقه)`,-1),p(`div`,ke,n(c(g)(V.value.rollMeters))+` متر`,1)])])]),p(`footer`,Ae,[p(`div`,je,[p(`button`,{type:`button`,class:`btn-primary`,disabled:K.value,onClick:qe},[s(ae,{size:18,color:`#ffffff`}),r(` `+n(K.value?`در حال افزودن...`:`افزودن به سفارش`),1)],8,Me),p(`p`,Ne,`حداقل سفارش: `+n(c(g)(Z.value))+` طاقه`,1)]),p(`button`,{type:`button`,class:`btn-secondary`,onClick:f[2]||=e=>c(L).push({path:`/catalog-request`,query:{productId:V.value.id}})},[p(`img`,{class:`btn-secondary__icon`,src:c(_e),alt:``,"aria-hidden":`true`},null,8,Pe),f[15]||=r(` درخواست کالیته `,-1)])])])):H.value?(u(),o(`div`,Fe,[s(le,{variant:`detail`})])):(u(),o(`div`,Ie,[p(`p`,null,n(U.value||`محصول یافت نشد.`),1),p(`button`,{type:`button`,onClick:f[3]||=e=>c(L).push(`/products`)},`بازگشت به لیست`)]))}}),[[`__scopeId`,`data-v-54dc20a3`]]);export{I as default};