import{T as _,c as m,o as i,b as t,a as r,i as h,t as n,F as b,g as $,f as F,w as f,d as g,e as w,u as e,h as v,N as p,j as T}from"./app-B4kV47qU.js";import{_ as k}from"./Modal-ChMy0A7y.js";import{_ as B}from"./Paginate-DtQjslkz.js";import{_ as j}from"./NoDataFound-su6Kbmdk.js";import{_ as x}from"./SpinnerBtn-B3fjBeDL.js";import{s as D}from"./sharedComposable-VJJUONp6.js";import{_ as G}from"./UserLayout-DG2qUs8x.js";import{u as M}from"./modalStore-BgORG3Nn.js";import"./toastComposable-CvcyPmJb.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ToastrContainer-Cfx6wOd2.js";import"./AssetModal-vtiWQmiY.js";import"./IntersectionObserver-DbdokySM.js";import"./assetStore-cDK0Afhq.js";const I={class:"table-responsive mt-4 w-full"},U={class:"table"},q={class:"w-[40%]"},A={class:"w-[50%] !text-right"},L={class:"w-[10%] !text-right"},O={key:0,class:"tbody"},R={class:"flex items-center gap-2"},z=["src"],H={class:"!text-right"},J={class:"flex justify-end"},K={class:"dropdown","data-placement":"bottom-start"},P={class:"dropdown-toggle"},Q={class:"dropdown-content w-56"},W={class:"dropdown-list"},X={class:"dropdown-list-item"},Y=["onClick"],Z={class:"dropdown-list-item"},tt=["onClick"],st={class:"w-full"},et={class:"mb-2"},ot={class:"mt-2 text-end"},nt={class:"mb-2"},at={class:"mt-2 text-end"},vt=Object.assign({layout:G},{__name:"Index",props:["device","groups"],setup(d){const u=M(),{deleteRow:y}=D(),l=_({name:""}),C=()=>{l.post(route("user.whatsapp-web.groups.store"),{onSuccess:()=>{u.close("groupCreate"),l.reset()}})},a=_({id:null,name:""}),N=()=>{a.put(route("user.whatsapp-web.groups.update",{group:a.id}),{onSuccess:()=>u.close("groupEdit")})},E=s=>{a.id=s.id,a.name=s.name,u.open("groupEdit")};return(s,c)=>(i(),m(b,null,[t("div",I,[t("table",U,[t("thead",null,[t("tr",null,[t("th",q,n(s.trans("Group Name")),1),t("th",A,n(s.trans("Total Customers")),1),t("th",L,n(s.trans("Action")),1)])]),d.groups.data.length?(i(),m("tbody",O,[(i(!0),m(b,null,$(d.groups.data,(o,S)=>(i(),m("tr",{key:S},[t("td",null,[t("div",R,[t("img",{src:"https://ui-avatars.com/api/?name="+o.name,class:"h-8 w-8"},null,8,z),t("span",null,n(o.name),1)])]),t("td",H,n(o.customers_count),1),t("td",null,[t("div",J,[t("div",K,[t("div",P,[r(e(p),{class:"h-5 text-3xl text-slate-400",icon:"bx:dots-vertical-rounded"})]),t("div",Q,[t("ul",W,[t("li",X,[t("a",{class:"dropdown-link",href:"#",onClick:V=>E(o)},[r(e(p),{icon:"bx:bxs-edit-alt"}),t("span",null,n(s.trans("Edit")),1)],8,Y)]),t("li",Z,[t("button",{class:"dropdown-link delete-confirm",href:"#",onClick:V=>e(y)(s.route("user.whatsapp-web.groups.destroy",o.id))},[r(e(p),{icon:"bx:trash"}),T(" "+n(s.trans("Delete")),1)],8,tt)])])])])])])]))),128))])):(i(),h(j,{key:1,forTable:!0}))]),t("div",st,[d.groups.data.length?(i(),h(B,{key:0,links:d.groups.links},null,8,["links"])):F("",!0)])]),r(k,{state:"groupCreate"},{default:f(()=>[t("form",{onSubmit:g(C,["prevent"])},[t("div",et,[t("label",null,n(s.trans("Name")),1),w(t("input",{type:"text","onUpdate:modelValue":c[0]||(c[0]=o=>e(l).name=o),class:"input",placeholder:"Group Name",required:""},null,512),[[v,e(l).name]])]),t("div",ot,[r(x,{classes:"btn btn-primary",processing:e(l).processing,"btn-text":s.trans("Create")},null,8,["processing","btn-text"])])],32)]),_:1}),r(k,{state:"groupEdit"},{default:f(()=>[t("form",{onSubmit:g(N,["prevent"])},[t("div",nt,[t("label",null,n(s.trans("Name")),1),w(t("input",{type:"text","onUpdate:modelValue":c[1]||(c[1]=o=>e(a).name=o),class:"input"},null,512),[[v,e(a).name]])]),t("div",at,[r(x,{classes:"btn btn-primary",processing:e(a).processing,"btn-text":s.trans("Save Changes")},null,8,["processing","btn-text"])])],32)]),_:1})],64))}});export{vt as default};
