Skip to content

Claude/erp phase 1 foundations 9mi e5#17261

Open
sufianbd wants to merge 139 commits into
react:mainfrom
sufianbd:claude/erp-phase-1-foundations-9miE5
Open

Claude/erp phase 1 foundations 9mi e5#17261
sufianbd wants to merge 139 commits into
react:mainfrom
sufianbd:claude/erp-phase-1-foundations-9miE5

Conversation

@sufianbd
Copy link
Copy Markdown

No description provided.

claude added 13 commits May 24, 2026 12:19
Sets up a complete Laravel 11 + Inertia.js + React 19 + TypeScript ERP
scaffold inside the erp/ subdirectory:

Backend
- Laravel 11 with Inertia.js v2, Ziggy, Spatie Permission v7
- Modular layout: Core / Inventory / Finance service providers
- Migrations: tenants, users (tenant_id, avatar, last_login_at), audit_logs
- Tenant model with BelongsToTenant trait (global scope + auto-assign)
- TenantMiddleware resolving tenant via X-Tenant header / subdomain / domain
- AuditLog model + HasAuditLog trait (created/updated/deleted observer)
- RBAC: 4 roles (super-admin, admin, manager, staff), 14 permissions seeded
- HandleInertiaRequests shares auth user, roles, permissions, ziggy, flash
- DashboardController with breadcrumb props

Frontend
- React 19 + TypeScript strict, Vite 6, Tailwind CSS v3
- Typed PageProps: User (with roles/permissions/initials), Tenant, Breadcrumb
- Hooks: useAuth, usePermission, useSidebar (localStorage-persisted)
- Common components: Button, Input, Badge, Modal (portal), Table (sortable)
- Layout components: Sidebar (collapsible, icon+label), Topbar, Breadcrumbs,
  UserDropdown (role badge, logout)
- AppLayout: persistent shell with flash message display
- Dashboard/Index page with stats grid and module quick-access cards
- Error pages: 403, 404, 500

Tests (Pest v3) — 51/51 passing
- Auth: login, register, logout, password reset flow
- RBAC: role seeding, permission inheritance, super-admin scope
- AuditLog: created/updated/deleted events, actor capture, password hashing
- Tenant: model creation, settings cast, user relations, middleware behavior
- Dashboard: auth redirect, Inertia component, shared props, ziggy, roles

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Complete Inventory module implementation:

Backend:
- 8 Eloquent models: Category, UnitOfMeasure, Supplier, Warehouse, Product,
  StockLevel, StockMovement, PurchaseOrder, PurchaseOrderItem
- 9 database migrations for all inventory tables
- 6 controllers with full CRUD + PO state machine (draft→submitted→approved→received/cancelled)
- Form requests with validation, API resources, ProductPolicy (RBAC)
- InventoryServiceProvider wires migrations, routes, and policies
- Routes use `web` middleware group to enable implicit route model binding
- PurchaseOrder: status default 'draft', availableTransitions(), transition endpoint

Frontend (React 19 + TypeScript + Tailwind):
- 4 shared components: StockLevelBadge, PurchaseOrderStatusBadge, Pagination, ProductForm
- 13 Inertia pages: Products (CRUD+Show), Categories, Warehouses, Suppliers (CRUD),
  StockMovements, PurchaseOrders (Index/Create/Show with dynamic line items)
- Sidebar updated with all inventory nav links

Tests:
- 81 Pest tests, 250 assertions — all passing

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Complete Finance module implementation:

Backend:
- 7 Eloquent models: Account (chart of accounts with type hierarchy),
  JournalEntry + JournalLine (double-entry bookkeeping with balance
  validation), Contact (customer/vendor/both), Invoice + InvoiceItem
  (status machine: draft→sent→paid/cancelled), Payment
- 7 database migrations for all finance tables
- 5 controllers: Accounts, Contacts, JournalEntries, Invoices, Reports
- Form requests with validation, 4 API resources, 4 policies
- FinanceServiceProvider wires routes and policy registration
- Invoice auto-numbering (INV-YYYY-NNNNN) generated post-creation
- Payment recording auto-transitions invoice to paid when fully settled
- Trial Balance report aggregates posted journal lines by account

Frontend (React 19 + TypeScript + Tailwind):
- finance.ts type definitions (Account, JournalEntry, Contact, Invoice,
  Payment, TrialBalanceRow, etc.)
