CNP GOD MODE

Platform operator only — not for tenant users

New company setup. Sign in, then use Issue licenses to create a key. Return to the Setup Wizard tab to paste and validate it.

Platform access code (`PLATFORM_ADMIN_SECRET`) does not expire. Sign in once — this browser stays signed in until you click Lock. Save the code in `deploy\hetzner\production.local.ps1` as `LicenseAdminSecret` so deploys never change it.

Platform secret
Auto-refresh
—

Shows tenant users with a valid login in the last window. Location is the client IP from login and periodic token checks (about every 60s).

User | Company | Branch | Role | IP / client | Logged in | Last seen | Idle
--- | --- | --- | --- | --- | --- | --- | ---
Loading…

—

###### Issued licenses not yet assigned to a company

These keys were created in Issue licenses but no tenant has completed setup with them yet.

Company | Company code | Branches | Users | License | License status | Tenant |
--- | --- | --- | --- | --- | --- | --- | ---

Setup wizard flow: create the main license below, then click Continue in Setup Wizard to send the key to /setup for validation and company registration.

###### Issue main license (setup key)

New customer setup token. Set license duration and branch count before creating the key.

Customer name
Customer email
Plan
License duration (years)
Deployment mode
Maximum users
Number of branches (incl. head office)

Standard — core ERP modules. Change plan to unlock more features.

1 branch — head office only (no extra locations at setup).

After setup, raise limits under Customer licensing → Upgrade main license, or add branch license slots for +1 branch each.

License created — copy for the customer:

``

Customer | Full license key | Branches / users | Plan | Status | Valid until |
--- | --- | --- | --- | --- | --- | ---

Select customer (company)
Select a customer to view their main license and branch licenses.

###### Main license

—

—

Full key
`—`
—
Extend term

###### Upgrade main license

Increase branch or user limits on the existing key (no new key required).

Number of branches (incl. HQ)
Maximum users

Also extend expiry (optional)

Assign pending main license

###### Add branch license slot (after setup)

Each slot allows one additional branch in the ERP (beyond what the main license allowed at setup). Expires when the main license ends.

Slot label
Link to branch (optional)
Number of branch licenses

Slot | Label | Branch | Status | Expires |
--- | --- | --- | --- | --- | ---

Node | Company | Type | Version | Last heartbeat | Last sync |
--- | --- | --- | --- | --- | --- | ---

###### GitHub update

—

Pulls latest code from GitHub, runs migrations, and restarts the app.

###### Update log

—

##### CNP Support & Admin Handbook

For platform operators, call center, and online support — use while helping customers by phone or chat.

##### Overview

This portal is CNP operator only — not for customer company admins. Customers use the normal ERP at `/static/login.html?from=home` with their username, password, and company code.

Use God Mode to:

- Find a customer company and view their full license key
- Reset passwords, enable/disable users, or Login as to see what they see
- Issue, renew, or revoke licenses; add branch license slots
- Monitor local servers (nodes) and deploy cloud updates

Never give customers the platform secret (`PLATFORM_ADMIN_SECRET`). That unlocks this entire portal.

##### Licensing model

Type | What it covers | Duration
--- | --- | ---
Main license | One company tenant + head office (1 branch) + user limit | 1 year — renew in Customer licensing
Branch license | +1 extra branch per slot (e.g. second store) | Same expiry as main — auto-extends when main is renewed; revoked when main is revoked

Branch limit = 1 (HQ included in main) + number of active branch licenses.

###### Deployment modes — cloud, local, or both

When you Issue licenses, set Deployment mode on the key. This controls where the customer may use that key — separate from plan (standard / professional / enterprise) and branch limits.

Issue as | Cloud `/setup` | Local LAN server | Typical customer
--- | --- | --- | ---
cloud | Yes | No — download/install blocked | SaaS only on `erp.cnpsolutions.co.bw`
local | No — cloud setup blocked | Yes — download + install | Offline LAN server only (rare)
both (default) | Yes | Yes | LAN server with cloud sync — most common

Support tip: If they want a PC in the office and online access, issue both. If they only use the website, issue cloud. There is no separate “hybrid” license — hybrid means a local install that syncs to cloud; use local or both.

Local server binding: Customer must verify the key at `/install/local` before download. The installer (`-LicenseKey`) binds the package to that computer. Copying files to another PC will not work. One main key = one company (reinstall on the same licensed server is OK).

Authority: All keys are issued and stored on this cloud hub. Local servers phone home to validate — even `local`-only keys are tracked here.

###### Subscription plans — Standard, Professional, Enterprise

Plan controls which ERP modules the company can use (navbar + API). User and branch caps are set separately on the key.

Plan | Modules | Suggested defaults
--- | --- | ---
Standard | POS, sales, purchases, inventory, accounting, banking, VAT, basic reports | 10 users · 1 branch (HQ)
Professional | + Manufacturing, job cards, COGS, procurement, budgeting, workflows, dimensional accounting, branch sales, billing | 25 users · 5 branches
Enterprise | + BI, traceability, fixed assets, management & period reports, invoice designer, Excel templates, logs, cloud sync API | 100 users · 25 branches

Upgrade path: Issue a new main license on the higher plan and assign to the company, or use Customer licensing → Upgrade for user/branch limits only (plan is on the license key — re-issue to change tier).

###### Issue a new customer (typical flow)

