Project

General

Profile

Edit Copy Actions

Feature #10454

open

Material Providers feature

Added by Sai Priyatham Sadineni 30 days ago. Updated 30 days ago.

Status:
Resolved
Priority:
Normal
Start date:
08/19/2026
Due date:
08/19/2026 (30 days late)
% Done:

100%

Estimated time:
8:00 h
Spent time:

Description

1. New material_provider role and portal
Added the role to the user model; providers are platform-level accounts (no tenant), resolved at login like superadmins.
Built the portal shell at /provider — dashboard, orders, materials, and profile pages.
Login now routes providers to their own portal automatically.
2. Automated credentials
Adding a provider in the superadmin portal now auto-creates their login and emails generated credentials (new branded email template).
Added a "Send credentials" action per row so existing providers can be provisioned on demand.
Made email mandatory on the provider form, with duplicate detection.
3. Forced password change on first login
Provisioned accounts carry a mustChangePassword flag; the portal blocks every page until the provider sets their own password. Survives reloads and bookmarked links.
4. US unit types and per-unit pricing
Replaced free-text unit boxes with grouped Weight / Volume / Count dropdowns (lb, oz, gallon, quart, pint, fl oz, each, dozen, pieces, boxes).
Price is now "price per unit" with $ formatting.
Extracted one shared unit definition used by all four screens, with matching server-side validation.
5. Orders flowing into the portal
Restaurant orders now appear in the provider's portal with search, status filter, and detail view.
Performance: orders live in per-tenant databases; querying across all 83 restaurants took 3.4 seconds and grew with each new one. Built a cross-tenant index — same query now runs in 0.7s and stays constant. Backfilled existing orders.
6. Order status workflow
New flow: placed → confirmed → sent → received. Providers confirm and dispatch (with an optional note); only the restaurant can mark received, since that creates a Purchase Order and adds stock. Transitions enforced server-side.
7. Provider-managed catalog with photos
Providers can add, edit, and remove their own materials; changes appear immediately in the tenant ordering screen and superadmin portal.
Photo upload per material, stored in S3 under platform/providers/material-images/.
8. Tenant units locked
Units in the tenant's order and receive dialogs are now read-only — the provider defines what they supply in. Enforced on the server too, so it can't be bypassed by the API.
9. Responsiveness
Hid scrollbars across provider screens; tables now drop columns on narrow viewports instead of scrolling sideways, with key details folded into the visible column.
Bugs found and fixed along the way
Silent credential failure — a provider whose email already belonged to another account saved successfully but never got credentials, with no error shown. Now blocked upfront with a clear message. (This was the cause of the missing email you reported.)
Tenant couldn't receive confirmed/sent orders — the "Received" button only appeared for placed orders, which the new workflow would have broken.
Superadmin edits wiped provider photos — the save payload dropped the image field.
JWT dropped the provider link, which would have broken portal access entirely.


Add

Subtasks


Add

Related issues

Actions #1

Updated by Sai Priyatham Sadineni 30 days ago

  • Status changed from New to Resolved
Edit Copy Actions

Also available in: Atom PDF