1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[994],{7299:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/staff/login",function(){return n(2603)}])},2603:function(e,t,n){"use strict";n.r(t);var a=n(5893),r=n(7294),c=n(9008),o=n.n(c),s=n(1163),i=n(7561);let u=()=>{let[e,t]=(0,r.useState)(""),[n,c]=(0,r.useState)(""),u=(0,s.useRouter)(),l=a=>{a.preventDefault(),(0,i.Ib)(e,t,n,c,u)};return(0,a.jsxs)("div",{children:[(0,a.jsxs)(o(),{children:[(0,a.jsx)("title",{children:"Staff Login | FirmSupport"}),(0,a.jsx)("meta",{name:"description",content:"Generated by create next app"}),(0,a.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1"}),(0,a.jsx)("link",{rel:"icon",href:"/favicon.ico"})]}),(0,a.jsxs)("main",{className:"w-full h-[100vh] flex flex-col items-center justify-center py-6 px-4",children:[(0,a.jsx)("h2",{className:"text-3xl font-bold mb-6",children:"Staff Sign in"}),(0,a.jsxs)("form",{className:"flex flex-col md:w-[60%] w-full",onSubmit:l,children:[(0,a.jsx)("label",{htmlFor:"email",children:"Email"}),(0,a.jsx)("input",{type:"email",id:"email",name:"email",value:e,onChange:e=>t(e.target.value),className:"py-2 px-4 border-[1px] rounded border-gray-200 mb-4"}),(0,a.jsx)("label",{htmlFor:"password",children:"Password"}),(0,a.jsx)("input",{type:"password",id:"password",name:"password",value:n,onChange:e=>c(e.target.value),className:"py-2 px-4 border-[1px] rounded border-gray-200 mb-4"}),(0,a.jsx)("button",{className:"p-3 bg-[#314484] rounded text-[#F4F8FB] w-[200px] hover:bg-[#2267D3]",children:"Sign in"})]}),(0,a.jsxs)("p",{className:"mt-10 text-sm text-gray-400 text-center",children:["\xa9 Copyright ",new Date().getFullYear()," FirmSupport"]})]})]})};t.default=u},7862:function(e,t,n){"use strict";n.d(t,{JT:function(){return c},Lp:function(){return r},db:function(){return o},tO:function(){return s}});var a=n(2391);let r=new a.KU;r.setEndpoint("https://cloud.appwrite.io/v1").setProject("646780aa9a0fe7b29180");let c=new a.mR(r),o=new a.Lg(r),s=new a.Ke(r)},7561:function(e,t,n){"use strict";n.d(t,{Ib:function(){return g},N3:function(){return p},Rf:function(){return D},Rx:function(){return l},SP:function(){return S},bG:function(){return C},cn:function(){return w},h8:function(){return x},hm:function(){return d},jF:function(){return f},jQ:function(){return v},mT:function(){return j},ni:function(){return b},t0:function(){return y}});var a=n(7862),r=n(2920),c=n(2391),o=n(5247);let s=()=>Math.random().toString(36).substring(2,24),i=(e,t,n,a,r)=>{o.ZP.send("david","ticket_creation",{user:e,ticketID:t,email:n,date_created:a,title:r},"KKb5VLsaXImzquvRW").then(e=>{console.log(e)},e=>{p(e.text)})},u=(e,t,n,a)=>{o.ZP.send("david","new_message",{user:e,chatURL:t,email:n,access_code:a},"KKb5VLsaXImzquvRW").then(e=>{console.log(e)},e=>{p(e.text)})},l=e=>{try{return JSON.parse(e)}catch(t){return console.error("Error parsing JSON:",t),null}},d=e=>{let t=[{title:"Open",value:"open"},{title:"In Progress",value:"in-progress"},{title:"Completed",value:"completed"}].filter(t=>t.value!==e),n=[{title:"Select",value:"select"},...t];return n},f=e=>{let t=new Date(e);return t.toLocaleString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"numeric",hour12:!0})},m=e=>{r.Am.success(e,{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})},p=e=>{r.Am.error(e,{position:"top-right",autoClose:5e3,hideProgressBar:!1,closeOnClick:!0,pauseOnHover:!0,draggable:!0,progress:void 0,theme:"light"})},h=async(e,t)=>{try{let n=await a.db.listDocuments("6469d372dbccca9ef248","646a1902d23f9343003a"),r=n.documents,c=r.filter(t=>t.email===e);c.length>0?(m("Welcome back \uD83C\uDF89"),t.push("/staff/dashboard")):p("Unauthorized...Contact Management.")}catch(o){p("An error occurred \uD83D\uDE2A"),console.error(o)}},g=async(e,t,n,r,c)=>{try{await a.JT.createEmailSession(e,n),await h(e,c),t(""),r("")}catch(o){console.log(o),p("Invalid credentials â")}},b=async e=>{try{await a.JT.deleteSession("current"),e.push("/"),m("See ya later \uD83C\uDF89")}catch(t){console.log(t),p("Encountered an error \uD83D\uDE2A")}},y=async(e,t,n)=>{try{let r=await a.JT.get();e(r),t(!1)}
1catch(c){n.push("/"),console.error(c)}},w=async(e,t,n)=>{try{await a.JT.create(s(),t,n,e),await a.db.createDocument("6469d372dbccca9ef248","646a1902d23f9343003a",c.ID.unique(),{user_id:s(),name:e,email:t}),m("User added successfully \uD83C\uDF89")}catch(r){console.log(r)}},D=async e=>{try{let t=await a.db.listDocuments("6469d372dbccca9ef248","646a1902d23f9343003a");e(t.documents)}catch(n){console.log(n)}},x=async e=>{try{await a.db.deleteDocument("6469d372dbccca9ef248","646a1902d23f9343003a",e),m("User removed \uD83C\uDF89")}catch(t){console.log(t),p("Encountered an error \uD83D\uDE2A")}},v=async(e,t,n,r,o,u)=>{let l=async function(){let o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"https://google.com";try{let l=await a.db.createDocument("6469d372dbccca9ef248","6469d38cbff4e5f15489",c.ID.unique(),{name:e,email:t,subject:n,content:r,status:"open",messages:[JSON.stringify({id:s(),content:r,admin:!1,name:"Customer"})],attachment_url:o,access_code:s()});i(e,l.$id,t,f(l.$createdAt),n),E(e),u(!1),m("Ticket created \uD83C\uDF89")}catch(d){p("Encountered saving ticket â")}};if(null!==o)try{let d=await a.tO.createFile("6469c7927b312af690db",c.ID.unique(),o),h="https://cloud.appwrite.io/v1/storage/buckets/".concat("6469c7927b312af690db","/files/").concat(d.$id,"/view?project=").concat("646780aa9a0fe7b29180","&mode=admin");l(h)}catch(g){p("Error uploading the image â")}else await l()},S=async(e,t,n)=>{try{let r=await a.db.listDocuments("6469d372dbccca9ef248","6469d38cbff4e5f15489"),c=r.documents,o=c.filter(e=>"open"===e.status),s=c.filter(e=>"in-progress"===e.status),i=c.filter(e=>"completed"===e.status);n(i),e(o),t(s)}catch(u){console.log(u)}},j=async(e,t)=>{try{await a.db.updateDocument("6469d372dbccca9ef248","6469d38cbff4e5f15489",e,{status:t}),m("Status updated, refresh page \uD83C\uDF89")}catch(n){console.log(n),p("Encountered an error â")}},C=async(e,t)=>{let n=await a.db.getDocument("6469d372dbccca9ef248","6469d38cbff4e5f15489",t);try{let r=await a.JT.get(),c=await a.db.updateDocument("6469d372dbccca9ef248","6469d38cbff4e5f15489",t,{messages:[...n.messages,JSON.stringify({id:s(),content:e,admin:!0,name:r.name})]});c.$id?(m("Message Sent! â
"),u(n.name,"https://firm-support.vercel.app/chat/".concat(n.$id),n.email,n.access_code)):p("Error! Try resending your messageâ")}catch(i){let o=await a.db.updateDocument("6469d372dbccca9ef248","6469d38cbff4e5f15489",t,{messages:[...n.messages,JSON.stringify({id:s(),content:e,admin:!1,name:"Customer"})]});o.$id?(m("Message Sent! â
"),N(o.name,o.status,o.subject)):p("Error! Try resending your messageâ")}},N=async(e,t,n)=>{try{await fetch("/api/notify",{method:"POST",body:JSON.stringify({username:e,status:t,title:n}),headers:{Accept:"application/json","Content-Type":"application/json"}})}catch(a){console.error(a)}},E=async e=>{try{await fetch("/api/new",{method:"POST",body:JSON.stringify({username:e}),headers:{Accept:"application/json","Content-Type":"application/json"}})}catch(t){console.error(t)}}}},function(e){e.O(0,[329,774,888,179],function(){return e(e.s=7299)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.