import{T as N,r as k,c as d,o as r,a as i,b as s,w as c,d as V,e as _,f,t,u as l,F as h,g as v,v as M,h as y,i as D,j as p}from"./app-B4kV47qU.js";import{_ as L,a as j}from"./UserLayout-DG2qUs8x.js";import{_ as B}from"./Modal-ChMy0A7y.js";import{_ as I}from"./Paginate-DtQjslkz.js";import{_ as T}from"./NoDataFound-su6Kbmdk.js";import{_ as U}from"./SpinnerBtn-B3fjBeDL.js";import{s as A}from"./sharedComposable-VJJUONp6.js";import{u as F}from"./modalStore-BgORG3Nn.js";import{_ as E}from"./NotificationRing-CraudT8E.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./ToastrContainer-Cfx6wOd2.js";import"./toastComposable-CvcyPmJb.js";import"./AssetModal-vtiWQmiY.js";import"./IntersectionObserver-DbdokySM.js";import"./assetStore-cDK0Afhq.js";import"./echoServiceComposable-n1MnmRL6.js";const R={class:"label mt-2"},W={value:""},K=["value"],O={class:"text-gray-600"},P={key:0,class:"text-red-600"},q={class:"my-3"},z={class:"label mt-2"},G={key:0,class:"text-red-600"},H={class:"label mt-2"},J={key:0,class:"text-red-600"},Q={class:"mt-4 flex justify-end"},X={class:"mt-4 flex w-full flex-col gap-4"},Y={key:0,class:"my-6 grid grid-flow-row grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3"},Z={class:"flex justify-between"},ss={class:"card-title mb-3 uppercase text-gray-400 dark:text-gray-50"},es={class:"dropdown-list"},ts={class:"dropdown-list-item"},os={class:"dropdown-list-item"},as=["onClick"],ls={class:"flex flex-col gap-2 text-sm"},ns={class:"flex gap-3"},rs={class:"w-1/3"},is={class:"flex gap-3"},ds={class:"w-1/3"},ms={class:"truncate"},cs={class:"font-semibold"},ps={class:"w-full"},Ds=Object.assign({layout:L},{__name:"Index",props:["apps","platforms","authKey"],setup(m){const{deleteRow:x}=A(),C=F(),o=N({name:"",site_link:"",platform_id:""}),S=()=>{o.post(route("user.whatsapp-web.apps.store"),{onSuccess:()=>{o.reset(),C.close()}})};return(a,n)=>{var w;const u=k("Icon"),b=k("Link");return r(),d(h,null,[i(E,{module:"whatsapp-web"}),i(B,{state:"appModal","header-state":!0,"header-title":"Create New App"},{default:c(()=>[s("form",{onSubmit:V(S,["prevent"])},[s("div",null,[s("label",R,t(a.trans("Select Device")),1),_(s("select",{class:"select","onUpdate:modelValue":n[0]||(n[0]=e=>l(o).platform_id=e)},[s("option",W,t(a.trans("Select Device")),1),(r(!0),d(h,null,v(m.platforms,e=>(r(),d("option",{value:e.id,key:e.id},t(e.name),9,K))),128))],512),[[M,l(o).platform_id]]),s("small",O,t(a.trans("User Will Receive Message From The Selected Number")),1),n[3]||(n[3]=s("br",null,null,-1)),l(o).errors.platform_id?(r(),d("small",P,t(l(o).errors.platform_id),1)):f("",!0)]),s("div",q,[s("label",z,t(a.trans("App Name")),1),_(s("input",{type:"text",class:"input","onUpdate:modelValue":n[1]||(n[1]=e=>l(o).name=e)},null,512),[[y,l(o).name]]),l(o).errors.name?(r(),d("small",G,t(l(o).errors.name),1)):f("",!0)]),s("div",null,[s("label",H,t(a.trans("Web Link")),1),_(s("input",{type:"url",class:"input","onUpdate:modelValue":n[2]||(n[2]=e=>l(o).site_link=e)},null,512),[[y,l(o).site_link]]),l(o).errors.site_link?(r(),d("small",J,t(l(o).errors.site_link),1)):f("",!0)]),s("div",Q,[i(U,{processing:l(o).processing,"btn-text":a.trans("Create App")},null,8,["processing","btn-text"])])],32)]),_:1}),s("div",X,[(w=m.apps)!=null&&w.data.length?(r(),d("div",Y,[(r(!0),d(h,null,v(m.apps.data,(e,$)=>{var g;return r(),d("div",{key:$,class:"card card-body"},[s("div",Z,[s("h5",ss,t(e==null?void 0:e.name),1),i(j,{"btn-type":"icon","icon-name":"bx:dots-vertical-rounded",btnClass:""},{default:c(()=>[s("ul",es,[s("li",ts,[i(b,{href:a.route("user.whatsapp-web.apps.logs",e.uuid),class:"dropdown-link gap-4"},{default:c(()=>[i(u,{icon:"bx:detail"}),p(" "+t(a.trans("Logs")),1)]),_:2},1032,["href"])]),s("li",os,[s("button",{type:"button",onClick:us=>l(x)(a.route("user.whatsapp-web.apps.destroy",e.uuid)),class:"dropdown-link gap-4"},[i(u,{icon:"bx:trash"}),p(" "+t(a.trans("Delete")),1)],8,as)])])]),_:2},1024)]),s("div",ls,[s("div",ns,[s("p",rs,t(a.trans("Platform")),1),n[4]||(n[4]=p(" : ",-1)),s("span",null,t((g=e.platform)==null?void 0:g.name),1)]),s("div",is,[s("p",ds,t(a.trans("Endpoint")),1),n[5]||(n[5]=p(" : ",-1)),s("span",ms,t(e.site_link),1)])]),i(b,{href:a.route("user.whatsapp-web.apps.show",e.uuid),class:"mt-4 flex items-center text-sm text-primary-600 hover:underline"},{default:c(()=>[s("span",cs,t(a.trans("Integration")),1),i(u,{class:"mt-1 text-xl",icon:"bx:right-arrow-alt"})]),_:2},1032,["href"])])}),128))])):(r(),D(T,{key:1})),s("div",ps,[i(I,{links:m.apps.links},null,8,["links"])])])],64)}}});export{Ds as default};
