(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7091],{1362:function(e,r,s){Promise.resolve().then(s.bind(s,34820))},89345:function(e,r,s){"use strict";s.d(r,{Z:function(){return a}});let a=(0,s(39763).Z)("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]])},53417:function(e,r,s){"use strict";s.d(r,{Z:function(){return a}});let a=(0,s(39763).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},34820:function(e,r,s){"use strict";s.r(r),s.d(r,{default:function(){return m}});var a=s(57437),t=s(80605),n=s(99376),i=s(2265),l=s(32660),d=s(89345),o=s(53417),c=s(21865),u=s(22383);function m(){var e,r;let{data:s,status:m}=(0,t.useSession)(),x=(0,n.useRouter)();return((0,i.useEffect)(()=>{if("loading"!==m){if(!s){x.push("/auth/login");return}if("company_admin"!==s.user.role&&"company_user"!==s.user.role){x.push("/dashboard");return}(async()=>{try{let e=await u.OR.requestPermission();"granted"===e?console.log("Browser notifications enabled for company admin/user"):console.log("Browser notifications denied or not supported for company admin/user")}catch(e){console.error("Error requesting notification permission for company admin/user:",e)}})()}},[s,m,x]),"loading"===m)?(0,a.jsx)("div",{className:"min-h-screen bg-gradient-bg-light dark:bg-gradient-bg-dark flex items-center justify-center",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-32 w-32 border-b-2 border-purple-600 dark:border-purple-400"})}):s&&("company_admin"===s.user.role||"company_user"===s.user.role)?(0,a.jsxs)("div",{className:"h-screen bg-gradient-bg-light dark:bg-gradient-bg-dark flex flex-col",children:[(0,a.jsx)("div",{className:"bg-white/80 dark:bg-gray-900/80 backdrop-blur-[20px] border-b border-gray-200 dark:border-gray-700 flex-shrink-0",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-6 py-4",children:(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsxs)("button",{onClick:()=>{x.push("/dashboard")},className:"flex items-center space-x-2 text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 transition-colors",children:[(0,a.jsx)(l.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"font-medium",children:"Back to Dashboard"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-gradient-primary rounded-xl flex items-center justify-center",children:(0,a.jsxs)("span",{className:"text-white font-semibold text-lg",children:[null===(e=s.user.firstName)||void 0===e?void 0:e[0],null===(r=s.user.lastName)||void 0===r?void 0:r[0]]})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-gray-800 dark:text-gray-100",children:"Messages"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:"Communicate with your tenants"})]})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-3",children:[(0,a.jsxs)("button",{onClick:()=>x.push("/dashboard/messages/email"),className:"flex items-center space-x-2 px-4 py-2 bg-gradient-primary text-white rounded-lg hover:bg-gradient-primary-hover transition-all duration-200 shadow-lg hover:shadow-xl",children:[(0,a.jsx)(d.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"font-medium",children:"Email"})]}),(0,a.jsxs)("button",{onClick:()=>x.push("/dashboard/messages/sms"),className:"flex items-center space-x-2 px-4 py-2 border-2 border-purple-600 text-purple-600 dark:text-purple-400 dark:border-purple-400 rounded-lg hover:bg-purple-50 dark:hover:bg-purple-900/20 transition-all duration-200",children:[(0,a.jsx)(o.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"font-medium",children:"SMS"})]})]})]})})}),(0,a.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,a.jsx)(c.Z,{currentUserId:s.user.id,currentUserRole:s.user.role})})]}):null}}},function(e){e.O(0,[7349,9840,2971,2117,1744],function(){return e(e.s=1362)}),_N_E=e.O()}]);