import{a as S}from"./Z4eZ-m2s.js";import{u as V,s as F,O as P,j as R,k as A,d as I,w as O,m as o,o as l,b as t,c as r,t as e,F as j,g as E,G as H,H as M,K as U,D as z,e as m,E as k}from"./Bgmy51Qv.js";import{u as G}from"./CYl1ofbh.js";import{u as K}from"./BE7GDBwC.js";import"./7pZkuj9N.js";import"./BHvLfWtM.js";import"./hSbGpNHU.js";import"./DuhDFJjj.js";import"./ByXs6QR-.js";import"./D_7E8SMU.js";import"./DKgjlGGV.js";const T={class:"lite-bold"},q=["value"],J={class:"mx-w-300x"},Q={key:0},W={key:1},X={key:0},Y={key:1},Z=["onClick"],x=["onClick"],pt={__name:"index",setup(tt){const _=V(),{setting:g}=F(_),{t:d}=P(),{priceFormat:y,getDataFromObject:i,getStatus:$}=K(),v=R({title:{title:d("index.title")},created_at:{title:d("category.date")},status:{title:d("category.status")}}),u=A(()=>{var n;return((n=g.value)==null?void 0:n.currency_icon)||"$"}),{cbList:c,deleteBulk:f,listPageRef:b,setItemList:C,checkAll:h,editNode:B,deleteNode:L}=G();return(n,a)=>{const D=S;return l(),I(D,{ref_key:"listPageRef",ref:b,"list-api":"getVouchers","delete-api":"deleteVoucher","route-name":"vouchers",name:n.$t("prod.voucher"),"order-options":o(v),onDeleteBulk:o(f),onList:o(C),gate:"voucher"},{table:O(({list:N})=>[t("tr",T,[t("th",null,[t("input",{type:"checkbox",onChange:a[0]||(a[0]=(...s)=>o(h)&&o(h)(...s))},null,32)]),t("th",null,e(n.$t("index.title")),1),t("th",null,e(n.$t("prod.code")),1),t("th",null,e(n.$t("brand.price"))+"("+e(o(u))+")",1),t("th",null,e(n.$t("prod.capped"))+"("+e(o(u))+")",1),t("th",null,e(n.$t("prod.spent"))+"("+e(o(u))+")",1),t("th",null,e(n.$t("prod.usage")),1),t("th",null,e(n.$t("prod.limit")),1),t("th",null,e(n.$t("category.status")),1),t("th",null,e(n.$t("category.created")),1),a[2]||(a[2]=t("th",null," ",-1))]),(l(!0),r(j,null,E(N,(s,w)=>(l(),r("tr",{key:w},[t("td",null,[H(t("input",{type:"checkbox",value:s.id,"onUpdate:modelValue":a[1]||(a[1]=p=>M(c)?c.value=p:null)},null,8,q),[[U,o(c)]])]),t("td",null,[t("h5",J,e(s.title),1)]),t("td",null,e(s.code),1),t("td",null,e(o(y)({type:s.type,price:s.price,icon:o(u)})),1),t("td",null,[o(i)(s,"capped_price")?(l(),r("span",Q,e(o(i)(s,"capped_price")),1)):(l(),r("span",W," N/A "))]),t("td",null,[o(i)(s,"min_spend")?(l(),r("span",X,e(o(i)(s,"min_spend")),1)):(l(),r("span",Y," N/A "))]),t("td",null,e(s.usage_limit),1),t("td",null,e(s.limit_per_customer),1),t("td",{class:z(["status",{active:s.status==1}])},[t("span",null,e(o($)(s.status)),1)],2),t("td",null,e(s.created),1),t("td",null,[n.$can("voucher","edit")?(l(),r("button",{key:0,onClick:k(p=>o(B)(s),["prevent"]),class:"lite-btn"},e(n.$t("category.edit")),9,Z)):m("",!0),n.$can("voucher","delete")?(l(),r("button",{key:1,onClick:k(p=>o(L)(s),["prevent"]),class:"delete-btn lite-btn"},e(n.$t("category.delete")),9,x)):m("",!0)])]))),128))]),_:1},8,["name","order-options","onDeleteBulk","onList"])}}};export{pt as default};
