Client Portal · Business GuideReference sections by CLI-XXX
CLI-001

System Overview & Role

The Client portal gives the project owner a window into their projects. Clients can track progress, view published documents, browse site photos, raise support tickets, and view their payment ledger. They cannot modify any project data.

CapabilitySource / filter
View projectsProject WHERE client_user_id = auth()->id()
Track progressProjectPhase across all client projects
View documentsProjectDocument WHERE status=published
Browse galleryGalleryItem WHERE visibility=client
Support ticketsSupportTicket WHERE client_user_id = auth()->id()
Financial ledgerLedgerEntry WHERE party_type=client AND party_id=auth()->id()
NotificationsAppNotification WHERE user_id = auth()->id()
CLI-002

Client Onboarding

A client user is created by the platform super_admin during tenant onboarding, or by the business admin inside the Admin portal. The client's user_id is then set on the relevant project's client_user_id field.

1Platform super_admin invites business → business admin account created
2Business admin creates client user account in the system
3Business admin creates project: POST /api/admin/projects with client_user_id
4Client user logs in → sees their project(s) immediately
5As work progresses, admin publishes documents and gallery items for client visibility
⚠ A client can only see projects where client_user_id matches their user ID. One client user can be linked to multiple projects.
CLI-003

Document Visibility Rules

Document statusClient sees it?When admin uses it
draftNoDocument being drafted
pendingNoAwaiting internal approval
approvedNoApproved internally; not yet for client
publishedYesReady for client to download
rejectedNoInternal use; not suitable for client

Documents with requires_approval: true (from DocumentType) must be internally approved before they are published. Admin controls the final status: published transition.

CLI-004

Gallery Visibility Rules

visibility valueWho sees it
internalAdmin and staff only
clientClient + admin/staff
publicAll portals (if applicable)

Admin sets visibility per GalleryItem. Only items with visibility = client appear in GET /api/client/gallery. This lets the admin curate what the client sees.

CLI-005

Support Ticket Flow

1Client raises ticket: POST /api/client/supportstatus: open
2Admin sees ticket in their system (future endpoint)
3Admin responds → status moves to in_progress
4Issue resolved → status moves to closed
5Client can view all their tickets but cannot close or delete them
CLI-006

Financial Ledger for Clients

The client ledger shows the financial relationship between the client and the business. The accounting perspective:

entry_typeDebitCreditMeaning
invoice0amountBusiness issued an invoice to client; client owes this amount
paymentamount0Client made a payment; reduces outstanding balance
refund0amountBusiness returned money to client
adjustmentvariesvariesManual correction
// Outstanding balance (client owes business)
credits = SUM(credit) WHERE entry_type IN (invoice, adjustment_credit)
debits = SUM(debit) WHERE entry_type = payment
balance_due = credits - debits
// Positive = client still owes money; negative = overpaid
CLI-007

Error Reference

CodeCause
401Token missing or expired
403user_type is not client
422Validation failed on support ticket creation