🔐

Two-Factor Authentication

Enter the 6-digit code from your Google Authenticator app.
Switch to SMS code instead
⏰ Session Expiring
Auto-logout in 60s
Welcome Back
Sign in to ETSRG CRM
Incorrect username or password.
🔒 SSL🛡 2FA⏰ Auto-Logout
etsrgcrm.com · Authorized users only
master
🔔
EG
E. Garcia
Admin
👥 Add New Client
✅ New Task
📅 New Event
📧 Compose Email
💰 New Invoice
📁 Upload Document
'; }; reader.readAsDataURL(input.files[0]); } } function trackRecent(type, name, id, icon) { var recent = JSON.parse(localStorage.getItem('etsrg_recent')||'[]'); var action = type==='client' ? "goClient('"+id+"')" : type==='community' ? "commId='"+id+"';currentPage='communities';render()" : "currentPage='referralpartners';render()"; recent = recent.filter(function(r){ return r.id !== id; }); recent.unshift({ type: type, name: name, id: id, icon: icon, action: action }); recent = recent.slice(0,10); localStorage.setItem('etsrg_recent', JSON.stringify(recent)); } function pgHome(){ var a=ag(); var d=new Date(); var hr=d.getHours(); var greet=hr<12?'Good Morning':hr<17?'Good Afternoon':'Good Evening'; var nm=currentUser?currentUser.name.split(' ')[0]:''; var dateStr=d.toLocaleDateString('en-US',{weekday:'long',month:'long',day:'numeric',year:'numeric'}); var todayISO2=d.toISOString().slice(0,10); // This week tasks var weekEnd = new Date(d); weekEnd.setDate(d.getDate()+7); var allTasks = []; (a.todos||[]).forEach(function(t){allTasks.push(t);}); (a.clients||[]).forEach(function(cl){(cl.todos||[]).forEach(function(t){allTasks.push(t);});}); var overdue = allTasks.filter(function(t){return !t.done && t.due && t.due < todayISO2;}); var thisWeek = allTasks.filter(function(t){return !t.done && t.due && t.due >= todayISO2 && t.due <= weekEnd.toISOString().slice(0,10);}); var nextWeek = allTasks.filter(function(t){if(!t.due||t.done)return false; var td=new Date(t.due); return td > weekEnd;}).slice(0,3); // Pipeline var pipeline=['Urgent','New Lead','Active','3-Month Hold','6-Month Hold','Future Prospect','Pending Assessment','Waitlisted','Unresponsive']; var pipeClients=(a.clients||[]).filter(function(c){return pipeline.indexOf(c.stage)>=0;}).sort(function(a,b){return a.stage==='Urgent'?-1:b.stage==='Urgent'?1:0;}); // Recent move-ins var recentMoveIns=(a.clients||[]).filter(function(c){return c.moveIn&&c.moveIn.date;}).sort(function(a,b){return b.moveIn.date.localeCompare(a.moveIn.date);}).slice(0,3); // Recent activity (last clicked - stored in localStorage) var recentActivity = JSON.parse(localStorage.getItem('etsrg_recent')||'[]'); // Invoices var pendingInv=(a.invoices||[]).filter(function(i){return i.status==='Draft'||i.status==='Sent';}); var paidInv=(a.invoices||[]).filter(function(i){return i.status==='Paid';}); return '
' +'
'+greet+', '+nm+' 👋
' +'
'+dateStr+'
' +'
' +'
'+overdue.length+'Overdue
' +'
'+thisWeek.length+'Due This Week
' +'
'+(a.clients||[]).filter(function(c){return c.stage==='Urgent';}).length+'Urgent Clients
' +'
'+pendingInv.length+'Pending Invoices
' +'
' +'
' // Column 1: Tasks +'
' +'
Overdue Tasks
'+overdue.length+'
' +(overdue.length ? overdue.slice(0,4).map(function(t){ return '
' +'' +'
'+t.title+'
' +'
Due '+t.due+'
'; }).join('') : '
No overdue tasks 🎉
') +'
' +'
This Week
'+thisWeek.length+'
' +(thisWeek.length ? thisWeek.slice(0,4).map(function(t){ return '
' +'' +'
'+t.title+'
' +'
Due '+t.due+'
'; }).join('') : '
No tasks this week
') +'
' // Column 2: Client Pipeline + Move-ins +'
' +'
Active Pipeline
' +pipeClients.slice(0,5).map(function(cl,i){ return '
' +'
'+initials(cl.name)+'
' +'
'+cl.name+'
' +'
'+cl.stage+'
' +badge(cl.stage)+'
'; }).join('') +(pipeClients.length===0?'
No active clients
':'') +'
' +'
Recent Move-Ins
' +(recentMoveIns.length ? recentMoveIns.map(function(cl){ var mo=Math.round(((cl.moveIn.rent||0)+(cl.moveIn.care||0))*(cl.moveIn.contractPct||90)/100); return '
'+cl.name+'
' +'
'+cl.moveIn.community+' · '+cl.moveIn.date+'
' +'
'+fmt(mo)+'/mo
'; }).join('') : '
No move-ins yet
') +'
' // Column 3: Invoices + Recent Activity +'
' +'
Invoices
' +'
' +'
'+fmt(paidInv.reduce(function(s,i){return s+i.amount;},0))+'
Collected
' +'
'+fmt(pendingInv.reduce(function(s,i){return s+i.amount;},0))+'
Pending
' +'
' +pendingInv.slice(0,3).map(function(inv){ return '
' +'
'+inv.client+'
'+inv.id+' · Due '+inv.due+'
' +'
'+fmt(inv.amount)+'
' +(inv.zelle?'':'') +'
'; }).join('') +'
' +'
Recently Viewed
' +(recentActivity.length ? recentActivity.slice(0,5).map(function(r){ return '
' +''+r.icon+'
'+r.name+'
'+r.type+'
'; }).join('') : '
No recent activity yet
') +'
' +'
'; } function pgReports(){ var a=ag(); var now=new Date(); var tm=now.getMonth(); var ty=now.getFullYear(); var lm=tm===0?11:tm-1; var ly=tm===0?ty-1:ty; var months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']; var miThis=(a.clients||[]).filter(function(c){if(!c.moveIn||!c.moveIn.date)return false;var d=new Date(c.moveIn.date);return d.getMonth()===tm&&d.getFullYear()===ty;}); var miLast=(a.clients||[]).filter(function(c){if(!c.moveIn||!c.moveIn.date)return false;var d=new Date(c.moveIn.date);return d.getMonth()===lm&&d.getFullYear()===ly;}); var miYear=(a.clients||[]).filter(function(c){if(!c.moveIn||!c.moveIn.date)return false;return new Date(c.moveIn.date).getFullYear()===ty;}); function commAmt(c){return c.moveIn?Math.round(((c.moveIn.rent||0)+(c.moveIn.care||0))*(c.moveIn.contractPct||90)/100):0;} var revThis=miThis.reduce(function(s,c){return s+commAmt(c);},0); var revLast=miLast.reduce(function(s,c){return s+commAmt(c);},0); var revYear=miYear.reduce(function(s,c){return s+commAmt(c);},0); var paid=(a.invoices||[]).filter(function(i){return i.status==='Paid';}); var pending=(a.invoices||[]).filter(function(i){return i.status!=='Paid';}); var paidAmt=paid.reduce(function(s,i){return s+i.amount;},0); var pendAmt=pending.reduce(function(s,i){return s+i.amount;},0); var refSrc={}; (a.clients||[]).forEach(function(c){var s=c.referredBy||'Direct';refSrc[s]=(refSrc[s]||0)+1;}); var topSrc=Object.entries(refSrc).sort(function(a,b){return b[1]-a[1];}).slice(0,6); var totalClients=(a.clients||[]).length||1; var stages={}; (a.clients||[]).forEach(function(c){stages[c.stage]=(stages[c.stage]||0)+1;}); var monthly=[]; for(var i=5;i>=0;i--){ var m=(tm-i+12)%12; var y=tm-i<0?ty-1:ty; var cnt=(a.clients||[]).filter(function(c){if(!c.moveIn||!c.moveIn.date)return false;var d=new Date(c.moveIn.date);return d.getMonth()===m&&d.getFullYear()===y;}).length; monthly.push({month:months[m],count:cnt}); } var maxMI=Math.max.apply(null,monthly.map(function(m){return m.count;}))||1; return '' +'
' +'
'+miThis.length+'
Move-Ins This Month
Last month: '+miLast.length+'
' +'
'+fmt(revThis)+'
Commission This Month
Last month: '+fmt(revLast)+'
' +'
'+fmt(revYear)+'
Revenue This Year
'+miYear.length+' move-ins
' +'
'+fmt(paidAmt)+'
Invoices Collected
Pending: '+fmt(pendAmt)+'
' +'
' +'
' // Move-ins chart +'
Move-Ins — Last 6 Months
' +'
' +monthly.map(function(m){var h=Math.round((m.count/maxMI)*100);return '
'+m.count+'
'+m.month+'
';}).join('') +'
' // Referral Sources +'
Top Referral Sources
' +topSrc.map(function(s){var pct=Math.round((s[1]/totalClients)*100);return '
'+s[0]+''+s[1]+' ('+pct+'%)
';}).join('') +'
' // Client Stages +'
Clients by Stage
' +'
' +Object.entries(stages).sort(function(a,b){return b[1]-a[1];}).map(function(s){var pct=Math.round((s[1]/totalClients)*100);return '';}).join('') +'
StageCount%
'+s[0]+''+s[1]+''+pct+'%
' // Invoice Summary +'
Invoice Summary
' +'
' +'
'+fmt(paidAmt)+'
Collected ('+paid.length+')
' +'
'+fmt(pendAmt)+'
Pending ('+pending.length+')
' +'
' +'
' +(a.invoices||[]).slice(0,6).map(function(inv){return '';}).join('') +'
InvoiceClientAmountStatus
'+inv.id+''+inv.client+''+fmt(inv.amount)+''+badge(inv.status)+'
' +'
'; } >