2 lines
1.8 KiB
JavaScript
2 lines
1.8 KiB
JavaScript
import{B}from"./C_gIYN7y.js";import"./SY11ehhM.js";import"./Bly7rU0x.js";import{d as k,u as O,G as _,r as P,a1 as b,F as D,z as $,D as c,A as t,H as d,C as u,B as p,af as f,cJ as I,cK as R,Q as m}from"./G_17LgpR.js";import{B as g}from"./DUAMdf4s.js";import{u as T}from"./ShsZnF8h.js";const A={class:"h-fit px-4"},N={class:"flex flex-col gap-2 mt-5 mb-5"},U={class:"text-sm text-white"},V={class:"text-red text-sm"},K=k({__name:"moreOptionProduct",props:{open:{type:Boolean},id:{}},emits:["update:open"],setup(x,{emit:v}){const y=O(),s=_(),i=P(null),a=x,r=v;async function S(){await f(),await i.value?.setOpen()}async function h(){await f(),await i.value?.setClose()}async function C(){await I(s.useString("areYouSureToDeleteThisProduct"),w)}const o=T();async function w(){o.percentUpload=0,o.loading=!0;try{await R(a.id),o.percentUpload=100,m.success(s.useString("deletedSuccessfully"))}catch(n){console.log(n),m.error(s.useString("errorInAction"))}finally{o.loading=!1,r("update:open",!1)}}return b(a,n=>{n.open?S():h()}),(n,e)=>($(),D(B,{title:"",ref_key:"sheetRef",ref:i,headerCls:"",closeOnClickOutside:"",onOnClickOutside:e[2]||(e[2]=l=>r("update:open",!1)),onOnClose:e[3]||(e[3]=l=>r("update:open",!1))},{header:c(()=>e[4]||(e[4]=[t("div",{flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},[t("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""})],-1)])),default:c(()=>[t("div",A,[t("div",N,[t("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-primary",onClick:e[0]||(e[0]=l=>d(y).push({name:"edit-product-id",params:{id:a.id}}))},[u(g,{icon:"vuesax-linear:edit",color:"white"}),t("div",U,p(d(s).useString("edit")),1)]),t("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-red-100",onClick:e[1]||(e[1]=l=>C())},[u(g,{icon:"vuesax-linear:trash",color:"red"}),t("div",V,p(d(s).useString("delete")),1)])])])]),_:1},512))}});export{K as _};
|