1. Issue licenses tab → create main key (1 year). Set Deployment mode (`both` unless they are cloud-only). Copy the full `CNP-XXXX-YYYY-…` key immediately.
2. Send the key and the right entry point:
   - Cloud or both: `https://erp.cnpsolutions.co.bw/setup`
   - Local or both: `/install/local` → verify key → download ZIP → install with `-LicenseKey`
3. After setup, open Customer licensing → select company → confirm main license is assigned.
4. If they need more branches, add branch license(s) there before they create branches in the ERP.

###### Renewal

Customer licensing → select company → Renew +1 year on main license. All active branch licenses match the new expiry.

###### Lost / reinstall key

Customer licensing → select company → copy Full license key. Keys issued before key vault may show “Not archived” — issue a new main license and assign if needed.

License key format: `CNP-PLAN-YYYY-XXXX-XXXX-XXXX` (dashes matter; uppercase when typing).

##### Phone & chat playbooks

##

Say: “I’ll send your license key. You’ll open our setup page, validate the key, then create your company and admin login.”

1. Issue main license in God Mode — set Deployment mode to `both` (usual) or `cloud` / `local`; email/SMS the full key.
2. Cloud / both: direct them to `https://erp.cnpsolutions.co.bw/setup`
3. Local / both: `/install/local` → verify key → download → install with `-LicenseKey` on their server PC.
4. They choose company code, admin username/password — you do not set these in God Mode unless resetting later.
5. After setup, they login at `/static/login.html?from=home` with username + password (no branch dropdown).

##

Ask: Company name or code? Username? Exact error message? Cloud or local install?

1. Companies → search → Manage → confirm user exists and is active.
2. Confirm company is Active (not deactivated).
3. Reset pwd on user → give them a temporary password; ask them to change it in Settings after login.
4. If license expired: Customer licensing → renew main license (402 errors in app).
5. Use Login as to verify their account works before closing the call.

##

Say: “Each extra location needs a branch license on your account. I’ll add that now, then you can create the branch in Branches settings.”

1. Customer licensing → select company → check branches used / allowed.
2. Add branch license (quantity = number of new locations).
3. Tell customer: ERP → Branches → create branch (admin/super_admin).

##

1. Customer licensing → confirm main expiry date and status.
2. Renew +1 year on main license (extends branch licenses too).
3. If revoked, issue new main license → Assign to company.

##

1. Customer licensing → copy full main license key. Confirm deployment mode is `local` or `both` (not `cloud`-only).
2. Local: `/install/local` → verify key → download → reinstall on the same licensed PC with `-LicenseKey` (Windows) or `--license-key` (Linux/Mac).
3. New PC needs a new key or CNP approval — installs are bound to the machine fingerprint.
4. After reinstall, confirm node appears under Nodes (heartbeat every 5 min).

##

1. Confirm user role — cashiers have limited menus by design.
2. Check user’s branch in Manage; session bar shows active branch.
3. Zero stock at branch may hide products — check cross-branch stock.
4. Login as their user to reproduce.

##### Login & accounts

- Customer login: username + password (branch from user profile).
- God Mode password reset: Companies → Manage → Reset pwd (min 6 chars).
- Login as: opens ERP in new tab as that user — for troubleshooting only.
- Deactivate company: Manage → Toggle active — blocks entire tenant.

##### Branches & limits

Setup creates head office only. Each extra location needs a branch license before creating the branch in ERP.

Branch slots show as `BR-COMPANY-001` — internal tracking only.

##### Local / on-prem servers

- Requires a main license with deployment local or both.
- Install guide: `/install/local` — customer verifies key before download.
- Windows: `Install-CNPERP-Local.ps1 -LicenseKey "CNP-…"` · Linux/Mac: `install-cnperp-local.sh --license-key "CNP-…"`
- LAN access: `http://server-ip:8010` · Setup: `/setup` on that server (license already bound at install).
- Heartbeat: every 5 minutes — visibility in Nodes tab; missing heartbeat does not auto-lock customer.
- Wrong machine / unlicensed: ERP blocks until reinstall with valid key on the licensed PC.

##### God Mode tabs

Tab | Use when…
--- | ---
Dashboard | Quick counts — companies, users, licenses, nodes, live sessions
Live sessions | Who is logged in now — user, company, branch, IP, last activity
Companies | Search tenant, reset passwords, impersonate
Issue licenses | Create new main keys (1 year) — set plan, deployment mode, users, branches
Customer licensing | Full key, renew/revoke, branch licenses
Nodes | Local servers and last heartbeat
Deploy / Updates | Update this cloud server only
Help | This handbook

##### Customer URLs

ERP login | `/static/login.html?from=home`
First-time setup | `/setup`
Local install guide | `/install/local`
Setup help (customers) | `/static/help/setup-configuration-guide.html`
Platform admin (operators only) | `/platform-admin`

##### Escalation checklist

- Company name, code, username, cloud vs local
- Exact error message; time of incident
- Whether Login as reproduces the issue
- License status from Customer licensing

Fix without escalation: password reset, license renew/issue, branch license add, company reactivate.

##### Company

Open ERP login
Company code (login)
—
Sign-in
—

###### Branches

Branch code | Name | HQ | Status
--- | --- | --- | ---
—

###### Main license

—
``

Full key not archived — issue a new license or check Issue licenses tab.

###### Users

User | Role | Branch | Status | Actions
--- | --- | --- | --- | ---