- 2 components: InvoiceStatusBadge, JournalEntryStatusBadge
- 13 Inertia pages: Accounts (Index/Create/Edit), Contacts (Index/Create/Edit),
  JournalEntries (Index/Create/Show with live balance check),
  Invoices (Index/Create/Show with inline payment form),
  Reports/TrialBalance
- Sidebar updated with Finance sub-navigation

Tests:
- 111 Pest tests, 341 assertions — all passing

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- HR module: 6 migrations, 6 models (Department, Employee, LeaveType,
  LeaveRequest, PayrollRun, PayrollItem), 4 controllers, 3 form requests,
  2 resources, 1 policy with optional model param for class-level auth
- LeaveRequest: approve/reject state machine with DomainException guards
- PayrollRun: process() state machine; total_gross/total_net computed attributes
- Admin UserController: create/update/destroy with role assignment via Spatie
- DashboardController: live metrics (9 stat fields, recentInvoices, recentPos)
- Frontend: HR pages (Employees CRUD, Departments, Leave, Payroll Index/Create/Show),
  Admin/Users pages (Index/Create/Edit), Dashboard wired to live stats
- Sidebar: HR and Admin nav groups with children
- Tests: 141 passing (453 assertions) — HR + Admin Pest feature suites added

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Analytics controller: revenue by month (last 12), invoice by status,
  headcount by dept, payroll summary, inventory value — all permission-gated
- SVG line chart + horizontal/vertical bar chart components (no external deps)
- Analytics page with KPI cards, line chart for revenue, bar charts for HR/inventory
- Notifications: Laravel database notifications table, LeaveRequestActioned class,
  dispatched on leave approve/reject if employee has linked user
- NotificationController: index, markRead, markAllRead, destroy
- NotificationBell in Topbar: unread count badge, dropdown, mark-all-read
- Inertia shared data: notifications_count on every request (lazy eval)
- AuditLogController: tenant-scoped, filterable by event/model, paginated
- Audit Log page: expandable rows showing old vs new values diff
- TenantSetting model: key-value store with getValue/setValue helpers
- SettingController: company_name, currency, timezone, fiscal_year_start
- Settings page: admin/super-admin only, validated form
- Sidebar: Analytics link (all users) + Audit Log under Admin group
- Tests: 161 passing (559 assertions) — Analytics, AuditLog, Setting, Notification suites

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Add SearchController (GET /search?q=) returning JSON results for
  invoices, contacts, products, purchase orders, and employees;
  permission-gated per module, debounced in the client
- Add CommandPalette component (Cmd/Ctrl+K) with keyboard navigation,
  type badges, and backdrop dismiss; wired into AppLayout
- Add ExportController with streaming CSV downloads for products,
  invoices, and employees; gated by viewAny policy
- Add export routes under /export/{products,invoices,employees}
- Add Export CSV buttons to Products, Invoices, and Employees index pages
- Add InvoiceController::print() rendering standalone Print page with
  company name and currency from TenantSetting
- Add printable invoice page (Finance/Invoices/Print) with print:hidden
  controls bar and window.print() button
- Add Print / PDF button to Invoice Show page
- Fix ExportController: selling_price → sale_price (Product field name)
- Add SearchTest (6 tests) and ExportTest (5 tests); all 172 tests pass

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Extract HasLineItemTotals trait (subtotal/tax/total/amount_due/isOverdue)
- Extract HasStatusTransitions trait (canTransitionTo/transitionTo/availableTransitions)
- Refactor Invoice model to use both traits via getTransitions()
- Add bills, bill_items, bill_payments migrations (timestamps 000003-000005)

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Add Vendor Bills module (AP): bills/bill_items/bill_payments tables,
  Bill/BillItem/BillPayment models, BillController, BillPolicy,
  BillResource, StoreBillRequest
- Extract HasLineItemTotals + HasStatusTransitions traits (shared by
  Invoice and Bill models)
- Add ReportController::profitAndLoss() and ::balanceSheet() with shared
  aggregateJournalLines() helper
