Claude/erp phase 1 foundations 9mi e5#17261
Conversation
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
|
Hi @sufianbd! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
…, 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
Forgot to stage tests/Feature/QualityControl/ in Phase 5 commit. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
…k modules Completes Phase 6 with 4 new ERP modules matching Odoo 19 feature parity: - Repairs: repair orders + lines, lifecycle (draft→confirmed→in_progress→done/cancelled), parts/labor tracking, 12 tests - Live Chat: channels, visitor sessions, messages, public widget API, agent assignment, 10 tests - Social Marketing: social accounts (multi-platform), post scheduling, metrics tracking, 10 tests - Frontdesk: stations, visitor check-in/check-out, pre-registration, badge generation, 10 tests All 2237 tests pass (6803 assertions). Co-Authored-By: Claude <noreply@anthropic.com>
…ules Completes Phase 7 with 4 new ERP modules achieving full Odoo 19 feature parity: - Lunch: supplier catalog, daily lunch ordering, confirm/deliver/cancel workflow, 10 tests - Appointments: appointment types, slots with capacity management, booking lifecycle, 10 tests - Website/CMS: web pages, blog posts with tags/views, nav menu builder, 10 tests - Purchase: RFQ->PO workflow, vendor management, line items, receive orders, 12 tests All 2279 tests pass (7012 assertions). Co-Authored-By: Claude <noreply@anthropic.com>
QualityControlServiceProvider was missing — created provider and wired it up so the module's routes are loaded on boot. All 35 modules now fully registered. 2279 tests pass. Co-Authored-By: Claude <noreply@anthropic.com>
Five Purchase migrations were untracked after Phase 7 commit: po_vendors, po_rfqs, po_rfq_lines, pos, po_lines tables. Co-Authored-By: Claude <noreply@anthropic.com>
Closes all gaps found between controller Inertia::render() calls and their corresponding page components: Finance (8): Currencies/Create, Currencies/Edit, Reports/AgedPayablesSummary, AgedReceivablesSummary, ExpenseSummary, InvoiceSummary, ProfitLossSummary, VendorBills/Create HR (1): Employees/Onboardings/Create Inventory (3): CycleCounts/Create, WarehouseStock/Show, Warranties/Edit KnowledgeBase (2): Categories, Search Manufacturing (1): WorkCenters/Show PM (1): Tasks/Index Subscriptions (2): Metrics, Plans Frontend coverage: 705 TSX pages. All 2279 tests pass. Co-Authored-By: Claude <noreply@anthropic.com>
Six integration workflows connecting isolated ERP modules: - Purchase PO confirmed → Inventory GoodsReceipt auto-created - CRM Deal won → Finance draft Invoice auto-created - Inventory stock low → Purchase RFQ auto-created (with reorder rule trigger) - HR Payroll approved → Accounting JournalEntry + lines auto-created - Subscription renewed → Finance draft Invoice auto-created - Manufacturing Order completed → Inventory StockMovement (finished goods) created Trigger methods added to models: Po::confirm(), CrmLead::markWon(), StockLevel::checkReorderRules(), PayrollRun::approve(), Subscription::renew(), ManufacturingOrder::complete(). Uses Laravel auto-discovery (withEvents() from ApplicationBuilder) — no duplicate registration via explicit EventServiceProvider. Also makes goods_receipt_items.product_id nullable to support PO lines that don't yet have a matching catalog product. Co-Authored-By: Claude <noreply@anthropic.com>
…tial) Co-Authored-By: Claude <noreply@anthropic.com>
Modules covered: Finance (bills/contacts), Accounting (journal entries/accounts), Purchase (vendors/RFQs/POs with confirm/receive actions), PM (projects/tasks), Subscriptions (plans/subscribe/renew/cancel), Repairs, Maintenance (orders/equipment/plans), Fleet (vehicles/assignments/fuel), Appointments (types/slots/bookings/cancel), Rental, QualityControl, Marketing (campaigns/lists/subscribers), Ecommerce, LiveChat, Lunch (suppliers/products/orders), Planning, Sign, SocialMarketing, KnowledgeBase. Co-Authored-By: Claude <noreply@anthropic.com>
…ontdesk, Website Co-Authored-By: Claude <noreply@anthropic.com>
…test files Co-Authored-By: Claude <noreply@anthropic.com>
Tests cover: Approvals, Discuss, Documents, Ecommerce, Events, FieldService, Frontdesk, Lunch, Planning, Sign, SocialMarketing, Subcontracting, Survey, Website. Each test file has authenticated (200) and unauthenticated (401) checks. Co-Authored-By: Claude <noreply@anthropic.com>
…d TenantFactory - Wire all 28 new module route groups into routes/api.php (auth:sanctum protected) - Fix FinanceApiController: use issue_date (not bill_date) to match bills schema - Fix PmApiController: status enum matches DB (draft/active/on_hold/completed/cancelled) - Create TenantFactory for 13 test files that use Tenant::factory()->create() - Fix test data: add required fields (po_number, slug, reference, unit_price) - Fix test data: use valid enum values (survey draft, project draft) - All 101 API tests now pass Co-Authored-By: Claude <noreply@anthropic.com>
- Add 31 new seeders covering every module (Accounting, Appointments, Approvals, CRM, Discuss, Documents, Ecommerce, Events, FieldService, Fleet, Frontdesk, Helpdesk, KnowledgeBase, LiveChat, Lunch, Maintenance, Manufacturing, Marketing, PM, POS, Planning, Purchase, QualityControl, Rental, Repairs, Sign, SocialMarketing, Subcontracting, Subscriptions, Survey, Website) - Wire all seeders into DatabaseSeeder.php in dependency order - Fix InventorySeeder: switch Category → ProductCategory to match the products.category_id FK that was migrated to product_categories - php artisan migrate:fresh --seed runs cleanly end-to-end Co-Authored-By: Claude <noreply@anthropic.com>
Backend:
- Install laravel/reverb; configure broadcasting.php and channels.php
- NewChatMessage event — broadcasts on private chat-session.{id}
- NewDiscussMessage event — broadcasts on private discuss-channel.{id}
- ErpNotification event — broadcasts on private tenant.{tenantId}
- LiveChatController::sendMessage() dispatches NewChatMessage
- DiscussController::sendMessage() dispatches NewDiscussMessage
- Channel auth in routes/channels.php (session, discuss, tenant scopes)
Frontend:
- Install laravel-echo + pusher-js; wire Echo into bootstrap.ts
- useEchoPrivateChannel() hook for declarative channel subscriptions
- LiveChat/Sessions/Show.tsx: real-time message streaming + auto-scroll
- Discuss/Show.tsx: receive other-user messages via Echo (dedup by id)
- global.d.ts: declare Window.Echo and Window.Pusher types
Tests (5/5 passing):
- Event payload and channel assertions for all 3 broadcast events
- Controller-level dispatch assertions using Event::fake()
Co-Authored-By: Claude <noreply@anthropic.com>
- Register routes/channels.php in bootstrap/app.php so channel authorization runs on broadcast auth requests - Add config/reverb.php (published by reverb:install) - Update root package.json/package-lock.json with laravel-echo + pusher-js Co-Authored-By: Claude <noreply@anthropic.com>
…gress) Phase 12 - Queue & Background Jobs: - SendInvoiceNotificationJob, ProcessLowStockAlertJob, GeneratePayslipJob, ProcessBulkImportJob - Dispatch jobs from low-stock and payroll listeners - InvoiceApiController dispatches SendInvoiceNotificationJob on store Phase 13 - Email Notifications: - InvoiceCreatedMail, LowStockAlertMail, PayrollApprovedMail, ApprovalRequestMail Mailables - Blade email templates for all 4 notification types - Listeners dispatch queued mail alongside existing side-effects Phase 14 - PDF Generation (views only, controller pending): - resources/views/pdfs/invoice.blade.php - resources/views/pdfs/purchase-order.blade.php - resources/views/pdfs/payslip.blade.php Co-Authored-By: Claude <noreply@anthropic.com>
…ress) - Phase 12: QueueJobsTest (4 tests) — invoice, low-stock, payroll, bulk-import - Phase 13: MailNotificationsTest (6 tests) — render + dispatch assertions - Phase 14: purchase-order PDF view added - Phase 15: ProductsExport, ContactsExport (partial) - Phase 16: DashboardController module_stats + activity_feed; Dashboard.tsx module overview cards and recent activity feed Co-Authored-By: Claude <noreply@anthropic.com>
Phase 14: PdfController — invoice, purchase-order, payslip PDF download endpoints; payslip.blade.php PDF view Phase 15: ImportExportController — export products/contacts/invoices as xlsx; import products/contacts from CSV; ProductsImport, ContactsImport Phase 16: DashboardAnalyticsTest (9 tests) — module_stats, activity_feed, cross-tenant scoping assertions; PDF and import/export routes wired Co-Authored-By: Claude <noreply@anthropic.com>
…olation Phase 12 - Queue Jobs (4 tests pass): SendInvoiceNotificationJob, ProcessLowStockAlertJob, GeneratePayslipJob, ProcessBulkImportJob Phase 13 - Email Notifications (6 tests pass): InvoiceCreatedMail, LowStockAlertMail, PayrollApprovedMail, ApprovalRequestMail + Blade email templates Phase 14 - PDF Generation (6 tests pass): PdfController (invoice/PO/payslip download), DomPDF Blade views, cross-tenant 404 guard, PDF routes in api.php Phase 15 - Import/Export (4 tests pass): ProductsExport/ContactsExport/InvoicesExport via maatwebsite/excel, ProductsImport/ContactsImport, ImportExportController, import/export routes in api.php Phase 16 - Dashboard Analytics (9 tests pass): DashboardController module_stats (8 counts) + activity_feed (10 items), Dashboard.tsx Module Overview cards + Recent Activity feed Phase 17 - Tenant Isolation (22 tests pass): Cross-tenant isolation verified for Finance, Purchase, Inventory, CRM, HR, PM, Accounting, Maintenance, Manufacturing, Subscriptions Co-Authored-By: Claude <noreply@anthropic.com>
Required for Phase 15 import/export functionality. Co-Authored-By: Claude <noreply@anthropic.com>
Stray PHP vendor dir created by a composer require run outside erp/. The Laravel app lives in erp/ — its own vendor/ is already gitignored. Co-Authored-By: Claude <noreply@anthropic.com>
…migration (partial) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
…(in-progress) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RdUGwo74JXChRCF88Yu27d
- Add .github/workflows/erp-ci.yml: PHP/Pest tests, TS type check, ESLint - Add ReportsController with financial/inventory/HR report endpoints - Add reports routes under /api/v1/reports/ - Add ReportsApiTest covering all 3 report endpoints - Add CLAUDE.md with full project documentation Co-Authored-By: Claude <noreply@anthropic.com>
No description provided.