import{_ as x,o as a,c as r,a as e,s as A,d as I,u as D,e as p,B as V,f as n,g as B,L as S,p as d,v,F as N,i as j,l as M,w as b,j as w,R as U,t as i,U as P,n as O}from"./index.c685e846.js";import{S as J}from"./sweetalert2.all.79a6bcd7.js";import{I as z}from"./icon-facebook.927aefe9.js";import{I as W,_ as F}from"./icon-twitter.vue_vue_type_script_setup_true_lang.bb64ec25.js";import{f as Z,N as q,o as E,V as R,_ as T,I as X}from"./icon-x.6c3c1ce6.js";import"./micro-task.27a59902.js";const H={},G={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Y=e("circle",{cx:"10",cy:"6",r:"4",stroke:"currentColor","stroke-width":"1.5"},null,-1),Q=e("path",{opacity:"0.5",d:"M18 17.5C18 19.9853 18 22 10 22C2 22 2 19.9853 2 17.5C2 15.0147 5.58172 13 10 13C14.4183 13 18 15.0147 18 17.5Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),ee=e("path",{d:"M21 10H19M19 10H17M19 10L19 8M19 10L19 12",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),te=[Y,Q,ee];function oe(g,u){return a(),r("svg",G,te)}const se=x(H,[["render",oe]]),le={},ne={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ie=A('',6),ae=[ie];function re(g,u){return a(),r("svg",ne,ae)}const de=x(le,[["render",re]]),ce={},ue={width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},pe=e("path",{opacity:"0.5",d:"M2.5 6.5C2.5 4.61438 2.5 3.67157 3.08579 3.08579C3.67157 2.5 4.61438 2.5 6.5 2.5C8.38562 2.5 9.32843 2.5 9.91421 3.08579C10.5 3.67157 10.5 4.61438 10.5 6.5C10.5 8.38562 10.5 9.32843 9.91421 9.91421C9.32843 10.5 8.38562 10.5 6.5 10.5C4.61438 10.5 3.67157 10.5 3.08579 9.91421C2.5 9.32843 2.5 8.38562 2.5 6.5Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),he=e("path",{opacity:"0.5",d:"M13.5 17.5C13.5 15.6144 13.5 14.6716 14.0858 14.0858C14.6716 13.5 15.6144 13.5 17.5 13.5C19.3856 13.5 20.3284 13.5 20.9142 14.0858C21.5 14.6716 21.5 15.6144 21.5 17.5C21.5 19.3856 21.5 20.3284 20.9142 20.9142C20.3284 21.5 19.3856 21.5 17.5 21.5C15.6144 21.5 14.6716 21.5 14.0858 20.9142C13.5 20.3284 13.5 19.3856 13.5 17.5Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),me=e("path",{d:"M2.5 17.5C2.5 15.6144 2.5 14.6716 3.08579 14.0858C3.67157 13.5 4.61438 13.5 6.5 13.5C8.38562 13.5 9.32843 13.5 9.91421 14.0858C10.5 14.6716 10.5 15.6144 10.5 17.5C10.5 19.3856 10.5 20.3284 9.91421 20.9142C9.32843 21.5 8.38562 21.5 6.5 21.5C4.61438 21.5 3.67157 21.5 3.08579 20.9142C2.5 20.3284 2.5 19.3856 2.5 17.5Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),_e=e("path",{d:"M13.5 6.5C13.5 4.61438 13.5 3.67157 14.0858 3.08579C14.6716 2.5 15.6144 2.5 17.5 2.5C19.3856 2.5 20.3284 2.5 20.9142 3.08579C21.5 3.67157 21.5 4.61438 21.5 6.5C21.5 8.38562 21.5 9.32843 20.9142 9.91421C20.3284 10.5 19.3856 10.5 17.5 10.5C15.6144 10.5 14.6716 10.5 14.0858 9.91421C13.5 9.32843 13.5 8.38562 13.5 6.5Z",stroke:"currentColor","stroke-width":"1.5"},null,-1),fe=[pe,he,me,_e];function ve(g,u){return a(),r("svg",ue,fe)}const we=x(ce,[["render",ve]]),ge={},be={width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},xe=e("circle",{cx:"11.5",cy:"11.5",r:"9.5",stroke:"currentColor","stroke-width":"1.5",opacity:"0.5"},null,-1),ye=e("path",{d:"M18.5 18.5L22 22",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round"},null,-1),Ce=[xe,ye];function ke(g,u){return a(),r("svg",be,Ce)}const $e=x(ge,[["render",ke]]),Me={},Ue={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},Le=e("path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z"},null,-1),Se=e("rect",{x:"2",y:"9",width:"4",height:"12"},null,-1),Ne=e("circle",{cx:"4",cy:"4",r:"2"},null,-1),je=[Le,Se,Ne];function Ee(g,u){return a(),r("svg",Ue,je)}const Ke=x(Me,[["render",Ee]]),Ae={class:"flex items-center justify-between flex-wrap gap-4"},Ie=e("h2",{class:"text-xl"},"\u5458\u5DE5\u5217\u8868",-1),De={class:"flex sm:flex-row flex-col sm:items-center sm:gap-3 gap-4 w-full sm:w-auto"},Ve={class:"flex gap-3"},Be={class:"relative"},Pe={class:"absolute ltr:right-[11px] rtl:left-[11px] top-1/2 -translate-y-1/2 peer-focus:text-primary"},Oe={class:"mt-5 panel p-0 border-0 overflow-hidden"},Je={key:0,class:"table-responsive"},ze={class:"table-striped table-hover"},We=e("thead",null,[e("tr",null,[e("th",null,"Name"),e("th",null,"Email"),e("th",null,"Location"),e("th",null,"Phone"),e("th",{class:"!text-center"},"Actions")])],-1),Fe={class:"flex items-center w-max"},Ze={class:"w-max"},qe=["src"],Re={class:"border border-gray-300 dark:border-gray-800 rounded-full grid place-content-center h-8 w-8 ltr:mr-2 rtl:ml-2"},Te={class:"whitespace-nowrap"},Xe={class:"whitespace-nowrap"},He={class:"flex gap-4 items-center justify-center"},Ge=["onClick"],Ye=["onClick"],Qe={key:0,class:"grid 2xl:grid-cols-4 xl:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-6 w-full"},et={class:"bg-white/40 rounded-t-md bg-[url('/assets/images/notification-bg.png')] bg-center bg-cover p-6 pb-0"},tt=["src"],ot={class:"px-6 pb-24 -mt-10 relative"},st={class:"shadow-md bg-white dark:bg-gray-900 rounded-md px-2 py-4"},lt={class:"text-xl"},nt={class:"text-white-dark"},it={class:"flex items-center justify-between flex-wrap mt-6 gap-3"},at={class:"flex-auto"},rt={class:"text-info"},dt=e("div",null,"Posts",-1),ct={class:"flex-auto"},ut={class:"text-info"},pt=e("div",null,"Following",-1),ht={class:"flex-auto"},mt={class:"text-info"},_t=e("div",null,"Followers",-1),ft={class:"mt-4"},vt={class:"flex space-x-4 rtl:space-x-reverse items-center justify-center"},wt={href:"javascript:;",class:"btn btn-outline-primary p-0 h-7 w-7 rounded-full"},gt={href:"javascript:;",class:"btn btn-outline-primary p-0 h-7 w-7 rounded-full"},bt={href:"javascript:;",class:"btn btn-outline-primary p-0 h-7 w-7 rounded-full"},xt={href:"javascript:;",class:"btn btn-outline-primary p-0 h-7 w-7 rounded-full"},yt={class:"mt-6 grid grid-cols-1 gap-4 ltr:text-left rtl:text-right"},Ct={class:"flex items-center"},kt=e("div",{class:"flex-none ltr:mr-2 rtl:ml-2"},"Email :",-1),$t={class:"truncate text-white-dark"},Mt={class:"flex items-center"},Ut=e("div",{class:"flex-none ltr:mr-2 rtl:ml-2"},"Phone :",-1),Lt={class:"text-white-dark"},St={class:"flex items-center"},Nt=e("div",{class:"flex-none ltr:mr-2 rtl:ml-2"},"Address :",-1),jt={class:"text-white-dark"},Et={class:"mt-6 flex gap-4 absolute bottom-0 w-full ltr:left-0 rtl:right-0 p-6"},Kt=["onClick"],At=["onClick"],It={class:"fixed inset-0 overflow-y-auto"},Dt={class:"flex min-h-full items-center justify-center px-4 py-8"},Vt={class:"text-lg font-medium bg-[#fbfbfb] dark:bg-[#121c2c] ltr:pl-5 rtl:pr-5 py-3 ltr:pr-[50px] rtl:pl-[50px]"},Bt={class:"p-5"},Pt=["onSubmit"],Ot={class:"mb-5"},Jt=e("label",{for:"name"},"Name",-1),zt={class:"mb-5"},Wt=e("label",{for:"email"},"Email",-1),Ft={class:"mb-5"},Zt=e("label",{for:"number"},"Phone Number",-1),qt={class:"mb-5"},Rt=e("label",{for:"occupation"},"Occupation",-1),Tt={class:"mb-5"},Xt=e("label",{for:"address"},"Address",-1),Ht={class:"flex justify-end items-center mt-8"},Gt={type:"submit",class:"btn btn-primary ltr:ml-4 rtl:mr-4"},lo=I({__name:"contacts",setup(g){D({title:"Contacts"});const u=p({id:null,name:"",email:"",role:"",phone:"",location:""}),h=p("list"),m=p(!1),s=p(JSON.parse(JSON.stringify(u.value))),C=p([]),k=p(""),c=p([{id:1,path:"profile-35.png",name:"Alan Green",role:"Web Developer",email:"alan@mail.com",location:"Boston, USA",phone:"+1 202 555 0197",posts:25,followers:"5K",following:500},{id:2,path:"profile-35.png",name:"Linda Nelson",role:"Web Designer",email:"linda@mail.com",location:"Sydney, Australia",phone:"+1 202 555 0170",posts:25,followers:"21.5K",following:350},{id:3,path:"profile-35.png",name:"Lila Perry",role:"UX/UI Designer",email:"lila@mail.com",location:"Miami, USA",phone:"+1 202 555 0105",posts:20,followers:"21.5K",following:350},{id:4,path:"profile-35.png",name:"Andy King",role:"Project Lead",email:"andy@mail.com",location:"Tokyo, Japan",phone:"+1 202 555 0194",posts:25,followers:"21.5K",following:300},{id:5,path:"profile-35.png",name:"Jesse Cory",role:"Web Developer",email:"jesse@mail.com",location:"Edinburgh, UK",phone:"+1 202 555 0161",posts:30,followers:"20K",following:350},{id:6,path:"profile-35.png",name:"Xavier",role:"UX/UI Designer",email:"xavier@mail.com",location:"New York, USA",phone:"+1 202 555 0155",posts:25,followers:"21.5K",following:350},{id:7,path:"profile-35.png",name:"Susan",role:"Project Manager",email:"susan@mail.com",location:"Miami, USA",phone:"+1 202 555 0118",posts:40,followers:"21.5K",following:350},{id:8,path:"profile-35.png",name:"Raci Lopez",role:"Web Developer",email:"traci@mail.com",location:"Edinburgh, UK",phone:"+1 202 555 0135",posts:25,followers:"21.5K",following:350},{id:9,path:"profile-35.png",name:"Steven Mendoza",role:"HR",email:"sokol@verizon.net",location:"Monrovia, US",phone:"+1 202 555 0100",posts:40,followers:"21.8K",following:300},{id:10,path:"profile-35.png",name:"James Cantrell",role:"Web Developer",email:"sravani@comcast.net",location:"Michigan, US",phone:"+1 202 555 0134",posts:100,followers:"28K",following:520},{id:11,path:"profile-35.png",name:"Reginald Brown",role:"Web Designer",email:"drhyde@gmail.com",location:"Entrimo, Spain",phone:"+1 202 555 0153",posts:35,followers:"25K",following:500},{id:12,path:"profile-35.png",name:"Stacey Smith",role:"Chief technology officer",email:"maikelnai@optonline.net",location:"Lublin, Poland",phone:"+1 202 555 0115",posts:21,followers:"5K",following:200}]);V(()=>{y()});const y=()=>{C.value=c.value.filter(l=>l.name.toLowerCase().includes(k.value.toLowerCase()))},$=(l=null)=>{s.value=JSON.parse(JSON.stringify(u.value)),l&&(s.value=JSON.parse(JSON.stringify(l))),m.value=!0},K=()=>{if(!s.value.name)return _("Name is required.","error"),!0;if(!s.value.email)return _("Email is required.","error"),!0;if(!s.value.phone)return _("Phone is required.","error"),!0;if(!s.value.role)return _("Occupation is required.","error"),!0;if(s.value.id){let l=c.value.find(o=>o.id===s.value.id);l.name=s.value.name,l.email=s.value.email,l.role=s.value.role,l.phone=s.value.phone,l.location=s.value.location}else{let o={id:(c.value.length?c.value.reduce((t,f)=>f.id>t?f.id:t,c.value[0].id):0)+1,path:"profile-35.png",name:s.value.name,email:s.value.email,role:s.value.role,phone:s.value.phone,location:s.value.location,posts:20,followers:"5K",following:500};c.value.splice(0,0,o),y()}_("User has been saved successfully."),m.value=!1},L=(l=null)=>{c.value=c.value.filter(o=>o.id!=l.id),y(),_("User has been deleted successfully.")},_=(l="",o="success")=>{J.mixin({toast:!0,position:"top",showConfirmButton:!1,timer:3e3,customClass:{container:"toast"}}).fire({icon:o,title:l,padding:"10px 20px"})};return(l,o)=>(a(),r("div",null,[e("div",Ae,[Ie,e("div",De,[e("div",Ve,[e("div",null,[e("button",{type:"button",class:"btn btn-primary",onClick:o[0]||(o[0]=t=>$())},[n(se,{class:"ltr:mr-2 rtl:ml-2"}),B(" Add Contact ")])]),e("div",null,[e("button",{type:"button",class:S(["btn btn-outline-primary p-2",{"bg-primary text-white":h.value==="list"}]),onClick:o[1]||(o[1]=t=>h.value="list")},[n(de)],2)]),e("div",null,[e("button",{type:"button",class:S(["btn btn-outline-primary p-2",{"bg-primary text-white":h.value==="grid"}]),onClick:o[2]||(o[2]=t=>h.value="grid")},[n(we)],2)])]),e("div",Be,[d(e("input",{type:"text",placeholder:"Search Contacts",class:"form-input py-2 ltr:pr-11 rtl:pl-11 peer","onUpdate:modelValue":o[3]||(o[3]=t=>k.value=t),onKeyup:y},null,544),[[v,k.value]]),e("div",Pe,[n($e,{class:"mx-auto"})])])])]),e("div",Oe,[h.value==="list"?(a(),r("div",Je,[e("table",ze,[We,e("tbody",null,[(a(!0),r(N,null,j(C.value,t=>(a(),r("tr",{key:t.id},[e("td",null,[e("div",Fe,[d(e("div",Ze,[e("img",{src:`/assets/images/${t.path}`,class:"h-8 w-8 rounded-full object-cover ltr:mr-2 rtl:ml-2",alt:"avatar"},null,8,qe)],512),[[U,t.path]]),d(e("div",{class:"grid place-content-center h-8 w-8 ltr:mr-2 rtl:ml-2 rounded-full bg-primary text-white text-sm font-semibold"},i(t.name.charAt(0)+""+t.name.charAt(t.name.indexOf(" ")+1)),513),[[U,!t.path&&t.name]]),d(e("div",Re,[n(P,{class:"w-4.5 h-4.5"})],512),[[U,!t.path&&!t.name]]),e("div",null,i(t.name),1)])]),e("td",null,i(t.email),1),e("td",Te,i(t.location),1),e("td",Xe,i(t.phone),1),e("td",null,[e("div",He,[e("button",{type:"button",class:"btn btn-sm btn-outline-primary",onClick:f=>$(t)},"Edit",8,Ge),e("button",{type:"button",class:"btn btn-sm btn-outline-danger",onClick:f=>L(t)},"Delete",8,Ye)])])]))),128))])])])):M("",!0)]),h.value==="grid"?(a(),r("div",Qe,[(a(!0),r(N,null,j(C.value,t=>(a(),r("div",{key:t.id,class:"bg-white dark:bg-[#1c232f] rounded-md overflow-hidden text-center shadow relative"},[e("div",et,[t.path?(a(),r("img",{key:0,class:"object-contain w-4/5 max-h-40 mx-auto",src:`/assets/images/${t.path}`},null,8,tt)):M("",!0)]),e("div",ot,[e("div",st,[e("div",lt,i(t.name),1),e("div",nt,i(t.role),1),e("div",it,[e("div",at,[e("div",rt,i(t.posts),1),dt]),e("div",ct,[e("div",ut,i(t.following),1),pt]),e("div",ht,[e("div",mt,i(t.followers),1),_t])]),e("div",ft,[e("ul",vt,[e("li",null,[e("a",wt,[n(z)])]),e("li",null,[e("a",gt,[n(W)])]),e("li",null,[e("a",bt,[n(Ke)])]),e("li",null,[e("a",xt,[n(F)])])])])]),e("div",yt,[e("div",Ct,[kt,e("div",$t,i(t.email),1)]),e("div",Mt,[Ut,e("div",Lt,i(t.phone),1)]),e("div",St,[Nt,e("div",jt,i(t.location),1)])])]),e("div",Et,[e("button",{type:"button",class:"btn btn-outline-primary w-1/2",onClick:f=>$(t)},"Edit",8,Kt),e("button",{type:"button",class:"btn btn-outline-danger w-1/2",onClick:f=>L(t)},"Delete",8,At)])]))),128))])):M("",!0),n(w(Z),{appear:"",show:m.value,as:"template"},{default:b(()=>[n(w(q),{as:"div",onClose:o[11]||(o[11]=t=>m.value=!1),class:"relative z-[51]"},{default:b(()=>[n(w(E),{as:"template",enter:"duration-300 ease-out","enter-from":"opacity-0","enter-to":"opacity-100",leave:"duration-200 ease-in","leave-from":"opacity-100","leave-to":"opacity-0"},{default:b(()=>[n(w(R),{class:"fixed inset-0 bg-[black]/60"})]),_:1}),e("div",It,[e("div",Dt,[n(w(E),{as:"template",enter:"duration-300 ease-out","enter-from":"opacity-0 scale-95","enter-to":"opacity-100 scale-100",leave:"duration-200 ease-in","leave-from":"opacity-100 scale-100","leave-to":"opacity-0 scale-95"},{default:b(()=>[n(w(T),{class:"panel border-0 p-0 rounded-lg overflow-hidden w-full max-w-lg text-black dark:text-white-dark"},{default:b(()=>[e("button",{type:"button",class:"absolute top-4 ltr:right-4 rtl:left-4 text-gray-400 hover:text-gray-800 dark:hover:text-gray-600 outline-none",onClick:o[4]||(o[4]=t=>m.value=!1)},[n(X)]),e("div",Vt,i(s.value.id?"Edit Contact":"Add Contact"),1),e("div",Bt,[e("form",{onSubmit:O(K,["prevent"])},[e("div",Ot,[Jt,d(e("input",{id:"name",type:"text",placeholder:"Enter Name",class:"form-input","onUpdate:modelValue":o[5]||(o[5]=t=>s.value.name=t)},null,512),[[v,s.value.name]])]),e("div",zt,[Wt,d(e("input",{id:"email",type:"email",placeholder:"Enter Email",class:"form-input","onUpdate:modelValue":o[6]||(o[6]=t=>s.value.email=t)},null,512),[[v,s.value.email]])]),e("div",Ft,[Zt,d(e("input",{id:"number",type:"text",placeholder:"Enter Phone Number",class:"form-input","onUpdate:modelValue":o[7]||(o[7]=t=>s.value.phone=t)},null,512),[[v,s.value.phone]])]),e("div",qt,[Rt,d(e("input",{id:"occupation",type:"text",placeholder:"Enter Occupation",class:"form-input","onUpdate:modelValue":o[8]||(o[8]=t=>s.value.role=t)},null,512),[[v,s.value.role]])]),e("div",Tt,[Xt,d(e("textarea",{id:"address",rows:"3",placeholder:"Enter Address",class:"form-textarea resize-none min-h-[130px]","onUpdate:modelValue":o[9]||(o[9]=t=>s.value.location=t)},null,512),[[v,s.value.location]])]),e("div",Ht,[e("button",{type:"button",class:"btn btn-outline-danger",onClick:o[10]||(o[10]=t=>m.value=!1)},"Cancel"),e("button",Gt,i(s.value.id?"Update":"Add"),1)])],40,Pt)])]),_:1})]),_:1})])])]),_:1})]),_:1},8,["show"])]))}});export{lo as default};