Skip to content

feat: add approved-vendor search and order-form approval badge - #49

Merged
matejstastny merged 5 commits into
mainfrom
feat/approved-vendor-search
Oct 21, 2026
Merged

matejstastny merged 5 commits into
mainfrom
feat/approved-vendor-search

Conversation

@R0mba-Na11avan

@R0mba-Na11avan R0mba-Na11avan commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What changed

  • Approved-vendor search dialog on Orders, and an Approved / Out-of-scope badge in the order form.
  • Finance page: "Approved vendors" card to upload finance's supplier export (.xlsx). Shows a diff preview (added / removed / changed vendors, old vs. new values) before applying.
  • Each import is logged (who, when, file, counts) in a new vendor_import table.

Also fix scripts/dev.ts to spawn next with shell:true so it runs on Windows.

Why

To see a list of approved vendors as you order. The vendor list only existed in a local spreadsheet loaded by a CLI script, so deploys shipped an empty table. Now any approved member can refresh it from the dashboard. No file copying on the server.

Type of change

  • Feature (feat/)
  • Bug fix (fix/)
  • Chore / infra (chore/)
  • Docs (docs/)
  • Refactor (refactor/)

Checklist

  • pnpm lint passes
  • pnpm format:check passes
  • If schema.ts was changed - migration generated (pnpm db:generate) and committed alongside the schema
  • PR is focused on one concern

@R0mba-Na11avan R0mba-Na11avan self-assigned this Oct 6, 2026
@matejstastny
matejstastny requested review from CPrutean and matejstastny and removed request for matejstastny October 6, 2026 01:54
@matejstastny matejstastny added the enhancement New feature or request label Oct 6, 2026
P0tatohead and others added 5 commits October 20, 2026 19:03
Import the supplier export into a new approved_vendors table with an FTS5
trigram index, and surface it two ways: a Search vendors dialog on the Orders
page, and a live Approved / Out-of-scope badge under the vendor field in the
order form. Approval = Supplier Status 'Active'. Matching is normalized
(punctuation/spacing-insensitive) so 'digikey' resolves to 'Digi-Key'.

Also fix scripts/dev.ts to spawn next with shell:true so it runs on Windows.
…view

The vendor list lived only in a local .xlsx and was loaded by a CLI script,
so deploys shipped an empty approved_vendors table. Any approved member can
now upload finance's supplier export on the Finance page, review a
git-diff-style preview (added / removed / changed vendors with old and new
values), and apply it.

- Move parse/diff/apply into src/lib/vendors/import.ts; scripts/import-vendors.ts
  is now a thin wrapper with --dry-run.
- Locate columns by header text and reject files missing the supplier
  name/status columns; normalize line endings in multi-line cells.
- Apply in one BEGIN IMMEDIATE transaction: update rows in place (stable ids),
  rebuild the FTS index, and log to a new vendor_import table.
- Apply re-checks the file hash and the import the preview was based on,
  returning 409 if another import landed in between.
- Switch xlsx to the SheetJS 0.20.3 build (fixes CVE-2023-30533,
  CVE-2024-22363 in the npm 0.18.5 release).
- Document the upload workflow in the deploy guide.
@matejstastny
matejstastny force-pushed the feat/approved-vendor-search branch from 6684f67 to abea61a Compare October 21, 2026 02:28
@matejstastny
matejstastny merged commit 8350c09 into main Oct 21, 2026
2 checks passed
@matejstastny
matejstastny deleted the feat/approved-vendor-search branch October 21, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants