Skip to content

Claude/erp phase 1 foundations 9mi e5#17261

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

Claude/erp phase 1 foundations 9mi e5#17261
sufianbd wants to merge 35 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
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