- Add Bills/Index, Bills/Create, Bills/Show React pages
- Add Reports/ProfitLoss and Reports/BalanceSheet React pages
- Add BillStatusBadge component
- Add bill routes (resource + receive/cancel/recordPayment) and report routes
- Update Sidebar with Bills and new report links
- Add BillTest (12 tests) and ReportTest (5 tests); all tests passing
- npm run build passes with no TypeScript errors

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- BillController: reject payment recording on non-received bills
- BillTest: scope Bill::latest() to tenant, load payments in total test,
  add staff-cannot-create and draft-payment-rejected tests
- ReportTest: add staff-403 tests, fix date range on zero-net test,
  add total_liabilities assertion to balance sheet equation test
- Show.tsx: use replaceAll() for multi-underscore payment methods

All 192 tests passing; npm run build clean.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
…story

- Add agedReceivables, agedPayables, accountLedgerIndex, accountLedger
  methods to ReportController with bucket-based aging logic
- Register new finance report routes (aged-receivables, aged-payables,
  account-ledger index + per-account)
- Add PO receiveForm GET route and controller method rendering
  Inventory/PurchaseOrders/Receive Inertia page
- New React pages: AgedReceivables, AgedPayables, AccountLedger,
  PO Receive form
- Update Products/Show with stock movement history and adjustment form
- Update PurchaseOrders/Show with "Receive Items" button for approved POs
- Add Aged Receivables, Aged Payables, Account Ledger to sidebar
- 19 new tests across Finance ReportTest and Inventory
  PurchaseOrderReceiveTest; all 206 tests passing

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Quote and QuoteItem models with HasLineItemTotals + HasStatusTransitions
- QuotePolicy registered in FinanceServiceProvider
- Migrations for quotes and quote_items tables
- Lifecycle: draft → sent → accepted/declined/cancelled

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements the full Quotes module including migrations, models, policy,
form request, resource, controller, routes, TypeScript types, React pages
(Index/Create/Show), QuoteStatusBadge component, Sidebar link, and 16
feature tests. All 222 tests pass.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
@meta-cla
Copy link
Copy Markdown

meta-cla Bot commented May 31, 2026

Hi @sufianbd!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

claude added 16 commits May 31, 2026 05:41
…, migrations)

