MajlinkE — Supply Chain & Retail Business Platform
Complete guide to setting up and operating the MajlinkE multi-tenant supply chain platform — covering supplier organisations, retailer business management, field agents, and multi-user team features. Works for any product vertical: pharmaceuticals, FMCG, food & beverages, building materials, and more.
🚀 System Overview
MajlinkE is a multi-tenant supply chain and retail business platform built for Nigerian distributors and retailers across any product vertical. It connects distributors to their retail networks — tracking deliveries, sales, inventory, credit, and fraud detection in real time — while giving retailers a full standalone business management suite.
Step 1 · First Login
The first account you should use is the Super Admin. It has unrestricted access to the entire platform.
Go to /login and sign in with the super admin credentials below.
You will land on the Main Dashboard which shows platform-wide sales totals and recent transactions.
Navigate to Settings → System Settings to configure the company name, currency, logo, and time zone.
Step 2 · Create an Organisation
Every supplier company must have its own Organisation record before any users or data can be associated with it.
Go to /admin/platform (Super Admin only).
Click Organisations in the platform menu.
Click New Organisation. Fill in: Name, Email, Phone, Address, Currency Code (NGN), Status (Active).
After saving, note the Organisation ID — you will assign it to the supplier admin user in the next step.
Create the Supplier Admin user account: go to User Management → Users → Add User. Set role_type = supplier_admin and select the organisation from the dropdown.
/supplier/* pages and redirected to the main dashboard with a warning.💳 Self-Serve Signup (/subscribe)
Besides the manual flow above, prospective supplier organisations can sign themselves up and pay for a plan without a super admin creating anything up front. No account exists until a super admin approves the paid application — payment alone never grants access.
Prospect visits /subscribe (public, no login required) — or a Growth Partner's referral link, /subscribe?ref={code} — and fills in company details, their state, the admin username/email they want to log in with, and picks a plan — plans, pricing, and included user seats are all admin-configurable at /admin/platform/plans, not hardcoded.
They choose monthly or annual billing, optionally enter a coupon code (/admin/platform/coupons), then a payment method — Paystack or Monnify (Moniepoint) — and are redirected to that gateway's hosted checkout page to pay the discounted total.
Once payment succeeds, the application is automatically marked Awaiting Approval (confirmed via a browser redirect back to /subscribe/callback/{gateway} and, independently, a webhook — whichever arrives first).
A super admin reviews it under Platform Admin → Subscription Applications (/admin/platform/subscriptions), checks the payment proof, and clicks Approve.
Approving creates the Organisation and the admin User automatically, generates a secure password, and emails the applicant their login link, username, and password.
Step 3 · Add Products & Variants
Products represent the drug catalogue. Each drug can have multiple pack-size variants (e.g. Carton, Box, Blister Pack).
Add a Simple Product
Go to /products/products/create.
Fill in: Name, Code (SKU), Category, Brand, Unit, Cost Price, Sale Price.
Set Stock Alert threshold — this is the reorder level that triggers a low-stock alert.
Toggle High Margin flag if this product should appear in the retailer's high-margin report.
Save. The product is now available across the system.
Add Pack-Size Variants
On the product edit page, toggle Has Variants.
Add a row for each pack size: select the unit (Carton / Box / Blister Pack / Tablet), enter cost and price.
Save. Retailers will see each variant as a separate line item when logging sales.
Step 4 · Add Retailers
Retailers are the pharmacies and drug stores that the supplier supplies to. They must be linked to the supplier organisation through the supplier_retailer relationship.
Create a user account for the retailer: /user-management/users → Add User. Set role_type = retailer. Do not set an organisation_id on the retailer user account.
Log in as the Supplier Admin (or switch to their org as super admin via /supplier/select-org).
Go to /supplier/retailers. New retailers submitted for onboarding appear in the Pending tab.
Click Approve on a retailer to activate them. You can also set their Credit Limit at this stage.
Once approved, the retailer appears in the Active tab and can immediately log sales and place orders.
Step 5 · Set Opening Inventory
Before the system can track stock accurately, you must record the initial stock supplied to each retailer via a Stock Delivery.
Go to /supplier/deliveries/create.
Select the Retailer, set the delivery date.
Add each product and the quantity delivered. Click Save & Confirm.
The system creates or updates an inventory_snapshot record for each product: quantity_supplied increments, current_stock recalculates.
Step 6 · Configure Alert Thresholds
Alerts fire automatically when inventory conditions are met. The key threshold is the reorder level set per product.
Open any product: /products/products/{id}/edit.
Set Stock Alert to the minimum acceptable units (e.g. 20 for a fast-moving line). This becomes the reorder_level.
When a retailer's current_stock drops to or below this number, a low_stock alert fires automatically and appears in /supplier/alerts.
When stock hits zero or goes negative, an out_of_stock alert fires with critical severity.
Step 7 · Add Users
MaaZGSI has four distinct user roles. Here is how to create each type:
Supplier Admin
Create user → set role_type = supplier_admin → assign organization_id from the org dropdown. This user will manage the supplier's supply chain portal.
Retailer
Create user → set role_type = retailer → leave organization_id blank. The supplier admin then links and approves them via /supplier/retailers.
Field Agent
Create user → set role_type = field_agent → assign to the supplier organisation. Their landing page is /agent/dashboard; they log retailer visits from /agent/visits/create.
Super Admin
Create user → set role_type = super_admin → leave organization_id blank. They access all orgs via /admin/platform and can switch into any supplier's context at /supplier/select-org.
📊 Supplier Dashboard
URL: /supplier/dashboard
The command centre for a supplier admin. Shows the health of their entire retail network at a glance.
🏪 Retailers
URL: /supplier/retailers
Manage the pharmacies and drug stores in your supply network.
Status Tabs
- Active — fully onboarded and operational
- Pending — applied but not yet approved
- Suspended — temporarily blocked from ordering
Actions
📋 Orders
URL: /supplier/orders
All supply orders placed by retailers. Filterable by status.
Status Flow
🚚 Deliveries
URL: /supplier/deliveries
Record physical stock sent to retailers independently of the order system (e.g. opening stock, ad-hoc restocks, or deliveries that bypass the order workflow).
Click New Delivery → /supplier/deliveries/create.
Select the Retailer, the delivery Date, and optionally attach a reference number.
Add product lines: product name and quantity delivered.
Click Confirm Delivery. The system increments quantity_supplied on each matching inventory_snapshot row and recalculates current_stock.
If a matching snapshot doesn't exist (first delivery of this product to this retailer), a new row is created automatically.
📦 Inventory Overview
URL: /supplier/inventory
A live view of stock levels across all retailers in your network.
Filter Tabs
- All — every product-retailer combination tracked
- Low Stock — current_stock > 0 but ≤ reorder_level (yellow warning)
- Out of Stock — current_stock ≤ 0 (red critical)
Columns Explained
Retailer Inventory View
Click the eye icon on any row to see all products for that specific retailer at /supplier/inventory/{retailer_id}.
💳 Credit & Payments
URL: /supplier/credit
Tracks goods-on-credit balances for each retailer. Retailers receive stock before paying — this module manages that ledger.
🔔 Alerts
URL: /supplier/alerts
All supply chain alerts for your organisation, newest first. The bell icon in the top navigation shows the unread count in real time.
Alert Types
Actions
⚠️ Mismatches
URL: /supplier/mismatches
A mismatch is automatically created whenever a retailer's current_stock goes negative — meaning they have logged more sales than the system recorded as supplied to them. This is the primary fraud detection mechanism.
Filter Options
- Status: Open · Investigating · Resolved
- Severity: Critical · Warning
Severity Scale
- Warning — discrepancy of 1–19 units
- Critical — discrepancy of 20+ units
Investigation Workflow
A mismatch appears as Open as soon as the system detects negative stock.
Click the mismatch to open the detail view. Review: product, retailer, supplied qty, sold qty, discrepancy size, date first detected.
Dispatch a field agent or contact the retailer to investigate. Update status to Investigating and add notes.
Once resolved (counting error confirmed, stock reconciled, or escalated), click Mark Resolved and add resolution notes. The record is permanently kept for audit purposes.
📈 Analytics
URL: /supplier/analytics
Deep-dive analytics for the selected time period. Use the period buttons (7 / 30 / 90 days / 1 Year) to change the scope.
📊 Retailer Business Dashboard
URL: /retailer/dashboard
The retailer's command centre. Unlike the supplier view (which only shows supply quantities and supply costs), this dashboard shows the retailer's own financial performance — gross profit, expenses, net profit, and cash flow — data the supplier never sees.
Period Filter
Use the pill buttons at the top — Today / This Week / This Month / Custom — to scope all KPI cards and charts to a chosen date range.
Financial KPI Cards (Row 1)
Inventory KPI Cards (Row 2)
30-Day Chart
Bar chart showing daily Revenue (blue) vs Expenses (red) for the last 30 days. Hover any bar for the exact amount.
Closing Stock Table
Full product list with cost price, selling price, margin %, current units, and stock value. Products below reorder level are highlighted in amber.
Expenses by Category
Top 5 expense categories this period with amounts — gives a quick view of where money is going (rent, wages, fuel, etc.).
💸 Retailer Expenses
URL: /retailer/expenses
Record and categorise all operating costs for the store — rent, staff wages, electricity, generator fuel, logistics, etc. Expenses are isolated per retailer account (sub-users share the same expense pool as the main account owner).
Log an Expense
Go to /retailer/expenses/create.
Select an Expense Category (e.g. Store Rent, Staff Wages, Electricity Bill).
Enter the Amount, Date, and an optional Description.
Click Save Expense. The amount is immediately reflected in the dashboard's Net Profit and Cash Flow cards.
Expense History
The expenses list at /retailer/expenses is filterable by date range. Each row shows reference, category, amount, date, and a delete button. The period total is shown above the table.
📈 Retailer Sales Reports
URL: /retailer/reports/overview
Aggregated financial reports for the retailer, broken down by period (daily / weekly / monthly) and filterable by date range.
Period Breakdown Table
Each row is one day/week/month, showing: Revenue, Gross Profit, Expenses, and Net Profit. Quickly spot which periods were most profitable.
Products Sold Ranking
A table of every product sold in the period: quantity, revenue, and gross profit contribution. Sort by any column.
3-Dataset Chart
A grouped bar chart overlaying Revenue (blue), Gross Profit (green), and Expenses (red) per period for visual trend analysis.
🖨️ Receipt Printing
URL: /retailer/sales/{id}/receipt
Every sale has a printable receipt available. The receipt is a standalone page (no sidebar, no header) styled for thermal printers — typically 80mm roll paper.
Receipt Contents
- Store name and sale reference number
- Sale date and time
- Line items: product name, quantity, unit price, line total
- Grand total and amount paid
- Payment status (PAID / PARTIAL / UNPAID)
- Thank-you footer
How to Print
From the dashboard's Recent Sales table, click the Receipt link on any sale row.
The receipt page opens in a new tab. Click the Print Receipt button or press Ctrl/⌘ + P.
In the browser print dialog, select your thermal printer. The page CSS automatically hides the print button and formats the output for narrow paper.
👥 Team Management (Multi-User)
URL: /retailer/team
A retailer account owner can create sub-user accounts (cashiers, managers, viewers) for their staff. All sub-users share the owner's product catalogue and see the same inventory — but the owner can see all activity attributed to each team member.
Sub-User Roles
Invite a Team Member
Go to /retailer/team (only available to the account owner — sub-users cannot manage team).
Click Add Team Member. Enter: Name, Email, Password, and Sub-User Role.
Click Create. The new account is created with parent_retailer_id pointing to the owner's account.
Share the login credentials with the team member. They log in at the normal login page — the system detects they are a sub-user and loads the correct retailer context.
🏷️ Custom Selling Prices
URL: /retailer/inventory
Products are supplied by the supplier at a fixed cost price, but retailers are free to set their own selling price independently. Each retailer maintains their own price list in the retailer_product_prices table. The supplier never sees the retailer's selling price.
Set a Selling Price
Go to /retailer/inventory. Each product row has a price editor inline.
Enter either a Selling Price (absolute amount) or a Margin % (markup over supplier cost). The system computes the other automatically.
Click Save. The price is stored in retailer_product_prices and immediately reflected in the dashboard's stock value calculations and gross profit KPIs.
Fallback Behaviour
If a retailer has not set a custom price for a product, the system falls back to the supplier's listed products.price. This means a retailer can start recording sales immediately without setting prices first.
🏢 How Multi-Tenancy Works
MajlinkE is fully multi-tenant. Every supplier organisation is completely isolated — one org's data is never visible to another org's users. Here is the isolation model:
retailer_id scopes all retailer business data (sales, expenses, inventory snapshots, team members)
parent_retailer_id links sub-users to their owner account — shared pool of data
Tenant Isolation Rules
- A supplier admin with
organization_id = 3can only see retailers, orders, and inventory belonging to org 3 - A retailer user can only see their own sales, expenses, and inventory — even if they receive stock from multiple supplier orgs
- A super admin can switch between any org via /supplier/select-org — this is the only cross-tenant view
- Field agents are scoped to one organisation and only see retailers linked to that org
Adding a New Industry Vertical
Create a new Organisation at /admin/platform with appropriate name, slug, and plan.
Create product categories and units relevant to the vertical (e.g. "FMCG & Household", "Crate", "Bag (50kg)").
Create a supplier admin user with organization_id set to the new org.
Add products with organization_id set. These products are only visible to this org's supply chain.
Onboard retailers by creating retailer accounts and linking them via /supplier/retailers.
🏭 FMCG Demo — Dangote Industries
A live demonstration of the platform applied to Fast-Moving Consumer Goods. Organisation: Dangote Industries Ltd. Products include sugar, salt, cement, flour, pasta, tomato paste, and noodles.
Demo Credentials
Sample Products (8 SKUs)
- Dangote Sugar 50kg —
DNG-SUG-50— Grain & Staples - Dangote Salt 1kg —
DNG-SLT-1K— Seasonings & Condiments - Dangote Cement 50kg —
DNG-CEM-50— Building Materials - Dangote Pasta 500g —
DNG-PST-500— Food & Beverages - Dangote Tomato Paste 800g —
DNG-TMP-800— Seasonings & Condiments - Dangote Flour 50kg —
DNG-FLR-50— Grain & Staples - Dangote Noodles (Carton) —
DNG-NDL-CTN— Food & Beverages - Dangote Table Salt 500g —
DNG-SLT-500— Seasonings & Condiments
🥛 Food & Beverages Demo — Chi Limited
A live demonstration of the platform applied to Dairy and Juice products. Organisation: Chi Limited. Products include Chivita juices, Hollandia dairy range, and Chi ice cream.
Demo Credentials
Sample Products (8 SKUs)
- Chivita Active 1L —
CHI-ACT-1L— Food & Beverages - Chivita Exotic 1L —
CHI-EXO-1L— Food & Beverages - Hollandia Yoghurt 500ml —
CHI-HOL-500— Dairy & Chilled - Hollandia Evaporated Milk —
CHI-HEM-400— Dairy & Chilled - Chi Cool Peak Ice Cream 2L —
CHI-ICE-2L— Dairy & Chilled - Chivita 250ml Carton ×24 —
CHI-ACT-CTN— Food & Beverages - Hollandia Full Cream 1L —
CHI-FCM-1L— Dairy & Chilled - Chi Exotic Juice 250ml —
CHI-EXO-250— Food & Beverages
👑 Role Guide: Super Admin
super_adminThe platform administrator. Unrestricted access to all organisations, all data, all settings.
Daily Tasks
- Review the main dashboard for platform-wide revenue and anomalies
- Go to /admin/platform for cross-org platform analytics
- Use /supplier/select-org to enter any supplier's context and review their supply chain data
- Create new organisations and first admin accounts for new supplier companies
- Review all users at /user-management/users — filter by role_type to find unlinked accounts
- Review paid /admin/platform/subscriptions applications awaiting approval
- Extend or reactivate a lapsed organisation's subscription from its detail page
Extending or Reactivating a Subscription
Open /admin/platform/organizations/{id} — the Subscription panel in Organisation Details shows the current expiry date and status (active/suspended).
Enter a number of days in the Extend by (days) field and click Extend & Reactivate.
This always both extends the expiry and reactivates the org (sets status = active) in one action — there's no separate "reactivate only" button, since a suspended org needs a valid future expiry to mean anything.
💳 Subscription Plans New
Plans are no longer hardcoded — /admin/platform/plans lets you create, edit, and retire plans without a deploy.
Each plan has a monthly and annual price, an included user seat count (staff/team users, not retailers) with a per-additional-user overage price, plus the existing retailer/product caps and analytics/geo/API feature flags.
Click Deactivate to stop a plan appearing on /subscribe for new signups — existing organisations already on it are completely unaffected and keep resolving their limits normally.
slug is fixed at creation and never editable — every organisation on that plan references it by slug (organizations.subscription_plan), so renaming the underlying slug would silently break their pricing/limits lookup. Renaming the display name is fine any time.🎟️ Coupons
/admin/platform/coupons — percentage or fixed-amount discounts, optionally capped by number of uses, a date window, or restricted to one plan. Applied by the customer at checkout on both /subscribe and /renew. A coupon's use count only increments on a payment that actually succeeds — an abandoned checkout never burns a redemption.
🆓 Trials
From an organisation's detail page, enter a number of days under Start Trial.
This sets the trial end date and reuses the exact same expiry/reminder/grace-period machinery as a normal subscription — the org just shows a Trial badge instead of a plan badge until it ends.
The first time a trialling org actually pays (via /renew), it's stamped as a trial conversion automatically — no manual step.
🔄 Upgrade / Downgrade / Cancel
The Change Plan dropdown on an organisation's detail page switches their plan slug immediately — the new price applies from their next billing cycle (no proration). Cancel Subscription sets a distinct cancelled status (voluntary) separate from suspended (involuntary, non-payment) — cancelling never deletes any data, and the org can be brought back any time via Extend.
🧾 Invoices & Failed Payments
An invoice (INV-YYYY-NNNNN, downloadable as a PDF) is generated automatically the moment a payment is confirmed — visible to the supplier admin at /invoices and to you on the organisation's detail page. Paystack/Monnify failure webhooks, plus a daily sweep for checkouts abandoned for over 24 hours, both mark a subscription_applications row failed — filterable on /admin/platform/subscriptions — so a payment attempt is never left silently stuck in limbo.
🤝 Growth Partners & Referral Attribution New
MAJLINK Business Development Reps ("Growth Partners") each get a unique referral link. A business that signs up through it is automatically attributed to that partner — and stays attributed even across plan changes, renewals, or cancellations, until you explicitly reassign it.
Create a partner at /admin/platform/growth-partners — set their tier (Rep, State Manager, Regional Manager, or Country Manager) and the territory they operate in (seeded with Nigeria's real Country → 6 geopolitical Regions → 36 States + FCT hierarchy). A secure login is generated and shown once — share it with the partner directly.
Set Reports To to build the management chain — a rep reports to their state manager, who reports to a regional manager, who reports to the country manager. This is what "clearly identifies" who's heading each territory.
The partner's unique link (/subscribe?ref={code}) is shown on their own dashboard and on their detail page in your admin view. Anyone who signs up through it sees a confirmation banner naming the referring partner, and — once their application is approved — the new organisation is attributed automatically.
If a partner leaves, use Reassign Growth Partner on any of their referred organisations' detail pages. Every reassignment is permanently logged (old partner, new partner, who made the change, when) — attribution history is never silently overwritten.
growth_partner role.🏆 Leaderboard & Performance Dashboard New
A monthly leaderboard ranks every Growth Partner by how many businesses they've brought on — visible to the whole team so everyone can see how the network is performing, with revenue kept private to the super admin.
Everyone except retailers can view /leaderboard. It ranks partners by subscriber count for the selected month, with the top three marked 🥇🥈🥉.
Filter by territory (country, region, or state) to see who's leading a specific patch, or by period to look back at a past month.
The revenue column only appears for the super admin — everyone else sees rank and subscriber count only, exactly as the client spec requires.
The current month is always computed live. Past months are read from a permanent snapshot instead — taken automatically at 00:30 on the 1st of each month by a scheduled job, so historical rankings never change after the fact even as new organisations sign up.
Switching Between Supplier Orgs
Click Supply Chain → Supplier Dashboard in the sidebar.
You are redirected to /supplier/select-org showing all 6 supplier organisations.
Select one and click Enter Supplier View. Session stores the selection.
All supply chain pages now show that organisation's data. The blue banner at the top of each page shows which org you are viewing.
Click Switch Org in the banner at any time to return to the selection screen.
🏭 Role Guide: Supplier Admin
supplier_adminManages one organisation's supply chain. Cannot see other organisations' data.
Daily Routine
- Open /supplier/dashboard — check pending orders count and unread alerts first
- Go to /supplier/orders?status=pending and action all pending orders (approve or reject)
- Check /supplier/alerts for critical alerts (out-of-stock, payment overdue)
- Check /supplier/mismatches?status=open and begin investigation on any critical discrepancies
- Review /supplier/inventory?filter=out_of_stock and schedule deliveries for stocked-out retailers
Monthly Tasks
- Review /supplier/analytics?period=30 for top/least selling products and retailer rankings
- Reconcile credit balances at /supplier/credit — follow up on overdue accounts
- Check inactive retailers in the dashboard and dispatch field agents
💳 Subscription Expiry & Renewal
Each plan runs on a ~30-day cycle. As expiry approaches you'll see a banner (and once-a-day popup) at the top of every page — starting 7 days out, it just warns; after expiry there's a 3-day grace period where the app still works but the warning turns urgent; after that the organisation is suspended and every supply-chain page redirects to the renewal page until it's paid.
Click Renew Now on the banner, or go directly to /renew.
Confirm your plan (price shown includes any extra-user overage beyond your plan's included seats), pick monthly or annual billing, optionally apply a coupon code, choose Paystack or Monnify, and pay on the gateway's checkout page.
Access is restored immediately on successful payment — unlike first-time signup, renewal does not wait on super admin approval, since you're already a verified organisation.
🏪 Role Guide: Retailer
retailerStore owners linked to one or more supplier organisations. Retailers have a full standalone business management suite — see the Retailer Business section for the complete feature set.
Log a Sale
Go to /retailer/sales/create.
Select the supplier organisation whose stock you are selling from.
Add products with quantity and selling price. GPS coordinates are captured automatically if browser location is permitted.
Click Record Sale. The system immediately: deducts from current_stock, updates the dashboard KPIs, and checks alert thresholds.
Place a Restock Order
Go to /retailer/orders/create.
Select products and quantities needed. Add any special instructions in the notes field.
Submit. The order goes to the supplier as Pending. You will receive an alert when it is approved or rejected.
Daily Routine
- /retailer/dashboard — check Revenue, Gross Profit, and Net Profit for today
- Record all sales through /retailer/sales/create or via POS
- Log any operating costs at /retailer/expenses/create (wages, rent, fuel)
- Print a receipt for each customer from the Recent Sales table on the dashboard
Inventory & Reports
- /retailer/inventory — live stock levels + inline price editor
- /retailer/inventory/out-of-stock — quick list of stocked-out lines
- /retailer/reports/overview — sales overview with daily/weekly/monthly breakdown
- /retailer/team — manage cashier and manager sub-accounts (owner only)
🧳 Role Guide: Field Agent
field_agentField agents visit pharmacies and drug stores on behalf of the supplier organisation to verify stock levels, collect orders, and resolve issues.
Pages
Daily Flow
Log in and open /agent/dashboard. Check the Retailers to Visit panel for pharmacies not visited in the last 7 days.
Go to /agent/retailers and click a retailer card to open their detail page. Review stock levels — rows highlighted in red mean out-of-stock; amber means low stock.
After the visit, click Log Visit (from the dashboard, retailers list, or retailer detail page). Choose a status:
- Visited — you met with the retailer and completed the check.
- Missed — retailer was not available (closed, refused, etc.).
- Postponed — visit rescheduled at the retailer's request.
Add notes on stock levels, orders discussed, or issues found. Click Capture Location to stamp the visit with your GPS coordinates.
If a stock mismatch needs investigation, record the physical count in the visit notes. The supplier admin can reference this from the retailer's visit history.
🔑 Test Credentials
Three verticals are pre-seeded. All retailer accounts demonstrate the full Retailer Business Platform (dashboard, expenses, reports, receipts, team).
Platform Admin
Pharmaceuticals (6 orgs)
FMCG & Consumer Goods — Dangote Industries
Food & Beverages / Dairy — Chi Limited
📐 Inventory Tracking Logic
Inventory is tracked per organisation × retailer × product in the inventory_snapshots table. There is no manual stock count — everything is computed from transactions.
quantity_supplied += units on each confirmed Delivery or Delivered Order
quantity_sold += units on each Sale logged by the Retailer
reorder_level = stock_alert value on the product record
- If
current_stock ≤ reorder_level→low_stockalert fires - If
current_stock ≤ 0→out_of_stockalert fires - If
current_stock < 0→ Mismatch Log created +mismatchalert fires
🔔 Alert System Reference
Alerts are stored in the supply_alerts table. They are created automatically by the system or manually by admins. The bell icon count only shows unread alerts for the logged-in user's organisation.
is_read = 0→ unread (counts toward the bell badge)is_read = 1+read_attimestamp → marked as read- Severity levels:
info(blue),warning(yellow),critical(red) - Alert data field: JSON payload with context (e.g. order_id, product_id, discrepancy units)
📋 Full Order Workflow
2. Status: pending — supplier receives alert
3. Supplier approves → Status: approved — retailer receives info alert
OR Supplier rejects → Status: rejected — rejection reason shown to retailer
4. Supplier marks delivered → Status: delivered
→
inventory_snapshot.quantity_supplied incremented→
supplier_retailer.outstanding_balance incremented→
credit_transactions row: type = credit_issued5. Retailer pays → Supplier records payment /supplier/credit/{id}
→
outstanding_balance decremented→
credit_transactions row: type = payment_received
💳 Credit Ledger Reference
The credit_transactions table is an append-only ledger. Each row records one event:
credit_issued— stock delivered on credit (balance ↑)payment_received— cash or transfer received (balance ↓)adjustment— manual correction by supplier adminrefund— credit note for returned goods (balance ↓)
Each row also stores balance_after — the running total after that transaction — so the full history can be audited without recalculating.
📦 Product Variants & Pack Sizes
Each product can be sold in multiple pack sizes. These are configured as Product Variants with their own SKU, cost, and price — applicable to any vertical (pharmaceuticals, FMCG, food & beverages, etc.).
Pharma: Sachet Box (×50 sachets) → Sachet | Bottle Carton (×12 bottles) → Bottle
FMCG example: Bag 50kg → Bag 25kg → Bag 5kg
Beverages example: Carton ×24 → Crate ×12 → Unit (single bottle)
Example — Emzor Paracetamol 500mg (Pharma):
📱 Mobile API Reference
Base URL: /api/v1/
All endpoints except /auth/login require a Laravel Sanctum bearer token in the Authorization header:
Authorization: Bearer {token}
All responses are JSON. Successful responses include a status: "success" field. Errors include status: "error" and a message field. Validation errors return HTTP 422 with an errors object.
Authentication
Supply Chain — Retailer Endpoints
Retailer Business Platform Endpoints NEW
These endpoints power the retailer's standalone business management features — dashboard KPIs, expenses, financial reports, receipt data, custom pricing, and team management. All endpoints are scoped to the authenticated retailer (or their sub-user's parent account).