import{c as a,I as ae,d as $e,n as je,O as Ae,o,b as p,w as s,p as l,h as v,t as $,F as A,e as J,i as P,Q as Me,f as w,m as V,s as me,J as Z,U as Re,r as x,q as H,R as xe,G as Ue,y as B,_ as Ce,u as Ee,x as Ne,k as qe,z as oe,A as Be,a as S,H as De,S as He,P as fe,T as Fe,E as Te,V as Ge,W as ie,l as Je}from"./index-BpoVO8sC.js";import{_ as ge}from"./ImageUploadInput.vue_vue_type_script_setup_true_lang-DFb5CG1L.js";import{A as ye}from"./AppstoreOutlined-DpD8Fmqj.js";var We={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M518.3 459a8 8 0 00-12.6 0l-112 141.7a7.98 7.98 0 006.3 12.9h73.9V856c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V613.7H624c6.7 0 10.4-7.7 6.3-12.9L518.3 459z"}},{tag:"path",attrs:{d:"M811.4 366.7C765.6 245.9 648.9 160 512.2 160S258.8 245.8 213 366.6C127.3 389.1 64 467.2 64 560c0 110.5 89.5 200 199.9 200H304c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8h-40.1c-33.7 0-65.4-13.4-89-37.7-23.5-24.2-36-56.8-34.9-90.6.9-26.4 9.9-51.2 26.2-72.1 16.7-21.3 40.1-36.8 66.1-43.7l37.9-9.9 13.9-36.6c8.6-22.8 20.6-44.1 35.7-63.4a245.6 245.6 0 0152.4-49.9c41.1-28.9 89.5-44.2 140-44.2s98.9 15.3 140 44.2c19.9 14 37.5 30.8 52.4 49.9 15.1 19.3 27.1 40.7 35.7 63.4l13.8 36.5 37.8 10C846.1 454.5 884 503.8 884 560c0 33.1-12.9 64.3-36.3 87.7a123.07 123.07 0 01-87.6 36.3H720c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h40.1C870.5 760 960 670.5 960 560c0-92.7-63.1-170.7-148.6-193.3z"}}]},name:"cloud-upload",theme:"outlined"};function be(u){for(var n=1;n[]},purpose:{default:void 0},placeholder:{default:"افزودن تصاویر گالری"}},emits:["update:modelValue"],setup(u,{emit:n}){const r=u,_=n,c=V([]),M=V(!1),R=V(""),W=()=>c.value.filter(d=>d.status==="done"&&d.url).map(d=>d.url),F=me(()=>c.value.filter(d=>d.status==="done").length),Q=me(()=>c.value.filter(d=>d.status==="uploading").length);function X(){_("update:modelValue",W())}je(()=>r.modelValue,d=>{if(JSON.stringify(W())===JSON.stringify(d??[]))return;const i=c.value.filter(f=>f.status==="uploading");c.value=[...(d??[]).map(f=>({uid:f,status:"done",url:f,percent:100})),...i]},{immediate:!0});function ee(d){return d.type.startsWith("image/")?!0:(Z.error(`«${d.name}» تصویر نیست`),Re.LIST_IGNORE)}let m=0;const E=[];function T(d){return new Promise((i,f)=>{const U=()=>{m++,d().then(i,f).finally(()=>{var L;m--,(L=E.shift())==null||L()})};mc.value.find(i=>i.uid===d);function Y({file:d}){const i=d.uid??`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;c.value.push({uid:i,status:"uploading",preview:URL.createObjectURL(d),percent:0}),T(async()=>{if(!q(i))return null;const f=new FormData;f.append("file",d),r.purpose&&f.append("purpose",r.purpose);const{data:U}=await B.post("file/create",f,{onUploadProgress:L=>{const C=q(i);C&&L.total&&(C.percent=Math.round(L.loaded/L.total*100))}});return U}).then(f=>{const U=q(i);!U||!(f!=null&&f.url)||(U.preview&&URL.revokeObjectURL(U.preview),Object.assign(U,{status:"done",url:f.url,preview:void 0,percent:100}),X())}).catch(f=>{var L,C;const U=((C=(L=f==null?void 0:f.response)==null?void 0:L.data)==null?void 0:C.message)??`بارگذاری «${d.name}» ناموفق بود`;Z.error(U),G(i)})}function G(d){const i=c.value.findIndex(U=>U.uid===d);if(i===-1)return;const[f]=c.value.splice(i,1);f.preview&&URL.revokeObjectURL(f.preview)}function N(d){G(d),X()}function D(d){R.value=d.url??d.preview??"",M.value=!0}return Ae(()=>{c.value.forEach(d=>d.preview&&URL.revokeObjectURL(d.preview))}),(d,i)=>{const f=x("a-upload-dragger"),U=x("a-progress"),L=x("a-modal");return o(),p("div",lt,[a(f,{accept:"image/*",multiple:"","show-upload-list":!1,"custom-request":Y,"before-upload":ee},{default:s(()=>[l("div",at,[a(v(ne),{class:"gallery-upload__icon"}),l("p",st,$(u.placeholder),1),i[1]||(i[1]=l("p",{class:"gallery-upload__hint"}," تصاویر را اینجا بکشید و رها کنید یا کلیک کنید — انتخاب چند تصویر به‌صورت همزمان امکان‌پذیر است ",-1))])]),_:1}),c.value.length?(o(),p("div",ot,[(o(!0),p(A,null,J(c.value,C=>(o(),p("div",{key:C.uid,class:H(["tile",{"is-uploading":C.status==="uploading"}])},[l("img",{src:C.url??C.preview,alt:""},null,8,it),C.status==="uploading"?(o(),p("div",nt,[a(U,{type:"circle",percent:C.percent,size:40,"stroke-width":8,"stroke-color":"#fff","trail-color":"rgba(255,255,255,.3)","show-info":!1},null,8,["percent"])])):(o(),p("div",rt,[l("button",{type:"button",class:"tile__btn",title:"نمایش",onClick:te=>D(C)},[a(v(xe))],8,dt),l("button",{type:"button",class:"tile__btn tile__btn--danger",title:"حذف",onClick:te=>N(C.uid)},[a(v(Ue))],8,ut)]))],2))),128))])):P("",!0),c.value.length?(o(),p("div",ct,[l("span",null,$(F.value)+" تصویر",1),Q.value?(o(),p("span",pt,[a(v(Me)),w(" در حال بارگذاری "+$(Q.value)+" تصویر… ",1)])):P("",!0)])):P("",!0),a(L,{open:M.value,footer:null,onCancel:i[0]||(i[0]=C=>M.value=!1)},{default:s(()=>[l("img",{src:R.value,style:{width:"100%"},alt:""},null,8,_t)]),_:1},8,["open"])])}}}),Oe=Ce(mt,[["__scopeId","data-v-79ab0f30"]]),ft={id:"page-user-view",class:"pf-page product-form-page"},gt={class:"pf-head"},yt={class:"pf-head__text"},bt={class:"pf-layout"},ht={class:"pf-main"},kt={class:"pf-section"},wt={class:"pf-section__head"},Ot={class:"pf-section__icon"},$t={key:0,class:"pf-section"},xt={class:"pf-section__head"},Ut={class:"pf-section__icon"},Ct={key:1,class:"table-scroll"},It=["src"],St={key:1,class:"variant-thumb variant-thumb--empty"},Pt={key:1,class:"pf-table__title"},Vt={key:0},Lt={key:1,class:"muted"},zt={key:0},jt={key:1,class:"muted"},At={key:0},Mt={key:1,class:"muted"},Rt={key:0},Et={key:1,class:"muted"},Nt={key:6,class:"pf-table__ops"},qt={class:"pf-section"},Bt={class:"pf-section__head"},Dt={class:"pf-section__icon"},Ht={class:"pf-side"},Ft={class:"pf-section"},Tt={class:"pf-section__head"},Gt={class:"pf-section__icon"},Jt={class:"pf-section"},Wt={class:"pf-section__head"},Qt={class:"pf-section__icon"},Xt={class:"pf-section"},Yt={class:"pf-section__head"},Zt={class:"pf-section__icon"},Kt={class:"pf-uploads"},el={class:"pf-actions"},tl={class:"pf-actions__hint"},ll={class:"vmodal-header"},al={class:"vmodal-header__icon"},sl={class:"vmodal-header__text"},ol={class:"vmodal-cols"},il={class:"vmodal-col"},nl={class:"vmodal-card"},rl={class:"vmodal-grid vmodal-grid--2"},dl={class:"vmodal-grid vmodal-grid--2"},ul={class:"color-opt"},cl={class:"vmodal-switches"},pl={class:"vmodal-switch-box"},_l={class:"vmodal-switch-box"},vl={class:"vmodal-card"},ml={class:"vmodal-grid vmodal-grid--2"},fl={class:"vmodal-col"},gl={class:"vmodal-card"},yl={key:0,class:"vmodal-picker"},bl=["onClick"],hl=["src"],kl={key:0,class:"vmodal-picker__check"},wl={key:1,class:"vmodal-picker-empty"},Ol={class:"vmodal-card"},$l={class:"vmodal-footer"},xl=$e({__name:"AddProduct",setup(u){const n=qe(),r=Je(),_=Ee(),c=h=>!!_.hasPermission(h),M=n.params.id,R=V(!1),W=V(void 0),F=V(!1),Q=V([]),X=V([]),ee=V([]),m=oe({title:"",product_code:"",show_type:3,category_id:void 0,brand_id:void 0,ciny_ids:[],body_html:"",is_active:!0,indicator_id:null,mobile_pic:null}),E=oe({}),T=V([]),q=V([]),Y=V([]),G=V([]),N=V([]),D=V(!1),d=V(null),i=oe({__key:"",title:"",grams:void 0,percentage_pay:void 0,qty:0,is_active:!0,is_pre_order:!1,color:void 0,color_str:void 0,rial_pay:void 0,details:"",description:"",image_id:null,image_url:null});function f(h){i.image_id=h?h.id:null,i.image_url=h?h.url:null}const U=[{title:"تصویر",dataIndex:"image",width:68,align:"center"},{title:"عنوان تنوع",dataIndex:"title"},{title:"وزن",dataIndex:"grams",align:"right"},{title:"رنگ",dataIndex:"color",align:"center"},{title:"اجرت",dataIndex:"percentage_pay",align:"right"},{title:"اجرت ریالی",dataIndex:"rial_pay",align:"right"},{title:"موجودی",dataIndex:"qty",align:"center"},{title:"وضعیت",dataIndex:"is_active",align:"center"},{title:"پیش‌سفارش",dataIndex:"is_pre_order",align:"center"},{title:"عملیات",dataIndex:"op",width:84,align:"center"}];function L(h,e){h&&e!==void 0?(d.value=e,Object.assign(i,h)):(d.value=null,Object.assign(i,{__key:`v-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:void 0,title:"",grams:void 0,percentage_pay:W.value,qty:0,is_active:!0,is_pre_order:!1,color:void 0,color_str:void 0,rial_pay:void 0,details:"",description:"",image_id:null,image_url:null})),D.value=!0}function C(){if(!i.title){Z.error("عنوان تنوع الزامی است");return}const h=G.value.find(k=>k.id===i.color);i.color_str=h?h.title:null;const e={...i};d.value===null?N.value.push(e):N.value[d.value]=e,D.value=!1}function te(){window.history.length>1?r.back():r.push("/apps/product/list")}function Ie(){return Object.keys(E).forEach(h=>delete E[h]),m.title||(E.title="لطفا مقدار را وارد کنید"),Object.keys(E).length===0}async function ue(){var h,e;if(Ie())try{F.value=!0;const k={...m,cats:m.category_id?[m.category_id]:[],images:T.value,images_mobile:q.value,variants:N.value.map(O=>({id:O.id,title:O.title,grams:O.grams,percentage_pay:O.percentage_pay,qty:O.qty,is_active:O.is_active,is_pre_order:O.is_pre_order,color:O.color??null,rial_pay:O.rial_pay??null,details:O.details||null,description:O.description||null,image_id:O.image_id??null}))};M?await B.put(`product/update/${M}`,k):await B.post("product/create",k),Z.info("اطلاعات با موفقیت به ثبت رسید."),r.push("/apps/product/list")}catch(k){Z.error(((e=(h=k==null?void 0:k.response)==null?void 0:h.data)==null?void 0:e.message)??"خطا در ثبت اطلاعات.")}finally{F.value=!1}}return Ne(async()=>{var h,e,k,O;try{const[g,y,b,z]=await Promise.all([B.get("brand"),B.post("category"),_.isSuperAdmin?B.get("admin/products/collections"):Promise.resolve({data:[]}),B.get("admin/products/colors").catch(()=>({data:[]}))]);Q.value=g.data,X.value=(y.data.rows??y.data).map(j=>({id:j.id,title:j.type_str?`${j.title} (${j.type_str}) `:j.title,type:j.type})),ee.value=b.data,G.value=z.data??[]}catch(g){console.log(g)}if(M)try{const{data:g}=await B.get(`product/show/${M}`);R.value=!!((h=g.accounting)!=null&&h.locked),W.value=((e=g.accounting)==null?void 0:e.sale_wage_percent)!=null?Number(g.accounting.sale_wage_percent):void 0,Object.assign(m,{title:g.title??"",product_code:g.product_code??"",show_type:g.show_type??3,category_id:((k=g.category)==null?void 0:k.id)??void 0,brand_id:((O=g.brand)==null?void 0:O.id)??void 0,ciny_ids:g.ciny_ids??[],body_html:g.body_html??"",is_active:g.is_active??!0,indicator_id:g.indicator_id??null,mobile_pic:g.mobile_pic??null}),T.value=g.images_gallery??[],q.value=g.images_mobile??[],Y.value=g.gallery??[],N.value=(g.variants_all??[]).map((y,b)=>{var z;return{__key:y.id??`v-${b}`,id:y.id,title:y.title,grams:Number(y.grams),percentage_pay:Number(y.percentage_pay),qty:y.qty,is_active:y.is_active,is_pre_order:y.is_pre_order,color:y.color!=null?Number(y.color):void 0,color_str:y.color_str??null,rial_pay:y.rial_pay!=null?Number(y.rial_pay):void 0,details:y.details??"",description:y.description??"",image_id:y.image_id??null,image_url:((z=y.image)==null?void 0:z.url)??null}})}catch(g){console.log(g)}}),(h,e)=>{const k=x("a-button"),O=x("a-tag"),g=x("a-alert"),y=x("a-input"),b=x("a-form-item"),z=x("a-select-option"),j=x("a-select"),ce=x("a-textarea"),Se=x("a-empty"),pe=x("a-tooltip"),Pe=x("a-table"),se=x("a-switch"),_e=x("a-form"),Ve=x("a-spin"),le=x("a-input-number"),Le=x("a-modal");return o(),p("div",ft,[a(Ve,{spinning:F.value},{default:s(()=>[l("header",gt,[a(k,{class:"pf-head__back",shape:"circle",onClick:te},{icon:s(()=>[a(v(Be))]),_:1}),l("div",yt,[l("h1",null,$(v(M)?"ویرایش محصول":"افزودن محصول"),1),e[27]||(e[27]=l("p",null,"اطلاعات، تنوع‌ها و تصاویر محصول را تکمیل کنید.",-1))]),v(M)?(o(),S(O,{key:0,color:m.is_active?"green":"default",class:"pf-head__status"},{default:s(()=>[w($(m.is_active?"فعال":"غیر فعال"),1)]),_:1},8,["color"])):P("",!0)]),a(_e,{layout:"vertical",class:"pf-form",onSubmit:De(ue,["prevent"])},{default:s(()=>[l("div",bt,[l("div",ht,[l("section",kt,[l("div",wt,[l("span",Ot,[a(v(He))]),e[28]||(e[28]=l("div",null,[l("h3",null,"اطلاعات پایه"),l("p",null,"نام، کد و توضیحات محصول")],-1))]),R.value?(o(),S(g,{key:0,class:"pf-alert",type:"info","show-icon":"",message:"این محصول به نرم‌افزار حسابداری متصل است؛ نام و کد محصول از آنجا خوانده می‌شود."})):P("",!0),a(b,{label:"نام محصول",required:"","validate-status":E.title?"error":"",help:E.title||(R.value?"از نرم‌افزار حسابداری — برای تغییر، آن را در حسابداری ویرایش کنید":void 0)},{default:s(()=>[a(y,{value:m.title,"onUpdate:value":e[0]||(e[0]=t=>m.title=t),placeholder:"مثلاً: گردنبند طلا",disabled:R.value},null,8,["value","disabled"])]),_:1},8,["validate-status","help"]),l("div",{class:H({"pf-grid-2":v(_).isSuperAdmin})},[a(b,{label:"کد محصول",class:H({"mb-0":!v(_).isSuperAdmin}),help:R.value?"از نرم‌افزار حسابداری":void 0},{default:s(()=>[a(y,{value:m.product_code,"onUpdate:value":e[1]||(e[1]=t=>m.product_code=t),disabled:R.value},null,8,["value","disabled"])]),_:1},8,["class","help"]),v(_).isSuperAdmin?(o(),S(b,{key:0,label:"نوع نمایش"},{default:s(()=>[a(j,{value:m.show_type,"onUpdate:value":e[2]||(e[2]=t=>m.show_type=t)},{default:s(()=>[a(z,{value:1},{default:s(()=>[...e[29]||(e[29]=[w("سایت",-1)])]),_:1}),a(z,{value:2},{default:s(()=>[...e[30]||(e[30]=[w("گوشی",-1)])]),_:1}),a(z,{value:3},{default:s(()=>[...e[31]||(e[31]=[w("سایت و گوشی",-1)])]),_:1})]),_:1},8,["value"])]),_:1})):P("",!0)],2),v(_).isSuperAdmin?(o(),S(b,{key:1,label:"شرح محصول (سایت)",class:"mb-0"},{default:s(()=>[a(ce,{value:m.body_html,"onUpdate:value":e[3]||(e[3]=t=>m.body_html=t),"auto-size":{minRows:5,maxRows:12},placeholder:"توضیحات محصول برای نمایش در سایت"},null,8,["value"])]),_:1})):P("",!0)]),c("product.list.variants")?(o(),p("section",$t,[l("div",xt,[l("span",Ut,[a(v(ye))]),e[33]||(e[33]=l("div",null,[l("h3",null,"تنوع ها"),l("p",null,"وزن، اجرت و موجودی هر مدل از محصول")],-1)),c("product.list.variants.add")?(o(),S(k,{key:0,type:"primary",class:"pf-section__action",onClick:e[4]||(e[4]=t=>L())},{icon:s(()=>[a(v(fe))]),default:s(()=>[e[32]||(e[32]=w(" افزودن تنوع ",-1))]),_:1})):P("",!0)]),N.value.length?(o(),p("div",Ct,[a(Pe,{class:"pf-table",columns:U,"data-source":N.value,pagination:!1,scroll:{x:"max-content"},size:"middle","row-key":"__key"},{bodyCell:s(({column:t,record:I,index:ve})=>[t.dataIndex==="image"?(o(),p(A,{key:0},[I.image_url?(o(),p("img",{key:0,src:I.image_url,class:"variant-thumb",alt:""},null,8,It)):(o(),p("span",St,[a(v(K))]))],64)):t.dataIndex==="title"?(o(),p("span",Pt,$(I.title),1)):t.dataIndex==="grams"?(o(),p(A,{key:2},[I.grams!=null?(o(),p("span",Vt,[w($(I.grams)+" ",1),e[35]||(e[35]=l("small",{class:"muted"},"گرم",-1))])):(o(),p("span",Lt,"—"))],64)):t.dataIndex==="color"?(o(),p(A,{key:3},[I.color_str?(o(),p("span",zt,$(I.color_str),1)):(o(),p("span",jt,"—"))],64)):t.dataIndex==="percentage_pay"?(o(),p(A,{key:4},[I.percentage_pay!=null?(o(),p("span",At,[w($(I.percentage_pay),1),e[36]||(e[36]=l("small",{class:"muted"},"٪",-1))])):(o(),p("span",Mt,"—"))],64)):t.dataIndex==="rial_pay"?(o(),p(A,{key:5},[I.rial_pay!=null?(o(),p("span",Rt,[w($(Number(I.rial_pay).toLocaleString("fa-IR"))+" ",1),e[37]||(e[37]=l("small",{class:"muted"},"ریال",-1))])):(o(),p("span",Et,"—"))],64)):t.dataIndex==="op"?(o(),p("div",Nt,[c("product.list.variants.edit")?(o(),S(pe,{key:0,title:"ویرایش"},{default:s(()=>[a(k,{type:"text",size:"small",onClick:ze=>L(I,ve)},{icon:s(()=>[a(v(Te),{class:"text-primary"})]),_:1},8,["onClick"])]),_:2},1024)):P("",!0),c("product.list.variants.remove")?(o(),S(pe,{key:1,title:"حذف"},{default:s(()=>[a(k,{type:"text",size:"small",danger:"",onClick:ze=>N.value.splice(ve,1)},{icon:s(()=>[a(v(Ue))]),_:1},8,["onClick"])]),_:2},1024)):P("",!0)])):t.dataIndex==="is_active"?(o(),S(O,{key:7,color:I.is_active?"green":"red"},{default:s(()=>[w($(I.is_active?"فعال":"غیر فعال"),1)]),_:2},1032,["color"])):t.dataIndex==="is_pre_order"?(o(),S(O,{key:8,color:I.is_pre_order?"blue":""},{default:s(()=>[w($(I.is_pre_order?"بله":"خیر"),1)]),_:2},1032,["color"])):P("",!0)]),_:1},8,["data-source"])])):(o(),S(Se,{key:0,image:v(Fe).PRESENTED_IMAGE_SIMPLE,description:"هنوز تنوعی برای این محصول ثبت نشده است."},{default:s(()=>[c("product.list.variants.add")?(o(),S(k,{key:0,onClick:e[5]||(e[5]=t=>L())},{icon:s(()=>[a(v(fe))]),default:s(()=>[e[34]||(e[34]=w(" افزودن اولین تنوع ",-1))]),_:1})):P("",!0)]),_:1},8,["image"]))])):P("",!0),l("section",qt,[l("div",Bt,[l("span",Dt,[a(v(K))]),l("div",null,[e[38]||(e[38]=l("h3",null,"گالری تصاویر",-1)),l("p",null,$(v(_).isSuperAdmin?"تصاویر جداگانه برای نمایش در سایت و اپلیکیشن موبایل":"تصاویر نمایش در اپلیکیشن موبایل"),1)])]),v(_).isSuperAdmin?(o(),p(A,{key:0},[a(b,{label:"گالری تصاویر سایت"},{default:s(()=>[a(Oe,{modelValue:T.value,"onUpdate:modelValue":e[6]||(e[6]=t=>T.value=t),purpose:"product.gallery",placeholder:"افزودن تصاویر گالری سایت"},null,8,["modelValue"])]),_:1}),e[39]||(e[39]=l("div",{class:"pf-divider"},null,-1))],64)):P("",!0),a(b,{label:"گالری تصاویر موبایل",class:"mb-0"},{default:s(()=>[a(Oe,{modelValue:q.value,"onUpdate:modelValue":e[7]||(e[7]=t=>q.value=t),purpose:"product.gallery_mobile",placeholder:"افزودن تصاویر گالری موبایل"},null,8,["modelValue"])]),_:1})])]),l("aside",Ht,[l("section",Ft,[l("div",Tt,[l("span",Gt,[a(v(xe))]),e[40]||(e[40]=l("div",null,[l("h3",null,"وضعیت نمایش"),l("p",null,"نمایش یا عدم نمایش محصول برای مشتریان")],-1))]),a(b,{label:"نمایش محصول",extra:m.is_active?"محصول برای مشتریان قابل مشاهده است":"محصول پنهان است",class:"mb-0"},{default:s(()=>[a(se,{checked:m.is_active,"onUpdate:checked":e[8]||(e[8]=t=>m.is_active=t)},null,8,["checked"])]),_:1},8,["extra"])]),l("section",Jt,[l("div",Wt,[l("span",Qt,[a(v(de))]),e[41]||(e[41]=l("div",null,[l("h3",null,"دسته‌بندی"),l("p",null,"دسته، برند و سینی‌های محصول")],-1))]),a(b,{label:"دسته بندی"},{default:s(()=>[a(j,{value:m.category_id,"onUpdate:value":e[9]||(e[9]=t=>m.category_id=t),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(o(!0),p(A,null,J(X.value,t=>(o(),S(z,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w($(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1}),a(b,{label:"برند",class:H({"mb-0":!v(_).isSuperAdmin})},{default:s(()=>[a(j,{value:m.brand_id,"onUpdate:value":e[10]||(e[10]=t=>m.brand_id=t),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(o(!0),p(A,null,J(Q.value,t=>(o(),S(z,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w($(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1},8,["class"]),v(_).isSuperAdmin?(o(),S(b,{key:0,label:"سینی ها",class:"mb-0"},{default:s(()=>[a(j,{value:m.ciny_ids,"onUpdate:value":e[11]||(e[11]=t=>m.ciny_ids=t),mode:"multiple","allow-clear":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(o(!0),p(A,null,J(ee.value,t=>(o(),S(z,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w($(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1})):P("",!0)]),l("section",Xt,[l("div",Yt,[l("span",Zt,[a(v(re))]),e[42]||(e[42]=l("div",null,[l("h3",null,"تصویر شاخص"),l("p",null,"تصویر اصلی در لیست محصولات")],-1))]),l("div",Kt,[v(_).isSuperAdmin?(o(),S(b,{key:0,label:"سایت",class:"mb-0"},{default:s(()=>[a(ge,{modelValue:m.indicator_id,"onUpdate:modelValue":e[12]||(e[12]=t=>m.indicator_id=t),purpose:"product.indicator",placeholder:"تصویر شاخص"},null,8,["modelValue"])]),_:1})):P("",!0),a(b,{label:"موبایل",class:"mb-0"},{default:s(()=>[a(ge,{modelValue:m.mobile_pic,"onUpdate:modelValue":e[13]||(e[13]=t=>m.mobile_pic=t),purpose:"product.indicator_mobile",placeholder:"تصویر شاخص موبایل"},null,8,["modelValue"])]),_:1})])])])]),l("div",el,[l("span",tl,[a(v(Ge)),e[43]||(e[43]=w(" تغییرات تنوع‌ها و تصاویر پس از «ثبت اطلاعات» ذخیره می‌شوند. ",-1))]),a(k,{onClick:te},{default:s(()=>[...e[44]||(e[44]=[w("انصراف",-1)])]),_:1}),a(k,{type:"primary",class:"form-submit",loading:F.value,onClick:ue},{icon:s(()=>[a(v(ie))]),default:s(()=>[e[45]||(e[45]=w(" ثبت اطلاعات ",-1))]),_:1},8,["loading"])])]),_:1})]),_:1},8,["spinning"]),a(Le,{open:D.value,"onUpdate:open":e[26]||(e[26]=t=>D.value=t),width:860,"wrap-class-name":"pf-variant-modal",footer:null,"destroy-on-close":!0,centered:""},{title:s(()=>[l("div",ll,[l("div",al,[a(v(ye))]),l("div",sl,[l("h3",null,$(d.value===null?"افزودن تنوع جدید":"ویرایش تنوع"),1),e[46]||(e[46]=l("p",null,"مشخصات، قیمت‌گذاری و تصویر این تنوع را وارد کنید.",-1))])])]),default:s(()=>[a(_e,{layout:"vertical",class:"vmodal-form"},{default:s(()=>[l("div",ol,[l("div",il,[l("div",nl,[e[49]||(e[49]=l("div",{class:"vmodal-card__head"},"مشخصات اصلی",-1)),l("div",rl,[a(b,{label:"عنوان تنوع",required:"",class:"vmodal-item"},{default:s(()=>[a(y,{value:i.title,"onUpdate:value":e[14]||(e[14]=t=>i.title=t),placeholder:"مثلاً: ۵ گرمی"},null,8,["value"])]),_:1}),a(b,{label:"وزن خام",class:"vmodal-item"},{default:s(()=>[a(le,{value:i.grams,"onUpdate:value":e[15]||(e[15]=t=>i.grams=t),class:"w-full",step:.001,"addon-after":"گرم",placeholder:"۰.۰۰۰"},null,8,["value"])]),_:1})]),l("div",dl,[a(b,{label:"تعداد موجودی",class:"vmodal-item"},{default:s(()=>[a(le,{value:i.qty,"onUpdate:value":e[16]||(e[16]=t=>i.qty=t),class:"w-full",min:0,placeholder:"۰"},null,8,["value"])]),_:1}),a(b,{label:"رنگ طلا",class:"vmodal-item"},{default:s(()=>[a(j,{value:i.color,"onUpdate:value":e[17]||(e[17]=t=>i.color=t),placeholder:"انتخاب رنگ","allow-clear":""},{default:s(()=>[(o(!0),p(A,null,J(G.value,t=>(o(),S(z,{key:t.id,value:t.id},{default:s(()=>[l("div",ul,[l("span",{class:H(["color-opt__dot",`color-opt__dot--${t.id}`])},null,2),l("span",null,$(t.title),1)])]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1})]),l("div",cl,[l("label",pl,[e[47]||(e[47]=l("span",{class:"vmodal-switch-label"},"فعال برای فروش",-1)),a(se,{checked:i.is_active,"onUpdate:checked":e[18]||(e[18]=t=>i.is_active=t),size:"small"},null,8,["checked"])]),l("label",_l,[e[48]||(e[48]=l("span",{class:"vmodal-switch-label"},"پیش‌سفارش",-1)),a(se,{checked:i.is_pre_order,"onUpdate:checked":e[19]||(e[19]=t=>i.is_pre_order=t),size:"small"},null,8,["checked"])])])]),l("div",vl,[e[50]||(e[50]=l("div",{class:"vmodal-card__head"},"اجرت و قیمت‌گذاری",-1)),l("div",ml,[a(b,{label:"اجرت درصدی",class:"vmodal-item"},{default:s(()=>[a(le,{value:i.percentage_pay,"onUpdate:value":e[20]||(e[20]=t=>i.percentage_pay=t),class:"w-full",step:.1,"addon-after":"٪",placeholder:"۰"},null,8,["value"])]),_:1}),a(b,{label:"اجرت ریالی",class:"vmodal-item"},{default:s(()=>[a(le,{value:i.rial_pay,"onUpdate:value":e[21]||(e[21]=t=>i.rial_pay=t),class:"w-full",step:5e4,"addon-after":"ریال",placeholder:"۰",formatter:t=>t?`${t}`.replace(/\B(?=(\d{3})+(?!\d))/g,","):"",parser:t=>t?t.replace(/,/g,""):""},null,8,["value","formatter","parser"])]),_:1})])])]),l("div",fl,[l("div",gl,[e[52]||(e[52]=l("div",{class:"vmodal-card__head"},"تصویر اختصاصی تنوع",-1)),Y.value.length?(o(),p("div",yl,[l("button",{type:"button",class:H(["vmodal-picker__item",{"is-active":!i.image_id}]),title:"بدون تصویر",onClick:e[22]||(e[22]=t=>f(null))},[a(v(K)),e[51]||(e[51]=l("span",null,"بدون عکس",-1))],2),(o(!0),p(A,null,J(Y.value,t=>(o(),p("button",{key:t.id,type:"button",class:H(["vmodal-picker__item",{"is-active":i.image_id===t.id}]),onClick:I=>f(t)},[l("img",{src:t.url,alt:""},null,8,hl),i.image_id===t.id?(o(),p("div",kl,[a(v(ie))])):P("",!0)],10,bl))),128))])):(o(),p("div",wl," تصویری در گالری ثبت نشده است (می‌توانید در بخش گالری محصول تصویر بارگذاری کنید). "))]),l("div",Ol,[e[53]||(e[53]=l("div",{class:"vmodal-card__head"},"توضیحات تکمیلی",-1)),a(b,{label:"توضیح مختصر",class:"vmodal-item"},{default:s(()=>[a(y,{value:i.details,"onUpdate:value":e[23]||(e[23]=t=>i.details=t),placeholder:"مثلاً: طراحی مات با تراش برلیان"},null,8,["value"])]),_:1}),a(b,{label:"توضیحات کامل",class:"vmodal-item mb-0"},{default:s(()=>[a(ce,{value:i.description,"onUpdate:value":e[24]||(e[24]=t=>i.description=t),style:{height:"95px","min-height":"95px","max-height":"95px",resize:"none"},placeholder:"ویژگی‌های خاص این تنوع..."},null,8,["value"])]),_:1})])])]),l("div",$l,[a(k,{class:"vmodal-footer__cancel",onClick:e[25]||(e[25]=t=>D.value=!1)},{default:s(()=>[...e[54]||(e[54]=[w(" انصراف ",-1)])]),_:1}),a(k,{type:"primary",class:"vmodal-footer__submit",onClick:C},{icon:s(()=>[a(v(ie))]),default:s(()=>[w(" "+$(d.value===null?"افزودن تنوع":"ذخیره تغییرات"),1)]),_:1})])]),_:1})]),_:1},8,["open"])])}}}),Sl=Ce(xl,[["__scopeId","data-v-aea3d1e2"]]);export{Sl as default};