- CreditNote + CreditNoteItem models with HasLineItemTotals + HasStatusTransitions
- CreditNotePolicy, StoreCreditNoteRequest, CreditNoteResource, CreditNoteController
- Migrations for credit_notes and credit_note_items tables
- Lifecycle: draft → issued → applied/cancelled; optional link to source invoice

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Wire up Credit Notes (routes, policy registration, frontend pages,
status badge, types, sidebar) and add the Customer Statement report
(ReportController methods, page, routes, sidebar). Adds 18 tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Add recurring-invoice templates that auto-generate Invoices on a
weekly/monthly/quarterly/yearly schedule. Includes models, policy,
request, resource, controller, console command + daily schedule,
Inertia pages, status badge, sidebar entry, and feature tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Adds a VAT Return report that summarises output tax (collected on sales
invoices) and input tax (paid on purchase bills) for a date range,
computing the net VAT payable/reclaimable figure.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Adds full user management for admin/super-admin users: view tenant users, invite new users with role assignment, change roles, toggle active/inactive status, and remove users. Includes migration for is_active column, UserManagementController, settings routes, React frontend page, Sidebar Settings > Users link, and 12 feature tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
claude added 30 commits June 5, 2026 19:09
Implements VendorBill and VendorBillItem models, migration, policy,
controller, routes, frontend stubs, TypeScript types, sidebar link,
and 10 Pest feature tests (1049 → 1059 passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Add migrations to extend credit_notes with credit_note_number,
  customer_id, currency, subtotal, tax, total, reason, created_by
  and add tenant_id to credit_note_items
- Enhance CreditNote model with generateCreditNoteNumber(),
  recalculateTotals(), issue(), apply(), void(), is_available and
  is_open accessors; maintain backwards compat with legacy fields
- Update CreditNoteItem model with tenant_id, line_total accessor,
  and float casts for quantity/unit_price
- Extend CreditNoteController with Phase 103 store path (auto
  credit_note_number, recalculate totals) and new apply() action
- Add finance.credit-notes.apply route before resource declaration
- Append CreditNoteV2 and CreditNoteItemV2 TypeScript interfaces
- Add 10 Phase 103 tests (makeCreditNote/makeCNItem helpers) covering
  auth, CRUD, status transitions (issue/apply/void), and soft-delete
- All 1069 tests pass (1059 prior + 10 new)

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements Payment Terms CRUD with model, policy, controller, routes,
frontend pages (Index/Show), TypeScript types, sidebar entry, and 10
Pest tests (1080 → 1090 passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements full skill tracking with SkillDefinition and EmployeeSkill
models, controllers, policies, migrations, Inertia pages, and 10 Pest
tests (1090 → 1100 passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements full HR Announcements module with migration, model (publish/archive/is_active), policy (hr.view/create/delete), controller (index/store/show/publish/archive/destroy), routes, HRServiceProvider registration, React pages (Index/Show), TypeScript types, sidebar link, and 10 Pest tests (all passing, total 1110).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements full CRUD for UnitOfMeasure with conversion support:
- Migration adding type, is_base, conversion_factor, is_active columns
- Updated model with casts, convertTo() method, display_name accessor
- UnitOfMeasurePolicy (inventory.view/create/delete permissions)
- UnitOfMeasureController (index/store/show/update/destroy)
- Routes via resource route under inventory. prefix
- InventoryServiceProvider policy registration
- Frontend: Index + Show pages, extended TypeScript interface, Sidebar link
- 10 Pest tests covering auth, CRUD, conversion logic, accessor (1110 → 1120)

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements the full offboarding lifecycle tracking module including
migration, model with status helpers, CRUD controller, RBAC policy,
routes, React pages, TypeScript types, sidebar link, and 10 Pest tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements full Petty Cash Management feature including migrations for
petty_cash_funds and petty_cash_transactions tables, models with
replenish/addExpense methods and is_low_balance/utilization_percent
accessors, CRUD controller, RBAC policy, routes, React pages, TypeScript
types, and 10 Pest tests (1130 → 1140 passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements scheduled physical stock counts to reconcile system vs.
actual quantities, including migrations, CycleCount/CycleCountItem
models, policy, controller, routes, frontend pages, TypeScript types,
sidebar link, and 10 Pest feature tests (1150 total, all passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements audit trail of promotions, transfers, salary changes with
full CRUD, approve action, policy, migration, 10 Pest tests (all pass,
total 1160), TypeScript types, and sidebar link.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implement flexible product labeling via ProductTag model, pivot table
assignments, CRUD controller, policy (inventory.view/create/delete),
attach/detach assignment controller, routes, frontend Index stub, and
10 Pest feature tests (1160 → 1170 passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements Bank Transfers feature for moving funds between bank accounts
with full status lifecycle (pending → completed/failed/cancelled), RBAC
policy, paginated index with status filtering, and 10 Pest feature tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements structured compensation framework with grade levels and salary
ranges: migration, SalaryGrade model (isSalaryInRange, salary_range,
midpoint accessors), salary_grade_id on employees, SalaryGradePolicy,
SalaryGradeController (index/store/show/update/destroy), routes, frontend
Index/Show stubs, TypeScript type, Sidebar link, and 10 Pest feature tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements B2B customer categorization with shared pricing rules:
migrations (customer_groups, customer_group_members), CustomerGroup
model with discount calculation, CRUD controller, policy (RBAC),
routes, Inertia pages, TypeScript type, sidebar link, and 10 Pest tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements advance payment recording and tracking before invoices are issued,
including migration, model with applyAmount/refund methods, CRUD controller,
policy, routes, React pages, TypeScript types, sidebar link, and 10 Pest tests.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Implements product substitute/alternative linking for out-of-stock scenarios,
including migration, model, policy, controller, routes, frontend stub, TS types,
and 10 Pest tests (1220 total passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Add full job offer letter lifecycle: draft → sent → accepted/declined,
with expiry detection, soft-delete, and policy-gated CRUD + action routes.

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Adds budget_number, department, budget_type, total_amount, allocated_amount,
spent_amount, approved_by, approved_at, start_date, end_date columns to the
budgets table; introduces budget_line_items table for Phase 128 line item
tracking; adds BudgetLineItem model; extends Budget model with activate(),
close(), generateBudgetNumber(), recalculate() methods and remaining_amount,
utilization_percent, is_active, is_exceeded accessors; updates BudgetController
with edit/update routes and corrected activate(userId) call; updates
BudgetPolicy with activate/close methods; adds Edit.tsx React stub; replaces
BudgetTest with Phase 128 feature tests (10 tests, all passing).

https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants