import{T as V,r as L,a as w,c as d,o as i,b as r,d as e,w as u,e as j,f as _,g as h,t as s,u as a,F as g,h as x,v as B,i as M,j as m,k as T}from"./app-fEKA3BkQ.js";import{h as U}from"./moment-BAtM24Ew.js";import{_ as Y,a as F}from"./UserLayout-D_lxcpvH.js";import{_ as O}from"./FilterDropdown-zriyDhiF.js";import{_ as C}from"./PageHeader-DmRLoM5E.js";import{_ as R}from"./Paginate-D_g9VFI3.js";import{_ as W}from"./NoDataFound-Xi4CpDbx.js";import{_ as E}from"./SpinnerBtn-BezRkGQj.js";import{s as K,u as P}from"./assetStore-BSVLrDIW.js";import"./ValidationErrors-B24rcOPH.js";const q={class:"label mt-2"},z=["value"],G={key:0,class:"text-red-600"},H={class:"my-3"},J={class:"label mt-2"},Q={key:0,class:"text-red-600"},X={class:"label mt-2"},Z={key:0,class:"text-red-600"},ee={class:"mt-4 flex justify-end"},se={class:"card card-body mb-2"},te={class:"mt-4 flex w-full flex-col gap-4"},oe={key:0,class:"my-6 grid grid-flow-row grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"},le={class:"flex justify-between"},ae={class:"card-title uppercase text-gray-400 dark:text-gray-50"},ne={class:"dropdown-list"},re={class:"dropdown-list-item"},ie=["onClick"],de={class:"dropdown-list-item"},me={class:"dropdown-list-item"},ce=["onClick"],ue={class:"flex flex-col gap-1 text-xs sm:text-sm"},pe={class:"flex gap-3"},fe={class:"w-1/3"},_e={class:"font-semibold"},he={class:"w-full"},De=Object.assign({layout:Y},{__name:"Index",props:["apps","devices"],setup(p){const{deleteRow:N}=K(),k=P(),l=V({name:"",site_link:"",platform_id:""}),D=()=>{l.post(route("user.whatsapp.apps.store"),{onSuccess:()=>{l.reset(),k.close()}})},$=[{label:"Name",value:"name"}],c=L({}),A=t=>{c.value=t,k.open("infoModal")};return(t,n)=>{var b;const f=w("Icon"),v=w("Link");return i(),d(g,null,[r(C,{state:"appModal","header-state":!0,"header-title":"Create New App"},{default:u(()=>[e("form",{onSubmit:j(D,["prevent"])},[e("div",null,[e("label",q,s(t.trans("Select Device")),1),_(e("select",{class:"select","onUpdate:modelValue":n[0]||(n[0]=o=>a(l).platform_id=o)},[n[3]||(n[3]=e("option",{value:""},"Select Device",-1)),(i(!0),d(g,null,x(p.devices,o=>(i(),d("option",{value:o.id,key:o.id},s(o.name),9,z))),128))],512),[[B,a(l).platform_id]]),n[4]||(n[4]=e("small",{class:"text-gray-600"},"User Will Receive Message From The Selected Number",-1)),n[5]||(n[5]=e("br",null,null,-1)),a(l).errors.platform_id?(i(),d("small",G,s(a(l).errors.platform_id),1)):h("",!0)]),e("div",H,[e("label",J,s(t.trans("App Name")),1),_(e("input",{type:"text",class:"input","onUpdate:modelValue":n[1]||(n[1]=o=>a(l).name=o)},null,512),[[M,a(l).name]]),a(l).errors.name?(i(),d("small",Q,s(a(l).errors.name),1)):h("",!0)]),e("div",null,[e("label",X,s(t.trans("Web Link")),1),_(e("input",{type:"text",class:"input","onUpdate:modelValue":n[2]||(n[2]=o=>a(l).site_link=o)},null,512),[[M,a(l).site_link]]),a(l).errors.site_link?(i(),d("small",Z,s(a(l).errors.site_link),1)):h("",!0)]),e("div",ee,[r(E,{processing:a(l).processing,"btn-text":t.trans("Create App")},null,8,["processing","btn-text"])])],32)]),_:1}),r(C,{state:"infoModal","header-state":!0,"header-title":t.trans("App Details")},{default:u(()=>[e("div",se,[e("p",null,[e("strong",null,s(t.trans("Name")),1),m(" "+s(c.value.name),1)]),e("p",null,[e("strong",null,s(t.trans("App Key")),1),m(" "+s(c.value.key),1)]),e("p",null,[e("strong",null,s(t.trans("App Link")),1),m(" "+s(c.value.site_link),1)]),e("p",null,[e("strong",null,s(t.trans("Created")),1),m(" "+s(a(U)(c.value.created_at).format("DD MMM,YYYY h:mm A")),1)])])]),_:1},8,["header-title"]),r(O,{options:$}),e("div",te,[(b=p.apps)!=null&&b.data.length?(i(),d("div",oe,[(i(!0),d(g,null,x(p.apps.data,(o,S)=>{var y;return i(),d("div",{key:S,class:"card card-body"},[e("div",le,[e("h5",ae,s(o==null?void 0:o.name),1),r(F,{"btn-type":"icon","icon-name":"bx:dots-vertical-rounded"},{default:u(()=>[e("ul",ne,[e("li",re,[e("button",{onClick:I=>A(o),class:"dropdown-link gap-4"},[r(f,{icon:"bx:detail"}),m(" "+s(t.trans("Info")),1)],8,ie)]),e("li",de,[r(v,{href:t.route("user.whatsapp.apps.logs",o.uuid),class:"dropdown-link gap-4"},{default:u(()=>[r(f,{icon:"bx:file"}),m(" "+s(t.trans("Logs")),1)]),_:2},1032,["href"])]),e("li",me,[e("button",{type:"button",onClick:I=>a(N)(t.route("user.whatsapp.apps.destroy",o.id)),class:"dropdown-link gap-4"},[r(f,{icon:"bx:trash"}),m(" "+s(t.trans("Delete")),1)],8,ce)])])]),_:2},1024)]),e("div",ue,[e("div",pe,[e("p",fe,s(t.trans("Phone Number ID")),1),n[6]||(n[6]=m(" : ",-1)),e("b",null,s((y=o.platform)==null?void 0:y.uuid),1)])]),r(v,{href:t.route("user.whatsapp.app.integration",o.uuid),class:"mt-5 flex items-center text-sm text-primary-600 hover:underline"},{default:u(()=>[e("span",_e,s(t.trans("Integration")),1),r(f,{class:"mt-1 text-xl",icon:"bx:right-arrow-alt"})]),_:2},1032,["href"])])}),128))])):(i(),T(W,{key:1})),e("div",he,[r(R,{links:p.apps.links},null,8,["links"])])])],64)}}});export{De as default};
