import{d as N,s as C,T as M,r as f,c as r,o as i,a as e,b as d,e as b,t as o,u as t,f as a,F as v,g as U,w,h as V,z as D,n as S,l as c,v as u,E as T,j as q}from"./app-Do7K7VDV.js";import{_ as E}from"./AdminLayout-DeT_GLTC.js";import{_ as $}from"./Paginate-BZTS8QtF.js";import{h as j}from"./moment-BAtM24Ew.js";import{_ as A}from"./NoDataFound-oJx-Mfyi.js";import{_ as B}from"./FilterDropdown-HyKaUaTA.js";import"./AssetModal-C18ToIEK.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./InputFieldError-0BmYlL24.js";import"./ToastrContainer-CtYDvNPN.js";import"./SpinnerBtn-C-rqKjUt.js";const R={class:"mt-4 space-y-4"},Y={class:"table-responsive whitespace-nowrap rounded-primary"},I={class:"table"},z={class:"w-[5%] uppercase"},F={class:"w-[15%] uppercase"},L={class:"w-[10%] uppercase"},O={class:"w-[10%] uppercase"},G={class:"w-[10%] uppercase"},H={class:"w-[5%] !text-right uppercase"},J={key:0},K={class:"text-left"},P={key:1},Q={class:"text-center"},W={class:"flex justify-end"},X={class:"dropdown","data-placement":"bottom-start"},Z={class:"dropdown-toggle"},ee={class:"dropdown-content w-40"},te={class:"dropdown-list"},se={class:"dropdown-list-item"},oe=["onClick"],ae={class:"form-group"},le={class:"form-group"},ne={class:"form-group"},ie={class:"form-group"},re=N({layout:E}),xe=Object.assign(re,{__name:"Index",props:["request","notifications","type"],setup(p){const{textExcerpt:m,deleteRow:g}=C(),x=[{label:"Title",value:"title"},{label:"Comment",value:"comment"},{label:"User Email",value:"user_email"},{label:"Status",value:"seen",options:[{label:"Read",value:1},{label:"Unread",value:0}]}],l=M({email:"",title:"",description:"",url:""}),k=()=>{l.post(route("admin.notification.store"),{onSuccess:()=>{l.reset(),T.success(a("Notification created successfully")),q().close("addNewNotificationModal")}})};return(_,n)=>{const h=f("Icon"),y=f("Modal");return i(),r(v,null,[e("div",R,[d(B,{options:x}),e("div",Y,[e("table",I,[e("thead",null,[e("tr",null,[e("th",z,o(t(a)("Title")),1),e("th",F,o(t(a)("Comment")),1),e("th",L,o(t(a)("User")),1),e("th",O,o(t(a)("Seen")),1),e("th",G,o(t(a)("Created At")),1),e("th",H,o(t(a)("Actions")),1)])]),p.notifications.total?(i(),r("tbody",J,[(i(!0),r(v,null,U(p.notifications.data,s=>(i(),r("tr",{key:s.id},[e("td",K,o(t(m)(s.title,80)),1),e("td",null,o(t(m)(s.comment,50)),1),e("td",null,[s.user_id?(i(),b(t(D),{key:0,class:"text-dark",href:_.route("admin.users.show",s.user_id)},{default:w(()=>[V(o(t(m)(s.user.name,15)),1)]),_:2},1032,["href"])):(i(),r("span",P,o(t(a)("None")),1))]),e("td",null,[e("span",{class:S(["badge",s.seen==1?"badge-success":"badge-danger"])},o(s.seen==1?"Read":"Unread"),3)]),e("td",Q,o(t(j)(s.created_at).format("DD-MMM-YYYY")),1),e("td",null,[e("div",W,[e("div",X,[e("div",Z,[d(h,{class:"w-30 text-lg",icon:"bi:three-dots-vertical"})]),e("div",ee,[e("ul",te,[e("li",se,[e("a",{class:"dropdown-link delete-confirm",href:"javascript:void(0)",onClick:de=>t(g)(_.route("admin.notification.destroy",s.id))},[d(h,{class:"w-30 text-lg",icon:"bx:trash"}),e("span",null,o(t(a)("Delete")),1)],8,oe)])])])])])])]))),128))])):(i(),b(A,{key:1,"for-table":"true"}))])]),d($,{links:p.notifications.links},null,8,["links"])]),d(y,{state:"addNewNotificationModal","header-state":!0,"header-title":"Send Notification","action-btn-state":!0,"action-btn-text":t(a)("Create Notification"),"action-processing":t(l).processing,onAction:k},{default:w(()=>[e("div",ae,[e("label",null,o(t(a)("Receive Email")),1),c(e("input",{"onUpdate:modelValue":n[0]||(n[0]=s=>t(l).email=s),type:"email",name:"email",class:"input",required:""},null,512),[[u,t(l).email]])]),e("div",le,[e("label",null,o(t(a)("Title")),1),c(e("input",{"onUpdate:modelValue":n[1]||(n[1]=s=>t(l).title=s),type:"text",name:"title",class:"input",required:"",maxlength:"100"},null,512),[[u,t(l).title]])]),e("div",ne,[e("label",null,o(t(a)("Description")),1),c(e("textarea",{"onUpdate:modelValue":n[2]||(n[2]=s=>t(l).description=s),class:"textarea",required:"",name:"description",maxlength:"200"},null,512),[[u,t(l).description]])]),e("div",ie,[e("label",null,o(t(a)("Action Link")),1),c(e("input",{"onUpdate:modelValue":n[3]||(n[3]=s=>t(l).url=s),type:"url",name:"url",class:"input",required:"",maxlength:"100"},null,512),[[u,t(l).url]])])]),_:1},8,["action-btn-text","action-processing"])],64)}}});export{xe as default};
