1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
import{At as e,D as t,F as n,G as r,M as i,Nt as a,Pt as o,U as s,_ as c,c as l,d as u,f as d,g as f,i as p,k as ee,l as m,nt as h,o as g,t as _,u as v,ut as y,v as b}from"./_plugin-vue_export-helper-1xMDlcEE.js";import{u as te}from"./BasicIcon-ba1FsUKx.js";import{o as x}from"./format-BHJptHdF.js";import{t as S}from"./catalog-DvXpKfLO.js";import{A as C,E as w,O as T,k as E,r as D,u as O}from"./index-CpQ4kL4n.js";import{t as k}from"./IconChevronBack-DytWz6TD.js";import{t as ne}from"./PageSkeleton-DYdjm4l9.js";import{a as re,o as ie,t as ae}from"./crm-BPBlQFWp.js";import{n as oe,r as se,t as ce}from"./IconWeave-CTypFxhM.js";import{t as le}from"./useGoBack-CmDcQElX.js";import{t as ue}from"./useTouchSwipe-C8fUyAcQ.js";import{t as A}from"./IconHeart-CvzbNH_T.js";import{n as de,t as fe}from"./AddressCompletionModal-BwpNpInM.js";import{n as pe,t as j}from"./colorSwatch-CCSfH9o4.js";var me=[`width`,`height`],he=[`stroke`],M=[`stroke`],N=[`stroke`],P=b({__name:`IconShare`,props:{size:{default:20},color:{default:`#9AA3AF`}},setup(e){return(t,n)=>(i(),d(`svg`,{width:e.size,height:e.size,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`},[m(`path`,{d:`M12 3.5v11`,stroke:e.color,"stroke-width":`1.5`,"stroke-linecap":`round`},null,8,he),m(`path`,{d:`M8.25 7 12 3.25 15.75 7`,stroke:e.color,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,M),m(`path`,{d:`M6.5 11.5v7.25c0 .97.78 1.75 1.75 1.75h7.5c.97 0 1.75-.78 1.75-1.75V11.5`,stroke:e.color,"stroke-width":`1.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},null,8,N)],8,me))}}),F={class:`dialog card product-order-modal`},I={class:`product-order-modal__head`},L={class:`product-order-modal__rows`},R={class:`product-order-row__color`},z=[`title`],B={key:0,class:`product-order-row__label`},V={class:`product-order-row__stepper`},H=[`disabled`,`onClick`],U={class:`product-order-row__qty`},W=[`disabled`,`onClick`],G={key:0,class:`product-order-modal__error`},K={class:`product-order-modal__footer`},q={class:`product-order-modal__prices`},ge={key:0,class:`product-order-modal__price`},_e={class:`product-order-modal__price`},J={key:0},Y={key:1},X={key:2},Z={key:0,class:`product-order-modal__hint`},ve=_(b({__name:`ProductOrderModal`,props:{open:{type:Boolean},product:{},rollMeters:{},minRolls:{},basePrice:{},loading:{type:Boolean},error:{}},emits:[`close`,`submit`],setup(e,{emit:ee}){let _=e,b=ee,S=h([]);s(()=>[_.open,_.product?.colors.length],([e])=>{!e||!_.product||(S.value=_.product.colors.map(()=>0))});let C=l(()=>S.value.reduce((e,t)=>e+(t>0?t:0),0)),w=l(()=>C.value*_.rollMeters),T=l(()=>!_.basePrice||w.value<=0?null:_.basePrice*w.value);function E(e){e.key===`Escape`&&_.open&&b(`close`)}s(()=>_.open,e=>{document.body.style.overflow=e?`hidden`:``,e?window.addEventListener(`keydown`,E):window.removeEventListener(`keydown`,E)},{immediate:!0}),t(()=>{document.body.style.overflow=``,window.removeEventListener(`keydown`,E)});function O(e,t){let n=[...S.value];n[e]=Math.max(0,(n[e]??0)+t),S.value=n}function k(){b(`submit`,[...S.value])}return(t,s)=>(i(),v(g,{to:`body`},[e.open&&e.product?(i(),d(`div`,{key:0,class:`dialog-overlay product-order-overlay`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`product-order-title`,onClick:s[1]||=te(e=>b(`close`),[`self`])},[m(`div`,F,[m(`header`,I,[s[2]||=m(`h3`,{id:`product-order-title`,class:`product-order-modal__title`},`ثبت سفارش`,-1),m(`button`,{type:`button`,class:`product-order-modal__close`,"aria-label":`بستن`,onClick:s[0]||=e=>b(`close`)},` × `)]),s[5]||=m(`div`,{class:`product-order-modal__table-head`,"aria-hidden":`true`},[m(`span`,null,`رنگ`),m(`span`,null,`طاقه`)],-1),m(`ul`,L,[(i(!0),d(p,null,n(e.product.colors,(t,n)=>(i(),d(`li`,{key:n,class:`product-order-row`},[m(`div`,R,[m(`span`,{class:`product-order-row__swatch`,style:a(y(j)(t,y(pe)(e.product.colorImages,e.product.colorVariantImages,n))),title:t},null,12,z),t?(i(),d(`span`,B,o(t),1)):u(``,!0)]),m(`div`,V,[m(`button`,{type:`button`,class:`product-order-row__btn`,"aria-label":`کاهش`,disable
|