| ← All Docs Personas & Workflows

Personas & Workflows

Verified Against source code Last updated: September 2026

Dealer (Owner)

Authentication

Access Level

Full access to all features. The dealer is the account owner and has unrestricted access to:

Daily Activity Profile

Staff Member

Authentication

Branch Scoping

Each staff member is assigned to one or more branches via branch_ids UUID[] on the staff_members table. Staff can only see and create data within their assigned branches. The branch context is set on login and cannot be changed without re-authenticating.

Permissions (JSONB)

Staff permissions are stored as a JSONB object on staff_members.permissions. Each key maps to a module and the value is either "visible" or "hidden".

Permission KeyModuleDefault
dashboardDashboardvisible
billHistoryBill Historyvisible
newBillCreate New Billvisible
farmerListFarmer Listvisible
addFarmerAdd New Farmervisible
inventoryInventory / Stockvisible
suppliersSuppliershidden
cashbookCashbookhidden
expensesExpenseshidden
reportsReportshidden
settingsSettingshidden
branchesBranch Managementhidden
staffManagementStaff Managementhidden
transactionsTransaction Historyhidden
Important: Permissions are enforced client-side only. The RLS (Row Level Security) policies grant full data access for the staff member's dealer. A technically savvy staff member could bypass these restrictions via direct API calls.

Platform Admin

Authentication

Roles

RoleCapabilities
superadminFull platform access — manage all dealers, subscriptions, product catalog, broadcasts, audit logs, admin users
adminManage dealers, subscriptions, support tickets, product catalog
supportView dealers (read-only), manage support tickets, impersonate dealers (read-only)

Admin Capabilities

Key Workflows

1. Creating a Bill

The core workflow. On mobile it's a 3-step wizard; on desktop it's a 2-panel layout. Both converge on the same save logic.

1
Select Farmer — Search by name or phone. The FarmerSelector component shows recent farmers first, with a search field. If the farmer doesn't exist, QuickAddFarmerModal allows inline creation without leaving the bill flow.
2
Select Products — The ProductSelector component (1,519 lines) shows the dealer's product catalog. Search, filter by category. For each product: enter quantity, confirm rate (auto-filled from latest lot), apply per-farmer discount if configured. Products are added to the bill items list. Up to 5 concurrent draft tabs in sessionStorage for switching between partial bills.
3
Payment & Review — The PaymentStep shows the bill total. Enter payment amount (can be 0 for full credit, partial, or full). Select payment method (cash, UPI, bank transfer, cheque). The ReviewStep shows a summary. Optional: capture signature on canvas.
4
Save — Calls create_bill_v2 RPC. This is an atomic PostgreSQL function that in a single transaction: creates the bill record, inserts bill items, deducts stock from FIFO lots, records payment (if any), allocates payment to the bill, creates cash book entry, updates farmer due balance. On success, the user is shown the bill detail with options to share via WhatsApp or download PDF.

2. Collecting a Payment

1
Select Farmer — Navigate to farmer's ledger or use the "Collect Payment" action from the dues page.
2
Enter Amount — Enter the payment amount. The farmer's current outstanding balance is displayed for reference.
3
Choose Method — Select payment method: Cash, UPI, Bank Transfer, or Cheque.
4
Allocate to Bills — The system allocates the payment to the farmer's oldest unpaid bills first (FIFO). The user can also manually allocate to specific bills. Settlement discounts can be applied during allocation.
5
Confirm — Payment is recorded, farmer due balance is updated, cash book entry is created. A payment receipt can be shared via WhatsApp.

3. Morning Routine

1
Check Dashboard — Review 5 KPI cards: today's sales, collections, outstanding dues, number of bills, active farmers. Scan the 10 toggleable widgets for alerts and trends.
2
Review Dues — Open the Dues page to see farmers sorted by outstanding amount. Focus on the ageing buckets — 90+ day dues need immediate attention.
3
Plan Collections — Identify farmers to visit or call. Use WhatsApp due reminders to send automated reminders to farmers with overdue balances.

4. End of Day

1
Review Daily Book — Navigate to the Daily Book page and review all transactions for the day: bills created, payments received, purchases made, expenses recorded.
2
Close Cash — Check the Cashbook for today. Verify the closing balance matches the physical cash. Record any discrepancies.
3
Reconcile — Confirm all payments are recorded, all bills are accounted for. The Daily Book's summary view shows totals for each category.

Persona Comparison Matrix

DimensionDealer (Owner)Staff MemberPlatform Admin
Auth methodEmail + password (Supabase Auth)4+ digit PIN (bcrypt)Email + password (custom)
Session storageJWT (Supabase SDK)staff_sessions tableadmin_sessions table
Entry URL/login/:shopSlug/:branchSlug/staff/admin/login
Data scopeAll own dealer dataAssigned branch(es) onlyAll dealers (platform-wide)
Rate limitingSupabase defaultstaff_login_attemptsNone
Permission modelFull access14-key JSONB (client-side)Role-based (superadmin/admin/support)
Can create billsYesYes (if newBill = visible)No
Can manage staffYesNo (unless granted)No
Can view profitYesNoYes (impersonation)