text: "use strict";(self["webpackChunkecommerce_admin"]=self["webpackChunkecommerce_admin"]||[]).push([[58],{4058:(e,o,t)=>{t.r(o),t.d(o,{default:()=>P});var a=t(3673),r=t(8880);const l=(0,a._)("div",{class:"text-body2 q-mt-lg"},"Descripción",-1),n={class:"row q-col-gutter-sm"},u={class:"col-12"};function c(e,o,t,c,i,d){const m=(0,a.up)("q-input"),s=(0,a.up)("q-editor"),p=(0,a.up)("q-card-section"),f=(0,a.up)("q-btn"),v=(0,a.up)("q-card-actions"),h=(0,a.up)("q-card"),y=(0,a.up)("q-form");return(0,a.wg)(),(0,a.j4)(h,null,{default:(0,a.w5)((()=>[(0,a.Wm)(p,null,{default:(0,a.w5)((()=>[(0,a.Wm)(y,{class:"q-gutter-md",onSubmit:(0,r.iM)(e.onSubmit,["prevent"])},{default:(0,a.w5)((()=>[(0,a.Wm)(h,null,{default:(0,a.w5)((()=>[(0,a.Wm)(p,{class:"q-gutter-y-sm"},{default:(0,a.w5)((()=>[(0,a.Wm)(m,{modelValue:e.form.name,"onUpdate:modelValue":o[0]||(o[0]=o=>e.form.name=o),type:"text",label:"Nombre"},null,8,["modelValue"]),l,(0,a.Wm)(s,{modelValue:e.form.description,"onUpdate:modelValue":o[1]||(o[1]=o=>e.form.description=o),"min-height":"10rem"},null,8,["modelValue"]),(0,a._)("div",n,[(0,a._)("div",u,[(0,a.Wm)(m,{modelValue:e.form.price,"onUpdate:modelValue":o[2]||(o[2]=o=>e.form.price=o),type:"number",min:"0",label:"Precio",step:"0.01"},null,8,["modelValue"])])])])),_:1}),(0,a.Wm)(v,null,{default:(0,a.w5)((()=>[(0,a.Wm)(f,{color:"primary","text-color":"dark",type:"submit",icon:"mdi-check",label:"Guardar",loading:e.loading},null,8,["loading"])])),_:1})])),_:1})])),_:1},8,["onSubmit"])])),_:1})])),_:1})}var i=t(1959),d=t(8825),m=t(9582),s=t(1239),p=t(8872),f=t(269);const v=(0,a.aZ)({name:"UpdateProductForm",props:{product:{type:Object,required:!1}},setup(e){const o=(0,i.BK)(e),t=(0,d.Z)(),r=(0,m.tv)(),{errorHandler:l}=(0,s.y)(t,r),n=(0,p.Ey)(p.xj);(0,a.wF)((()=>{o.product&&o.product.value&&(u.value=o.product.value)}));const u=(0,i.iH)({id:0,description:"",image:"",name:"",price:0,stock:0,gallery:[]}),c=(0,i.iH)(!1);function v(){c.value=!0,0===u.value.id?n.createProductAction(u.value).then((()=>{t.notify({message:"Producto Creado",type:"positive",position:"center",actions:[{icon:"mdi-close",color:"white",handler:()=>{}}]}),r.push({name:f.I.PRODUCTS})})).catch((e=>{l(e,"Error creando producto")})).finally((()=>{c.value=!1})):n.updateProductAction(u.value).then((()=>{t.notify({message:"Producto actualizado",type:"positive",position:"center",actions:[{icon:"mdi-close",color:"white",handler:()=>{}}]}),r.push({name:f.I.PRODUCTS})})).catch((e=>{l(e,"Error actualizando producto")})).finally((()=>{c.value=!1}))}return{form:u,loading:c,onSubmit:v}}});var h=t(4260),y=t(151),b=t(5589),g=t(5269),w=t(4842),q=t(3626),_=t(9367),Z=t(2165),V=t(7518),W=t.n(V);const C=(0,h.Z)(v,[["render",c]]),P=C;W()(v,"components",{QCard:y.Z,QCardSection:b.Z,QForm:g.Z,QInput:w.Z,QEditor:q.Z,QCardActions:_.Z,QBtn:Z.Z})}}]);