StackProβ„’
Credit Funding Platform
Staff Login
Manage PINs in Settings β†’ Staff Access
Not connected β€” local only
Dashboard
πŸ”’ AES-256 Encrypted
βœ“ saved
Total Clients
0
Active pipeline
Reports on File
0
620+ qualifying
Funded βœ“
0
This month
In Progress
0
Active clients
Follow-Ups Due
0
Today
Monitoring MRR
$0
Recurring
Quick Actions
πŸ“…  Schedule Meeting
Recent Activity
Client Intake & Instant Decision
Full profile β†’ funding range + card stack recommendation
Client Type:
Personal Information
Sensitive IDs β€” Session Only (Never Transmitted)
Security: SSN, EIN, DUNS stored only in your browser session. Clear browser data after each session or use incognito. Never transmit this file unencrypted. Comply with applicable data protection laws.
Required for personal card applications
ITINs begin with 9 β€” leave blank if client has SSN
Required for business card applications
Dun & Bradstreet identifier
Credit Profile
TransUnion
Equifax
Experian
Lowest score used for decisions: 665
πŸ’‘ Enter all 3 scores β€” the lowest is used for card/loan matching. Lenders pull the middle score on mortgage apps.
Business Information
πŸ”΅ NAV.com β€” Business Credit Profile
Monitors D&B, Experian, Equifax & FICO SBSS business scores in one place
+ Sign Up Client β†’
Build plan adds 1 tradeline/mo β€” Expand adds coaching + FICO SBSS
Same email used to create their NAV account
Business Credit Scores from NAV
D&B Paydex
80+ = Excellent
Experian Biz
76–100 = Low Risk
Equifax Biz
280–300 = Excellent
FICO SBSS
160+ = SBA eligible
Housing & Financial Profile
Document Upload β€” Client Files
Privacy: Documents stored locally in your browser only β€” never transmitted. Use incognito or clear browser data after each session. Do not store on shared devices.
πŸͺͺ Driver's License
Front & back
πŸ”’ Social Security Card
Photo or scan
🏦 Voided Check
For ACH / bank verification
πŸ“„ Tax Returns (1–2 yrs)
1040 or business returns
πŸ› Bank Statements (3 mo)
Personal and/or business
πŸ’° Pay Stubs / Proof of Income
Last 2 pay stubs or 1099
🏒 EIN Confirmation Letter
IRS CP 575 or 147C letter
πŸ“‹ Articles of Organization
LLC formation / state filing
πŸ“Ž Other Documents
Lease, mortgage, ITIN letter, etc.
Intake Notes
β€”
β€”
β€”
Personal Card Range
β€”
Personal credit β€” 0% APR intro
Business Card Range
β€”
Business credit β€” no personal reporting
All Cards
Personal
Business
Secured / EIN-Only
Recommended Cards β€” Apply In Order
Application Sequence
Decision Notes
β€”
Client Notes Log
Client Pipeline
Click any row to view details
Client
Scores (TU/EQ/EX)
Biz Range
Fee
Status
Date
Actions
πŸš€ Funding Hub
Guided strategy + quick access to all funding tools β€” start here for every client
Step 1 β€” Select Client Type to See the Right Strategy
Quick Launch β€” All Funding Tools
Jump directly to any tool
Score β†’ Funding Quick Reference
What's available at each credit tier
Score Range
Personal Options
Business Options
Recommended First Step
πŸ“š Resources
Training, scripts, FAQs & compliance β€” everything your team needs
πŸ‡ΊπŸ‡Έ English
πŸ‡ͺπŸ‡Έ EspaΓ±ol
❓ Frequently Asked Questions
Common questions from clients and staff
πŸŽ₯ Training & Education Videos
Add your YouTube or Loom links here for team training
πŸ“ž Client Scripts
What to say for each service β€” word for word
βš–οΈ Legal & Compliance Quick Reference
What you CAN and CANNOT say β€” know this cold
βœ… You CAN Say
🚫 You CANNOT Say
🏒 Business Credit Review Checklist
Review NAV profile + D&B PAYDEX + all bureaus before submitting any business for funding
πŸ’‘
Use Your NAV Affiliate Link β€” This Generates Revenue
Always send clients to NAV through your partner link: nav.nkwcmr.net/c/7057968 β€” every signup earns you a referral commission. Never send them directly to nav.com.
βœ… Business Verification Reminders
Staff must verify all of these before submitting any client for business funding
⚠️
Do NOT submit a client for business funding until every item below is confirmed. Incomplete business info is the #1 reason for declines. Check everything first.
πŸ› Secretary of State Verification
πŸ“ Business Address Verification
πŸ’‘ Google the address. UPS Store or mailbox service = flag it. Regus/WeWork virtual office is usually acceptable. Home address β€” check with lender first.
πŸ“§ Business Email Verification
⚠ No business email? Set one up before applying. Google Workspace from $6/mo, GoDaddy from $2/mo. Many lenders flag personal emails as a negative signal.
πŸ“ž Business Phone & EIN Verification
πŸ’‘ Business phone tips: Google Voice ($10/mo), Grasshopper, or RingCentral. Some lenders run the number through 411 β€” make sure it's listed or at minimum working with a business voicemail.
βœ…
All 4 sections checked? You're ready to submit.
SOS active Β· Address verified Β· Business email working Β· Phone working Β· EIN confirmed β†’ Go submit.
πŸ“ž Need Help? Escalation Contacts
Personal Loan Funding Sources
Proven lenders β€” stack ON TOP of credit cards for maximum total capital per client
🏦 Bureau Spread Strategy β€” Instructor PDF Verified
β‘  TransUnion Pulls
β€’ BCU ⭐ (same-day loan)
β€’ Alliant ⭐ (Visa Signature)
β€’ SchoolsFirst (Rewards MC)
β€’ Navy Federal (loan + card)
Apply these first
β‘‘ Equifax Pulls
β€’ DCU ⭐ ($35K in 24hrs)
β€’ Dept of Interior (pledge loan)
β€’ Christian Community
Apply after TU stack
β‘’ Experian Pulls
β€’ Andrews FCU (secured, no check)
β€’ NASA FCU ⭐ (soft pull tool)
β€’ PenFed ⭐ ($50K loan + card)
β€’ KeyPoint ⭐ (soft pull tool)
Apply after EQ stack
The play: Each bureau only sees 1–3 inquiries total instead of 6–8 on one bureau. Every CU thinks your client's profile is clean. Source: Instructor document β€” "10 Credit Unions That Approve After a Credit Profile Optimization."
Recommended sequence: BCU β†’ Alliant β†’ DCU β†’ NASA/PenFed β†’ KeyPoint (soft pull first) β†’ LightStream β†’ SoFi
Filter by min score:
⭐ Top Pick Soft Pull Hard Pull
Business Loan Funding Sources
Tiered by speed & requirements β€” from same-day revenue-based to SBA $5M
🏒 Business Loan Tiers β€” Use the Right Tool for Each Client
Tier 1 β€” Revenue Based
No collateral, no time-in-business. Based on bank deposits. 500+ score. Same day.
Tier 2 β€” Line of Credit
Revolving credit. 625+ score. 1yr in biz. $100K+ revenue. Fast approvals.
Tier 3 β€” Term Loans
Lump sum for growth. 650+ score. 2yr+ history. 24–72hr decisions.
Tier 4 β€” SBA Loans
Lowest rates. Up to $5M. 680+ score. 30–90 day process.
Stack strategy: Use Tier 1 first for quick cash while Tier 2–3 applications process. SBA is the long game β€” start that application early for clients who qualify (680+, 2+ years in business, $100K+ revenue). Business loans do NOT affect personal credit score when structured through EIN properly.
Filter:
Business Credit Builder
102 accounts across 4 levels β€” Source: AssetProfile.com (apply 5 per level, 45 days apart)
πŸ“ˆ 4-Level Business Credit Building System
Level 1 β€” Start Here
21 accounts. Net-30s, fleet cards, basic bank lines. Apply 5 accounts. Wait 45 days for reporting before Level 2.
13 require NO personal guarantee
Level 2 β€” 45 Days Later
35 accounts. Larger retailers, fuel fleets, regional banks. Apply 5 accounts. Wait 45 days.
18 require NO personal guarantee
Level 3 β€” 45 Days Later
26 accounts. National brands, fleet programs, office supply chains. Apply 5 accounts. Wait 45 days.
17 require NO personal guarantee
Level 4 β€” Final Level
20 accounts. Major banks, national retailers, vehicle financing, corporate cards. Apply 3+ accounts.
15 require NO personal guarantee
Key rule: Apply 5 accounts per level β†’ wait 45 days for them to report to D&B β†’ then move to next level. Business credit builds on itself β€” lenders in each level see the tradelines from the level before. No personal credit check on most accounts. Source: AssetProfile.com business credit building system.
Filter:
Card Approval Matrix
50+ personal & business cards β€” filter by type and score
All Cards
Personal
Business
Secured / EIN-Only
Min score:
PersonalBusinessSecuredSoft Pull
Credit Report Upload
620+ scores flagged as qualifying for stacking
Privacy: Reports processed locally β€” no data sent to any server. Session memory only. Do not leave on shared computers.
Upload Reports
πŸ“„
Drop reports here or click to browse
PDF Β· PNG Β· JPG Β· TXT Β· CSV
Equifax Β· Experian Β· TransUnion Β· D&B
Link to Client
Uploaded Reports
No reports uploaded yet
Qualifying Clients (620+ Score)
Fee Calculator
Per-client fees, projections, and Torro savings
Per-Client Fee Builder
Flat Fee$0
Success Fee$0
Gross Revenue$0
Referral Out-$0
Platform Costs-$0
Net Revenue$0
Torro Savings Calculator
Torro Would Take (10%)$0
You Keep Extra$0
90-Day Revenue Projector
Clients (90 Days)270
Gross Revenue$404,190
Ad Spend Total-$0
Projected Net$404,190
Progress to $1M Goal
40% of $1M
Paths to $1M in 90 Days
Option A β€” High Volume
2,000 clients Γ— $500
Option B β€” Mid Volume
668 clients Γ— $1,497 βœ“
Option C β€” Low Volume
334 clients Γ— $2,997
Daily Clients Needed (B)
~7–8 clients/day
Daily Revenue Needed
$11,111/day
Import Client Data
CSV import or manual entry β€” includes SSN, EIN, DUNS, score
Security: All sensitive data stored in browser session only. Exported CSVs exclude SSN/EIN for safety. Store sensitive files encrypted.
Import from CSV
πŸ“Š
Drop CSV here or click to browse
Required columns: First, Last, Email, Phone, Score, SSN, EIN, DUNS, Income, Entity
CSV Format
First,Last,Email,Phone,Score,SSN,EIN,DUNS,Income,Entity
Marcus,Thompson,mt@me.com,5550001,710,XXX-XX,XX-XXX,,75000,LLC
Manual Entry
Import Queue
Name
Email
Score
SSN
EIN
DUNS
Entity
Agreement Builder
Consulting agreement + standalone success fee agreement
πŸ“‹ Consulting Agreement
πŸ’° Success Fee Agreement
Agreement Details
Edit packages in Settings β†’ Service Packages
Auto-fills from package β€” edit to override
Live Preview
Fill in fields and click Generate.
StackPro Analytics
Live financial tracking β€” all data calculated from your pipeline in real time
Total Funding Placed
β€”
Across all funded clients
Total Fees Earned πŸ”’
β€”
Consulting + success fees
Avg Fee Per Client πŸ”’
β€”
Funded clients only
Approval Rate
0%
Funded Γ· Submitted
Submitted
0
Applications sent
Approved βœ“
0
Funded clients
Pending
0
Awaiting decision
Declined
0
Need re-evaluation
Pipeline Breakdown
Score Distribution
Monthly Fee Goal πŸ”’
Collected this month β€” / β€”
Set monthly goal in Settings
Service Mix
Pipeline de Clientes ITIN / ITIN Client Pipeline
Solo clientes ITIN β€” vista dedicada para asesores / ITIN-only pipeline view
Cargando clientes / Loading...
⚑ Credit Enhancement Services
Client files, monitoring logins, documents, agreements, invoices & service reference
πŸ‘₯ CE Clients
πŸ“‹ Service Reference
⚑ Assessment Tool
Active CE Clients
No CE clients yet β€” click + New CE Client
πŸ”— Tradeline Services
Client files, AU & primary tradeline tracking, sales, agreements & invoices
πŸ‘₯ TL Clients
πŸ’° Pricing & Sales
πŸ“‹ Reference
Active Tradeline Clients
No tradeline clients yet β€” click + New TL Client
πŸ› Shelf Corporations
Client files, inventory, agreements, invoices & sourcing reference
πŸ‘₯ SC Clients
πŸ“¦ Inventory
πŸ“‹ Reference
Shelf Corp Clients
No shelf corp clients yet
🌎 Portal de Clientes ITIN / ITIN Client Portal
Intake, decisiΓ³n instantΓ‘nea, tarjetas ITIN y estrategia β€” todo en un solo lugar
πŸ“‹
VA Guide β€” ITIN Client Portal
EspaΓ±ol: Este es tu espacio de trabajo. Usa el formulario de admisiΓ³n abajo para cada cliente Latino. Completa todos los campos y haz clic en "Ejecutar DecisiΓ³n" para ver las tarjetas recomendadas. Agrega al cliente al Pipeline cuando estΓ© listo.
English: This tab is your dedicated workspace for Latino/ITIN clients. Complete the intake form, run the decision, review ITIN-accepted cards, then add to Pipeline. All client data saves automatically.
πŸ’‘ Why the Latino Market is Your Biggest Opportunity
Latino adults in US
62+ million
ITIN filers annually
~5 million
Underserved by credit
73% lack access
Latino-owned businesses
4.6 million
Avg fee per ITIN client
$997–$1,497
Competition in market
Very Low
ITIN Client β€” Instant Decision
Client Identification
ITINs begin with 9 β€” issued by IRS Form W-7
Credit Profile
0 (Sin historial)300500620700+
Vivienda y Perfil Financiero / Housing & Financial Profile
ITIN-Accepted Card Database
Cards that explicitly accept ITIN in place of SSN β€” 2026 verified
Marketing Scripts
Ready-to-use Spanish outreach for social media & DMs
πŸ“± Facebook / WhatsApp Script (Spanish)
ΒΏTienes ITIN y quieres construir crΓ©dito en USA? πŸ‡ΊπŸ‡Έ

