2 lines
29 KiB
JavaScript
2 lines
29 KiB
JavaScript
import{c as a,I as ne,d as Ue,n as je,N as ze,o as i,b as d,w as s,p as l,h as _,t as x,F as j,e as W,i as P,O as Re,f as w,m as V,s as fe,G as K,U as Me,r as $,q as J,Q as xe,D as $e,y as q,_ as Ce,u as Ne,x as Ee,k as qe,z as se,R as Be,a as S,H as De,S as Fe,P as ge,T as Te,E as He,V as Ge,W as oe,l as We}from"./index-C9T3Vski.js";import{_ as ye}from"./ImageUploadInput.vue_vue_type_script_setup_true_lang-Bjo3vw78.js";import{A as be}from"./AppstoreOutlined-lwgIJvjh.js";import{P as ie}from"./PictureOutlined-BBgbZIZs.js";var Je={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 he(v){for(var u=1;u<arguments.length;u++){var r=arguments[u]!=null?Object(arguments[u]):{},m=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(m=m.concat(Object.getOwnPropertySymbols(r).filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable}))),m.forEach(function(c){Qe(v,c,r[c])})}return v}function Qe(v,u,r){return u in v?Object.defineProperty(v,u,{value:r,enumerable:!0,configurable:!0,writable:!0}):v[u]=r,v}var de=function(u,r){var m=he({},u,r.attrs);return a(ne,he({},m,{icon:Je}),null)};de.displayName="CloudUploadOutlined";de.inheritAttrs=!1;var Xe={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M553.1 509.1l-77.8 99.2-41.1-52.4a8 8 0 00-12.6 0l-99.8 127.2a7.98 7.98 0 006.3 12.9H696c6.7 0 10.4-7.7 6.3-12.9l-136.5-174a8.1 8.1 0 00-12.7 0zM360 442a40 40 0 1080 0 40 40 0 10-80 0zm494.6-153.4L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"}}]},name:"file-image",theme:"outlined"};function ke(v){for(var u=1;u<arguments.length;u++){var r=arguments[u]!=null?Object(arguments[u]):{},m=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(m=m.concat(Object.getOwnPropertySymbols(r).filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable}))),m.forEach(function(c){Ye(v,c,r[c])})}return v}function Ye(v,u,r){return u in v?Object.defineProperty(v,u,{value:r,enumerable:!0,configurable:!0,writable:!0}):v[u]=r,v}var re=function(u,r){var m=ke({},u,r.attrs);return a(ne,ke({},m,{icon:Xe}),null)};re.displayName="FileImageOutlined";re.inheritAttrs=!1;var Ze={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M483.2 790.3L861.4 412c1.7-1.7 2.5-4 2.3-6.3l-25.5-301.4c-.7-7.8-6.8-13.9-14.6-14.6L522.2 64.3c-2.3-.2-4.7.6-6.3 2.3L137.7 444.8a8.03 8.03 0 000 11.3l334.2 334.2c3.1 3.2 8.2 3.2 11.3 0zm62.6-651.7l224.6 19 19 224.6L477.5 694 233.9 450.5l311.9-311.9zm60.16 186.23a48 48 0 1067.88-67.89 48 48 0 10-67.88 67.89zM889.7 539.8l-39.6-39.5a8.03 8.03 0 00-11.3 0l-362 361.3-237.6-237a8.03 8.03 0 00-11.3 0l-39.6 39.5a8.03 8.03 0 000 11.3l243.2 242.8 39.6 39.5c3.1 3.1 8.2 3.1 11.3 0l407.3-406.6c3.1-3.1 3.1-8.2 0-11.3z"}}]},name:"tags",theme:"outlined"};function we(v){for(var u=1;u<arguments.length;u++){var r=arguments[u]!=null?Object(arguments[u]):{},m=Object.keys(r);typeof Object.getOwnPropertySymbols=="function"&&(m=m.concat(Object.getOwnPropertySymbols(r).filter(function(c){return Object.getOwnPropertyDescriptor(r,c).enumerable}))),m.forEach(function(c){Ke(v,c,r[c])})}return v}function Ke(v,u,r){return u in v?Object.defineProperty(v,u,{value:r,enumerable:!0,configurable:!0,writable:!0}):v[u]=r,v}var ue=function(u,r){var m=we({},u,r.attrs);return a(ne,we({},m,{icon:Ze}),null)};ue.displayName="TagsOutlined";ue.inheritAttrs=!1;const et={class:"gallery-upload"},tt={class:"gallery-upload__zone"},lt={class:"gallery-upload__title"},at={key:0,class:"gallery-upload__grid"},st=["src"],ot={key:0,class:"tile__progress"},it={key:1,class:"tile__overlay"},nt=["onClick"],dt=["onClick"],rt={key:1,class:"gallery-upload__meta"},ut={key:0,class:"gallery-upload__pending"},ct=["src"],pt=3,_t=Ue({__name:"GalleryUploadInput",props:{modelValue:{default:()=>[]},purpose:{default:void 0},placeholder:{default:"افزودن تصاویر گالری"}},emits:["update:modelValue"],setup(v,{emit:u}){const r=v,m=u,c=V([]),z=V(!1),R=V(""),Q=()=>c.value.filter(n=>n.status==="done"&&n.url).map(n=>n.url),F=fe(()=>c.value.filter(n=>n.status==="done").length),X=fe(()=>c.value.filter(n=>n.status==="uploading").length);function Y(){m("update:modelValue",Q())}je(()=>r.modelValue,n=>{if(JSON.stringify(Q())===JSON.stringify(n??[]))return;const g=c.value.filter(o=>o.status==="uploading");c.value=[...(n??[]).map(o=>({uid:o,status:"done",url:o,percent:100})),...g]},{immediate:!0});function ee(n){return n.type.startsWith("image/")?!0:(K.error(`«${n.name}» تصویر نیست`),Me.LIST_IGNORE)}let T=0;const p=[];function B(n){return new Promise((g,o)=>{const C=()=>{T++,n().then(g,o).finally(()=>{var A;T--,(A=p.shift())==null||A()})};T<pt?C():p.push(C)})}const D=n=>c.value.find(g=>g.uid===n);function H({file:n}){const g=n.uid??`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;c.value.push({uid:g,status:"uploading",preview:URL.createObjectURL(n),percent:0}),B(async()=>{if(!D(g))return null;const o=new FormData;o.append("file",n),r.purpose&&o.append("purpose",r.purpose);const{data:C}=await q.post("file/create",o,{onUploadProgress:A=>{const O=D(g);O&&A.total&&(O.percent=Math.round(A.loaded/A.total*100))}});return C}).then(o=>{const C=D(g);!C||!(o!=null&&o.url)||(C.preview&&URL.revokeObjectURL(C.preview),Object.assign(C,{status:"done",url:o.url,preview:void 0,percent:100}),Y())}).catch(o=>{var A,O;const C=((O=(A=o==null?void 0:o.response)==null?void 0:A.data)==null?void 0:O.message)??`بارگذاری «${n.name}» ناموفق بود`;K.error(C),G(g)})}function G(n){const g=c.value.findIndex(C=>C.uid===n);if(g===-1)return;const[o]=c.value.splice(g,1);o.preview&&URL.revokeObjectURL(o.preview)}function Z(n){G(n),Y()}function M(n){R.value=n.url??n.preview??"",z.value=!0}return ze(()=>{c.value.forEach(n=>n.preview&&URL.revokeObjectURL(n.preview))}),(n,g)=>{const o=$("a-upload-dragger"),C=$("a-progress"),A=$("a-modal");return i(),d("div",et,[a(o,{accept:"image/*",multiple:"","show-upload-list":!1,"custom-request":H,"before-upload":ee},{default:s(()=>[l("div",tt,[a(_(de),{class:"gallery-upload__icon"}),l("p",lt,x(v.placeholder),1),g[1]||(g[1]=l("p",{class:"gallery-upload__hint"}," تصاویر را اینجا بکشید و رها کنید یا کلیک کنید — انتخاب چند تصویر بهصورت همزمان امکانپذیر است ",-1))])]),_:1}),c.value.length?(i(),d("div",at,[(i(!0),d(j,null,W(c.value,O=>(i(),d("div",{key:O.uid,class:J(["tile",{"is-uploading":O.status==="uploading"}])},[l("img",{src:O.url??O.preview,alt:""},null,8,st),O.status==="uploading"?(i(),d("div",ot,[a(C,{type:"circle",percent:O.percent,size:40,"stroke-width":8,"stroke-color":"#fff","trail-color":"rgba(255,255,255,.3)","show-info":!1},null,8,["percent"])])):(i(),d("div",it,[l("button",{type:"button",class:"tile__btn",title:"نمایش",onClick:le=>M(O)},[a(_(xe))],8,nt),l("button",{type:"button",class:"tile__btn tile__btn--danger",title:"حذف",onClick:le=>Z(O.uid)},[a(_($e))],8,dt)]))],2))),128))])):P("",!0),c.value.length?(i(),d("div",rt,[l("span",null,x(F.value)+" تصویر",1),X.value?(i(),d("span",ut,[a(_(Re)),w(" در حال بارگذاری "+x(X.value)+" تصویر… ",1)])):P("",!0)])):P("",!0),a(A,{open:z.value,footer:null,onCancel:g[0]||(g[0]=O=>z.value=!1)},{default:s(()=>[l("img",{src:R.value,style:{width:"100%"},alt:""},null,8,ct)]),_:1},8,["open"])])}}}),Oe=Ce(_t,[["__scopeId","data-v-79ab0f30"]]),vt={id:"page-user-view",class:"pf-page product-form-page"},mt={class:"pf-head"},ft={class:"pf-head__text"},gt={class:"pf-layout"},yt={class:"pf-main"},bt={class:"pf-section"},ht={class:"pf-section__head"},kt={class:"pf-section__icon"},wt={key:0,class:"pf-section"},Ot={class:"pf-section__head"},Ut={class:"pf-section__icon"},xt={key:1,class:"table-scroll"},$t=["src"],Ct={key:1,class:"variant-thumb variant-thumb--empty"},It={key:1,class:"pf-table__title"},St={key:0},Pt={key:1,class:"muted"},Vt={key:0},At={key:1,class:"muted"},Lt={key:0},jt={key:1,class:"muted"},zt={key:0},Rt={key:1,class:"muted"},Mt={key:6,class:"pf-table__ops"},Nt={class:"pf-section"},Et={class:"pf-section__head"},qt={class:"pf-section__icon"},Bt={class:"pf-side"},Dt={class:"pf-section"},Ft={class:"pf-section__head"},Tt={class:"pf-section__icon"},Ht={class:"pf-section"},Gt={class:"pf-section__head"},Wt={class:"pf-section__icon"},Jt={class:"pf-section"},Qt={class:"pf-section__head"},Xt={class:"pf-section__icon"},Yt={class:"pf-uploads"},Zt={class:"pf-actions"},Kt={class:"pf-actions__hint"},el={class:"vmodal-header"},tl={class:"vmodal-header__icon"},ll={class:"vmodal-header__text"},al={class:"vmodal-cols"},sl={class:"vmodal-col"},ol={class:"vmodal-card"},il={class:"vmodal-grid vmodal-grid--2"},nl={class:"vmodal-grid vmodal-grid--2"},dl={class:"color-opt"},rl={class:"vmodal-switches"},ul={class:"vmodal-switch-box"},cl={class:"vmodal-switch-box"},pl={class:"vmodal-card"},_l={class:"vmodal-grid vmodal-grid--2"},vl={class:"vmodal-col"},ml={class:"vmodal-card"},fl={key:0,class:"vmodal-picker"},gl=["onClick"],yl=["src"],bl={key:0,class:"vmodal-picker__check"},hl={key:1,class:"vmodal-picker-empty"},kl={class:"vmodal-card"},wl={class:"vmodal-footer"},Ol=Ue({__name:"AddProduct",setup(v){const u=qe(),r=We(),m=Ne(),c=h=>!!m.hasPermission(h),z=u.params.id,R=V(!1),Q=V(void 0),F=V(!1),X=V([]),Y=V([]),ee=V([]),T=V([]),p=se({title:"",product_code:"",show_type:3,category_id:void 0,brand_id:void 0,ciny_ids:[],tags:[],body_html:"",is_active:!0,indicator_id:null,mobile_pic:null}),B=se({}),D=V([]),H=V([]),G=V([]),Z=V([]),M=V([]),n=V(!1),g=V(null),o=se({__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 C(h){o.image_id=h?h.id:null,o.image_url=h?h.url:null}const A=[{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 O(h,e){h&&e!==void 0?(g.value=e,Object.assign(o,h)):(g.value=null,Object.assign(o,{__key:`v-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:void 0,title:"",grams:void 0,percentage_pay:Q.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})),n.value=!0}function le(){if(!o.title){K.error("عنوان تنوع الزامی است");return}const h=Z.value.find(k=>k.id===o.color);o.color_str=h?h.title:null;const e={...o};g.value===null?M.value.push(e):M.value[g.value]=e,n.value=!1}function ce(){window.history.length>1?r.back():r.push("/apps/product/list")}function Ie(){return Object.keys(B).forEach(h=>delete B[h]),p.title||(B.title="لطفا مقدار را وارد کنید"),Object.keys(B).length===0}async function pe(){var h,e;if(Ie())try{F.value=!0;const k={...p,cats:p.category_id?[p.category_id]:[],images:D.value,images_mobile:H.value,variants:M.value.map(U=>({id:U.id,title:U.title,grams:U.grams,percentage_pay:U.percentage_pay,qty:U.qty,is_active:U.is_active,is_pre_order:U.is_pre_order,color:U.color??null,rial_pay:U.rial_pay??null,details:U.details||null,description:U.description||null,image_id:U.image_id??null}))};z?await q.put(`product/update/${z}`,k):await q.post("product/create",k),K.info("اطلاعات با موفقیت به ثبت رسید."),r.push("/apps/product/list")}catch(k){K.error(((e=(h=k==null?void 0:k.response)==null?void 0:h.data)==null?void 0:e.message)??"خطا در ثبت اطلاعات.")}finally{F.value=!1}}return Ee(async()=>{var h,e,k,U;try{const[f,y,b,L,N]=await Promise.all([q.get("brand"),q.post("category"),m.isSuperAdmin?q.get("admin/products/collections"):Promise.resolve({data:[]}),q.get("admin/products/colors").catch(()=>({data:[]})),q.get("const/__list__tags").catch(()=>({data:[]}))]);X.value=f.data,Y.value=(y.data.rows??y.data).map(E=>({id:E.id,title:E.type_str?`${E.title} (${E.type_str}) `:E.title,type:E.type})),ee.value=b.data,Z.value=L.data??[],T.value=Array.isArray(N.data)?N.data.map(String):[]}catch(f){console.log(f)}if(z)try{const{data:f}=await q.get(`product/show/${z}`);R.value=!!((h=f.accounting)!=null&&h.locked),Q.value=((e=f.accounting)==null?void 0:e.sale_wage_percent)!=null?Number(f.accounting.sale_wage_percent):void 0,Object.assign(p,{title:f.title??"",product_code:f.product_code??"",show_type:f.show_type??3,category_id:((k=f.category)==null?void 0:k.id)??void 0,brand_id:((U=f.brand)==null?void 0:U.id)??void 0,ciny_ids:f.ciny_ids??[],tags:Array.isArray(f.tags)?f.tags:[],body_html:f.body_html??"",is_active:f.is_active??!0,indicator_id:f.indicator_id??null,mobile_pic:f.mobile_pic??null}),D.value=f.images_gallery??[],H.value=f.images_mobile??[],G.value=f.gallery??[],M.value=(f.variants_all??[]).map((y,b)=>{var L;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:((L=y.image)==null?void 0:L.url)??null}})}catch(f){console.log(f)}}),(h,e)=>{const k=$("a-button"),U=$("a-tag"),f=$("a-alert"),y=$("a-input"),b=$("a-form-item"),L=$("a-select-option"),N=$("a-select"),E=$("a-textarea"),Se=$("a-empty"),_e=$("a-tooltip"),Pe=$("a-table"),ae=$("a-switch"),ve=$("a-form"),Ve=$("a-spin"),te=$("a-input-number"),Ae=$("a-modal");return i(),d("div",vt,[a(Ve,{spinning:F.value},{default:s(()=>[l("header",mt,[a(k,{class:"pf-head__back",shape:"circle",onClick:ce},{icon:s(()=>[a(_(Be))]),_:1}),l("div",ft,[l("h1",null,x(_(z)?"ویرایش محصول":"افزودن محصول"),1),e[28]||(e[28]=l("p",null,"اطلاعات، تنوعها و تصاویر محصول را تکمیل کنید.",-1))]),_(z)?(i(),S(U,{key:0,color:p.is_active?"green":"default",class:"pf-head__status"},{default:s(()=>[w(x(p.is_active?"فعال":"غیر فعال"),1)]),_:1},8,["color"])):P("",!0)]),a(ve,{layout:"vertical",class:"pf-form",onSubmit:De(pe,["prevent"])},{default:s(()=>[l("div",gt,[l("div",yt,[l("section",bt,[l("div",ht,[l("span",kt,[a(_(Fe))]),e[29]||(e[29]=l("div",null,[l("h3",null,"اطلاعات پایه"),l("p",null,"نام، کد و توضیحات محصول")],-1))]),R.value?(i(),S(f,{key:0,class:"pf-alert",type:"info","show-icon":"",message:"این محصول به نرمافزار حسابداری متصل است؛ نام و کد محصول از آنجا خوانده میشود."})):P("",!0),a(b,{label:"نام محصول",required:"","validate-status":B.title?"error":"",help:B.title||(R.value?"از نرمافزار حسابداری — برای تغییر، آن را در حسابداری ویرایش کنید":void 0)},{default:s(()=>[a(y,{value:p.title,"onUpdate:value":e[0]||(e[0]=t=>p.title=t),placeholder:"مثلاً: گردنبند طلا",disabled:R.value},null,8,["value","disabled"])]),_:1},8,["validate-status","help"]),l("div",{class:J({"pf-grid-2":_(m).isSuperAdmin})},[a(b,{label:"کد محصول",class:J({"mb-0":!_(m).isSuperAdmin}),help:R.value?"از نرمافزار حسابداری":void 0},{default:s(()=>[a(y,{value:p.product_code,"onUpdate:value":e[1]||(e[1]=t=>p.product_code=t),disabled:R.value},null,8,["value","disabled"])]),_:1},8,["class","help"]),_(m).isSuperAdmin?(i(),S(b,{key:0,label:"نوع نمایش"},{default:s(()=>[a(N,{value:p.show_type,"onUpdate:value":e[2]||(e[2]=t=>p.show_type=t)},{default:s(()=>[a(L,{value:1},{default:s(()=>[...e[30]||(e[30]=[w("سایت",-1)])]),_:1}),a(L,{value:2},{default:s(()=>[...e[31]||(e[31]=[w("گوشی",-1)])]),_:1}),a(L,{value:3},{default:s(()=>[...e[32]||(e[32]=[w("سایت و گوشی",-1)])]),_:1})]),_:1},8,["value"])]),_:1})):P("",!0)],2),_(m).isSuperAdmin?(i(),S(b,{key:1,label:"شرح محصول (سایت)",class:"mb-0"},{default:s(()=>[a(E,{value:p.body_html,"onUpdate:value":e[3]||(e[3]=t=>p.body_html=t),"auto-size":{minRows:5,maxRows:12},placeholder:"توضیحات محصول برای نمایش در سایت"},null,8,["value"])]),_:1})):P("",!0)]),c("product.list.variants")?(i(),d("section",wt,[l("div",Ot,[l("span",Ut,[a(_(be))]),e[34]||(e[34]=l("div",null,[l("h3",null,"تنوع ها"),l("p",null,"وزن، اجرت و موجودی هر مدل از محصول")],-1)),c("product.list.variants.add")?(i(),S(k,{key:0,type:"primary",class:"pf-section__action",onClick:e[4]||(e[4]=t=>O())},{icon:s(()=>[a(_(ge))]),default:s(()=>[e[33]||(e[33]=w(" افزودن تنوع ",-1))]),_:1})):P("",!0)]),M.value.length?(i(),d("div",xt,[a(Pe,{class:"pf-table",columns:A,"data-source":M.value,pagination:!1,scroll:{x:"max-content"},size:"middle","row-key":"__key"},{bodyCell:s(({column:t,record:I,index:me})=>[t.dataIndex==="image"?(i(),d(j,{key:0},[I.image_url?(i(),d("img",{key:0,src:I.image_url,class:"variant-thumb",alt:""},null,8,$t)):(i(),d("span",Ct,[a(_(ie))]))],64)):t.dataIndex==="title"?(i(),d("span",It,x(I.title),1)):t.dataIndex==="grams"?(i(),d(j,{key:2},[I.grams!=null?(i(),d("span",St,[w(x(I.grams)+" ",1),e[36]||(e[36]=l("small",{class:"muted"},"گرم",-1))])):(i(),d("span",Pt,"—"))],64)):t.dataIndex==="color"?(i(),d(j,{key:3},[I.color_str?(i(),d("span",Vt,x(I.color_str),1)):(i(),d("span",At,"—"))],64)):t.dataIndex==="percentage_pay"?(i(),d(j,{key:4},[I.percentage_pay!=null?(i(),d("span",Lt,[w(x(I.percentage_pay),1),e[37]||(e[37]=l("small",{class:"muted"},"٪",-1))])):(i(),d("span",jt,"—"))],64)):t.dataIndex==="rial_pay"?(i(),d(j,{key:5},[I.rial_pay!=null?(i(),d("span",zt,[w(x(Number(I.rial_pay).toLocaleString("fa-IR"))+" ",1),e[38]||(e[38]=l("small",{class:"muted"},"ریال",-1))])):(i(),d("span",Rt,"—"))],64)):t.dataIndex==="op"?(i(),d("div",Mt,[c("product.list.variants.edit")?(i(),S(_e,{key:0,title:"ویرایش"},{default:s(()=>[a(k,{type:"text",size:"small",onClick:Le=>O(I,me)},{icon:s(()=>[a(_(He),{class:"text-primary"})]),_:1},8,["onClick"])]),_:2},1024)):P("",!0),c("product.list.variants.remove")?(i(),S(_e,{key:1,title:"حذف"},{default:s(()=>[a(k,{type:"text",size:"small",danger:"",onClick:Le=>M.value.splice(me,1)},{icon:s(()=>[a(_($e))]),_:1},8,["onClick"])]),_:2},1024)):P("",!0)])):t.dataIndex==="is_active"?(i(),S(U,{key:7,color:I.is_active?"green":"red"},{default:s(()=>[w(x(I.is_active?"فعال":"غیر فعال"),1)]),_:2},1032,["color"])):t.dataIndex==="is_pre_order"?(i(),S(U,{key:8,color:I.is_pre_order?"blue":""},{default:s(()=>[w(x(I.is_pre_order?"بله":"خیر"),1)]),_:2},1032,["color"])):P("",!0)]),_:1},8,["data-source"])])):(i(),S(Se,{key:0,image:_(Te).PRESENTED_IMAGE_SIMPLE,description:"هنوز تنوعی برای این محصول ثبت نشده است."},{default:s(()=>[c("product.list.variants.add")?(i(),S(k,{key:0,onClick:e[5]||(e[5]=t=>O())},{icon:s(()=>[a(_(ge))]),default:s(()=>[e[35]||(e[35]=w(" افزودن اولین تنوع ",-1))]),_:1})):P("",!0)]),_:1},8,["image"]))])):P("",!0),l("section",Nt,[l("div",Et,[l("span",qt,[a(_(ie))]),l("div",null,[e[39]||(e[39]=l("h3",null,"گالری تصاویر",-1)),l("p",null,x(_(m).isSuperAdmin?"تصاویر جداگانه برای نمایش در سایت و اپلیکیشن موبایل":"تصاویر نمایش در اپلیکیشن موبایل"),1)])]),_(m).isSuperAdmin?(i(),d(j,{key:0},[a(b,{label:"گالری تصاویر سایت"},{default:s(()=>[a(Oe,{modelValue:D.value,"onUpdate:modelValue":e[6]||(e[6]=t=>D.value=t),purpose:"product.gallery",placeholder:"افزودن تصاویر گالری سایت"},null,8,["modelValue"])]),_:1}),e[40]||(e[40]=l("div",{class:"pf-divider"},null,-1))],64)):P("",!0),a(b,{label:"گالری تصاویر موبایل",class:"mb-0"},{default:s(()=>[a(Oe,{modelValue:H.value,"onUpdate:modelValue":e[7]||(e[7]=t=>H.value=t),purpose:"product.gallery_mobile",placeholder:"افزودن تصاویر گالری موبایل"},null,8,["modelValue"])]),_:1})])]),l("aside",Bt,[l("section",Dt,[l("div",Ft,[l("span",Tt,[a(_(xe))]),e[41]||(e[41]=l("div",null,[l("h3",null,"وضعیت نمایش"),l("p",null,"نمایش یا عدم نمایش محصول برای مشتریان")],-1))]),a(b,{label:"نمایش محصول",extra:p.is_active?"محصول برای مشتریان قابل مشاهده است":"محصول پنهان است",class:"mb-0"},{default:s(()=>[a(ae,{checked:p.is_active,"onUpdate:checked":e[8]||(e[8]=t=>p.is_active=t)},null,8,["checked"])]),_:1},8,["extra"])]),l("section",Ht,[l("div",Gt,[l("span",Wt,[a(_(ue))]),e[42]||(e[42]=l("div",null,[l("h3",null,"دستهبندی"),l("p",null,"دسته، برند، سینی و برچسبهای محصول")],-1))]),a(b,{label:"دسته بندی"},{default:s(()=>[a(N,{value:p.category_id,"onUpdate:value":e[9]||(e[9]=t=>p.category_id=t),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(i(!0),d(j,null,W(Y.value,t=>(i(),S(L,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w(x(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1}),a(b,{label:"برند"},{default:s(()=>[a(N,{value:p.brand_id,"onUpdate:value":e[10]||(e[10]=t=>p.brand_id=t),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(i(!0),d(j,null,W(X.value,t=>(i(),S(L,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w(x(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1}),_(m).isSuperAdmin?(i(),S(b,{key:0,label:"سینی ها"},{default:s(()=>[a(N,{value:p.ciny_ids,"onUpdate:value":e[11]||(e[11]=t=>p.ciny_ids=t),mode:"multiple","allow-clear":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:s(()=>[(i(!0),d(j,null,W(ee.value,t=>(i(),S(L,{key:t.id,value:t.id,label:t.title},{default:s(()=>[w(x(t.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1})):P("",!0),a(b,{label:"برچسب ها",class:"mb-0"},{default:s(()=>[a(N,{value:p.tags,"onUpdate:value":e[12]||(e[12]=t=>p.tags=t),mode:"multiple","allow-clear":"","option-filter-prop":"label",placeholder:"انتخاب از فهرست برچسبها",options:T.value.map(t=>({value:t,label:t}))},null,8,["value","options"])]),_:1})]),l("section",Jt,[l("div",Qt,[l("span",Xt,[a(_(re))]),e[43]||(e[43]=l("div",null,[l("h3",null,"تصویر شاخص"),l("p",null,"تصویر اصلی در لیست محصولات")],-1))]),l("div",Yt,[_(m).isSuperAdmin?(i(),S(b,{key:0,label:"سایت",class:"mb-0"},{default:s(()=>[a(ye,{modelValue:p.indicator_id,"onUpdate:modelValue":e[13]||(e[13]=t=>p.indicator_id=t),purpose:"product.indicator",placeholder:"تصویر شاخص"},null,8,["modelValue"])]),_:1})):P("",!0),a(b,{label:"موبایل",class:"mb-0"},{default:s(()=>[a(ye,{modelValue:p.mobile_pic,"onUpdate:modelValue":e[14]||(e[14]=t=>p.mobile_pic=t),purpose:"product.indicator_mobile",placeholder:"تصویر شاخص موبایل"},null,8,["modelValue"])]),_:1})])])])]),l("div",Zt,[l("span",Kt,[a(_(Ge)),e[44]||(e[44]=w(" تغییرات تنوعها و تصاویر پس از «ثبت اطلاعات» ذخیره میشوند. ",-1))]),a(k,{onClick:ce},{default:s(()=>[...e[45]||(e[45]=[w("انصراف",-1)])]),_:1}),a(k,{type:"primary",class:"form-submit",loading:F.value,onClick:pe},{icon:s(()=>[a(_(oe))]),default:s(()=>[e[46]||(e[46]=w(" ثبت اطلاعات ",-1))]),_:1},8,["loading"])])]),_:1})]),_:1},8,["spinning"]),a(Ae,{open:n.value,"onUpdate:open":e[27]||(e[27]=t=>n.value=t),width:860,"wrap-class-name":"pf-variant-modal",footer:null,"destroy-on-close":!0,centered:""},{title:s(()=>[l("div",el,[l("div",tl,[a(_(be))]),l("div",ll,[l("h3",null,x(g.value===null?"افزودن تنوع جدید":"ویرایش تنوع"),1),e[47]||(e[47]=l("p",null,"مشخصات، قیمتگذاری و تصویر این تنوع را وارد کنید.",-1))])])]),default:s(()=>[a(ve,{layout:"vertical",class:"vmodal-form"},{default:s(()=>[l("div",al,[l("div",sl,[l("div",ol,[e[50]||(e[50]=l("div",{class:"vmodal-card__head"},"مشخصات اصلی",-1)),l("div",il,[a(b,{label:"عنوان تنوع",required:"",class:"vmodal-item"},{default:s(()=>[a(y,{value:o.title,"onUpdate:value":e[15]||(e[15]=t=>o.title=t),placeholder:"مثلاً: ۵ گرمی"},null,8,["value"])]),_:1}),a(b,{label:"وزن خام",class:"vmodal-item"},{default:s(()=>[a(te,{value:o.grams,"onUpdate:value":e[16]||(e[16]=t=>o.grams=t),class:"w-full",step:.001,"addon-after":"گرم",placeholder:"۰.۰۰۰"},null,8,["value"])]),_:1})]),l("div",nl,[a(b,{label:"تعداد موجودی",class:"vmodal-item"},{default:s(()=>[a(te,{value:o.qty,"onUpdate:value":e[17]||(e[17]=t=>o.qty=t),class:"w-full",min:0,placeholder:"۰"},null,8,["value"])]),_:1}),a(b,{label:"رنگ طلا",class:"vmodal-item"},{default:s(()=>[a(N,{value:o.color,"onUpdate:value":e[18]||(e[18]=t=>o.color=t),placeholder:"انتخاب رنگ","allow-clear":""},{default:s(()=>[(i(!0),d(j,null,W(Z.value,t=>(i(),S(L,{key:t.id,value:t.id},{default:s(()=>[l("div",dl,[l("span",{class:J(["color-opt__dot",`color-opt__dot--${t.id}`])},null,2),l("span",null,x(t.title),1)])]),_:2},1032,["value"]))),128))]),_:1},8,["value"])]),_:1})]),l("div",rl,[l("label",ul,[e[48]||(e[48]=l("span",{class:"vmodal-switch-label"},"فعال برای فروش",-1)),a(ae,{checked:o.is_active,"onUpdate:checked":e[19]||(e[19]=t=>o.is_active=t),size:"small"},null,8,["checked"])]),l("label",cl,[e[49]||(e[49]=l("span",{class:"vmodal-switch-label"},"پیشسفارش",-1)),a(ae,{checked:o.is_pre_order,"onUpdate:checked":e[20]||(e[20]=t=>o.is_pre_order=t),size:"small"},null,8,["checked"])])])]),l("div",pl,[e[51]||(e[51]=l("div",{class:"vmodal-card__head"},"اجرت و قیمتگذاری",-1)),l("div",_l,[a(b,{label:"اجرت درصدی",class:"vmodal-item"},{default:s(()=>[a(te,{value:o.percentage_pay,"onUpdate:value":e[21]||(e[21]=t=>o.percentage_pay=t),class:"w-full",step:.1,"addon-after":"٪",placeholder:"۰"},null,8,["value"])]),_:1}),a(b,{label:"اجرت ریالی",class:"vmodal-item"},{default:s(()=>[a(te,{value:o.rial_pay,"onUpdate:value":e[22]||(e[22]=t=>o.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",vl,[l("div",ml,[e[53]||(e[53]=l("div",{class:"vmodal-card__head"},"تصویر اختصاصی تنوع",-1)),G.value.length?(i(),d("div",fl,[l("button",{type:"button",class:J(["vmodal-picker__item",{"is-active":!o.image_id}]),title:"بدون تصویر",onClick:e[23]||(e[23]=t=>C(null))},[a(_(ie)),e[52]||(e[52]=l("span",null,"بدون عکس",-1))],2),(i(!0),d(j,null,W(G.value,t=>(i(),d("button",{key:t.id,type:"button",class:J(["vmodal-picker__item",{"is-active":o.image_id===t.id}]),onClick:I=>C(t)},[l("img",{src:t.url,alt:""},null,8,yl),o.image_id===t.id?(i(),d("div",bl,[a(_(oe))])):P("",!0)],10,gl))),128))])):(i(),d("div",hl," تصویری در گالری ثبت نشده است (میتوانید در بخش گالری محصول تصویر بارگذاری کنید). "))]),l("div",kl,[e[54]||(e[54]=l("div",{class:"vmodal-card__head"},"توضیحات تکمیلی",-1)),a(b,{label:"توضیح مختصر",class:"vmodal-item"},{default:s(()=>[a(y,{value:o.details,"onUpdate:value":e[24]||(e[24]=t=>o.details=t),placeholder:"مثلاً: طراحی مات با تراش برلیان"},null,8,["value"])]),_:1}),a(b,{label:"توضیحات کامل",class:"vmodal-item mb-0"},{default:s(()=>[a(E,{value:o.description,"onUpdate:value":e[25]||(e[25]=t=>o.description=t),style:{height:"95px","min-height":"95px","max-height":"95px",resize:"none"},placeholder:"ویژگیهای خاص این تنوع..."},null,8,["value"])]),_:1})])])]),l("div",wl,[a(k,{class:"vmodal-footer__cancel",onClick:e[26]||(e[26]=t=>n.value=!1)},{default:s(()=>[...e[55]||(e[55]=[w(" انصراف ",-1)])]),_:1}),a(k,{type:"primary",class:"vmodal-footer__submit",onClick:le},{icon:s(()=>[a(_(oe))]),default:s(()=>[w(" "+x(g.value===null?"افزودن تنوع":"ذخیره تغییرات"),1)]),_:1})])]),_:1})]),_:1},8,["open"])])}}}),Il=Ce(Ol,[["__scopeId","data-v-461486f5"]]);export{Il as default};
|