import{$ as e,A as t,C as n,G as r,S as i,Wt as a,_ as o,v as s,vt as c,z as l}from"./vue.runtime.esm-bundler-DAWRyTnP.js";import{a as u,i as d}from"./vue-router-Bna4o8ws.js";import{t as f}from"./notification-BM55Quw3.js";import{t as p}from"./user-gWi04hVo.js";import{n as m}from"./vue-i18n-C4HYJWrq.js";import{t as h}from"./customer-Clj0rp3e.js";import{Pn as g,b as _}from"./main-CgSmSYZA.js";var v={__name:`CustomerIndexDropdown`,props:{row:{type:Object,default:null},table:{type:Object,default:null},loadData:{type:Function,default:()=>{}}},setup(v){let y=v,b=h();f();let x=_(),S=p(),{t:C}=m(),w=d();u(),t(`utils`);function T(e){x.openDialog({title:C(`general.are_you_sure`),message:C(`customers.confirm_delete`,1),yesLabel:C(`general.ok`),noLabel:C(`general.cancel`),variant:`danger`,hideNoButton:!1,size:`lg`}).then(t=>{t&&b.deleteCustomer({ids:[e]}).then(e=>{if(e.data.success)return y.loadData&&y.loadData(),!0})})}return(t,u)=>{let d=r(`BaseIcon`),f=r(`BaseButton`),p=r(`BaseDropdownItem`),m=r(`router-link`),h=r(`BaseDropdown`);return l(),o(h,{"content-loading":c(b).isFetchingViewData},{activator:e(()=>[c(w).name===`customers.view`?(l(),o(f,{key:0,variant:`primary`},{default:e(()=>[n(d,{name:`EllipsisHorizontalIcon`,class:`h-5 text-white`})]),_:1})):(l(),o(d,{key:1,name:`EllipsisHorizontalIcon`,class:`h-5 text-gray-500`}))]),default:e(()=>[c(S).hasAbilities(c(g).EDIT_CUSTOMER)?(l(),o(m,{key:0,to:`/admin/customers/${v.row.id}/edit`},{default:e(()=>[n(p,null,{default:e(()=>[n(d,{name:`PencilIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.edit`)),1)]),_:1})]),_:1},8,[`to`])):s(``,!0),c(w).name!==`customers.view`&&c(S).hasAbilities(c(g).VIEW_CUSTOMER)?(l(),o(m,{key:1,to:`customers/${v.row.id}/view`},{default:e(()=>[n(p,null,{default:e(()=>[n(d,{name:`EyeIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.view`)),1)]),_:1})]),_:1},8,[`to`])):s(``,!0),c(S).hasAbilities(c(g).DELETE_CUSTOMER)?(l(),o(p,{key:2,onClick:u[0]||=e=>T(v.row.id)},{default:e(()=>[n(d,{name:`TrashIcon`,class:`w-5 h-5 mr-3 text-gray-400 group-hover:text-gray-500`}),i(` `+a(t.$t(`general.delete`)),1)]),_:1})):s(``,!0)]),_:1},8,[`content-loading`])}}};export{v as t};