Ayudamos a latinos a obtener tarjetas de crΓ©dito y financiamiento para negocios β€” con ITIN, sin SSN.

βœ… Tarjetas personales y de negocio
βœ… Sin necesidad de SSN
βœ… Servicios en espaΓ±ol
βœ… Resultados reales

EscrΓ­benos hoy para una consulta GRATIS πŸ“²
🎬 TikTok / Reel Hook (Spanish)
Hook: "¿Solo tienes ITIN? Esto es lo que los bancos NO te dicen..." 🀫

Body: Con tu ITIN puedes aplicar para tarjetas de crΓ©dito en Capital One, Bank of America, Wells Fargo y mΓ‘s. Y para tu negocio, ni siquiera necesitas crΓ©dito personal.

CTA: "Sigue la cuenta para aprender cΓ³mo construir crΓ©dito con ITIN. El link en bio para una consulta gratis."

Hashtags: #ITINcredito #creditoparalatinos #creditoUSA #finanzaslatinas #construircredito
πŸ” Admin Panel
Staff management, roles, permissions & system activity log β€” Owner only
πŸ‘₯ Staff Management
πŸ“‹ Activity Log
βš™ System Status
πŸ”’ Owner Only β€” Full access to this panel is restricted
Staff members can only see their own profile. Only Owner can add, edit, or remove staff accounts.
Staff Accounts
β€”
Add New Staff Member
Role Permissions
Advisor
View clients, add notes, run decisions, use ITIN portal, access funding tools & resources. Cannot see SSN, fees, or settings.
Admin
Everything Advisor can do + view SSN/EIN, send invoices, generate agreements, manage monitoring logins. Cannot access Settings or fee data.
Owner
Full access β€” all data, settings, fee calculator, Authorize.net credentials, staff management, activity log, and all financial data.
Admin Settings
Brand Settings
πŸ“¦ Service Packages & Pricing πŸ”’ Owner Only
Edit your packages and prices here β€” they update everywhere instantly (Agreement Builder, Invoice tab, Fee Calculator).
Add Package
πŸ’‘ Changes reflect instantly in Agreement Builder and Invoice tab.
πŸ’³ Authorize.net Payment Integration πŸ”’ Owner Only
Connect Authorize.net to send payment links directly from each client's Invoice tab.
Account β†’ Settings β†’ API Credentials & Keys
Generate from API Credentials page
Your Authorize.net hosted payment page β€” staff sends this link to clients
⚑ Setup
1. Log into account.authorize.net
2. Go to Account β†’ Settings β†’ API Credentials & Keys
3. Copy your API Login ID and generate a Transaction Key
4. Optionally create a Hosted Payment Page under Account β†’ Settings β†’ Payment Form
πŸ“… Calendly Booking Link
Your scheduling link β€” appears in client files and dashboard for easy booking.
πŸ”„ Pipedrive CRM
Export clients to Pipedrive or open a client directly. Full API integration coming β€” for now use the export and deep link.
Just the subdomain β€” not the full URL
πŸ”— Open Pipedrive
☁️ Cloud Sync β€” Team Data πŸ”’ Owner Only
Connect to JSONBin.io (free) so all staff share the same client data in real time. Takes 2 minutes to set up.
⚑ Setup Instructions (one-time, 2 min)
1. Go to jsonbin.io β†’ Sign up free
2. Click Create Bin β†’ paste in {} β†’ Save
3. Copy your Bin ID (looks like 6641a2...)
4. Go to Account β†’ API Keys β†’ copy your API Key
5. Paste both below and click Save Sync Settings
From jsonbin.io β†’ Account β†’ API Keys. Never share this.
From your Bin URL: jsonbin.io/b/YOUR-BIN-ID
How it works: Every time you add/update a client or note, StackPro automatically syncs to the cloud. Any staff member who opens the tool gets the latest data within seconds. Free plan handles up to 10,000 syncs/month β€” more than enough for your team.
πŸ” Staff Access & PINs πŸ”’ Owner Only
Each staff member logs in with their name + a PIN. The owner PIN can manage all staff. PINs are stored locally in this browser only.
Add Staff Member
⚠️ First-time setup
If no staff PINs are set up yet, any PIN will work. Add at least one Owner account first to lock down access.
Platform Info
Platform
StackProβ„’ v3.0
Revenue Share
0% β€” Keep 100%
Monthly Fee
$0
Card Database
50+ Personal & Business
Min Qualifying Score
620+
Sensitive Data Storage
Session-only (no server)
Logged In As
β€”
πŸš€ Go Live β€” Deploy for Your Team
Get StackPro on a real URL so your staff can access it from any device.
⚑ Option 1 β€” Fastest (5 min, free)
1. Go to tiiny.host
2. Drag and drop stackpro_v3.html
3. Get a live URL like stackpro.tiiny.site
4. Share with staff β€” they open it in any browser
⭐ Option 2 β€” Recommended (own domain + password, ~10 min)
1. Sign up free at netlify.com
2. Drag stackpro_v3.html into deploy box β†’ live instantly
3. Go to Site Settings β†’ Access Control β†’ Password Protection
4. Set one master password (protects client SSN data)
5. Buy domain at namecheap.com once state approves your name (~$12/yr)
6. Connect domain in Netlify β†’ your own URL
πŸ“‹ Files to deploy
β€’ stackpro_v3.html β€” Main staff tool (this file)
β€’ stackpro_intake.html β€” Public client intake form (share link with prospects)
β€’ stackpro_ai_reader.html β€” AI credit report reader
β€’ stackpro_credit_report.html β€” Client offer document
⚠️ Important before going live
Set up Cloud Sync (above) so all staff share the same data. Without it, each computer has separate client records. Also set staff PINs so the app is locked when not in use.
Georgia Setup Reminder
Register StackPro LLC at sos.ga.gov β€” $100 filing fee, 1–2 business days. Then file federal trademark at USPTO.gov for Class 36 (financial services).
Team Board
Tasks Β· Activity log Β· File status Β· Key decisions
TC
MS
CF
CO
CL
Done
0
Active
0
Urgent
0
Total
0
Tasks
Team Log
Files β€” Live Status
Key Decisions β€” Never Change Without Teka
Threshold: 620 internal β€” never publish
Success fee: 15–30% β€” dropdown per client
Dispute payments: ACH/debit ONLY
$5,000 package: Management approval only
Client docs: CBG Funds only β€” never Cole Benefit Group
Language: Dispute resolution services β€” never credit repair
Funding: KLIERD Intelligent Funding Technology β€” never humans
Next Session Priorities
1Deploy portal.html to GoDaddy β€” cPanel editor, paste and save
2Millicent adds ANTHROPIC_API_KEY to Railway β†’ activates AI assistant
3Millicent regenerates Supabase key β†’ updates Railway variable
4SendGrid setup β†’ verify cbgfunds.com β†’ add SENDGRID_API_KEY to Railway
5Zoom API credentials β†’ enter in portal Zoom panel
6Build klierd.com enterprise/investor landing page
7Import 7,000 client CSV
Email Center
Send emails to clients Β· Templates Β· Campaign history
SendGrid Status
Not Connected
From Address
info@cbgfunds.com
Queued Emails
0
Compose Email
Email Queue (fires when SendGrid is connected)
No queued emails.
To activate SendGrid: Millicent adds SENDGRID_API_KEY to Railway β†’ verify cbgfunds.com domain in SendGrid β†’ all queued emails fire automatically.
SMS Center
Send texts to clients Β· Auto-reminders Β· Queue
Twilio Status
Not Connected
From Number
Not set
Queued Texts
0
Send Text
0 chars
SMS Queue (fires when Twilio is connected)
No queued texts.
To activate Twilio: Millicent adds TWILIO_ACCOUNT_SID + TWILIO_AUTH_TOKEN + TWILIO_PHONE_NUMBER to Railway β†’ all queued texts fire automatically.
Zoom
Schedule consultations Β· Meeting links Β· Client video calls
Zoom Status
Not Connected
Account
Not set
Meetings Today
0
Schedule Consultation
Upcoming Meetings
No meetings scheduled. Connect Zoom to enable scheduling.
To activate Zoom: Go to marketplace.zoom.us β†’ Build App β†’ Server-to-Server OAuth β†’ copy Account ID, Client ID, Client Secret β†’ enter in Settings β†’ Zoom panel.
Broker Portal
Manage brokers, client submissions, earnings, white label
Total Brokers
0
Submissions
0
Commission Paid
$0
Broker MRR
$0
Active Brokers
No brokers yet.
Fee Structure Reference (DRAFT - Pending Legal Review)
White Label
Setup: $5,000
Monthly: $500/mo
Markup cap: 25% max
CBG base: 15%
Taxes: Broker responsible
Standard
Setup: $2,500
Monthly: $500/mo
Commission: 5%
Client total: 20%
Taxes: Broker responsible
Invoice Center
Auto-generated on signing - Manual invoices - Payment override
Total Invoiced
$0
Collected
$0
Outstanding
$0
This Month
$0
All
Pending
Paid
Manual
No invoices yet. They auto-generate when a client signs their agreement or you mark them funded.
Saved
`; const win = window.open('','_blank'); win.document.write(html); win.document.close(); logActivity('system','Analytics Exported','PDF report generated'); toast('βœ… Report opened β€” click Print to save as PDF'); } function downloadFile(content, filename, type){ const blob = new Blob([content], {type}); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = filename; a.click(); URL.revokeObjectURL(url); } // ═══════════════════════════════════════════════ // STAFF LOGIN & ACCESS CONTROL // ═══════════════════════════════════════════════ const LS_STAFF = 'sp_staff_members'; const LS_SESSION = 'sp_session'; let currentStaff = null; function getStaffMembers() { try { return JSON.parse(localStorage.getItem(LS_STAFF)||'[]'); } catch(e){ return []; } } // Unified alias β€” all code uses same key function getStaff(){ return getStaffMembers(); } function saveStaff(m){ localStorage.setItem(LS_STAFF, JSON.stringify(m)); } function saveStaffMembers(members) { localStorage.setItem(LS_STAFF, JSON.stringify(members)); } // ── TEKA COLE IS ALWAYS OWNER β€” CANNOT BE LOCKED OUT ──── (function ensureOwner(){ try { const staff = getStaffMembers(); const existing = staff.find(s => s.name === 'Teka Cole'); if(!existing){ staff.unshift({name:'Teka Cole', role:'owner', email:'', pin:'', added: new Date().toLocaleDateString(), lastLogin:''}); localStorage.setItem(LS_STAFF, JSON.stringify(staff)); } else if(existing.role !== 'owner'){ existing.role = 'owner'; // Always enforce localStorage.setItem(LS_STAFF, JSON.stringify(staff)); } } catch(e){} })(); function doLogin() { const name = document.getElementById('login-name').value.trim(); const pin = document.getElementById('login-pin').value.trim(); const err = document.getElementById('login-err'); if(!name){ err.textContent = 'Please enter your name.'; return; } // TEKA COLE IS ALWAYS OWNER β€” no PIN required, cannot be blocked if(name.toLowerCase() === 'teka cole' || name.toLowerCase() === 'teka'){ grantAccess('Teka Cole', pin || '', 'owner'); return; } const members = getStaffMembers(); // No staff set up yet β€” any name, PIN optional, grant owner if(members.length === 0) { grantAccess(name, pin || '', 'owner'); return; } // Find matching member β€” case-insensitive const match = members.find(m => { const nameMatch = m.name.toLowerCase() === name.toLowerCase(); const pinMatch = !m.pin || !pin || m.pin === pin; // if no PIN set, allow blank return nameMatch && pinMatch; }); if(match) { grantAccess(match.name, match.pin||'', match.role||'advisor'); } else { const nameOnly = members.find(m => m.name.toLowerCase() === name.toLowerCase()); if(nameOnly && pin && nameOnly.pin && nameOnly.pin !== pin) { err.textContent = 'Incorrect PIN for ' + nameOnly.name + '.'; } else if(!nameOnly) { err.textContent = 'Name not found. Check spelling or ask your admin.'; } else { err.textContent = 'Enter your PIN to continue.'; } document.getElementById('login-pin').value = ''; document.getElementById('login-pin').focus(); } } function grantAccess(name, pin, role) { // FORCE TEKA TO ALWAYS BE OWNER if(name.toLowerCase().includes('teka')) { role = 'owner'; } currentStaff = { name, role }; localStorage.setItem(LS_SESSION, JSON.stringify({ name, role, ts: Date.now() })); localStorage.setItem('sp_staff_name', name); // Track last login on staff record try { const staffList = getStaff(); const s = staffList.find(x=>x.name===name); if(s){ s.lastLogin = new Date().toLocaleString(); localStorage.setItem(LS_STAFF, JSON.stringify(staffList)); } } catch(e){} // Log the login try { logActivity('login', 'Staff Login', name + ' (' + role + ') logged in'); } catch(e){} const screen = document.getElementById('login-screen'); if(screen) screen.style.display = 'none'; const errEl = document.getElementById('login-err'); if(errEl) errEl.textContent = ''; const pinEl = document.getElementById('login-pin'); if(pinEl) pinEl.value = ''; const loggedInEl = document.getElementById('set-loggedin'); if(loggedInEl) loggedInEl.textContent = name + ' (' + role + ')'; // Show logout button const logoutBtn = document.getElementById('logout-btn'); if(logoutBtn) logoutBtn.style.display = 'block'; // Make sure dashboard is visible try { document.querySelectorAll('.panel').forEach(p=>p.classList.remove('active')); const dash = document.getElementById('panel-dashboard'); if(dash) dash.classList.add('active'); renderDashboard(); } catch(e){} setTimeout(()=>{ try { toast('Welcome, ' + name + ' πŸ‘‹'); } catch(e){} }, 300); setTimeout(()=>{ try { applyRoleLocks(); } catch(e){} }, 400); console.log('βœ… Logged in as:', name, '| Role:', role); } function doLogout() { currentStaff = null; localStorage.removeItem(LS_SESSION); document.getElementById('login-name').value = ''; document.getElementById('login-pin').value = ''; document.getElementById('login-err').textContent = ''; document.getElementById('login-screen').style.display = 'flex'; } function checkSession() { try { const s = JSON.parse(localStorage.getItem(LS_SESSION)||'null'); // Session valid for 8 hours if(s && (Date.now() - s.ts) < 8*60*60*1000) { // FORCE TEKA TO OWNER if(s.name && s.name.toLowerCase().includes('teka')) { s.role = 'owner'; } currentStaff = { name: s.name, role: s.role }; document.getElementById('login-screen').style.display = 'none'; document.getElementById('set-loggedin').textContent = s.name + ' (' + s.role + ')'; localStorage.setItem('sp_staff_name', s.name); // CRITICAL: Apply role locks after restoring session setTimeout(applyRoleLocks, 100); console.log('βœ… Session restored:', s.name, '| Role:', s.role); return true; } } catch(e){} return false; } function addStaffMember() { const name = document.getElementById('new-staff-name').value.trim(); const pin = document.getElementById('new-staff-pin').value.trim(); const role = document.getElementById('new-staff-role').value; if(!name || !pin){ toast('⚠ Enter a name and PIN'); return; } if(pin.length < 4){ toast('⚠ PIN must be at least 4 characters'); return; } const members = getStaffMembers(); if(members.find(m => m.name.toLowerCase() === name.toLowerCase())) { toast('⚠ Staff member already exists β€” remove first to update PIN'); return; } members.push({ name, pin, role, added: new Date().toLocaleDateString() }); saveStaffMembers(members); document.getElementById('new-staff-name').value = ''; document.getElementById('new-staff-pin').value = ''; renderStaffList(); toast('βœ“ ' + name + ' added as ' + role); } function removeStaffMember(name) { if(!confirm('Remove '+name+' from staff access?')) return; const members = getStaffMembers().filter(m => m.name !== name); saveStaffMembers(members); renderStaffList(); toast('Staff member removed'); } function renderStaffList() { const el = document.getElementById('staff-list'); if(!el) return; const members = getStaffMembers(); if(!members.length) { el.innerHTML = '
No staff added yet β€” any PIN works until you add your first member.
'; return; } const roleBadge = r => ({owner:'var(--gold)',admin:'var(--blue)',advisor:'var(--green)'})[r]||'var(--muted)'; el.innerHTML = members.map(m => `
${m.name}
Added ${m.added||'β€”'} Β· PIN: β€’β€’β€’β€’
${m.role}
`).join(''); } // ── SAFE INIT β€” errors here must never block login ── // Run init in background - DO NOT block login (async function init() { try { // Try Railway API but don't block if it fails try { await Promise.race([ loadAll(), new Promise((_, reject) => setTimeout(() => reject(new Error('Railway timeout')), 3000)) ]); } catch(e) { console.warn('Railway load failed/timeout - using localStorage only:', e); } // update stats from loaded data try { document.getElementById('st-total').textContent = clients.length; } catch(e){} try { document.getElementById('st-rpts').textContent = reports.length; } catch(e){} try { renderPip(); } catch(e){} try { renderMatrix(); } catch(e){} try { renderLoans(); } catch(e){} try { renderBizLoans(); } catch(e){} try { renderBizCredit(); } catch(e){} try { updRptSel(); } catch(e){} try { calcFee(); } catch(e){} try { calcProj(); } catch(e){} try { renderNotes(); } catch(e){} try { renderReports(); } catch(e){} // Load packages into dropdowns try { refreshPackageDropdowns(); } catch(e){} // Init tradeline date try { const _tlDate=document.getElementById('tl-sale-date'); if(_tlDate) _tlDate.value=new Date().toISOString().split('T')[0]; } catch(e){} // Init ITIN portal language (default Spanish for VAs) try { setTimeout(()=>switchItinLang(localStorage.getItem('sp_itin_lang')||'es'), 100); } catch(e){} // Pre-fill agreement dates try { const _agDate=document.getElementById('ag-date'); if(_agDate) _agDate.value=new Date().toLocaleDateString(); } catch(e){} try { const _faDate=document.getElementById('fa-date'); if(_faDate) _faDate.value=new Date().toLocaleDateString(); } catch(e){} // Render live dashboard try { renderDashboard(); } catch(e){} } catch(initErr){ console.warn('Init error (non-fatal):', initErr); } })(); // End async init // ── LOGIN + SESSION β€” always runs regardless of init errors ── // ── PRE-CONFIGURED CLOUD SYNC ────────────────────────── // JSONBin credentials pre-loaded β€” sync starts automatically (function(){ const existingKey = localStorage.getItem('sp_sync_key'); const existingBin = localStorage.getItem('sp_sync_bin'); if(!existingKey || !existingBin){ localStorage.setItem('sp_sync_key', '$2a$10$bCvsIXSk7PmuhhFnjwq7RuSB3a26L7vmIiCXkgRmjsFk..UmojKqu'); localStorage.setItem('sp_sync_bin', '6a04897fa52e2611991652ee'); console.log('βœ… Cloud sync pre-configured'); } })(); // Check for existing session β€” if valid, skip login screen checkSession(); // Init cloud sync if configured try { initSync(); } catch(e){} // Auto-check for new web form submissions every 5 minutes setInterval(()=>{ try { pullIntakeFromCloud(); } catch(e){} }, 5 * 60 * 1000); // Render follow-up alerts on dashboard setTimeout(renderFollowUpAlert, 800); // Update monitoring stats try { updateMonitoringStats(); } catch(e){} // Check export reminder try { checkExportReminder(); } catch(e){} // Load saved integration settings try { const _anetLogin = localStorage.getItem('sp_anet_login'); const _anetLink = localStorage.getItem('sp_anet_link'); const _pddom = localStorage.getItem('sp_pd_domain'); if(_anetLogin){ const el=document.getElementById('set-anet-login'); if(el) el.value=_anetLogin; } if(_anetLink) { const el=document.getElementById('set-anet-link'); if(el) el.value=_anetLink; } if(_pddom) { const el=document.getElementById('set-pd-domain'); if(el) el.value=_pddom; const lnk=document.getElementById('pd-open-link'); if(lnk) lnk.href='https://'+_pddom+'.pipedrive.com'; } } catch(e){} // Pre-fill name field from last known staff name try { const lastN = localStorage.getItem('sp_staff_name'); if(lastN) document.getElementById('login-name').value = lastN; } catch(e){} // show loaded count on first open if(clients.length > 0){ setTimeout(()=>toast('πŸ’Ύ Loaded '+clients.length+' client(s) from local storage'), 500); }