Files
nademitex_user/dist/assets/ProductDetailView-7kd_faet.js
T

1 line
11 KiB
JavaScript
Raw Normal View History

import{A as e,Ct as t,Dt as n,Et as r,J as i,L as a,N as o,O as s,P as c,Q as l,R as u,X as d,_ as ee,g as te,ht as f,j as p,n as ne,nt as re,wt as m,z as h}from"./BasicIcon-Bnxm-DKk.js";import{o as g}from"./format-C72AoJ2H.js";import{t as ie}from"./catalog-B2Z_WZGF.js";import{A as ae,O as _,l as oe}from"./index-DB4cQnln.js";import{t as se}from"./IconChevronBack-DguSlPDK.js";import{t as ce}from"./PageSkeleton-CpZ7eT1v.js";import{t as v}from"./IconShare-DtutVVj1.js";import{a as le,o as ue,t as de}from"./crm-CZ7XH3z9.js";import{t as fe}from"./useGoBack-Ds4z3swU.js";import{n as y,t as pe}from"./colorSwatch-BgOH1LE5.js";import{t as me}from"./IconShoppingBag-kdnOLLiZ.js";import{t as b}from"./quick-catalog-request-Di7-t6Ua.js";import{t as x}from"./IconHeart-CiwVmqRC.js";var he={key:0,class:`page product-detail product-page`},ge={class:`pd-header mobile-only`},_e={class:`pd-header__actions`},ve=[`aria-label`,`aria-pressed`],ye={class:`desktop-page__head desktop-only pd-desk-head`},be={class:`desktop-page__title`},xe={class:`desktop-page__subtitle`},S={class:`pd-desk-head__actions`},C=[`aria-label`,`aria-pressed`],w={class:`page__scroll pd-scroll product-page__scroll`},T={class:`product-page__layout`},E={class:`product-page__main`},D={class:`gallery`},O={class:`gallery__count`},k={class:`gallery__thumbs`},A=[`onClick`],j={class:`pd-body`},M={class:`title-row`},Se={key:0,class:`new-badge`},Ce={class:`code`},we={class:`specs`},Te={class:`spec-cell`},Ee={class:`spec-cell`},De={class:`spec-cell`},Oe={class:`spec-icon`,"aria-hidden":`true`},ke={class:`spec-cell`},Ae={key:0,class:`specs-extra`},je={class:`pd-section pd-section--boxed`},Me={class:`section-head`},Ne={class:`colors`},Pe=[`onClick`],Fe={class:`pd-section`},Ie={class:`tags`,role:`list`},Le=[`onClick`],Re={class:`pd-section`},ze={class:`roll-field`},Be={class:`product-page__sidebar desktop-only`},N={class:`cart-summary-panel`},Ve={class:`cart-summary-panel__row`},He={class:`cart-summary-panel__row`},Ue={class:`cart-summary-panel__btn`},We=[`disabled`],Ge=[`src`],Ke={class:`pd-footer mobile-only sticky-footer`},qe={class:`pd-footer__primary`},Je=[`disabled`],Ye={class:`min-note`},Xe=[`src`],Ze={key:1,class:`page empty`},Qe={key:2,class:`page empty`},P=ne(h({__name:`ProductDetailView`,setup(ne){let h={suit:`پارچه کت‌شلواری`,trousers:`پارچه شلواری`,shirt:`پارچه پیراهنی`},P={summer:`پارچه تابستانه`,winter:`پارچه زمستانه`,all_season:`پارچه چهارفصل`},$e=te(),F=ee(),{goBack:I}=fe(`/products`),et=de(),L=oe(),tt=ae(),nt=ie(),R=e(()=>String($e.query.id??``)),z=f(null),B=f(!0),V=f(null),H=f(0),U=f(1),W=f(!1),G=f(!1),K=e(()=>z.value?.rollMeters??50),q=e(()=>{let e=z.value;return e?pe(e.colors,e.colorImages,e.imageUrls,H.value,e.imageUrl):``}),rt=e(()=>z.value?.colors[H.value]??``),J=e(()=>U.value*K.value),it=e(()=>{let e=z.value?.minMeterage;return e&&e>0?e:K.value}),Y=e(()=>Math.max(1,Math.ceil(it.value/K.value))),at=e(()=>h[z.value?.categoryId??``]||`—`),ot=e(()=>P[z.value?.season??``]||`—`),st=e(()=>{let e=z.value;if(!e)return[];let t=[],n=ue.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=le.some(t=>t.id===e.season)?e.season:``,a=i?P[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 X(){if(!R.value){z.value=null,B.value=!1;return}B.value=!0,V.value=null;try{await Promise.all([L.hydrate(),nt.loadCompanies()]),z.value=await et.loadProductById(R.value),H.value=0,U.value=Y.value}catch(e){z.value=null,V.value=e instanceof Error?e.message:`محصول یافت نشد.`}finally{B.value=!1}}i(X),re(R,X);function ct(e){let t=e.rollMeters||50,n=e.orderMultiplier&