Files
tehran_taj/apps/admin-panel/dist/assets/AddProduct-BZyz90Bn.js
T

2 lines
26 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{c as t,I as te,d as ke,n as je,N as ze,o as r,b as _,w as n,p as a,h as m,t as L,F as N,e as Q,i as j,O as Me,f as h,m as P,s as _e,G as X,U as Ee,r as k,q as K,Q as we,D as Oe,y as D,_ as $e,u as Re,x as Ae,k as Ne,z as ne,R as qe,a as I,H as Be,S as De,P as fe,T as He,E as Fe,V as Te,W as Ge,l as We}from"./index-CWG3wO0f.js";import{_ as ve}from"./ImageUploadInput.vue_vue_type_script_setup_true_lang-CKangRMD.js";import{A as Je}from"./AppstoreOutlined-BKyu7r8n.js";var Qe={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 me(u){for(var o=1;o<arguments.length;o++){var i=arguments[o]!=null?Object(arguments[o]):{},p=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(i).filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable}))),p.forEach(function(d){Xe(u,d,i[d])})}return u}function Xe(u,o,i){return o in u?Object.defineProperty(u,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):u[o]=i,u}var se=function(o,i){var p=me({},o,i.attrs);return t(te,me({},p,{icon:Qe}),null)};se.displayName="CloudUploadOutlined";se.inheritAttrs=!1;var Ye={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 ge(u){for(var o=1;o<arguments.length;o++){var i=arguments[o]!=null?Object(arguments[o]):{},p=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(i).filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable}))),p.forEach(function(d){Ze(u,d,i[d])})}return u}function Ze(u,o,i){return o in u?Object.defineProperty(u,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):u[o]=i,u}var oe=function(o,i){var p=ge({},o,i.attrs);return t(te,ge({},p,{icon:Ye}),null)};oe.displayName="FileImageOutlined";oe.inheritAttrs=!1;var Ke={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 632H136v-39.9l138.5-164.3 150.1 178L658.1 489 888 761.6V792zm0-129.8L664.2 396.8c-3.2-3.8-9-3.8-12.2 0L424.6 666.4l-144-170.7c-3.2-3.8-9-3.8-12.2 0L136 652.7V232h752v430.2zM304 456a88 88 0 100-176 88 88 0 000 176zm0-116c15.5 0 28 12.5 28 28s-12.5 28-28 28-28-12.5-28-28 12.5-28 28-28z"}}]},name:"picture",theme:"outlined"};function ye(u){for(var o=1;o<arguments.length;o++){var i=arguments[o]!=null?Object(arguments[o]):{},p=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(i).filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable}))),p.forEach(function(d){et(u,d,i[d])})}return u}function et(u,o,i){return o in u?Object.defineProperty(u,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):u[o]=i,u}var ee=function(o,i){var p=ye({},o,i.attrs);return t(te,ye({},p,{icon:Ke}),null)};ee.displayName="PictureOutlined";ee.inheritAttrs=!1;var tt={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 be(u){for(var o=1;o<arguments.length;o++){var i=arguments[o]!=null?Object(arguments[o]):{},p=Object.keys(i);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(i).filter(function(d){return Object.getOwnPropertyDescriptor(i,d).enumerable}))),p.forEach(function(d){lt(u,d,i[d])})}return u}function lt(u,o,i){return o in u?Object.defineProperty(u,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):u[o]=i,u}var ie=function(o,i){var p=be({},o,i.attrs);return t(te,be({},p,{icon:tt}),null)};ie.displayName="TagsOutlined";ie.inheritAttrs=!1;const at={class:"gallery-upload"},nt={class:"gallery-upload__zone"},st={class:"gallery-upload__title"},ot={key:0,class:"gallery-upload__grid"},it=["src"],rt={key:0,class:"tile__progress"},ut={key:1,class:"tile__overlay"},dt=["onClick"],ct=["onClick"],pt={key:1,class:"gallery-upload__meta"},_t={key:0,class:"gallery-upload__pending"},ft=["src"],vt=3,mt=ke({__name:"GalleryUploadInput",props:{modelValue:{default:()=>[]},purpose:{default:void 0},placeholder:{default:"افزودن تصاویر گالری"}},emits:["update:modelValue"],setup(u,{emit:o}){const i=u,p=o,d=P([]),z=P(!1),E=P(""),T=()=>d.value.filter(s=>s.status==="done"&&s.url).map(s=>s.url),H=_e(()=>d.value.filter(s=>s.status==="done").length),G=_e(()=>d.value.filter(s=>s.status==="uploading").length);function W(){p("update:modelValue",T())}je(()=>i.modelValue,s=>{if(JSON.stringify(T())===JSON.stringify(s??[]))return;const g=d.value.filter(f=>f.status==="uploading");d.value=[...(s??[]).map(f=>({uid:f,status:"done",url:f,percent:100})),...g]},{immediate:!0});function Y(s){return s.type.startsWith("image/")?!0:(X.error(`«${s.name}» تصویر نیست`),Ee.LIST_IGNORE)}let c=0;const R=[];function F(s){return new Promise((g,f)=>{const w=()=>{c++,s().then(g,f).finally(()=>{var V;c--,(V=R.shift())==null||V()})};c<vt?w():R.push(w)})}const A=s=>d.value.find(g=>g.uid===s);function J({file:s}){const g=s.uid??`${Date.now()}-${Math.random().toString(36).slice(2,8)}`;d.value.push({uid:g,status:"uploading",preview:URL.createObjectURL(s),percent:0}),F(async()=>{if(!A(g))return null;const f=new FormData;f.append("file",s),i.purpose&&f.append("purpose",i.purpose);const{data:w}=await D.post("file/create",f,{onUploadProgress:V=>{const $=A(g);$&&V.total&&($.percent=Math.round(V.loaded/V.total*100))}});return w}).then(f=>{const w=A(g);!w||!(f!=null&&f.url)||(w.preview&&URL.revokeObjectURL(w.preview),Object.assign(w,{status:"done",url:f.url,preview:void 0,percent:100}),W())}).catch(f=>{var V,$;const w=(($=(V=f==null?void 0:f.response)==null?void 0:V.data)==null?void 0:$.message)??`بارگذاری «${s.name}» ناموفق بود`;X.error(w),M(g)})}function M(s){const g=d.value.findIndex(w=>w.uid===s);if(g===-1)return;const[f]=d.value.splice(g,1);f.preview&&URL.revokeObjectURL(f.preview)}function q(s){M(s),W()}function B(s){E.value=s.url??s.preview??"",z.value=!0}return ze(()=>{d.value.forEach(s=>s.preview&&URL.revokeObjectURL(s.preview))}),(s,g)=>{const f=k("a-upload-dragger"),w=k("a-progress"),V=k("a-modal");return r(),_("div",at,[t(f,{accept:"image/*",multiple:"","show-upload-list":!1,"custom-request":J,"before-upload":Y},{default:n(()=>[a("div",nt,[t(m(se),{class:"gallery-upload__icon"}),a("p",st,L(u.placeholder),1),g[1]||(g[1]=a("p",{class:"gallery-upload__hint"}," تصاویر را اینجا بکشید و رها کنید یا کلیک کنید — انتخاب چند تصویر به‌صورت همزمان امکان‌پذیر است ",-1))])]),_:1}),d.value.length?(r(),_("div",ot,[(r(!0),_(N,null,Q(d.value,$=>(r(),_("div",{key:$.uid,class:K(["tile",{"is-uploading":$.status==="uploading"}])},[a("img",{src:$.url??$.preview,alt:""},null,8,it),$.status==="uploading"?(r(),_("div",rt,[t(w,{type:"circle",percent:$.percent,size:40,"stroke-width":8,"stroke-color":"#fff","trail-color":"rgba(255,255,255,.3)","show-info":!1},null,8,["percent"])])):(r(),_("div",ut,[a("button",{type:"button",class:"tile__btn",title:"نمایش",onClick:le=>B($)},[t(m(we))],8,dt),a("button",{type:"button",class:"tile__btn tile__btn--danger",title:"حذف",onClick:le=>q($.uid)},[t(m(Oe))],8,ct)]))],2))),128))])):j("",!0),d.value.length?(r(),_("div",pt,[a("span",null,L(H.value)+" تصویر",1),G.value?(r(),_("span",_t,[t(m(Me)),h(" در حال بارگذاری "+L(G.value)+" تصویر… ",1)])):j("",!0)])):j("",!0),t(V,{open:z.value,footer:null,onCancel:g[0]||(g[0]=$=>z.value=!1)},{default:n(()=>[a("img",{src:E.value,style:{width:"100%"},alt:""},null,8,ft)]),_:1},8,["open"])])}}}),he=$e(mt,[["__scopeId","data-v-79ab0f30"]]),gt={id:"page-user-view",class:"pf-page product-form-page"},yt={class:"pf-head"},bt={class:"pf-head__text"},ht={class:"pf-layout"},kt={class:"pf-main"},wt={class:"pf-section"},Ot={class:"pf-section__head"},$t={class:"pf-section__icon"},Ut={class:"pf-grid-2"},Ct={key:0,class:"pf-section"},xt={class:"pf-section__head"},Pt={class:"pf-section__icon"},It={key:1,class:"table-scroll"},Vt=["src"],St={key:1,class:"variant-thumb variant-thumb--empty"},Lt={key:1,class:"pf-table__title"},jt={key:0},zt={key:1,class:"muted"},Mt={key:0},Et={key:1,class:"muted"},Rt={key:4,class:"pf-table__ops"},At={class:"pf-section"},Nt={class:"pf-section__head"},qt={class:"pf-section__icon"},Bt={class:"pf-side"},Dt={class:"pf-section"},Ht={class:"pf-section__head"},Ft={class:"pf-section__icon"},Tt={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:"variant-form__media"},tl={key:0,class:"variant-picker"},ll=["onClick"],al=["src"],nl={class:"variant-form__fields"},sl={class:"pf-grid-3"},ol=ke({__name:"AddProduct",setup(u){const o=Ne(),i=We(),p=Re(),d=b=>!!p.hasPermission(b),z=o.params.id,E=P(!1),T=P(void 0),H=P(!1),G=P([]),W=P([]),Y=P([]),c=ne({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}),R=ne({}),F=P([]),A=P([]),J=P([]),M=P([]),q=P(!1),B=P(null),s=ne({__key:"",title:"",grams:void 0,percentage_pay:void 0,qty:0,is_active:!0,is_pre_order:!1,image_id:null,image_url:null});function g(b){s.image_id=b?b.id:null,s.image_url=b?b.url:null}const f=[{title:"تصویر",dataIndex:"image",width:68,align:"center"},{title:"عنوان تنوع",dataIndex:"title"},{title:"وزن",dataIndex:"grams",align:"right"},{title:"اجرت",dataIndex:"percentage_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 w(b,e){b&&e!==void 0?(B.value=e,Object.assign(s,b)):(B.value=null,Object.assign(s,{__key:`v-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,id:void 0,title:"",grams:void 0,percentage_pay:T.value,qty:0,is_active:!0,is_pre_order:!1,image_id:null,image_url:null})),q.value=!0}function V(){if(!s.title){X.error("عنوان تنوع الزامی است");return}const b={...s};B.value===null?M.value.push(b):M.value[B.value]=b,q.value=!1}function $(){window.history.length>1?i.back():i.push("/apps/product/list")}function le(){return Object.keys(R).forEach(b=>delete R[b]),c.title||(R.title="لطفا مقدار را وارد کنید"),Object.keys(R).length===0}async function re(){var b,e;if(le())try{H.value=!0;const O={...c,cats:c.category_id?[c.category_id]:[],images:F.value,images_mobile:A.value,variants:M.value.map(x=>({id:x.id,title:x.title,grams:x.grams,percentage_pay:x.percentage_pay,qty:x.qty,is_active:x.is_active,is_pre_order:x.is_pre_order,image_id:x.image_id??null}))};z?await D.put(`product/update/${z}`,O):await D.post("product/create",O),X.info("اطلاعات با موفقیت به ثبت رسید."),i.push("/apps/product/list")}catch(O){X.error(((e=(b=O==null?void 0:O.response)==null?void 0:b.data)==null?void 0:e.message)??"خطا در ثبت اطلاعات.")}finally{H.value=!1}}return Ae(async()=>{var b,e,O,x;try{const[v,U,y]=await Promise.all([D.get("brand"),D.post("category"),p.isSuperAdmin?D.get("admin/products/collections"):Promise.resolve({data:[]})]);G.value=v.data,W.value=(U.data.rows??U.data).map(C=>({id:C.id,title:C.type_str?`${C.title} (${C.type_str}) `:C.title,type:C.type})),Y.value=y.data}catch(v){console.log(v)}if(z)try{const{data:v}=await D.get(`product/show/${z}`);E.value=!!((b=v.accounting)!=null&&b.locked),T.value=((e=v.accounting)==null?void 0:e.sale_wage_percent)!=null?Number(v.accounting.sale_wage_percent):void 0,Object.assign(c,{title:v.title??"",product_code:v.product_code??"",show_type:v.show_type??3,category_id:((O=v.category)==null?void 0:O.id)??void 0,brand_id:((x=v.brand)==null?void 0:x.id)??void 0,ciny_ids:v.ciny_ids??[],body_html:v.body_html??"",is_active:v.is_active??!0,indicator_id:v.indicator_id??null,mobile_pic:v.mobile_pic??null}),F.value=v.images_gallery??[],A.value=v.images_mobile??[],J.value=v.gallery??[],M.value=(v.variants_all??[]).map((U,y)=>{var C;return{__key:U.id??`v-${y}`,id:U.id,title:U.title,grams:Number(U.grams),percentage_pay:Number(U.percentage_pay),qty:U.qty,is_active:U.is_active,is_pre_order:U.is_pre_order,image_id:U.image_id??null,image_url:((C=U.image)==null?void 0:C.url)??null}})}catch(v){console.log(v)}}),(b,e)=>{const O=k("a-button"),x=k("a-tag"),v=k("a-alert"),U=k("a-input"),y=k("a-form-item"),C=k("a-select-option"),Z=k("a-select"),Ue=k("a-textarea"),Ce=k("a-empty"),ue=k("a-tooltip"),xe=k("a-table"),Pe=k("a-switch"),de=k("a-form"),Ie=k("a-spin"),ae=k("a-input-number"),ce=k("a-checkbox"),Ve=k("a-space"),Se=k("a-modal");return r(),_("div",gt,[t(Ie,{spinning:H.value},{default:n(()=>[a("header",yt,[t(O,{class:"pf-head__back",shape:"circle",onClick:$},{icon:n(()=>[t(m(qe))]),_:1}),a("div",bt,[a("h1",null,L(m(z)?"ویرایش محصول":"افزودن محصول"),1),e[23]||(e[23]=a("p",null,"اطلاعات، تنوع‌ها و تصاویر محصول را تکمیل کنید.",-1))]),m(z)?(r(),I(x,{key:0,color:c.is_active?"green":"default",class:"pf-head__status"},{default:n(()=>[h(L(c.is_active?"فعال":"غیر فعال"),1)]),_:1},8,["color"])):j("",!0)]),t(de,{layout:"vertical",class:"pf-form",onSubmit:Be(re,["prevent"])},{default:n(()=>[a("div",ht,[a("div",kt,[a("section",wt,[a("div",Ot,[a("span",$t,[t(m(De))]),e[24]||(e[24]=a("div",null,[a("h3",null,"اطلاعات پایه"),a("p",null,"نام، کد و توضیحات محصول")],-1))]),E.value?(r(),I(v,{key:0,class:"pf-alert",type:"info","show-icon":"",message:"این محصول به نرم‌افزار حسابداری متصل است؛ نام و کد محصول از آنجا خوانده می‌شود."})):j("",!0),t(y,{label:"نام محصول",required:"","validate-status":R.title?"error":"",help:R.title||(E.value?"از نرم‌افزار حسابداری — برای تغییر، آن را در حسابداری ویرایش کنید":void 0)},{default:n(()=>[t(U,{value:c.title,"onUpdate:value":e[0]||(e[0]=l=>c.title=l),placeholder:"مثلاً: گردنبند طلا",disabled:E.value},null,8,["value","disabled"])]),_:1},8,["validate-status","help"]),a("div",Ut,[t(y,{label:"کد محصول",help:E.value?"از نرم‌افزار حسابداری":void 0},{default:n(()=>[t(U,{value:c.product_code,"onUpdate:value":e[1]||(e[1]=l=>c.product_code=l),disabled:E.value},null,8,["value","disabled"])]),_:1},8,["help"]),t(y,{label:"نوع نمایش"},{default:n(()=>[t(Z,{value:c.show_type,"onUpdate:value":e[2]||(e[2]=l=>c.show_type=l)},{default:n(()=>[t(C,{value:1},{default:n(()=>[...e[25]||(e[25]=[h("سایت",-1)])]),_:1}),t(C,{value:2},{default:n(()=>[...e[26]||(e[26]=[h("گوشی",-1)])]),_:1}),t(C,{value:3},{default:n(()=>[...e[27]||(e[27]=[h("سایت و گوشی",-1)])]),_:1})]),_:1},8,["value"])]),_:1})]),t(y,{label:"شرح محصول (سایت)",class:"mb-0"},{default:n(()=>[t(Ue,{value:c.body_html,"onUpdate:value":e[3]||(e[3]=l=>c.body_html=l),"auto-size":{minRows:5,maxRows:12},placeholder:"توضیحات محصول برای نمایش در سایت"},null,8,["value"])]),_:1})]),d("product.list.variants")?(r(),_("section",Ct,[a("div",xt,[a("span",Pt,[t(m(Je))]),e[29]||(e[29]=a("div",null,[a("h3",null,"تنوع ها"),a("p",null,"وزن، اجرت و موجودی هر مدل از محصول")],-1)),d("product.list.variants.add")?(r(),I(O,{key:0,type:"primary",class:"pf-section__action",onClick:e[4]||(e[4]=l=>w())},{icon:n(()=>[t(m(fe))]),default:n(()=>[e[28]||(e[28]=h(" افزودن تنوع ",-1))]),_:1})):j("",!0)]),M.value.length?(r(),_("div",It,[t(xe,{class:"pf-table",columns:f,"data-source":M.value,pagination:!1,scroll:{x:"max-content"},size:"middle","row-key":"__key"},{bodyCell:n(({column:l,record:S,index:pe})=>[l.dataIndex==="image"?(r(),_(N,{key:0},[S.image_url?(r(),_("img",{key:0,src:S.image_url,class:"variant-thumb",alt:""},null,8,Vt)):(r(),_("span",St,[t(m(ee))]))],64)):l.dataIndex==="title"?(r(),_("span",Lt,L(S.title),1)):l.dataIndex==="grams"?(r(),_(N,{key:2},[S.grams!=null?(r(),_("span",jt,[h(L(S.grams)+" ",1),e[31]||(e[31]=a("small",{class:"muted"},"گرم",-1))])):(r(),_("span",zt,"—"))],64)):l.dataIndex==="percentage_pay"?(r(),_(N,{key:3},[S.percentage_pay!=null?(r(),_("span",Mt,[h(L(S.percentage_pay),1),e[32]||(e[32]=a("small",{class:"muted"},"٪",-1))])):(r(),_("span",Et,"—"))],64)):l.dataIndex==="op"?(r(),_("div",Rt,[d("product.list.variants.edit")?(r(),I(ue,{key:0,title:"ویرایش"},{default:n(()=>[t(O,{type:"text",size:"small",onClick:Le=>w(S,pe)},{icon:n(()=>[t(m(Fe),{class:"text-primary"})]),_:1},8,["onClick"])]),_:2},1024)):j("",!0),d("product.list.variants.remove")?(r(),I(ue,{key:1,title:"حذف"},{default:n(()=>[t(O,{type:"text",size:"small",danger:"",onClick:Le=>M.value.splice(pe,1)},{icon:n(()=>[t(m(Oe))]),_:1},8,["onClick"])]),_:2},1024)):j("",!0)])):l.dataIndex==="is_active"?(r(),I(x,{key:5,color:S.is_active?"green":"red"},{default:n(()=>[h(L(S.is_active?"فعال":"غیر فعال"),1)]),_:2},1032,["color"])):l.dataIndex==="is_pre_order"?(r(),I(x,{key:6,color:S.is_pre_order?"blue":""},{default:n(()=>[h(L(S.is_pre_order?"بله":"خیر"),1)]),_:2},1032,["color"])):j("",!0)]),_:1},8,["data-source"])])):(r(),I(Ce,{key:0,image:m(He).PRESENTED_IMAGE_SIMPLE,description:"هنوز تنوعی برای این محصول ثبت نشده است."},{default:n(()=>[d("product.list.variants.add")?(r(),I(O,{key:0,onClick:e[5]||(e[5]=l=>w())},{icon:n(()=>[t(m(fe))]),default:n(()=>[e[30]||(e[30]=h(" افزودن اولین تنوع ",-1))]),_:1})):j("",!0)]),_:1},8,["image"]))])):j("",!0),a("section",At,[a("div",Nt,[a("span",qt,[t(m(ee))]),e[33]||(e[33]=a("div",null,[a("h3",null,"گالری تصاویر"),a("p",null,"تصاویر جداگانه برای نمایش در سایت و اپلیکیشن موبایل")],-1))]),t(y,{label:"گالری تصاویر سایت"},{default:n(()=>[t(he,{modelValue:F.value,"onUpdate:modelValue":e[6]||(e[6]=l=>F.value=l),purpose:"product.gallery",placeholder:"افزودن تصاویر گالری سایت"},null,8,["modelValue"])]),_:1}),e[34]||(e[34]=a("div",{class:"pf-divider"},null,-1)),t(y,{label:"گالری تصاویر موبایل",class:"mb-0"},{default:n(()=>[t(he,{modelValue:A.value,"onUpdate:modelValue":e[7]||(e[7]=l=>A.value=l),purpose:"product.gallery_mobile",placeholder:"افزودن تصاویر گالری موبایل"},null,8,["modelValue"])]),_:1})])]),a("aside",Bt,[a("section",Dt,[a("div",Ht,[a("span",Ft,[t(m(we))]),e[35]||(e[35]=a("div",null,[a("h3",null,"وضعیت نمایش"),a("p",null,"نمایش یا عدم نمایش محصول برای مشتریان")],-1))]),t(y,{label:"نمایش محصول",extra:c.is_active?"محصول برای مشتریان قابل مشاهده است":"محصول پنهان است",class:"mb-0"},{default:n(()=>[t(Pe,{checked:c.is_active,"onUpdate:checked":e[8]||(e[8]=l=>c.is_active=l)},null,8,["checked"])]),_:1},8,["extra"])]),a("section",Tt,[a("div",Gt,[a("span",Wt,[t(m(ie))]),e[36]||(e[36]=a("div",null,[a("h3",null,"دسته‌بندی"),a("p",null,"دسته، برند و سینی‌های محصول")],-1))]),t(y,{label:"دسته بندی"},{default:n(()=>[t(Z,{value:c.category_id,"onUpdate:value":e[9]||(e[9]=l=>c.category_id=l),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:n(()=>[(r(!0),_(N,null,Q(W.value,l=>(r(),I(C,{key:l.id,value:l.id,label:l.title},{default:n(()=>[h(L(l.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1}),t(y,{label:"برند",class:K({"mb-0":!m(p).isSuperAdmin})},{default:n(()=>[t(Z,{value:c.brand_id,"onUpdate:value":e[10]||(e[10]=l=>c.brand_id=l),"allow-clear":"","show-search":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:n(()=>[(r(!0),_(N,null,Q(G.value,l=>(r(),I(C,{key:l.id,value:l.id,label:l.title},{default:n(()=>[h(L(l.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1},8,["class"]),m(p).isSuperAdmin?(r(),I(y,{key:0,label:"سینی ها",class:"mb-0"},{default:n(()=>[t(Z,{value:c.ciny_ids,"onUpdate:value":e[11]||(e[11]=l=>c.ciny_ids=l),mode:"multiple","allow-clear":"","option-filter-prop":"label",placeholder:"انتخاب کنید"},{default:n(()=>[(r(!0),_(N,null,Q(Y.value,l=>(r(),I(C,{key:l.id,value:l.id,label:l.title},{default:n(()=>[h(L(l.title),1)]),_:2},1032,["value","label"]))),128))]),_:1},8,["value"])]),_:1})):j("",!0)]),a("section",Jt,[a("div",Qt,[a("span",Xt,[t(m(oe))]),e[37]||(e[37]=a("div",null,[a("h3",null,"تصویر شاخص"),a("p",null,"تصویر اصلی در لیست محصولات")],-1))]),a("div",Yt,[t(y,{label:"سایت",class:"mb-0"},{default:n(()=>[t(ve,{modelValue:c.indicator_id,"onUpdate:modelValue":e[12]||(e[12]=l=>c.indicator_id=l),purpose:"product.indicator",placeholder:"تصویر شاخص"},null,8,["modelValue"])]),_:1}),t(y,{label:"موبایل",class:"mb-0"},{default:n(()=>[t(ve,{modelValue:c.mobile_pic,"onUpdate:modelValue":e[13]||(e[13]=l=>c.mobile_pic=l),purpose:"product.indicator_mobile",placeholder:"تصویر شاخص موبایل"},null,8,["modelValue"])]),_:1})])])])]),a("div",Zt,[a("span",Kt,[t(m(Te)),e[38]||(e[38]=h(" تغییرات تنوع‌ها و تصاویر پس از «ثبت اطلاعات» ذخیره می‌شوند. ",-1))]),t(O,{onClick:$},{default:n(()=>[...e[39]||(e[39]=[h("انصراف",-1)])]),_:1}),t(O,{type:"primary",class:"form-submit",loading:H.value,onClick:re},{icon:n(()=>[t(m(Ge))]),default:n(()=>[e[40]||(e[40]=h(" ثبت اطلاعات ",-1))]),_:1},8,["loading"])])]),_:1})]),_:1},8,["spinning"]),t(Se,{open:q.value,"onUpdate:open":e[22]||(e[22]=l=>q.value=l),title:B.value===null?"افزودن تنوع":"ویرایش تنوع",width:640,"wrap-class-name":"pf-variant-modal"},{footer:n(()=>[t(O,{onClick:e[21]||(e[21]=l=>q.value=!1)},{default:n(()=>[...e[44]||(e[44]=[h("انصراف",-1)])]),_:1}),t(O,{type:"primary",onClick:V},{default:n(()=>[...e[45]||(e[45]=[h("ثبت",-1)])]),_:1})]),default:n(()=>[t(de,{layout:"vertical",class:"pf-form variant-form"},{default:n(()=>[a("div",el,[t(y,{label:"تصویر اختصاصی این تنوع",class:"variant-image-item"},{default:n(()=>[J.value.length?(r(),_("div",tl,[a("button",{type:"button",class:K(["variant-picker__item",{"is-on":!s.image_id}]),title:"بدون تصویر اختصاصی",onClick:e[14]||(e[14]=l=>g(null))},[...e[41]||(e[41]=[a("span",{class:"variant-picker__none"},"بدون تصویر",-1)])],2),(r(!0),_(N,null,Q(J.value,l=>(r(),_("button",{key:l.id,type:"button",class:K(["variant-picker__item",{"is-on":s.image_id===l.id}]),onClick:S=>g(l)},[a("img",{src:l.url,alt:""},null,8,al)],10,ll))),128))])):(r(),I(v,{key:1,type:"info","show-icon":"",message:m(z)?"برای این محصول تصویری در گالری ثبت نشده است.":"ابتدا محصول را ذخیره کنید تا تصاویر گالری برای انتخاب فعال شوند."},null,8,["message"]))]),_:1})]),a("div",nl,[t(y,{label:"عنوان",required:""},{default:n(()=>[t(U,{value:s.title,"onUpdate:value":e[15]||(e[15]=l=>s.title=l),placeholder:"مثلاً: ۵ گرمی"},null,8,["value"])]),_:1}),a("div",sl,[t(y,{label:"وزن"},{default:n(()=>[t(ae,{value:s.grams,"onUpdate:value":e[16]||(e[16]=l=>s.grams=l),class:"w-full",step:.001,"addon-after":"گرم"},null,8,["value"])]),_:1}),t(y,{label:"اجرت درصدی"},{default:n(()=>[t(ae,{value:s.percentage_pay,"onUpdate:value":e[17]||(e[17]=l=>s.percentage_pay=l),class:"w-full",step:.1,"addon-after":"٪"},null,8,["value"])]),_:1}),t(y,{label:"تعداد"},{default:n(()=>[t(ae,{value:s.qty,"onUpdate:value":e[18]||(e[18]=l=>s.qty=l),class:"w-full"},null,8,["value"])]),_:1})]),t(y,{label:"وضعیت",class:"mb-0"},{default:n(()=>[t(Ve,{size:24},{default:n(()=>[t(ce,{checked:s.is_active,"onUpdate:checked":e[19]||(e[19]=l=>s.is_active=l)},{default:n(()=>[...e[42]||(e[42]=[h("فعال",-1)])]),_:1},8,["checked"]),t(ce,{checked:s.is_pre_order,"onUpdate:checked":e[20]||(e[20]=l=>s.is_pre_order=l)},{default:n(()=>[...e[43]||(e[43]=[h("پیش سفارش",-1)])]),_:1},8,["checked"])]),_:1})]),_:1})])]),_:1}),e[46]||(e[46]=a("p",{class:"variant-form__hint"},"تصویر بارگذاری‌شده به گالری سایت محصول هم اضافه می‌شود.",-1))]),_:1},8,["open","title"])])}}}),dl=$e(ol,[["__scopeId","data-v-1b2e7ceb"]]);export{dl as default};