diff --git a/.gitignore b/.gitignore index ffa71fafc6d..cd90af8d9bc 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ yarn-debug.log* yarn-error.log* /.changelog .npm/ +.claude/ +.env.bak +*.env.bak diff --git a/erp/.editorconfig b/erp/.editorconfig new file mode 100644 index 00000000000..6df84280f0e --- /dev/null +++ b/erp/.editorconfig @@ -0,0 +1,18 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false + +[*.{yml,yaml}] +indent_size = 2 + +[{compose,docker-compose}.{yml,yaml}] +indent_size = 4 diff --git a/erp/.env.example b/erp/.env.example new file mode 100644 index 00000000000..c0660ea143a --- /dev/null +++ b/erp/.env.example @@ -0,0 +1,65 @@ +APP_NAME=Laravel +APP_ENV=local +APP_KEY= +APP_DEBUG=true +APP_URL=http://localhost + +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US + +APP_MAINTENANCE_DRIVER=file +# APP_MAINTENANCE_STORE=database + +# PHP_CLI_SERVER_WORKERS=4 + +BCRYPT_ROUNDS=12 + +LOG_CHANNEL=stack +LOG_STACK=single +LOG_DEPRECATIONS_CHANNEL=null +LOG_LEVEL=debug + +DB_CONNECTION=sqlite +# DB_HOST=127.0.0.1 +# DB_PORT=3306 +# DB_DATABASE=laravel +# DB_USERNAME=root +# DB_PASSWORD= + +SESSION_DRIVER=database +SESSION_LIFETIME=120 +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null + +BROADCAST_CONNECTION=log +FILESYSTEM_DISK=local +QUEUE_CONNECTION=database + +CACHE_STORE=database +# CACHE_PREFIX= + +MEMCACHED_HOST=127.0.0.1 + +REDIS_CLIENT=phpredis +REDIS_HOST=127.0.0.1 +REDIS_PASSWORD=null +REDIS_PORT=6379 + +MAIL_MAILER=log +MAIL_SCHEME=null +MAIL_HOST=127.0.0.1 +MAIL_PORT=2525 +MAIL_USERNAME=null +MAIL_PASSWORD=null +MAIL_FROM_ADDRESS="hello@example.com" +MAIL_FROM_NAME="${APP_NAME}" + +AWS_ACCESS_KEY_ID= +AWS_SECRET_ACCESS_KEY= +AWS_DEFAULT_REGION=us-east-1 +AWS_BUCKET= +AWS_USE_PATH_STYLE_ENDPOINT=false + +VITE_APP_NAME="${APP_NAME}" diff --git a/erp/.gitattributes b/erp/.gitattributes new file mode 100644 index 00000000000..fcb21d396d6 --- /dev/null +++ b/erp/.gitattributes @@ -0,0 +1,11 @@ +* text=auto eol=lf + +*.blade.php diff=html +*.css diff=css +*.html diff=html +*.md diff=markdown +*.php diff=php + +/.github export-ignore +CHANGELOG.md export-ignore +.styleci.yml export-ignore diff --git a/erp/.gitignore b/erp/.gitignore new file mode 100644 index 00000000000..ac7ff5e2801 --- /dev/null +++ b/erp/.gitignore @@ -0,0 +1,28 @@ +*.log +.DS_Store +.env +.env.backup +.env.production +.phpactor.json +.phpunit.result.cache +/.codex +/.cursor/ +/.idea +/.nova +/.phpunit.cache +/.vscode +/.zed +/auth.json +/node_modules +/public/build +/public/fonts-manifest.dev.json +/public/hot +/public/storage +/storage/*.key +/storage/pail +/vendor +_ide_helper.php +Homestead.json +Homestead.yaml +Thumbs.db +erp/.env.bak diff --git a/erp/.npmrc b/erp/.npmrc new file mode 100644 index 00000000000..495a6af9983 --- /dev/null +++ b/erp/.npmrc @@ -0,0 +1,2 @@ +ignore-scripts=true +audit=true diff --git a/erp/README.md b/erp/README.md new file mode 100644 index 00000000000..5ad13779e0d --- /dev/null +++ b/erp/README.md @@ -0,0 +1,58 @@ +

Laravel Logo

+ +

+Build Status +Total Downloads +Latest Stable Version +License +

+ +## About Laravel + +Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as: + +- [Simple, fast routing engine](https://laravel.com/docs/routing). +- [Powerful dependency injection container](https://laravel.com/docs/container). +- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. +- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). +- Database agnostic [schema migrations](https://laravel.com/docs/migrations). +- [Robust background job processing](https://laravel.com/docs/queues). +- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). + +Laravel is accessible, powerful, and provides tools required for large, robust applications. + +## Learning Laravel + +Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework. + +In addition, [Laracasts](https://laracasts.com) contains thousands of video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library. + +You can also watch bite-sized lessons with real-world projects on [Laravel Learn](https://laravel.com/learn), where you will be guided through building a Laravel application from scratch while learning PHP fundamentals. + +## Agentic Development + +Laravel's predictable structure and conventions make it ideal for AI coding agents like Claude Code, Cursor, and GitHub Copilot. Install [Laravel Boost](https://laravel.com/docs/ai) to supercharge your AI workflow: + +```bash +composer require laravel/boost --dev + +php artisan boost:install +``` + +Boost provides your agent 15+ tools and skills that help agents build Laravel applications while following best practices. + +## Contributing + +Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). + +## Code of Conduct + +In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct). + +## Security Vulnerabilities + +If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. + +## License + +The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). diff --git a/erp/app/Http/Controllers/Admin/AuditLogController.php b/erp/app/Http/Controllers/Admin/AuditLogController.php new file mode 100644 index 00000000000..e9ee6928eb0 --- /dev/null +++ b/erp/app/Http/Controllers/Admin/AuditLogController.php @@ -0,0 +1,47 @@ +authorize('viewAny', User::class); + + $logs = AuditLog::with('user') + ->where('tenant_id', auth()->user()->tenant_id) + ->when($request->event, fn ($q) => $q->where('event', $request->event)) + ->when($request->model, fn ($q) => $q->where('auditable_type', 'like', "%{$request->model}%")) + ->latest() + ->paginate(50) + ->withQueryString() + ->through(fn ($log) => [ + 'id' => $log->id, + 'event' => $log->event, + 'model' => class_basename($log->auditable_type), + 'model_id' => $log->auditable_id, + 'user' => $log->user?->name ?? 'System', + 'old_values' => $log->old_values, + 'new_values' => $log->new_values, + 'ip_address' => $log->ip_address, + 'created_at' => $log->created_at->diffForHumans(), + 'created_at_raw' => $log->created_at->toDateTimeString(), + ]); + + return Inertia::render('Admin/AuditLog/Index', [ + 'logs' => $logs, + 'filters' => $request->only(['event', 'model']), + 'breadcrumbs' => [ + ['label' => 'Administration'], + ['label' => 'Audit Log', 'href' => route('admin.audit-log.index')], + ], + ]); + } +} diff --git a/erp/app/Http/Controllers/Admin/UserController.php b/erp/app/Http/Controllers/Admin/UserController.php new file mode 100644 index 00000000000..61972cda6e8 --- /dev/null +++ b/erp/app/Http/Controllers/Admin/UserController.php @@ -0,0 +1,139 @@ +authorize('viewAny', User::class); + + $users = User::with('roles') + ->when($request->search, fn ($q) => $q->where('name', 'like', "%{$request->search}%") + ->orWhere('email', 'like', "%{$request->search}%")) + ->where('tenant_id', auth()->user()->tenant_id) + ->orderBy('name') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Admin/Users/Index', [ + 'users' => $users->through(fn ($u) => [ + 'id' => $u->id, + 'name' => $u->name, + 'email' => $u->email, + 'roles' => $u->roles->pluck('name'), + 'created_at' => $u->created_at?->toDateString(), + ]), + 'filters' => $request->only(['search']), + 'breadcrumbs' => [ + ['label' => 'Administration'], + ['label' => 'Users', 'href' => route('admin.users.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', User::class); + + return Inertia::render('Admin/Users/Create', [ + 'roles' => Role::orderBy('name')->pluck('name'), + 'breadcrumbs' => [ + ['label' => 'Administration'], + ['label' => 'Users', 'href' => route('admin.users.index')], + ['label' => 'New User'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', User::class); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'email', 'max:255', 'unique:users,email'], + 'password' => ['required', Password::defaults()], + 'role' => ['required', 'string', 'exists:roles,name'], + ]); + + $user = User::create([ + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => Hash::make($data['password']), + 'tenant_id' => auth()->user()->tenant_id, + ]); + + $user->assignRole($data['role']); + + return redirect()->route('admin.users.index') + ->with('success', 'User created.'); + } + + public function edit(User $user): Response + { + $this->authorize('update', $user); + + return Inertia::render('Admin/Users/Edit', [ + 'user' => [ + 'id' => $user->id, + 'name' => $user->name, + 'email' => $user->email, + 'role' => $user->roles->first()?->name, + ], + 'roles' => Role::orderBy('name')->pluck('name'), + 'breadcrumbs' => [ + ['label' => 'Administration'], + ['label' => 'Users', 'href' => route('admin.users.index')], + ['label' => $user->name . ' — Edit'], + ], + ]); + } + + public function update(Request $request, User $user): RedirectResponse + { + $this->authorize('update', $user); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'email' => ['required', 'email', 'max:255', "unique:users,email,{$user->id}"], + 'password' => ['nullable', Password::defaults()], + 'role' => ['required', 'string', 'exists:roles,name'], + ]); + + $user->update([ + 'name' => $data['name'], + 'email' => $data['email'], + ...(($data['password'] ?? null) ? ['password' => Hash::make($data['password'])] : []), + ]); + + $user->syncRoles([$data['role']]); + + return redirect()->route('admin.users.index') + ->with('success', 'User updated.'); + } + + public function destroy(User $user): RedirectResponse + { + $this->authorize('delete', $user); + + if ($user->id === auth()->id()) { + return back()->withErrors(['user' => 'You cannot delete your own account.']); + } + + $user->delete(); + + return redirect()->route('admin.users.index') + ->with('success', 'User deleted.'); + } +} diff --git a/erp/app/Http/Controllers/AnalyticsController.php b/erp/app/Http/Controllers/AnalyticsController.php new file mode 100644 index 00000000000..8fc987896ff --- /dev/null +++ b/erp/app/Http/Controllers/AnalyticsController.php @@ -0,0 +1,103 @@ +user(); + + return Inertia::render('Analytics/Index', [ + 'revenue_by_month' => $user->can('finance.view') ? $this->revenueByMonth() : [], + 'invoice_by_status' => $user->can('finance.view') ? $this->invoiceByStatus() : [], + 'headcount_by_dept' => $user->can('hr.view') ? $this->headcountByDept() : [], + 'payroll_summary' => $user->can('hr.view') ? $this->payrollSummary() : [], + 'inventory_value' => $user->can('inventory.view') ? $this->inventoryValue() : null, + 'breadcrumbs' => [['label' => 'Analytics', 'href' => route('analytics')]], + ]); + } + + private function revenueByMonth(): array + { + $paid = Invoice::where('status', 'paid') + ->where('updated_at', '>=', now()->subMonths(12)->startOfMonth()) + ->with('items') + ->get(); + + return collect(range(11, 0))->map(function ($i) use ($paid) { + $month = now()->subMonths($i)->startOfMonth(); + $monthKey = $month->format('Y-m'); + + $total = $paid + ->filter(fn ($inv) => $inv->updated_at->format('Y-m') === $monthKey) + ->sum(fn ($inv) => $inv->total); + + return ['label' => $month->format('M y'), 'value' => round((float) $total, 2)]; + })->values()->all(); + } + + private function invoiceByStatus(): array + { + $counts = Invoice::selectRaw('status, count(*) as total') + ->groupBy('status') + ->pluck('total', 'status'); + + return collect(['draft', 'sent', 'paid', 'cancelled'])->map(fn ($s) => [ + 'label' => ucfirst($s), + 'value' => (int) ($counts[$s] ?? 0), + ])->all(); + } + + private function headcountByDept(): array + { + return Department::withCount(['employees' => fn ($q) => $q->where('status', 'active')]) + ->get() + ->map(fn ($d) => ['label' => $d->name, 'value' => $d->employees_count]) + ->sortByDesc('value') + ->values() + ->all(); + } + + private function payrollSummary(): array + { + return PayrollRun::with('items') + ->latest('period_start') + ->limit(6) + ->get() + ->map(fn ($run) => [ + 'label' => $run->period_start->format('M Y'), + 'value' => round($run->total_net, 2), + ]) + ->sortBy(fn ($r) => $r['label']) + ->values() + ->all(); + } + + private function inventoryValue(): array + { + $total = StockLevel::join('products', 'products.id', '=', 'stock_levels.product_id') + ->selectRaw('SUM(stock_levels.quantity * products.cost_price) as total_value, COUNT(DISTINCT products.id) as product_count') + ->first(); + + $lowStock = StockLevel::join('products', 'products.id', '=', 'stock_levels.product_id') + ->whereColumn('stock_levels.quantity', '<=', 'products.reorder_point') + ->distinct('products.id') + ->count('products.id'); + + return [ + 'total_value' => round((float) ($total->total_value ?? 0), 2), + 'product_count' => (int) ($total->product_count ?? 0), + 'low_stock' => $lowStock, + ]; + } +} diff --git a/erp/app/Http/Controllers/AuditLogController.php b/erp/app/Http/Controllers/AuditLogController.php new file mode 100644 index 00000000000..16eaeb2f6bc --- /dev/null +++ b/erp/app/Http/Controllers/AuditLogController.php @@ -0,0 +1,50 @@ +user()->hasAnyRole(['super-admin', 'admin'])) { + abort(403); + } + + $tenantId = $request->user()->tenant_id; + + $query = AuditLog::where('tenant_id', $tenantId) + ->with('user') + ->orderByDesc('created_at'); + + // Optional filters + if ($event = $request->query('event')) { + $query->where('event', $event); + } + if ($model = $request->query('model')) { + $query->where('auditable_type', 'like', "%{$model}%"); + } + + $logs = $query->paginate(50)->withQueryString()->through(fn ($log) => [ + 'id' => $log->id, + 'event' => $log->event, + 'model_name' => class_basename($log->auditable_type), + 'auditable_id' => $log->auditable_id, + 'user_name' => $log->user?->name ?? 'System', + 'old_values' => $log->old_values, + 'new_values' => $log->new_values, + 'ip_address' => $log->ip_address, + 'created_at' => $log->created_at?->toISOString(), + ]); + + return Inertia::render('Settings/AuditLog', [ + 'logs' => $logs, + 'filter_event' => $request->query('event', ''), + 'filter_model' => $request->query('model', ''), + ]); + } +} diff --git a/erp/app/Http/Controllers/Auth/AuthenticatedSessionController.php b/erp/app/Http/Controllers/Auth/AuthenticatedSessionController.php new file mode 100644 index 00000000000..d44fe974541 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/AuthenticatedSessionController.php @@ -0,0 +1,52 @@ + Route::has('password.request'), + 'status' => session('status'), + ]); + } + + /** + * Handle an incoming authentication request. + */ + public function store(LoginRequest $request): RedirectResponse + { + $request->authenticate(); + + $request->session()->regenerate(); + + return redirect()->intended(route('dashboard', absolute: false)); + } + + /** + * Destroy an authenticated session. + */ + public function destroy(Request $request): RedirectResponse + { + Auth::guard('web')->logout(); + + $request->session()->invalidate(); + + $request->session()->regenerateToken(); + + return redirect('/'); + } +} diff --git a/erp/app/Http/Controllers/Auth/ConfirmablePasswordController.php b/erp/app/Http/Controllers/Auth/ConfirmablePasswordController.php new file mode 100644 index 00000000000..d2b1f14be72 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/ConfirmablePasswordController.php @@ -0,0 +1,41 @@ +validate([ + 'email' => $request->user()->email, + 'password' => $request->password, + ])) { + throw ValidationException::withMessages([ + 'password' => __('auth.password'), + ]); + } + + $request->session()->put('auth.password_confirmed_at', time()); + + return redirect()->intended(route('dashboard', absolute: false)); + } +} diff --git a/erp/app/Http/Controllers/Auth/EmailVerificationNotificationController.php b/erp/app/Http/Controllers/Auth/EmailVerificationNotificationController.php new file mode 100644 index 00000000000..f64fa9ba798 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/EmailVerificationNotificationController.php @@ -0,0 +1,24 @@ +user()->hasVerifiedEmail()) { + return redirect()->intended(route('dashboard', absolute: false)); + } + + $request->user()->sendEmailVerificationNotification(); + + return back()->with('status', 'verification-link-sent'); + } +} diff --git a/erp/app/Http/Controllers/Auth/EmailVerificationPromptController.php b/erp/app/Http/Controllers/Auth/EmailVerificationPromptController.php new file mode 100644 index 00000000000..b42e0d53462 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/EmailVerificationPromptController.php @@ -0,0 +1,22 @@ +user()->hasVerifiedEmail() + ? redirect()->intended(route('dashboard', absolute: false)) + : Inertia::render('Auth/VerifyEmail', ['status' => session('status')]); + } +} diff --git a/erp/app/Http/Controllers/Auth/NewPasswordController.php b/erp/app/Http/Controllers/Auth/NewPasswordController.php new file mode 100644 index 00000000000..740cc5163f1 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/NewPasswordController.php @@ -0,0 +1,69 @@ + $request->email, + 'token' => $request->route('token'), + ]); + } + + /** + * Handle an incoming new password request. + * + * @throws ValidationException + */ + public function store(Request $request): RedirectResponse + { + $request->validate([ + 'token' => 'required', + 'email' => 'required|email', + 'password' => ['required', 'confirmed', Rules\Password::defaults()], + ]); + + // Here we will attempt to reset the user's password. If it is successful we + // will update the password on an actual user model and persist it to the + // database. Otherwise we will parse the error and return the response. + $status = Password::reset( + $request->only('email', 'password', 'password_confirmation', 'token'), + function ($user) use ($request) { + $user->forceFill([ + 'password' => Hash::make($request->password), + 'remember_token' => Str::random(60), + ])->save(); + + event(new PasswordReset($user)); + } + ); + + // If the password was successfully reset, we will redirect the user back to + // the application's home authenticated view. If there is an error we can + // redirect them back to where they came from with their error message. + if ($status == Password::PASSWORD_RESET) { + return redirect()->route('login')->with('status', __($status)); + } + + throw ValidationException::withMessages([ + 'email' => [trans($status)], + ]); + } +} diff --git a/erp/app/Http/Controllers/Auth/PasswordController.php b/erp/app/Http/Controllers/Auth/PasswordController.php new file mode 100644 index 00000000000..57a82b58e0c --- /dev/null +++ b/erp/app/Http/Controllers/Auth/PasswordController.php @@ -0,0 +1,29 @@ +validate([ + 'current_password' => ['required', 'current_password'], + 'password' => ['required', Password::defaults(), 'confirmed'], + ]); + + $request->user()->update([ + 'password' => Hash::make($validated['password']), + ]); + + return back(); + } +} diff --git a/erp/app/Http/Controllers/Auth/PasswordResetLinkController.php b/erp/app/Http/Controllers/Auth/PasswordResetLinkController.php new file mode 100644 index 00000000000..c8b2b6f01b2 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/PasswordResetLinkController.php @@ -0,0 +1,51 @@ + session('status'), + ]); + } + + /** + * Handle an incoming password reset link request. + * + * @throws ValidationException + */ + public function store(Request $request): RedirectResponse + { + $request->validate([ + 'email' => 'required|email', + ]); + + // We will send the password reset link to this user. Once we have attempted + // to send the link, we will examine the response then see the message we + // need to show to the user. Finally, we'll send out a proper response. + $status = Password::sendResetLink( + $request->only('email') + ); + + if ($status == Password::RESET_LINK_SENT) { + return back()->with('status', __($status)); + } + + throw ValidationException::withMessages([ + 'email' => [trans($status)], + ]); + } +} diff --git a/erp/app/Http/Controllers/Auth/RegisteredUserController.php b/erp/app/Http/Controllers/Auth/RegisteredUserController.php new file mode 100644 index 00000000000..3887f1cf4fb --- /dev/null +++ b/erp/app/Http/Controllers/Auth/RegisteredUserController.php @@ -0,0 +1,52 @@ +validate([ + 'name' => 'required|string|max:255', + 'email' => 'required|string|lowercase|email|max:255|unique:'.User::class, + 'password' => ['required', 'confirmed', Rules\Password::defaults()], + ]); + + $user = User::create([ + 'name' => $request->name, + 'email' => $request->email, + 'password' => Hash::make($request->password), + ]); + + event(new Registered($user)); + + Auth::login($user); + + return redirect(route('dashboard', absolute: false)); + } +} diff --git a/erp/app/Http/Controllers/Auth/VerifyEmailController.php b/erp/app/Http/Controllers/Auth/VerifyEmailController.php new file mode 100644 index 00000000000..784765e3a59 --- /dev/null +++ b/erp/app/Http/Controllers/Auth/VerifyEmailController.php @@ -0,0 +1,27 @@ +user()->hasVerifiedEmail()) { + return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); + } + + if ($request->user()->markEmailAsVerified()) { + event(new Verified($request->user())); + } + + return redirect()->intended(route('dashboard', absolute: false).'?verified=1'); + } +} diff --git a/erp/app/Http/Controllers/CompanySettingsController.php b/erp/app/Http/Controllers/CompanySettingsController.php new file mode 100644 index 00000000000..7fbcf5d9926 --- /dev/null +++ b/erp/app/Http/Controllers/CompanySettingsController.php @@ -0,0 +1,88 @@ +user()->hasAnyRole(['super-admin', 'admin'])) { + abort(403); + } + } + + public function show(Request $request) + { + $this->authorizeAdmin($request); + + $tenant = Tenant::findOrFail($request->user()->tenant_id); + + $timezones = \DateTimeZone::listIdentifiers(); + $currencies = ['USD', 'EUR', 'GBP', 'JPY', 'CAD', 'AUD', 'CHF', 'CNY', 'INR', 'SGD', + 'AED', 'SAR', 'BRL', 'MXN', 'ZAR', 'NOK', 'SEK', 'DKK', 'NZD', 'HKD']; + $dateFormats = [ + 'Y-m-d' => now()->format('Y-m-d') . ' (YYYY-MM-DD)', + 'd/m/Y' => now()->format('d/m/Y') . ' (DD/MM/YYYY)', + 'm/d/Y' => now()->format('m/d/Y') . ' (MM/DD/YYYY)', + 'd-m-Y' => now()->format('d-m-Y') . ' (DD-MM-YYYY)', + 'd M Y' => now()->format('d M Y') . ' (DD Mon YYYY)', + ]; + + return Inertia::render('Settings/Company', [ + 'tenant' => $tenant->only([ + 'id', 'name', 'slug', 'email', 'phone', 'address', 'city', + 'country', 'currency_code', 'timezone', 'date_format', 'logo_path', + ]), + 'timezones' => $timezones, + 'currencies' => $currencies, + 'dateFormats' => $dateFormats, + ]); + } + + public function update(Request $request) + { + $this->authorizeAdmin($request); + + $tenant = Tenant::findOrFail($request->user()->tenant_id); + + $data = $request->validate([ + 'name' => 'required|string|max:191', + 'email' => 'nullable|email|max:191', + 'phone' => 'nullable|string|max:50', + 'address' => 'nullable|string|max:500', + 'city' => 'nullable|string|max:100', + 'country' => 'nullable|string|max:100', + 'currency_code' => 'required|string|size:3', + 'timezone' => 'required|string|timezone', + 'date_format' => 'required|string|in:Y-m-d,d/m/Y,m/d/Y,d-m-Y,d M Y', + ]); + + $tenant->update($data); + + return back()->with('success', 'Company settings saved.'); + } + + public function uploadLogo(Request $request) + { + $this->authorizeAdmin($request); + + $request->validate(['logo' => 'required|image|mimes:png,jpg,jpeg,gif,svg|max:1024']); + + $tenant = Tenant::findOrFail($request->user()->tenant_id); + + // Delete old logo if exists + if ($tenant->logo_path && Storage::disk('public')->exists($tenant->logo_path)) { + Storage::disk('public')->delete($tenant->logo_path); + } + + $path = $request->file('logo')->store('logos', 'public'); + $tenant->update(['logo_path' => $path]); + + return back()->with('success', 'Logo uploaded.'); + } +} diff --git a/erp/app/Http/Controllers/Controller.php b/erp/app/Http/Controllers/Controller.php new file mode 100644 index 00000000000..e7f7c94bba8 --- /dev/null +++ b/erp/app/Http/Controllers/Controller.php @@ -0,0 +1,10 @@ +user()->tenant_id; + + // KPI: revenue this month (invoices issued this month, not cancelled) + $revenueThisMonth = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereYear('issue_date', now()->year) + ->whereMonth('issue_date', now()->month) + ->get() + ->sum(fn ($inv) => $inv->load('items')->total); + + // KPI: expenses this month (bills issued this month, not cancelled) + $expensesThisMonth = Bill::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereYear('issue_date', now()->year) + ->whereMonth('issue_date', now()->month) + ->get() + ->sum(fn ($b) => $b->load('items')->total); + + // KPI: outstanding AR (amount due on unpaid invoices) + $outstandingAr = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['paid', 'cancelled']) + ->with(['items', 'payments']) + ->get() + ->sum(fn ($inv) => $inv->amount_due); + + // KPI: outstanding AP (amount due on unpaid bills) + $outstandingAp = Bill::where('tenant_id', $tenantId) + ->whereNotIn('status', ['paid', 'cancelled']) + ->with(['items', 'payments']) + ->get() + ->sum(fn ($b) => $b->amount_due); + + // Monthly revenue vs expenses — last 12 months + $months = collect(); + for ($i = 11; $i >= 0; $i--) { + $date = now()->subMonths($i); + $label = $date->format('M y'); + $year = (int) $date->format('Y'); + $month = (int) $date->format('n'); + + $rev = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereYear('issue_date', $year) + ->whereMonth('issue_date', $month) + ->with('items') + ->get() + ->sum(fn ($inv) => $inv->total); + + $exp = Bill::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereYear('issue_date', $year) + ->whereMonth('issue_date', $month) + ->with('items') + ->get() + ->sum(fn ($b) => $b->total); + + $months->push(['month' => $label, 'revenue' => round($rev, 2), 'expenses' => round($exp, 2)]); + } + + // Recent invoices (last 5) + $recentInvoices = Invoice::where('tenant_id', $tenantId) + ->with(['contact', 'items', 'payments']) + ->latest() + ->take(5) + ->get() + ->map(fn ($inv) => [ + 'id' => $inv->id, + 'number' => $inv->number, + 'contact' => $inv->contact?->name, + 'total' => round($inv->total, 2), + 'amount_due'=> round($inv->amount_due, 2), + 'status' => $inv->status, + 'issue_date'=> $inv->issue_date, + ]); + + // Low stock: products where total stock across all warehouses < 10 + $lowStock = Product::where('tenant_id', $tenantId) + ->with(['stockLevels']) + ->get() + ->filter(function ($product) { + $total = $product->stockLevels->sum('quantity'); + return $total < 10; + }) + ->take(10) + ->map(fn ($p) => [ + 'id' => $p->id, + 'sku' => $p->sku, + 'name' => $p->name, + 'quantity' => round($p->stockLevels->sum('quantity'), 2), + ]) + ->values(); + + // Overdue invoices count + $overdueCount = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['paid', 'cancelled']) + ->whereNotNull('due_date') + ->where('due_date', '<', now()->startOfDay()) + ->count(); + + return Inertia::render('Dashboard', [ + 'breadcrumbs' => [ + ['label' => 'Dashboard', 'href' => route('dashboard')], + ], + 'kpis' => [ + 'revenue_this_month' => round($revenueThisMonth, 2), + 'expenses_this_month' => round($expensesThisMonth, 2), + 'outstanding_ar' => round($outstandingAr, 2), + 'outstanding_ap' => round($outstandingAp, 2), + 'overdue_count' => $overdueCount, + ], + 'monthly_chart' => $months->values(), + 'recent_invoices'=> $recentInvoices->values(), + 'low_stock' => $lowStock, + ]); + } +} diff --git a/erp/app/Http/Controllers/ExportController.php b/erp/app/Http/Controllers/ExportController.php new file mode 100644 index 00000000000..df48177b3db --- /dev/null +++ b/erp/app/Http/Controllers/ExportController.php @@ -0,0 +1,94 @@ +streamDownload(function () { + $out = fopen('php://output', 'w'); + fputcsv($out, ['SKU', 'Name', 'Category', 'Cost Price', 'Selling Price', 'Reorder Point', 'Active']); + + Product::with('category')->chunk(200, function ($products) use ($out) { + foreach ($products as $p) { + fputcsv($out, [ + $p->sku ?? '', + $p->name, + $p->category?->name ?? '', + $p->cost_price, + $p->sale_price, + $p->reorder_point, + $p->is_active ? 'Yes' : 'No', + ]); + } + }); + + fclose($out); + }, 'products-' . now()->format('Y-m-d') . '.csv', ['Content-Type' => 'text/csv']); + } + + public function invoices(): StreamedResponse + { + Gate::authorize('viewAny', Invoice::class); + + return response()->streamDownload(function () { + $out = fopen('php://output', 'w'); + fputcsv($out, ['Number', 'Contact', 'Status', 'Issue Date', 'Due Date', 'Total', 'Amount Due']); + + Invoice::with(['contact', 'items', 'payments'])->chunk(200, function ($invoices) use ($out) { + foreach ($invoices as $inv) { + fputcsv($out, [ + $inv->number ?? '', + $inv->contact?->name ?? '', + $inv->status, + $inv->issue_date?->toDateString() ?? '', + $inv->due_date?->toDateString() ?? '', + $inv->total, + $inv->amount_due, + ]); + } + }); + + fclose($out); + }, 'invoices-' . now()->format('Y-m-d') . '.csv', ['Content-Type' => 'text/csv']); + } + + public function employees(): StreamedResponse + { + // Export requires create permission (manager+) to protect sensitive salary data + Gate::authorize('create', Employee::class); + + return response()->streamDownload(function () { + $out = fopen('php://output', 'w'); + fputcsv($out, ['Employee #', 'First Name', 'Last Name', 'Email', 'Position', 'Department', 'Type', 'Status', 'Start Date', 'Salary']); + + Employee::with('department')->chunk(200, function ($employees) use ($out) { + foreach ($employees as $emp) { + fputcsv($out, [ + $emp->employee_number ?? '', + $emp->first_name, + $emp->last_name, + $emp->email ?? '', + $emp->position ?? '', + $emp->department?->name ?? '', + $emp->employment_type, + $emp->status, + $emp->start_date?->toDateString() ?? '', + $emp->salary_amount, + ]); + } + }); + + fclose($out); + }, 'employees-' . now()->format('Y-m-d') . '.csv', ['Content-Type' => 'text/csv']); + } +} diff --git a/erp/app/Http/Controllers/NotificationController.php b/erp/app/Http/Controllers/NotificationController.php new file mode 100644 index 00000000000..814b4ee336f --- /dev/null +++ b/erp/app/Http/Controllers/NotificationController.php @@ -0,0 +1,54 @@ +user() + ->notifications() + ->latest() + ->paginate(25) + ->through(fn ($n) => [ + 'id' => $n->id, + 'type' => $n->data['type'] ?? 'info', + 'title' => $n->data['title'] ?? '', + 'message' => $n->data['message'] ?? '', + 'link' => $n->data['link'] ?? null, + 'read' => ! is_null($n->read_at), + 'created_at' => $n->created_at->diffForHumans(), + ]); + + return Inertia::render('Notifications/Index', [ + 'notifications' => $notifications, + 'breadcrumbs' => [['label' => 'Notifications']], + ]); + } + + public function markRead(string $id): RedirectResponse + { + auth()->user()->notifications()->findOrFail($id)->markAsRead(); + + return back()->with('success', 'Notification marked as read.'); + } + + public function markAllRead(): RedirectResponse + { + auth()->user()->unreadNotifications->markAsRead(); + + return back()->with('success', 'All notifications marked as read.'); + } + + public function destroy(string $id): RedirectResponse + { + auth()->user()->notifications()->findOrFail($id)->delete(); + + return back()->with('success', 'Notification deleted.'); + } +} diff --git a/erp/app/Http/Controllers/ProfileController.php b/erp/app/Http/Controllers/ProfileController.php new file mode 100644 index 00000000000..873b4f7d7e0 --- /dev/null +++ b/erp/app/Http/Controllers/ProfileController.php @@ -0,0 +1,63 @@ + $request->user() instanceof MustVerifyEmail, + 'status' => session('status'), + ]); + } + + /** + * Update the user's profile information. + */ + public function update(ProfileUpdateRequest $request): RedirectResponse + { + $request->user()->fill($request->validated()); + + if ($request->user()->isDirty('email')) { + $request->user()->email_verified_at = null; + } + + $request->user()->save(); + + return Redirect::route('profile.edit'); + } + + /** + * Delete the user's account. + */ + public function destroy(Request $request): RedirectResponse + { + $request->validate([ + 'password' => ['required', 'current_password'], + ]); + + $user = $request->user(); + + Auth::logout(); + + $user->delete(); + + $request->session()->invalidate(); + $request->session()->regenerateToken(); + + return Redirect::to('/'); + } +} diff --git a/erp/app/Http/Controllers/SearchController.php b/erp/app/Http/Controllers/SearchController.php new file mode 100644 index 00000000000..4838c495724 --- /dev/null +++ b/erp/app/Http/Controllers/SearchController.php @@ -0,0 +1,56 @@ +get('q', '')); + + if (strlen($query) < 2) { + return response()->json(['results' => []]); + } + + $user = auth()->user(); + $results = []; + + if ($user->can('finance.view')) { + foreach (Invoice::where('number', 'like', "%{$query}%")->with('contact')->limit(self::LIMIT)->get() as $inv) { + $results[] = ['type' => 'Invoice', 'label' => $inv->number ?? "Invoice #{$inv->id}", 'sub' => $inv->contact?->name ?? '', 'href' => "/finance/invoices/{$inv->id}"]; + } + + foreach (Contact::search($query)->limit(self::LIMIT)->get() as $c) { + $results[] = ['type' => 'Contact', 'label' => $c->name, 'sub' => $c->email ?? '', 'href' => "/finance/contacts"]; + } + } + + if ($user->can('inventory.view')) { + foreach (Product::search($query)->limit(self::LIMIT)->get() as $p) { + $results[] = ['type' => 'Product', 'label' => $p->name, 'sub' => $p->sku ?? '', 'href' => "/inventory/products/{$p->id}"]; + } + + foreach (PurchaseOrder::with('supplier')->where('id', 'like', "%{$query}%")->orWhereHas('supplier', fn ($q) => $q->where('name', 'like', "%{$query}%"))->limit(self::LIMIT)->get() as $po) { + $results[] = ['type' => 'Purchase Order', 'label' => "PO #{$po->id}", 'sub' => $po->supplier?->name ?? '', 'href' => "/inventory/purchase-orders/{$po->id}"]; + } + } + + if ($user->can('hr.view')) { + foreach (Employee::search($query)->limit(self::LIMIT)->get() as $emp) { + $results[] = ['type' => 'Employee', 'label' => $emp->full_name, 'sub' => $emp->position ?? '', 'href' => "/hr/employees/{$emp->id}"]; + } + } + + return response()->json(['results' => $results]); + } +} diff --git a/erp/app/Http/Controllers/SettingController.php b/erp/app/Http/Controllers/SettingController.php new file mode 100644 index 00000000000..4cbcc7d1338 --- /dev/null +++ b/erp/app/Http/Controllers/SettingController.php @@ -0,0 +1,59 @@ + '', + 'currency' => 'USD', + 'timezone' => 'UTC', + 'fiscal_year_start' => '01-01', + ]; + + public function edit(): Response + { + if (! auth()->user()->hasAnyRole(['super-admin', 'admin'])) { + abort(403); + } + + $tenantId = auth()->user()->tenant_id; + $settings = collect(self::KEYS)->mapWithKeys(fn ($key) => [ + $key => TenantSetting::getValue($tenantId, $key, self::DEFAULTS[$key]), + ])->all(); + + return Inertia::render('Settings/Index', [ + 'settings' => $settings, + 'breadcrumbs' => [['label' => 'Settings', 'href' => route('settings.edit')]], + ]); + } + + public function update(Request $request): RedirectResponse + { + if (! auth()->user()->hasAnyRole(['super-admin', 'admin'])) { + abort(403); + } + + $data = $request->validate([ + 'company_name' => ['required', 'string', 'max:255'], + 'currency' => ['required', 'string', 'size:3'], + 'timezone' => ['required', 'string', 'max:64'], + 'fiscal_year_start' => ['required', 'regex:/^\d{2}-\d{2}$/'], + ]); + + $tenantId = auth()->user()->tenant_id; + foreach ($data as $key => $value) { + TenantSetting::setValue($tenantId, $key, $value); + } + + return back()->with('success', 'Settings saved.'); + } +} diff --git a/erp/app/Http/Controllers/UserManagementController.php b/erp/app/Http/Controllers/UserManagementController.php new file mode 100644 index 00000000000..5b30639045e --- /dev/null +++ b/erp/app/Http/Controllers/UserManagementController.php @@ -0,0 +1,116 @@ +user(); + if (! $user->hasAnyRole(['super-admin', 'admin'])) { + abort(403); + } + } + + public function index(Request $request) + { + $this->authorizeAdmin($request); + + $users = User::where('tenant_id', $request->user()->tenant_id) + ->with('roles') + ->orderBy('name') + ->get() + ->map(fn ($u) => [ + 'id' => $u->id, + 'name' => $u->name, + 'email' => $u->email, + 'is_active' => (bool) $u->is_active, + 'roles' => $u->roles->pluck('name'), + 'created_at' => $u->created_at?->toDateString(), + ]); + + $roles = Role::whereIn('name', ['admin', 'manager', 'staff'])->pluck('name'); + + return Inertia::render('Settings/Users/Index', [ + 'users' => $users, + 'roles' => $roles, + ]); + } + + public function invite(Request $request) + { + $this->authorizeAdmin($request); + + $data = $request->validate([ + 'name' => 'required|string|max:191', + 'email' => 'required|email|unique:users,email', + 'role' => 'required|in:admin,manager,staff', + ]); + + $user = User::create([ + 'tenant_id' => $request->user()->tenant_id, + 'name' => $data['name'], + 'email' => $data['email'], + 'password' => Hash::make(Str::random(16)), + 'is_active' => true, + ]); + + $user->assignRole($data['role']); + + return back()->with('success', "User {$user->name} invited successfully."); + } + + public function updateRole(Request $request, User $user) + { + $this->authorizeAdmin($request); + $this->ensureSameTenant($request, $user); + + $data = $request->validate(['role' => 'required|in:admin,manager,staff']); + + $user->syncRoles([$data['role']]); + + return back()->with('success', 'Role updated.'); + } + + public function toggleActive(Request $request, User $user) + { + $this->authorizeAdmin($request); + $this->ensureSameTenant($request, $user); + + if ($user->id === $request->user()->id) { + return back()->withErrors(['user' => 'You cannot deactivate yourself.']); + } + + $user->update(['is_active' => ! $user->is_active]); + + return back()->with('success', $user->is_active ? 'User reactivated.' : 'User deactivated.'); + } + + public function destroy(Request $request, User $user) + { + $this->authorizeAdmin($request); + $this->ensureSameTenant($request, $user); + + if ($user->id === $request->user()->id) { + return back()->withErrors(['user' => 'You cannot remove yourself.']); + } + + $user->delete(); + + return back()->with('success', 'User removed.'); + } + + private function ensureSameTenant(Request $request, User $user): void + { + if ($user->tenant_id !== $request->user()->tenant_id) { + abort(403); + } + } +} diff --git a/erp/app/Http/Middleware/HandleInertiaRequests.php b/erp/app/Http/Middleware/HandleInertiaRequests.php new file mode 100644 index 00000000000..46b6d582f0c --- /dev/null +++ b/erp/app/Http/Middleware/HandleInertiaRequests.php @@ -0,0 +1,67 @@ + */ + public function share(Request $request): array + { + $user = $request->user(); + + return [ + ...parent::share($request), + 'auth' => [ + 'user' => $user ? [ + 'id' => $user->id, + 'name' => $user->name, + 'email' => $user->email, + 'avatar' => $user->avatar, + 'initials' => $user->initials, + 'roles' => $user->getRoleNames(), + 'permissions' => $user->getAllPermissions()->pluck('name'), + ] : null, + 'tenant' => $request->attributes->get('tenant') instanceof Tenant + ? [ + 'id' => $request->attributes->get('tenant')->id, + 'name' => $request->attributes->get('tenant')->name, + 'slug' => $request->attributes->get('tenant')->slug, + ] + : null, + ], + 'ziggy' => fn () => [ + ...(new Ziggy)->toArray(), + 'location' => $request->url(), + ], + 'flash' => [ + 'success' => $request->session()->get('success'), + 'error' => $request->session()->get('error'), + ], + 'notifications_count' => fn () => $user + ? $user->unreadNotifications()->count() + : 0, + 'notifications' => function () use ($user) { + if (! $user) { + return []; + } + try { + return \App\Services\NotificationService::forUser($user); + } catch (\Throwable) { + return []; + } + }, + ]; + } +} diff --git a/erp/app/Http/Middleware/TenantMiddleware.php b/erp/app/Http/Middleware/TenantMiddleware.php new file mode 100644 index 00000000000..40a91237ac9 --- /dev/null +++ b/erp/app/Http/Middleware/TenantMiddleware.php @@ -0,0 +1,48 @@ +resolveTenant($request); + + if ($tenant === null) { + abort(404, 'Tenant not found.'); + } + + if (! $tenant->is_active) { + abort(403, 'Tenant is inactive.'); + } + + app()->instance('tenant', $tenant); + $request->attributes->set('tenant', $tenant); + + return $next($request); + } + + private function resolveTenant(Request $request): ?Tenant + { + // 1. Try X-Tenant header (API clients) + if ($slug = $request->header('X-Tenant')) { + return Tenant::where('slug', $slug)->first(); + } + + // 2. Try subdomain + $host = $request->getHost(); + $parts = explode('.', $host); + if (count($parts) >= 3) { + $subdomain = $parts[0]; + return Tenant::where('slug', $subdomain)->first(); + } + + // 3. Try full domain match + return Tenant::where('domain', $host)->first(); + } +} diff --git a/erp/app/Http/Policies/UserPolicy.php b/erp/app/Http/Policies/UserPolicy.php new file mode 100644 index 00000000000..4f1d3d67cf1 --- /dev/null +++ b/erp/app/Http/Policies/UserPolicy.php @@ -0,0 +1,14 @@ +can('users.view'); } + public function view(User $user, User $model): bool { return $user->can('users.view'); } + public function create(User $user): bool { return $user->can('users.create'); } + public function update(User $user, User $model): bool { return $user->can('users.update'); } + public function delete(User $user, User $model): bool { return $user->can('users.delete'); } +} diff --git a/erp/app/Http/Requests/Auth/LoginRequest.php b/erp/app/Http/Requests/Auth/LoginRequest.php new file mode 100644 index 00000000000..711e0a16902 --- /dev/null +++ b/erp/app/Http/Requests/Auth/LoginRequest.php @@ -0,0 +1,86 @@ +|string> + */ + public function rules(): array + { + return [ + 'email' => ['required', 'string', 'email'], + 'password' => ['required', 'string'], + ]; + } + + /** + * Attempt to authenticate the request's credentials. + * + * @throws ValidationException + */ + public function authenticate(): void + { + $this->ensureIsNotRateLimited(); + + if (! Auth::attempt($this->only('email', 'password'), $this->boolean('remember'))) { + RateLimiter::hit($this->throttleKey()); + + throw ValidationException::withMessages([ + 'email' => trans('auth.failed'), + ]); + } + + RateLimiter::clear($this->throttleKey()); + } + + /** + * Ensure the login request is not rate limited. + * + * @throws ValidationException + */ + public function ensureIsNotRateLimited(): void + { + if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { + return; + } + + event(new Lockout($this)); + + $seconds = RateLimiter::availableIn($this->throttleKey()); + + throw ValidationException::withMessages([ + 'email' => trans('auth.throttle', [ + 'seconds' => $seconds, + 'minutes' => ceil($seconds / 60), + ]), + ]); + } + + /** + * Get the rate limiting throttle key for the request. + */ + public function throttleKey(): string + { + return Str::transliterate(Str::lower($this->string('email')).'|'.$this->ip()); + } +} diff --git a/erp/app/Http/Requests/ProfileUpdateRequest.php b/erp/app/Http/Requests/ProfileUpdateRequest.php new file mode 100644 index 00000000000..e2202dd0aa6 --- /dev/null +++ b/erp/app/Http/Requests/ProfileUpdateRequest.php @@ -0,0 +1,31 @@ +|string> + */ + public function rules(): array + { + return [ + 'name' => ['required', 'string', 'max:255'], + 'email' => [ + 'required', + 'string', + 'lowercase', + 'email', + 'max:255', + Rule::unique(User::class)->ignore($this->user()->id), + ], + ]; + } +} diff --git a/erp/app/Models/User.php b/erp/app/Models/User.php new file mode 100644 index 00000000000..07c8fce9d1e --- /dev/null +++ b/erp/app/Models/User.php @@ -0,0 +1,60 @@ + */ + use HasFactory; + use HasRoles; + use HasAuditLog; + use Notifiable; + + protected $fillable = [ + 'name', + 'email', + 'password', + 'tenant_id', + 'avatar', + 'last_login_at', + 'is_active', + ]; + + protected $hidden = [ + 'password', + 'remember_token', + ]; + + protected function casts(): array + { + return [ + 'email_verified_at' => 'datetime', + 'last_login_at' => 'datetime', + 'password' => 'hashed', + 'is_active' => 'boolean', + ]; + } + + public function tenant(): BelongsTo + { + return $this->belongsTo(Tenant::class); + } + + public function getInitialsAttribute(): string + { + return collect(explode(' ', $this->name)) + ->map(fn (string $word) => strtoupper($word[0])) + ->take(2) + ->implode(''); + } +} diff --git a/erp/app/Modules/Core/Http/Controllers/AuditLogController.php b/erp/app/Modules/Core/Http/Controllers/AuditLogController.php new file mode 100644 index 00000000000..8b45484a77d --- /dev/null +++ b/erp/app/Modules/Core/Http/Controllers/AuditLogController.php @@ -0,0 +1,63 @@ +user()->hasRole('super-admin')) { + abort(403); + } + + $query = AuditLog::with('user') + ->orderByDesc('created_at'); + + if ($event = $request->query('event')) { + $query->where('event', $event); + } + + if ($userId = $request->query('user_id')) { + $query->where('user_id', $userId); + } + + if ($auditableType = $request->query('auditable_type')) { + $query->where('auditable_type', 'like', "%{$auditableType}%"); + } + + if ($tenantId = $request->query('tenant_id')) { + $query->where('tenant_id', $tenantId); + } + + if ($dateFrom = $request->query('date_from')) { + $query->whereDate('created_at', '>=', $dateFrom); + } + + if ($dateTo = $request->query('date_to')) { + $query->whereDate('created_at', '<=', $dateTo); + } + + $logs = $query->paginate(30)->withQueryString(); + + $filters = $request->only([ + 'event', + 'user_id', + 'auditable_type', + 'tenant_id', + 'date_from', + 'date_to', + ]); + + return Inertia::render('Core/AuditLogs/Index', [ + 'logs' => $logs, + 'filters' => $filters, + ]); + } +} diff --git a/erp/app/Modules/Core/Http/Controllers/NotificationInboxController.php b/erp/app/Modules/Core/Http/Controllers/NotificationInboxController.php new file mode 100644 index 00000000000..7bd80ad3216 --- /dev/null +++ b/erp/app/Modules/Core/Http/Controllers/NotificationInboxController.php @@ -0,0 +1,65 @@ +user(); + + $notifications = NotificationInbox::where('user_id', $user->id) + ->orderByDesc('created_at') + ->paginate(20); + + $unreadCount = NotificationInbox::where('user_id', $user->id) + ->where('is_read', false) + ->count(); + + return Inertia::render('Core/Notifications/Index', [ + 'notifications' => $notifications, + 'unread_count' => $unreadCount, + ]); + } + + public function markRead(Request $request, NotificationInbox $notification): RedirectResponse + { + if ($notification->user_id !== $request->user()->id) { + abort(403); + } + + $notification->markRead(); + + return back()->with('success', 'Notification marked as read.'); + } + + public function markAllRead(Request $request): RedirectResponse + { + NotificationInbox::where('user_id', $request->user()->id) + ->where('is_read', false) + ->update([ + 'is_read' => true, + 'read_at' => now(), + ]); + + return back()->with('success', 'All notifications marked as read.'); + } + + public function destroy(Request $request, NotificationInbox $notification): RedirectResponse + { + if ($notification->user_id !== $request->user()->id) { + abort(403); + } + + $notification->delete(); + + return back()->with('success', 'Notification deleted.'); + } +} diff --git a/erp/app/Modules/Core/Http/Controllers/NotificationRuleController.php b/erp/app/Modules/Core/Http/Controllers/NotificationRuleController.php new file mode 100644 index 00000000000..4df415fffb4 --- /dev/null +++ b/erp/app/Modules/Core/Http/Controllers/NotificationRuleController.php @@ -0,0 +1,68 @@ +user()->id) + ->orderByDesc('created_at') + ->paginate(20); + + return Inertia::render('Core/NotificationRules/Index', [ + 'rules' => $rules, + ]); + } + + public function create(): Response + { + return Inertia::render('Core/NotificationRules/Create'); + } + + public function store(Request $request): RedirectResponse + { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'event_type' => ['required', 'string', 'max:100'], + 'conditions' => ['nullable', 'array'], + ]); + + NotificationRule::create(array_merge($validated, [ + 'user_id' => auth()->id(), + ])); + + return redirect()->route('notification-rules.index') + ->with('success', 'Notification rule created.'); + } + + public function destroy(Request $request, NotificationRule $notificationRule): RedirectResponse + { + if ($notificationRule->user_id !== $request->user()->id) { + abort(403); + } + + $notificationRule->delete(); + + return redirect()->route('notification-rules.index') + ->with('success', 'Notification rule deleted.'); + } + + public function toggle(Request $request, NotificationRule $notificationRule): RedirectResponse + { + if ($notificationRule->user_id !== $request->user()->id) { + abort(403); + } + + $notificationRule->update(['is_active' => ! $notificationRule->is_active]); + + return back()->with('success', 'Notification rule updated.'); + } +} diff --git a/erp/app/Modules/Core/Models/AuditLog.php b/erp/app/Modules/Core/Models/AuditLog.php new file mode 100644 index 00000000000..11497093110 --- /dev/null +++ b/erp/app/Modules/Core/Models/AuditLog.php @@ -0,0 +1,79 @@ + 'array', + 'new_values' => 'array', + 'created_at' => 'datetime', + ]; + + public function auditable(): MorphTo + { + return $this->morphTo(); + } + + public function user(): BelongsTo + { + return $this->belongsTo(\App\Models\User::class); + } + + public function tenant(): BelongsTo + { + return $this->belongsTo(Tenant::class); + } + + /** + * Record an audit log entry. + * + * @param string $event + * @param Model|null $auditable + * @param array $oldValues + * @param array $newValues + * @param int|null $tenantId + * @return static + */ + public static function record( + string $event, + ?Model $auditable = null, + array $oldValues = [], + array $newValues = [], + ?int $tenantId = null + ): static { + return static::create([ + 'user_id' => auth()->id(), + 'tenant_id' => $tenantId, + 'event' => $event, + 'auditable_type' => $auditable ? get_class($auditable) : null, + 'auditable_id' => $auditable?->getKey(), + 'old_values' => $oldValues ?: null, + 'new_values' => $newValues ?: null, + 'ip_address' => request()->ip(), + 'user_agent' => request()->userAgent(), + 'created_at' => now(), + ]); + } +} diff --git a/erp/app/Modules/Core/Models/NotificationInbox.php b/erp/app/Modules/Core/Models/NotificationInbox.php new file mode 100644 index 00000000000..fbbf4accdc2 --- /dev/null +++ b/erp/app/Modules/Core/Models/NotificationInbox.php @@ -0,0 +1,71 @@ + 'boolean', + 'read_at' => 'datetime', + 'created_at' => 'datetime', + ]; + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function markRead(): void + { + $this->is_read = true; + $this->read_at = now(); + $this->save(); + } + + public static function send( + int $tenantId, + int $userId, + string $title, + string $type, + ?string $body = null, + ?string $link = null + ): self { + $notification = new self(); + $notification->tenant_id = $tenantId; + $notification->user_id = $userId; + $notification->title = $title; + $notification->type = $type; + $notification->body = $body; + $notification->link = $link; + $notification->is_read = false; + $notification->created_at = now(); + $notification->save(); + + return $notification; + } +} diff --git a/erp/app/Modules/Core/Models/NotificationRule.php b/erp/app/Modules/Core/Models/NotificationRule.php new file mode 100644 index 00000000000..e8cf8fb2ac1 --- /dev/null +++ b/erp/app/Modules/Core/Models/NotificationRule.php @@ -0,0 +1,38 @@ + 'array', + 'is_active' => 'boolean', + ]; + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function scopeActive(Builder $query): Builder + { + return $query->where('is_active', true); + } +} diff --git a/erp/app/Modules/Core/Models/Tenant.php b/erp/app/Modules/Core/Models/Tenant.php new file mode 100644 index 00000000000..f56b1c63328 --- /dev/null +++ b/erp/app/Modules/Core/Models/Tenant.php @@ -0,0 +1,46 @@ + 'array', + 'is_active' => 'boolean', + ]; + + public function users(): HasMany + { + return $this->hasMany(\App\Models\User::class); + } + + public function auditLogs(): HasMany + { + return $this->hasMany(AuditLog::class); + } +} diff --git a/erp/app/Modules/Core/Models/TenantSetting.php b/erp/app/Modules/Core/Models/TenantSetting.php new file mode 100644 index 00000000000..508093fc125 --- /dev/null +++ b/erp/app/Modules/Core/Models/TenantSetting.php @@ -0,0 +1,29 @@ +belongsTo(Tenant::class); + } + + public static function getValue(int $tenantId, string $key, mixed $default = null): mixed + { + return static::where('tenant_id', $tenantId)->where('key', $key)->value('value') ?? $default; + } + + public static function setValue(int $tenantId, string $key, mixed $value): void + { + static::updateOrCreate( + ['tenant_id' => $tenantId, 'key' => $key], + ['value' => $value] + ); + } +} diff --git a/erp/app/Modules/Core/Observers/AuditLogObserver.php b/erp/app/Modules/Core/Observers/AuditLogObserver.php new file mode 100644 index 00000000000..9183a1fb2d3 --- /dev/null +++ b/erp/app/Modules/Core/Observers/AuditLogObserver.php @@ -0,0 +1,65 @@ +log('created', $model, [], $model->getAttributes()); + } + + public function updated(Model $model): void + { + $dirty = $model->getDirty(); + if (empty($dirty)) { + return; + } + + $old = array_intersect_key($model->getOriginal(), $dirty); + $this->log('updated', $model, $old, $dirty); + } + + public function deleted(Model $model): void + { + $this->log('deleted', $model, $model->getOriginal(), []); + } + + private function log(string $event, Model $model, array $old, array $new): void + { + $tenantId = $this->resolveTenantId($model); + + AuditLog::create([ + 'user_id' => Auth::id(), + 'tenant_id' => $tenantId, + 'event' => $event, + 'auditable_type' => get_class($model), + 'auditable_id' => $model->getKey(), + 'old_values' => $old ?: null, + 'new_values' => $new ?: null, + 'ip_address' => Request::ip(), + 'user_agent' => Request::userAgent(), + ]); + } + + private function resolveTenantId(Model $model): ?int + { + if (isset($model->tenant_id)) { + return $model->tenant_id; + } + + try { + /** @var \App\Modules\Core\Models\Tenant|null $tenant */ + $tenant = app()->has('tenant') ? app('tenant') : null; + + return $tenant?->id; + } catch (\Throwable) { + return null; + } + } +} diff --git a/erp/app/Modules/Core/Providers/CoreServiceProvider.php b/erp/app/Modules/Core/Providers/CoreServiceProvider.php new file mode 100644 index 00000000000..3b218078ad9 --- /dev/null +++ b/erp/app/Modules/Core/Providers/CoreServiceProvider.php @@ -0,0 +1,23 @@ +app->register(InventoryServiceProvider::class); + $this->app->register(FinanceServiceProvider::class); + $this->app->register(HRServiceProvider::class); + } + + public function boot(): void + { + $this->loadRoutesFrom(__DIR__ . '/../routes/core.php'); + } +} diff --git a/erp/app/Modules/Core/Traits/Auditable.php b/erp/app/Modules/Core/Traits/Auditable.php new file mode 100644 index 00000000000..15aa83155f8 --- /dev/null +++ b/erp/app/Modules/Core/Traits/Auditable.php @@ -0,0 +1,45 @@ +getDirty(), + $model->tenant_id ?? null + ); + }); + + static::updated(function ($model) { + $dirty = $model->getDirty(); + if (empty($dirty)) { + return; + } + AuditLog::record( + 'updated', + $model, + $model->getOriginal(), + $dirty, + $model->tenant_id ?? null + ); + }); + + static::deleted(function ($model) { + AuditLog::record( + 'deleted', + $model, + $model->toArray(), + [], + $model->tenant_id ?? null + ); + }); + } +} diff --git a/erp/app/Modules/Core/Traits/BelongsToTenant.php b/erp/app/Modules/Core/Traits/BelongsToTenant.php new file mode 100644 index 00000000000..2369d641493 --- /dev/null +++ b/erp/app/Modules/Core/Traits/BelongsToTenant.php @@ -0,0 +1,32 @@ +has('tenant')) { + /** @var Tenant $tenant */ + $tenant = app('tenant'); + $query->where((new static())->getTable() . '.tenant_id', $tenant->id); + } + }); + + static::creating(function ($model) { + if (app()->has('tenant') && empty($model->tenant_id)) { + $model->tenant_id = app('tenant')->id; + } + }); + } + + public function tenant(): BelongsTo + { + return $this->belongsTo(Tenant::class); + } +} diff --git a/erp/app/Modules/Core/Traits/HasAuditLog.php b/erp/app/Modules/Core/Traits/HasAuditLog.php new file mode 100644 index 00000000000..90cf8dce939 --- /dev/null +++ b/erp/app/Modules/Core/Traits/HasAuditLog.php @@ -0,0 +1,17 @@ + app(AuditLogObserver::class); + + static::created(fn ($model) => $observer()->created($model)); + static::updated(fn ($model) => $observer()->updated($model)); + static::deleted(fn ($model) => $observer()->deleted($model)); + } +} diff --git a/erp/app/Modules/Core/routes/core.php b/erp/app/Modules/Core/routes/core.php new file mode 100644 index 00000000000..36f827f6e89 --- /dev/null +++ b/erp/app/Modules/Core/routes/core.php @@ -0,0 +1,38 @@ +group(function () { + Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard'); + + Route::get('/analytics', [AnalyticsController::class, 'index'])->name('analytics'); + + Route::get('/notifications', [NotificationInboxController::class, 'index'])->name('notifications.index'); + Route::post('/notifications/mark-all-read', [NotificationInboxController::class, 'markAllRead'])->name('notifications.mark-all-read'); + Route::patch('/notifications/{notification}/read', [NotificationInboxController::class, 'markRead'])->name('notifications.read'); + Route::delete('/notifications/{notification}', [NotificationInboxController::class, 'destroy'])->name('notifications.destroy'); + + Route::get('/search', SearchController::class)->name('search'); + + Route::prefix('export')->name('export.')->group(function () { + Route::get('products', [ExportController::class, 'products'])->name('products'); + Route::get('invoices', [ExportController::class, 'invoices'])->name('invoices'); + Route::get('employees', [ExportController::class, 'employees'])->name('employees'); + }); + + Route::get('/settings', [SettingController::class, 'edit'])->name('settings.edit'); + Route::put('/settings', [SettingController::class, 'update'])->name('settings.update'); + + Route::prefix('admin')->name('admin.')->group(function () { + Route::resource('users', UserController::class)->names('users'); + Route::get('audit-log', [AuditLogController::class, 'index'])->name('audit-log.index'); + }); +}); diff --git a/erp/app/Modules/Finance/Console/Commands/GenerateRecurringInvoices.php b/erp/app/Modules/Finance/Console/Commands/GenerateRecurringInvoices.php new file mode 100644 index 00000000000..b9fe9ea2f27 --- /dev/null +++ b/erp/app/Modules/Finance/Console/Commands/GenerateRecurringInvoices.php @@ -0,0 +1,27 @@ +with('items')->get() as $recurringInvoice) { + $recurringInvoice->generateInvoice(); + $count++; + } + + $this->info("Generated {$count} invoice(s)."); + + return self::SUCCESS; + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/AccountController.php b/erp/app/Modules/Finance/Http/Controllers/AccountController.php new file mode 100644 index 00000000000..b7e519dce0e --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/AccountController.php @@ -0,0 +1,96 @@ +authorize('viewAny', Account::class); + + $accounts = Account::with('parent') + ->when($request->search, fn ($q) => $q->where('name', 'like', "%{$request->search}%") + ->orWhere('code', 'like', "%{$request->search}%")) + ->when($request->type, fn ($q) => $q->where('type', $request->type)) + ->orderBy('code') + ->paginate(50) + ->withQueryString(); + + return Inertia::render('Finance/Accounts/Index', [ + 'accounts' => AccountResource::collection($accounts), + 'filters' => $request->only(['search', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Chart of Accounts', 'href' => route('finance.accounts.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Account::class); + + return Inertia::render('Finance/Accounts/Create', [ + 'parentAccounts' => Account::active()->orderBy('code')->get(['id', 'code', 'name', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Chart of Accounts', 'href' => route('finance.accounts.index')], + ['label' => 'New Account'], + ], + ]); + } + + public function store(StoreAccountRequest $request): RedirectResponse + { + $this->authorize('create', Account::class); + + Account::create([...$request->validated(), 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('finance.accounts.index') + ->with('success', 'Account created.'); + } + + public function edit(Account $account): Response + { + $this->authorize('update', $account); + + return Inertia::render('Finance/Accounts/Edit', [ + 'account' => new AccountResource($account), + 'parentAccounts' => Account::active()->where('id', '!=', $account->id)->orderBy('code')->get(['id', 'code', 'name', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Chart of Accounts', 'href' => route('finance.accounts.index')], + ['label' => $account->name . ' — Edit'], + ], + ]); + } + + public function update(StoreAccountRequest $request, Account $account): RedirectResponse + { + $this->authorize('update', $account); + + $account->update($request->validated()); + + return redirect()->route('finance.accounts.index') + ->with('success', 'Account updated.'); + } + + public function destroy(Account $account): RedirectResponse + { + $this->authorize('delete', $account); + + $account->delete(); + + return redirect()->route('finance.accounts.index') + ->with('success', 'Account deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/AttachmentController.php b/erp/app/Modules/Finance/Http/Controllers/AttachmentController.php new file mode 100644 index 00000000000..b19852845ea --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/AttachmentController.php @@ -0,0 +1,70 @@ + \App\Modules\Finance\Models\Invoice::class, + 'bills' => \App\Modules\Finance\Models\Bill::class, + 'expense-claims' => \App\Modules\HR\Models\ExpenseClaim::class, + 'projects' => \App\Modules\Finance\Models\Project::class, + ]; + + public function store(Request $request, string $modelType, int $modelId): RedirectResponse + { + abort_unless(array_key_exists($modelType, $this->allowedModels), 404); + + $this->authorize('create', Attachment::class); + + $request->validate([ + 'file' => 'required|file|max:20480|mimes:pdf,png,jpg,jpeg,webp,gif,csv,xlsx,docx,doc', + ]); + + $modelClass = $this->allowedModels[$modelType]; + $model = $modelClass::findOrFail($modelId); + + $file = $request->file('file'); + $path = $file->store("attachments/{$modelType}/{$modelId}", 'local'); + + Attachment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'attachable_type' => $modelClass, + 'attachable_id' => $modelId, + 'filename' => $file->getClientOriginalName(), + 'disk' => 'local', + 'path' => $path, + 'mime_type' => $file->getMimeType(), + 'size' => $file->getSize(), + 'uploaded_by' => auth()->id(), + ]); + + return back()->with('success', 'File attached.'); + } + + public function download(Attachment $attachment): Response|\Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('view', $attachment); + + abort_unless(Storage::disk($attachment->disk)->exists($attachment->path), 404); + + return Storage::disk($attachment->disk)->download($attachment->path, $attachment->filename); + } + + public function destroy(Attachment $attachment): RedirectResponse + { + $this->authorize('delete', $attachment); + + Storage::disk($attachment->disk)->delete($attachment->path); + $attachment->delete(); + + return back()->with('success', 'Attachment deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BankAccountController.php b/erp/app/Modules/Finance/Http/Controllers/BankAccountController.php new file mode 100644 index 00000000000..05e21142a16 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BankAccountController.php @@ -0,0 +1,114 @@ +authorize('viewAny', BankAccount::class); + + $accounts = BankAccount::where('tenant_id', $request->user()->tenant_id) + ->get() + ->map(function (BankAccount $account) { + return array_merge($account->toArray(), [ + 'balance' => $account->balance, + 'unreconciled_count' => $account->unreconciledCount, + ]); + }); + + return Inertia::render('Finance/BankAccounts/Index', [ + 'accounts' => $accounts, + ]); + } + + public function create(): Response + { + $this->authorize('create', BankAccount::class); + + return Inertia::render('Finance/BankAccounts/Create'); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', BankAccount::class); + + $data = $request->validate([ + 'name' => 'required|string|max:255', + 'bank_name' => 'nullable|string|max:255', + 'account_number' => 'nullable|string|max:255', + 'currency_code' => 'required|string|size:3', + 'opening_balance' => 'required|numeric', + ]); + + BankAccount::create([ + ...$data, + 'tenant_id' => $request->user()->tenant_id, + ]); + + return redirect()->route('finance.bank-accounts.index') + ->with('success', 'Bank account created.'); + } + + public function show(Request $request, BankAccount $bankAccount): Response + { + $this->authorize('view', $bankAccount); + + $transactions = BankTransaction::where('bank_account_id', $bankAccount->id) + ->orderByDesc('transaction_date') + ->orderByDesc('id') + ->paginate(50); + + return Inertia::render('Finance/BankAccounts/Show', [ + 'account' => $bankAccount->load([]), + 'transactions' => $transactions, + 'balance' => $bankAccount->balance, + 'unreconciled' => $bankAccount->unreconciledCount, + ]); + } + + public function edit(BankAccount $bankAccount): Response + { + $this->authorize('update', $bankAccount); + + return Inertia::render('Finance/BankAccounts/Edit', [ + 'account' => $bankAccount, + ]); + } + + public function update(Request $request, BankAccount $bankAccount): RedirectResponse + { + $this->authorize('update', $bankAccount); + + $data = $request->validate([ + 'name' => 'required|string|max:255', + 'bank_name' => 'nullable|string|max:255', + 'account_number' => 'nullable|string|max:255', + 'currency_code' => 'required|string|size:3', + 'opening_balance' => 'required|numeric', + ]); + + $bankAccount->update($data); + + return redirect()->route('finance.bank-accounts.index') + ->with('success', 'Bank account updated.'); + } + + public function destroy(BankAccount $bankAccount): RedirectResponse + { + $this->authorize('delete', $bankAccount); + + $bankAccount->delete(); + + return redirect()->route('finance.bank-accounts.index') + ->with('success', 'Bank account deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BankStatementController.php b/erp/app/Modules/Finance/Http/Controllers/BankStatementController.php new file mode 100644 index 00000000000..5e1997ceb5b --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BankStatementController.php @@ -0,0 +1,46 @@ +authorize('update', $bankAccount); + $request->validate(['file' => 'required|file|mimes:csv,txt|max:2048']); + + $path = $request->file('file')->getRealPath(); + $handle = fopen($path, 'r'); + $header = fgetcsv($handle); // skip header row + $count = 0; + $now = now(); + + while (($row = fgetcsv($handle)) !== false) { + if (count($row) < 3) continue; + [$date, $description, $amount] = $row; + $reference = $row[3] ?? null; + if (!is_numeric(str_replace([',', ' '], '', $amount))) continue; + $amount = (float) str_replace(',', '', $amount); + BankTransaction::create([ + 'tenant_id' => $bankAccount->tenant_id, + 'bank_account_id' => $bankAccount->id, + 'transaction_date' => $date, + 'description' => trim($description), + 'amount' => $amount, + 'reference' => $reference ? trim($reference) : null, + 'reconciled' => false, + 'imported_at' => $now, + ]); + $count++; + } + fclose($handle); + + return back()->with('success', "{$count} transactions imported."); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BatchPaymentController.php b/erp/app/Modules/Finance/Http/Controllers/BatchPaymentController.php new file mode 100644 index 00000000000..8fd6521073c --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BatchPaymentController.php @@ -0,0 +1,160 @@ +authorize('viewAny', BatchPayment::class); + + $batches = BatchPayment::withCount('payments') + ->orderByDesc('payment_date') + ->paginate(25); + + return Inertia::render('Finance/BatchPayments/Index', compact('batches')); + } + + public function create(Request $request): Response + { + $this->authorize('create', BatchPayment::class); + + $type = $request->get('type', 'received'); + + if ($type === 'received') { + $openItems = Invoice::with('contact') + ->whereIn('status', ['sent', 'partial']) + ->orderBy('due_date') + ->get(['id', 'number', 'contact_id', 'due_date', 'currency_code', 'status']); + } else { + $openItems = Bill::with('contact') + ->whereIn('status', ['received', 'partial']) + ->orderBy('due_date') + ->get(['id', 'number', 'contact_id', 'due_date', 'currency_code', 'status']); + } + + // Load items and payments for computed totals + $openItems->load(['items', 'payments']); + + return Inertia::render('Finance/BatchPayments/Create', compact('openItems', 'type')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', BatchPayment::class); + + $data = $request->validate([ + 'reference' => 'required|string|max:100|unique:batch_payments,reference', + 'payment_date' => 'required|date', + 'payment_method' => 'required|in:bank_transfer,cheque,cash,card,other', + 'type' => 'required|in:received,made', + 'notes' => 'nullable|string', + 'payments' => 'required|array|min:1', + 'payments.*.id' => 'required|integer', + 'payments.*.amount' => 'required|numeric|min:0.01', + ]); + + DB::transaction(function () use ($data) { + $totalAmount = collect($data['payments'])->sum('amount'); + + $batch = BatchPayment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'reference' => $data['reference'], + 'payment_date' => $data['payment_date'], + 'payment_method' => $data['payment_method'], + 'type' => $data['type'], + 'total_amount' => $totalAmount, + 'notes' => $data['notes'] ?? null, + ]); + + foreach ($data['payments'] as $p) { + if ($data['type'] === 'received') { + $invoice = Invoice::with(['items', 'payments'])->findOrFail($p['id']); + $outstanding = $invoice->total - $invoice->amount_paid; + $amount = min((float) $p['amount'], $outstanding); + + if ($amount <= 0) { + continue; + } + + Payment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'invoice_id' => $invoice->id, + 'amount' => $amount, + 'payment_date' => $data['payment_date'], + 'method' => $data['payment_method'], + 'reference' => $data['reference'], + 'batch_payment_id' => $batch->id, + ]); + + // Reload to get updated amount_paid + $invoice->load(['items', 'payments']); + if ($invoice->amount_due <= 0 && $invoice->canTransitionTo('paid')) { + $invoice->transitionTo('paid'); + } elseif ($invoice->amount_paid > 0 && $invoice->canTransitionTo('partial')) { + $invoice->transitionTo('partial'); + } + } else { + $bill = Bill::with(['items', 'payments'])->findOrFail($p['id']); + $outstanding = $bill->total - $bill->amount_paid; + $amount = min((float) $p['amount'], $outstanding); + + if ($amount <= 0) { + continue; + } + + BillPayment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'bill_id' => $bill->id, + 'amount' => $amount, + 'payment_date' => $data['payment_date'], + 'method' => $data['payment_method'], + 'reference' => $data['reference'], + ]); + + // Reload to get updated amount_paid + $bill->load(['items', 'payments']); + if ($bill->amount_due <= 0 && $bill->canTransitionTo('paid')) { + $bill->transitionTo('paid'); + } elseif ($bill->amount_paid > 0 && $bill->canTransitionTo('partial')) { + $bill->transitionTo('partial'); + } + } + } + }); + + return redirect()->route('finance.batch-payments.index') + ->with('success', 'Batch payment recorded.'); + } + + public function show(BatchPayment $batchPayment): Response + { + $this->authorize('view', $batchPayment); + + $batchPayment->load('payments.invoice'); + + return Inertia::render('Finance/BatchPayments/Show', compact('batchPayment')); + } + + public function destroy(BatchPayment $batchPayment): RedirectResponse + { + $this->authorize('delete', $batchPayment); + + $batchPayment->delete(); + + return redirect()->route('finance.batch-payments.index') + ->with('success', 'Batch payment deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BillController.php b/erp/app/Modules/Finance/Http/Controllers/BillController.php new file mode 100644 index 00000000000..cd49cef0db3 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BillController.php @@ -0,0 +1,218 @@ +authorize('viewAny', Bill::class); + + $bills = Bill::with('contact') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->contact_id, fn ($q) => $q->where('contact_id', $request->contact_id)) + ->when($request->search, fn ($q) => $q->where('number', 'like', "%{$request->search}%")) + ->latest('issue_date') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/Bills/Index', [ + 'bills' => BillResource::collection($bills), + 'contacts' => Contact::vendors()->active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'contact_id', 'search']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Bills', 'href' => route('finance.bills.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Bill::class); + + return Inertia::render('Finance/Bills/Create', [ + 'contacts' => Contact::vendors()->active()->orderBy('name')->get(['id', 'name']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Bills', 'href' => route('finance.bills.index')], + ['label' => 'New Bill'], + ], + ]); + } + + public function store(StoreBillRequest $request): RedirectResponse + { + $this->authorize('create', Bill::class); + + $data = $request->validated(); + + $bill = DB::transaction(function () use ($data) { + $bill = Bill::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'] ?? null, + 'issue_date' => $data['issue_date'], + 'due_date' => $data['due_date'] ?? null, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + 'currency_code' => $data['currency_code'] ?? 'USD', + 'exchange_rate' => $data['exchange_rate'] ?? 1.0, + ]); + + $bill->update([ + 'number' => 'BILL-' . now()->format('Y') . '-' . str_pad((string) $bill->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($data['items'] as $item) { + BillItem::create([ + 'bill_id' => $bill->id, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + ]); + } + + return $bill; + }); + + return redirect()->route('finance.bills.show', $bill) + ->with('success', 'Bill created.'); + } + + public function show(Bill $bill): Response + { + $this->authorize('view', $bill); + + $bill->load(['contact', 'items', 'payments', 'creator', 'attachments']); + + return Inertia::render('Finance/Bills/Show', [ + 'bill' => new BillResource($bill), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Bills', 'href' => route('finance.bills.index')], + ['label' => $bill->number ?? "Bill #{$bill->id}"], + ], + ]); + } + + public function receive(Bill $bill): RedirectResponse + { + $this->authorize('update', $bill); + + try { + $bill->transitionTo('received'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Bill marked as received.'); + } + + public function cancel(Bill $bill): RedirectResponse + { + $this->authorize('update', $bill); + + try { + $bill->transitionTo('cancelled'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Bill cancelled.'); + } + + public function recordPayment(StorePaymentRequest $request, Bill $bill): RedirectResponse + { + $this->authorize('update', $bill); + + if ($bill->status !== 'received') { + return back()->withErrors(['status' => 'Payments can only be recorded on received bills.']); + } + + $data = $request->validated(); + + DB::transaction(function () use ($data, $bill) { + BillPayment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'bill_id' => $bill->id, + 'amount' => $data['amount'], + 'payment_date' => $data['payment_date'], + 'method' => $data['method'], + 'reference' => $data['reference'] ?? null, + 'notes' => $data['notes'] ?? null, + ]); + + $bill->load(['items', 'payments']); + + if ($bill->amount_due <= 0 && $bill->canTransitionTo('paid')) { + $bill->transitionTo('paid'); + } + }); + + return back()->with('success', 'Payment recorded.'); + } + + public function destroy(Bill $bill): RedirectResponse + { + $this->authorize('delete', $bill); + + $bill->delete(); + + return redirect()->route('finance.bills.index') + ->with('success', 'Bill deleted.'); + } + + public function pdf(Bill $bill): \Illuminate\Http\Response + { + $this->authorize('view', $bill); + $bill->load(['items', 'contact', 'payments']); + $pdf = $this->renderDocumentPdf('pdf.bill', [ + 'bill' => $bill, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'bill-' . $bill->number . '.pdf'; + return response($pdf, 200, [ + 'Content-Type' => 'application/pdf', + 'Content-Disposition' => 'attachment; filename="' . $filename . '"', + ]); + } + + public function email(Request $request, Bill $bill): \Illuminate\Http\RedirectResponse + { + $this->authorize('update', $bill); + $request->validate(['email' => 'required|email', 'message' => 'nullable|string|max:1000']); + + $bill->load(['items', 'contact', 'payments']); + $pdf = $this->renderDocumentPdf('pdf.bill', [ + 'bill' => $bill, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'bill-' . $bill->number . '.pdf'; + + $this->sendDocumentEmail($request, $request->input('email'), 'Bill ' . $bill->number, $pdf, $filename); + + return back()->with('success', 'Bill emailed successfully.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BudgetController.php b/erp/app/Modules/Finance/Http/Controllers/BudgetController.php new file mode 100644 index 00000000000..69225d02c1d --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BudgetController.php @@ -0,0 +1,222 @@ +authorize('viewAny', Budget::class); + + $budgets = Budget::withCount('lines') + ->orderByDesc('fiscal_year') + ->orderByDesc('id') + ->paginate(15) + ->through(fn ($b) => [ + 'id' => $b->id, + 'name' => $b->name, + 'fiscal_year' => $b->fiscal_year ?? $b->year, + 'year' => $b->year, + 'period_type' => $b->period_type, + 'status' => $b->status, + 'lines_count' => $b->lines_count, + 'total_budgeted' => null, + ]); + + return Inertia::render('Finance/Budgets/Index', [ + 'budgets' => $budgets, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Budgets'], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Budget::class); + + $accounts = Account::whereIn('type', ['income', 'expense']) + ->where('is_active', true) + ->orderBy('code') + ->get(['id', 'code', 'name', 'type']); + + return Inertia::render('Finance/Budgets/Create', [ + 'accounts' => $accounts, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Budgets', 'href' => '/finance/budgets'], + ['label' => 'New Budget'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Budget::class); + + $tenantId = app('tenant')->id; + $fiscalYear = $request->input('fiscal_year') ?? $request->input('year'); + + $validated = $request->validate([ + 'name' => [ + 'required', + 'string', + 'max:255', + Rule::unique('budgets')->where(fn ($q) => $q + ->where('fiscal_year', $fiscalYear) + ->where('tenant_id', $tenantId) + ->whereNull('deleted_at') + ), + ], + 'fiscal_year' => ['required', 'integer', 'min:2000', 'max:2100'], + 'period_type' => ['required', Rule::in(['annual', 'quarterly', 'monthly'])], + 'notes' => ['nullable', 'string'], + 'lines' => ['required', 'array', 'min:1'], + 'lines.*.account_id' => ['required', Rule::exists('accounts', 'id')], + 'lines.*.period' => ['required', 'integer', 'min:0', 'max:12'], + 'lines.*.amount' => ['required', 'numeric', 'min:0'], + ]); + + $fy = $validated['fiscal_year']; + + $budget = DB::transaction(function () use ($validated, $request, $tenantId, $fy) { + $budget = Budget::create([ + 'tenant_id' => $tenantId, + 'name' => $validated['name'], + 'fiscal_year' => $fy, + 'year' => $fy, + 'period_type' => $validated['period_type'], + 'notes' => $validated['notes'] ?? null, + 'status' => 'draft', + 'created_by' => $request->user()->id, + ]); + + foreach ($validated['lines'] as $line) { + $budget->lines()->create([ + 'tenant_id' => $tenantId, + 'account_id' => $line['account_id'], + 'period' => $line['period'], + 'amount' => $line['amount'], + 'notes' => $line['notes'] ?? null, + ]); + } + + return $budget; + }); + + return redirect()->route('finance.budgets.show', $budget) + ->with('success', 'Budget created successfully.'); + } + + public function show(Budget $budget): Response + { + $this->authorize('view', $budget); + $budget->load(['lines.account']); + + $tenantId = request()->user()->tenant_id; + $year = $budget->fiscal_year ?? $budget->year; + + // Compute actuals from posted journal entries for this fiscal year + $actuals = DB::table('journal_lines') + ->join('journal_entries', 'journal_lines.journal_entry_id', '=', 'journal_entries.id') + ->join('accounts', 'journal_lines.account_id', '=', 'accounts.id') + ->where('journal_entries.tenant_id', $tenantId) + ->where('journal_entries.status', 'posted') + ->whereYear('journal_entries.date', $year) + ->whereIn('accounts.type', ['income', 'expense']) + ->select( + 'journal_lines.account_id', + 'accounts.type', + DB::raw('SUM(journal_lines.debit) as total_debit'), + DB::raw('SUM(journal_lines.credit) as total_credit'), + ) + ->groupBy('journal_lines.account_id', 'accounts.type') + ->get() + ->keyBy('account_id'); + + $lines = $budget->lines->map(function ($line) use ($actuals) { + $actual = $actuals->get($line->account_id); + $actualAmount = 0; + if ($actual) { + $actualAmount = $actual->type === 'income' + ? (float) $actual->total_credit - (float) $actual->total_debit + : (float) $actual->total_debit - (float) $actual->total_credit; + } + $variance = $actualAmount - (float) $line->amount; + $variancePct = $line->amount != 0 ? round($variance / $line->amount * 100, 1) : null; + + return [ + 'id' => $line->id, + 'account_id' => $line->account_id, + 'account_code' => $line->account->code, + 'account_name' => $line->account->name, + 'account_type' => $line->account->type, + 'period' => $line->period, + 'budget' => round((float) $line->amount, 2), + 'actual' => round($actualAmount, 2), + 'variance' => round($variance, 2), + 'variance_pct' => $variancePct, + ]; + }); + + return Inertia::render('Finance/Budgets/Show', [ + 'budget' => [ + 'id' => $budget->id, + 'name' => $budget->name, + 'fiscal_year' => $budget->fiscal_year ?? $budget->year, + 'year' => $budget->year, + 'period_type' => $budget->period_type, + 'status' => $budget->status, + 'notes' => $budget->notes, + ], + 'lines' => $lines->values(), + 'total_budget' => $lines->sum('budget'), + 'total_actual' => $lines->sum('actual'), + 'total_variance' => round($lines->sum('variance'), 2), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Budgets', 'href' => '/finance/budgets'], + ['label' => $budget->name], + ], + ]); + } + + public function destroy(Budget $budget): RedirectResponse + { + $this->authorize('delete', $budget); + + $budget->delete(); + + return redirect()->route('finance.budgets.index') + ->with('success', 'Budget deleted.'); + } + + public function activate(Budget $budget): RedirectResponse + { + $this->authorize('update', $budget); + + $budget->activate(); + + return redirect()->back()->with('success', 'Budget activated.'); + } + + public function close(Budget $budget): RedirectResponse + { + $this->authorize('update', $budget); + + $budget->close(); + + return redirect()->back()->with('success', 'Budget closed.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/BudgetLineController.php b/erp/app/Modules/Finance/Http/Controllers/BudgetLineController.php new file mode 100644 index 00000000000..5145d760649 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/BudgetLineController.php @@ -0,0 +1,34 @@ +authorize('update', $budgetLine->budget); + + $validated = $request->validate([ + 'amount' => ['required', 'numeric', 'min:0'], + 'notes' => ['nullable', 'string'], + ]); + + $budgetLine->update($validated); + + return redirect()->back()->with('success', 'Budget line updated.'); + } + + public function destroy(BudgetLine $budgetLine): RedirectResponse + { + $this->authorize('delete', $budgetLine->budget); + + $budgetLine->delete(); + + return redirect()->back()->with('success', 'Budget line deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/CommissionController.php b/erp/app/Modules/Finance/Http/Controllers/CommissionController.php new file mode 100644 index 00000000000..e8246611ea5 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/CommissionController.php @@ -0,0 +1,161 @@ +authorize('viewAny', Commission::class); + + $commissions = Commission::with(['rule', 'user', 'invoice']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->user_id, fn ($q) => $q->where('user_id', $request->user_id)) + ->latest() + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Finance/Commissions/Index', [ + 'commissions' => $commissions, + 'users' => User::orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'user_id']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commissions', 'href' => route('finance.commissions.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Commission::class); + + return Inertia::render('Finance/Commissions/Create', [ + 'rules' => CommissionRule::with('user')->where('is_active', true)->latest()->get(['id', 'name', 'user_id']), + 'invoices' => Invoice::latest()->get(['id', 'number']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commissions', 'href' => route('finance.commissions.index')], + ['label' => 'New Commission'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Commission::class); + + $data = $request->validate([ + 'commission_rule_id' => ['required', Rule::exists('commission_rules', 'id')], + 'invoice_id' => ['required', Rule::exists('invoices', 'id')], + 'notes' => ['nullable', 'string'], + ]); + + $rule = CommissionRule::findOrFail($data['commission_rule_id']); + $invoice = Invoice::with('items', 'payments')->findOrFail($data['invoice_id']); + + $invoiceAmount = (float) $invoice->total; + $commissionAmount = $rule->calculateCommission($invoiceAmount); + + $commission = Commission::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'commission_rule_id' => $rule->id, + 'user_id' => $rule->user_id, + 'invoice_id' => $invoice->id, + 'invoice_amount' => $invoiceAmount, + 'commission_amount' => $commissionAmount, + 'status' => 'pending', + 'notes' => $data['notes'] ?? null, + ]); + + return redirect()->route('finance.commissions.show', $commission) + ->with('success', 'Commission created.'); + } + + public function show(Commission $commission): Response + { + $this->authorize('view', $commission); + + $commission->load(['rule', 'user', 'invoice']); + + return Inertia::render('Finance/Commissions/Show', [ + 'commission' => $commission, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commissions', 'href' => route('finance.commissions.index')], + ['label' => "Commission #{$commission->id}"], + ], + ]); + } + + public function destroy(Commission $commission): RedirectResponse + { + $this->authorize('delete', $commission); + + $commission->delete(); + + return redirect()->route('finance.commissions.index') + ->with('success', 'Commission deleted.'); + } + + public function approve(Commission $commission): RedirectResponse + { + $this->authorize('create', Commission::class); + + $commission->approve(); + + return back()->with('success', 'Commission approved.'); + } + + public function markPaid(Commission $commission): RedirectResponse + { + $this->authorize('create', Commission::class); + + $commission->markPaid(); + + return back()->with('success', 'Commission marked as paid.'); + } + + public function generate(Request $request): RedirectResponse + { + $this->authorize('create', Commission::class); + + $request->validate([ + 'invoice_id' => ['required', Rule::exists('invoices', 'id')], + ]); + + $invoice = Invoice::with('items', 'payments')->findOrFail($request->invoice_id); + + $rule = CommissionRule::where('user_id', $invoice->assigned_to_user_id) + ->where('is_active', true) + ->where('tenant_id', app('tenant')->id) + ->first(); + + if (!$rule) { + return back()->with('error', 'No active commission rule for assigned user.'); + } + + $commission = Commission::create([ + 'tenant_id' => app('tenant')->id, + 'commission_rule_id' => $rule->id, + 'user_id' => $rule->user_id, + 'invoice_id' => $invoice->id, + 'invoice_amount' => $invoice->total, + 'commission_amount' => $rule->calculateCommission((float) $invoice->total), + 'status' => 'pending', + ]); + + return redirect()->route('finance.commissions.show', $commission); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/CommissionRuleController.php b/erp/app/Modules/Finance/Http/Controllers/CommissionRuleController.php new file mode 100644 index 00000000000..d28bdf94a3a --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/CommissionRuleController.php @@ -0,0 +1,98 @@ +authorize('viewAny', CommissionRule::class); + + $rules = CommissionRule::with('user') + ->latest() + ->paginate(15); + + return Inertia::render('Finance/CommissionRules/Index', [ + 'rules' => $rules, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commission Rules', 'href' => route('finance.commission-rules.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', CommissionRule::class); + + return Inertia::render('Finance/CommissionRules/Create', [ + 'users' => User::orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commission Rules', 'href' => route('finance.commission-rules.index')], + ['label' => 'New Rule'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', CommissionRule::class); + + $data = $request->validate([ + 'user_id' => ['required', Rule::exists('users', 'id')], + 'name' => ['required', 'string', 'max:255'], + 'rate' => ['required_if:type,percentage', 'nullable', 'numeric', 'min:0', 'max:1'], + 'type' => ['required', Rule::in(['percentage', 'fixed'])], + 'fixed_amount' => ['required_if:type,fixed', 'nullable', 'numeric', 'min:0'], + ]); + + $rule = CommissionRule::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'user_id' => $data['user_id'], + 'name' => $data['name'], + 'type' => $data['type'], + 'rate' => $data['rate'] ?? 0, + 'fixed_amount' => $data['fixed_amount'] ?? null, + 'is_active' => $request->boolean('is_active', true), + ]); + + return redirect()->route('finance.commission-rules.show', $rule) + ->with('success', 'Commission rule created.'); + } + + public function show(CommissionRule $commissionRule): Response + { + $this->authorize('view', $commissionRule); + + $commissionRule->load(['user', 'commissions.invoice']); + + return Inertia::render('Finance/CommissionRules/Show', [ + 'rule' => $commissionRule, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Commission Rules', 'href' => route('finance.commission-rules.index')], + ['label' => $commissionRule->name], + ], + ]); + } + + public function destroy(CommissionRule $commissionRule): RedirectResponse + { + $this->authorize('delete', $commissionRule); + + $commissionRule->delete(); + + return redirect()->route('finance.commission-rules.index') + ->with('success', 'Commission rule deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/Concerns/SendsDocuments.php b/erp/app/Modules/Finance/Http/Controllers/Concerns/SendsDocuments.php new file mode 100644 index 00000000000..9e0692e5168 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/Concerns/SendsDocuments.php @@ -0,0 +1,44 @@ +output(); + } + + private function resolveCompanyName(): string + { + try { + return app('tenant')->name; + } catch (\Throwable) { + return config('app.name', 'ERP'); + } + } + + private function sendDocumentEmail( + Request $request, + string $toEmail, + string $subject, + string $pdfData, + string $filename, + ): void { + $company = $this->resolveCompanyName(); + $messageBody = $request->input('message', ''); + + Mail::to($toEmail)->send(new DocumentMail( + mailSubject: $subject, + pdfData: $pdfData, + filename: $filename, + company: $company, + messageBody: $messageBody, + )); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ContactController.php b/erp/app/Modules/Finance/Http/Controllers/ContactController.php new file mode 100644 index 00000000000..4a86f0e393c --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ContactController.php @@ -0,0 +1,95 @@ +authorize('viewAny', Contact::class); + + $contacts = Contact::when($request->search, fn ($q) => $q->search($request->search)) + ->when($request->type, fn ($q) => $q->where('type', $request->type)) + ->orderBy('name') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/Contacts/Index', [ + 'contacts' => ContactResource::collection($contacts), + 'filters' => $request->only(['search', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contacts', 'href' => route('finance.contacts.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Contact::class); + + return Inertia::render('Finance/Contacts/Create', [ + 'priceLists' => PriceList::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contacts', 'href' => route('finance.contacts.index')], + ['label' => 'New Contact'], + ], + ]); + } + + public function store(StoreContactRequest $request): RedirectResponse + { + $this->authorize('create', Contact::class); + + Contact::create([...$request->validated(), 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('finance.contacts.index') + ->with('success', 'Contact created.'); + } + + public function edit(Contact $contact): Response + { + $this->authorize('update', $contact); + + return Inertia::render('Finance/Contacts/Edit', [ + 'contact' => new ContactResource($contact), + 'priceLists' => PriceList::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contacts', 'href' => route('finance.contacts.index')], + ['label' => $contact->name . ' — Edit'], + ], + ]); + } + + public function update(StoreContactRequest $request, Contact $contact): RedirectResponse + { + $this->authorize('update', $contact); + + $contact->update($request->validated()); + + return redirect()->route('finance.contacts.index') + ->with('success', 'Contact updated.'); + } + + public function destroy(Contact $contact): RedirectResponse + { + $this->authorize('delete', $contact); + + $contact->delete(); + + return redirect()->route('finance.contacts.index') + ->with('success', 'Contact deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ContractController.php b/erp/app/Modules/Finance/Http/Controllers/ContractController.php new file mode 100644 index 00000000000..213929c4506 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ContractController.php @@ -0,0 +1,165 @@ +authorize('viewAny', Contract::class); + + $contracts = Contract::with('contact') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->type, fn ($q) => $q->where('type', $request->type)) + ->latest() + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Finance/Contracts/Index', [ + 'contracts' => $contracts, + 'filters' => $request->only(['status', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contracts', 'href' => route('finance.contracts.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Contract::class); + + return Inertia::render('Finance/Contracts/Create', [ + 'contacts' => Contact::orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contracts', 'href' => route('finance.contracts.index')], + ['label' => 'New Contract'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Contract::class); + + $data = $request->validate([ + 'title' => ['required', 'string', 'max:255'], + 'reference' => ['nullable', 'string', 'max:100'], + 'contact_id' => ['nullable', Rule::exists('contacts', 'id')], + 'type' => ['required', Rule::in(['client', 'vendor', 'employment', 'nda', 'other'])], + 'status' => ['nullable', Rule::in(['draft', 'active', 'expired', 'terminated'])], + 'value' => ['nullable', 'numeric', 'min:0'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'start_date' => ['nullable', 'date'], + 'end_date' => ['nullable', 'date', 'after_or_equal:start_date'], + 'auto_renew' => ['boolean'], + 'renewal_notice_days' => ['nullable', 'integer', 'min:0'], + 'description' => ['nullable', 'string'], + 'terms' => ['nullable', 'string'], + ]); + + $contract = Contract::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('finance.contracts.show', $contract) + ->with('success', 'Contract created.'); + } + + public function show(Contract $contract): Response + { + $this->authorize('view', $contract); + + $contract->load('contact'); + + return Inertia::render('Finance/Contracts/Show', [ + 'contract' => $contract, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contracts', 'href' => route('finance.contracts.index')], + ['label' => $contract->title], + ], + ]); + } + + public function edit(Contract $contract): Response + { + $this->authorize('create', Contract::class); + + return Inertia::render('Finance/Contracts/Edit', [ + 'contract' => $contract, + 'contacts' => Contact::orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contracts', 'href' => route('finance.contracts.index')], + ['label' => $contract->title, 'href' => route('finance.contracts.show', $contract)], + ['label' => 'Edit'], + ], + ]); + } + + public function update(Request $request, Contract $contract): RedirectResponse + { + $this->authorize('create', Contract::class); + + $data = $request->validate([ + 'title' => ['required', 'string', 'max:255'], + 'reference' => ['nullable', 'string', 'max:100'], + 'contact_id' => ['nullable', Rule::exists('contacts', 'id')], + 'type' => ['required', Rule::in(['client', 'vendor', 'employment', 'nda', 'other'])], + 'status' => ['nullable', Rule::in(['draft', 'active', 'expired', 'terminated'])], + 'value' => ['nullable', 'numeric', 'min:0'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'start_date' => ['nullable', 'date'], + 'end_date' => ['nullable', 'date', 'after_or_equal:start_date'], + 'auto_renew' => ['boolean'], + 'renewal_notice_days' => ['nullable', 'integer', 'min:0'], + 'description' => ['nullable', 'string'], + 'terms' => ['nullable', 'string'], + ]); + + $contract->update($data); + + return redirect()->route('finance.contracts.show', $contract) + ->with('success', 'Contract updated.'); + } + + public function destroy(Contract $contract): RedirectResponse + { + $this->authorize('delete', $contract); + + $contract->delete(); + + return redirect()->route('finance.contracts.index') + ->with('success', 'Contract deleted.'); + } + + public function activate(Contract $contract): RedirectResponse + { + $this->authorize('create', Contract::class); + + $contract->activate(); + + return back()->with('success', 'Contract activated.'); + } + + public function terminate(Contract $contract): RedirectResponse + { + $this->authorize('create', Contract::class); + + $contract->terminate(); + + return back()->with('success', 'Contract terminated.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/CreditNoteController.php b/erp/app/Modules/Finance/Http/Controllers/CreditNoteController.php new file mode 100644 index 00000000000..ebfa41c8c19 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/CreditNoteController.php @@ -0,0 +1,144 @@ +authorize('viewAny', CreditNote::class); + + $creditNotes = CreditNote::with(['contact']) + ->orderByDesc('issue_date') + ->paginate(25); + + return Inertia::render('Finance/CreditNotes/Index', compact('creditNotes')); + } + + public function create(Request $request): Response + { + $this->authorize('create', CreditNote::class); + + $contacts = Contact::orderBy('name')->get(['id', 'name', 'type']); + $invoices = Invoice::where('status', 'sent') + ->orderByDesc('issue_date')->get(['id', 'number']); + $bills = Bill::where('status', 'received') + ->orderByDesc('issue_date')->get(['id', 'number']); + $type = $request->get('type', 'sale'); + + return Inertia::render('Finance/CreditNotes/Create', compact('contacts', 'invoices', 'bills', 'type')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', CreditNote::class); + + $data = $request->validate([ + 'reference' => 'required|string|max:100', + 'contact_id' => 'nullable|exists:contacts,id', + 'original_invoice_id' => 'nullable|exists:invoices,id', + 'original_bill_id' => 'nullable|exists:bills,id', + 'type' => 'required|in:sale,purchase', + 'issue_date' => 'required|date', + 'currency_code' => 'required|string|size:3', + 'exchange_rate' => 'required|numeric|min:0.000001', + 'notes' => 'nullable|string', + 'items' => 'required|array|min:1', + 'items.*.description' => 'required|string', + 'items.*.quantity' => 'required|numeric|min:0.01', + 'items.*.unit_price' => 'required|numeric|min:0', + 'items.*.tax_rate' => 'required|numeric|min:0|max:100', + ]); + + $cn = CreditNote::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'reference' => $data['reference'], + 'contact_id' => $data['contact_id'] ?? null, + 'original_invoice_id' => $data['original_invoice_id'] ?? null, + 'original_bill_id' => $data['original_bill_id'] ?? null, + 'type' => $data['type'], + 'status' => 'draft', + 'issue_date' => $data['issue_date'], + 'currency_code' => $data['currency_code'], + 'exchange_rate' => $data['exchange_rate'], + 'notes' => $data['notes'] ?? null, + 'subtotal' => 0, + 'tax_total' => 0, + 'total' => 0, + 'amount_applied' => 0, + ]); + + foreach ($data['items'] as $item) { + $cn->items()->create([ + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + 'line_total' => round($item['quantity'] * $item['unit_price'], 2), + ]); + } + + // Recalculate totals explicitly after items are created + $cn->refresh()->load('items'); + $subtotal = $cn->items->sum('line_total'); + $tax_total = $cn->items->sum(fn ($i) => $i->line_total * $i->tax_rate / 100); + $cn->update([ + 'subtotal' => $subtotal, + 'tax_total' => $tax_total, + 'total' => $subtotal + $tax_total, + ]); + + return redirect()->route('finance.credit-notes.show', $cn) + ->with('success', 'Credit note created.'); + } + + public function show(CreditNote $creditNote): Response + { + $this->authorize('view', $creditNote); + + $creditNote->load(['contact', 'invoice', 'bill', 'items']); + + return Inertia::render('Finance/CreditNotes/Show', compact('creditNote')); + } + + public function issue(CreditNote $creditNote): RedirectResponse + { + $this->authorize('update', $creditNote); + + abort_unless($creditNote->status === 'draft', 422, 'Only draft credit notes can be issued.'); + $creditNote->update(['status' => 'issued']); + + return back()->with('success', 'Credit note issued.'); + } + + public function void(CreditNote $creditNote): RedirectResponse + { + $this->authorize('update', $creditNote); + + abort_unless(in_array($creditNote->status, ['draft', 'issued']), 422, 'Cannot void applied credit notes.'); + $creditNote->update(['status' => 'void']); + + return back()->with('success', 'Credit note voided.'); + } + + public function destroy(CreditNote $creditNote): RedirectResponse + { + $this->authorize('delete', $creditNote); + + abort_unless($creditNote->status === 'draft', 422, 'Only draft credit notes can be deleted.'); + $creditNote->delete(); + + return redirect()->route('finance.credit-notes.index') + ->with('success', 'Credit note deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/CustomerPortalController.php b/erp/app/Modules/Finance/Http/Controllers/CustomerPortalController.php new file mode 100644 index 00000000000..c0c047f30ae --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/CustomerPortalController.php @@ -0,0 +1,125 @@ +authorize('create', Invoice::class); + + $validated = $request->validate([ + 'email' => ['required', 'email'], + 'expires_days' => ['nullable', 'integer', 'min:1', 'max:365'], + ]); + + $days = $validated['expires_days'] ?? 30; + + $token = CustomerPortalToken::generate( + $contact->tenant_id, + $contact->id, + $validated['email'], + (int) $days, + ); + + return redirect()->back()->with('portal_url', route('portal.show', $token->token)); + } + + /** + * Public portal: show the customer's invoices. + */ + public function show(string $token): Response + { + $portalToken = CustomerPortalToken::where('token', $token)->firstOrFail(); + + if ($portalToken->is_expired) { + abort(403, 'This portal link has expired.'); + } + + $portalToken->update(['last_accessed_at' => now()]); + + $contact = $portalToken->contact()->with([ + 'invoices' => function ($query) { + $query->whereIn('status', ['sent', 'partial', 'paid']) + ->latest('issue_date') + ->limit(20); + }, + ])->firstOrFail(); + + return Inertia::render('Portal/Show', [ + 'token' => $token, + 'contact' => [ + 'id' => $contact->id, + 'name' => $contact->name, + ], + 'invoices' => $contact->invoices->map(fn (Invoice $inv) => [ + 'id' => $inv->id, + 'number' => $inv->number, + 'issue_date' => $inv->issue_date?->toDateString(), + 'due_date' => $inv->due_date?->toDateString(), + 'status' => $inv->status, + 'total' => $inv->total, + 'amount_due' => $inv->amount_due, + ]), + ]); + } + + /** + * Public portal: show a specific invoice detail. + */ + public function invoice(string $token, int $invoiceId): Response + { + $portalToken = CustomerPortalToken::where('token', $token)->firstOrFail(); + + if ($portalToken->is_expired) { + abort(403, 'This portal link has expired.'); + } + + $invoice = Invoice::with('items')->findOrFail($invoiceId); + + if ($invoice->contact_id !== $portalToken->contact_id) { + abort(403, 'Access denied.'); + } + + return Inertia::render('Portal/Invoice', [ + 'token' => $token, + 'invoice' => [ + 'id' => $invoice->id, + 'number' => $invoice->number, + 'issue_date' => $invoice->issue_date?->toDateString(), + 'due_date' => $invoice->due_date?->toDateString(), + 'status' => $invoice->status, + 'notes' => $invoice->notes, + 'subtotal' => $invoice->subtotal, + 'tax_total' => $invoice->tax_total, + 'total' => $invoice->total, + 'amount_due' => $invoice->amount_due, + 'items' => $invoice->items->map(fn ($item) => [ + 'id' => $item->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + 'line_total' => $item->line_total, + ]), + ], + 'contact' => [ + 'id' => $portalToken->contact->id, + 'name' => $portalToken->contact->name, + ], + ]); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/DeliveryNoteController.php b/erp/app/Modules/Finance/Http/Controllers/DeliveryNoteController.php new file mode 100644 index 00000000000..1fc448b04e0 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/DeliveryNoteController.php @@ -0,0 +1,119 @@ +authorize('viewAny', DeliveryNote::class); + $deliveryNotes = DeliveryNote::with(['contact', 'salesOrder', 'invoice']) + ->orderByDesc('created_at') + ->paginate(25); + return Inertia::render('Finance/DeliveryNotes/Index', compact('deliveryNotes')); + } + + public function create(Request $request): Response + { + $this->authorize('create', DeliveryNote::class); + $contacts = Contact::where('type', 'customer')->orWhere('type', 'both')->orderBy('name')->get(['id', 'name']); + $salesOrders = SalesOrder::whereIn('status', ['confirmed', 'invoiced'])->orderByDesc('order_date')->get(['id', 'reference', 'number']); + $invoices = Invoice::whereIn('status', ['sent', 'partial'])->orderByDesc('issue_date')->get(['id', 'reference']); + $products = Product::orderBy('name')->get(['id', 'name', 'sku']); + $salesOrderId = $request->get('sales_order_id'); + $invoiceId = $request->get('invoice_id'); + return Inertia::render('Finance/DeliveryNotes/Create', compact('contacts', 'salesOrders', 'invoices', 'products', 'salesOrderId', 'invoiceId')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', DeliveryNote::class); + $data = $request->validate([ + 'reference' => 'required|string|max:100|unique:delivery_notes,reference', + 'sales_order_id' => 'nullable|exists:sales_orders,id', + 'invoice_id' => 'nullable|exists:invoices,id', + 'contact_id' => 'nullable|exists:contacts,id', + 'carrier' => 'nullable|string|max:100', + 'tracking_number' => 'nullable|string|max:100', + 'dispatch_date' => 'nullable|date', + 'notes' => 'nullable|string', + 'items' => 'required|array|min:1', + 'items.*.description' => 'required|string', + 'items.*.product_id' => 'nullable|exists:products,id', + 'items.*.quantity' => 'required|numeric|min:0.01', + ]); + + $dn = DeliveryNote::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'reference' => $data['reference'], + 'sales_order_id' => $data['sales_order_id'] ?? null, + 'invoice_id' => $data['invoice_id'] ?? null, + 'contact_id' => $data['contact_id'] ?? null, + 'carrier' => $data['carrier'] ?? null, + 'tracking_number' => $data['tracking_number'] ?? null, + 'dispatch_date' => $data['dispatch_date'] ?? null, + 'status' => 'draft', + 'notes' => $data['notes'] ?? null, + ]); + + foreach ($data['items'] as $item) { + $dn->items()->create([ + 'product_id' => $item['product_id'] ?? null, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + ]); + } + + return redirect()->route('finance.delivery-notes.show', $dn)->with('success', 'Delivery note created.'); + } + + public function show(DeliveryNote $deliveryNote): Response + { + $this->authorize('view', $deliveryNote); + $deliveryNote->load(['contact', 'salesOrder', 'invoice', 'items.product']); + return Inertia::render('Finance/DeliveryNotes/Show', compact('deliveryNote')); + } + + public function dispatch(DeliveryNote $deliveryNote, Request $request): RedirectResponse + { + $this->authorize('update', $deliveryNote); + abort_unless($deliveryNote->status === 'draft', 422, 'Only draft notes can be dispatched.'); + $request->validate(['dispatch_date' => 'nullable|date']); + $deliveryNote->update([ + 'status' => 'dispatched', + 'dispatch_date' => $request->dispatch_date ?? now()->toDateString(), + ]); + return back()->with('success', 'Delivery note dispatched.'); + } + + public function deliver(DeliveryNote $deliveryNote, Request $request): RedirectResponse + { + $this->authorize('update', $deliveryNote); + abort_unless($deliveryNote->status === 'dispatched', 422, 'Only dispatched notes can be marked delivered.'); + $request->validate(['delivery_date' => 'nullable|date']); + $deliveryNote->update([ + 'status' => 'delivered', + 'delivery_date' => $request->delivery_date ?? now()->toDateString(), + ]); + return back()->with('success', 'Delivery confirmed.'); + } + + public function destroy(DeliveryNote $deliveryNote): RedirectResponse + { + $this->authorize('delete', $deliveryNote); + abort_unless($deliveryNote->status === 'draft', 422, 'Only draft delivery notes can be deleted.'); + $deliveryNote->delete(); + return redirect()->route('finance.delivery-notes.index')->with('success', 'Delivery note deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/DocumentTemplateController.php b/erp/app/Modules/Finance/Http/Controllers/DocumentTemplateController.php new file mode 100644 index 00000000000..70a10eb7cba --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/DocumentTemplateController.php @@ -0,0 +1,133 @@ +authorize('viewAny', DocumentTemplate::class); + + $query = DocumentTemplate::orderByDesc('created_at'); + + if ($request->filled('type')) { + $query->forType($request->type); + } + + $templates = $query->paginate(15)->withQueryString(); + + return Inertia::render('Finance/DocumentTemplates/Index', [ + 'templates' => $templates, + 'filter' => ['type' => $request->get('type', '')], + ]); + } + + public function create(): Response + { + $this->authorize('create', DocumentTemplate::class); + + return Inertia::render('Finance/DocumentTemplates/Create'); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', DocumentTemplate::class); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'type' => ['required', Rule::in(['invoice', 'quote', 'letter', 'receipt', 'purchase_order'])], + 'subject' => ['nullable', 'string', 'max:255'], + 'body' => ['required', 'string'], + 'variables' => ['nullable', 'array'], + 'is_default' => ['boolean'], + 'is_active' => ['boolean'], + ]); + + $template = DocumentTemplate::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'name' => $data['name'], + 'type' => $data['type'], + 'subject' => $data['subject'] ?? null, + 'body' => $data['body'], + 'variables' => $data['variables'] ?? null, + 'is_default' => $data['is_default'] ?? false, + 'is_active' => $data['is_active'] ?? true, + ]); + + return redirect()->route('finance.document-templates.show', $template) + ->with('success', 'Document template created.'); + } + + public function show(DocumentTemplate $documentTemplate): Response + { + $this->authorize('view', $documentTemplate); + + return Inertia::render('Finance/DocumentTemplates/Show', [ + 'template' => $documentTemplate, + ]); + } + + public function edit(DocumentTemplate $documentTemplate): Response + { + $this->authorize('create', DocumentTemplate::class); + + return Inertia::render('Finance/DocumentTemplates/Edit', [ + 'template' => $documentTemplate, + ]); + } + + public function update(Request $request, DocumentTemplate $documentTemplate): RedirectResponse + { + $this->authorize('create', DocumentTemplate::class); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'type' => ['required', Rule::in(['invoice', 'quote', 'letter', 'receipt', 'purchase_order'])], + 'subject' => ['nullable', 'string', 'max:255'], + 'body' => ['required', 'string'], + 'variables' => ['nullable', 'array'], + 'is_default' => ['boolean'], + 'is_active' => ['boolean'], + ]); + + $documentTemplate->update($data); + + return redirect()->route('finance.document-templates.show', $documentTemplate) + ->with('success', 'Document template updated.'); + } + + public function destroy(DocumentTemplate $documentTemplate): RedirectResponse + { + $this->authorize('delete', $documentTemplate); + + $documentTemplate->delete(); + + return redirect()->route('finance.document-templates.index') + ->with('success', 'Document template deleted.'); + } + + public function preview(Request $request): JsonResponse + { + $this->authorize('viewAny', DocumentTemplate::class); + + $request->validate([ + 'type' => ['required', Rule::in(['invoice', 'quote', 'letter', 'receipt', 'purchase_order'])], + 'data' => ['nullable', 'json'], + ]); + + $template = DocumentTemplate::forType($request->type)->active()->firstOrFail(); + + $data = $request->filled('data') ? json_decode($request->data, true) : []; + + return response()->json(['html' => $template->render($data)]); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ExchangeRateController.php b/erp/app/Modules/Finance/Http/Controllers/ExchangeRateController.php new file mode 100644 index 00000000000..d90b24db8cb --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ExchangeRateController.php @@ -0,0 +1,120 @@ +authorize('viewAny', ExchangeRate::class); + + $tenantId = $request->user()->tenant_id; + + $rates = ExchangeRate::withoutGlobalScopes() + ->where('tenant_id', $tenantId) + ->orderByDesc('effective_date') + ->orderBy('base_currency') + ->orderBy('quote_currency') + ->paginate(20); + + return Inertia::render('Finance/ExchangeRates/Index', [ + 'rates' => $rates, + ]); + } + + public function create(): Response + { + $this->authorize('create', ExchangeRate::class); + + return Inertia::render('Finance/ExchangeRates/Create'); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', ExchangeRate::class); + + $tenantId = app('tenant')->id; + + $validated = $request->validate([ + 'base_currency' => ['required', 'string', 'size:3'], + 'quote_currency' => ['required', 'string', 'size:3', 'different:base_currency'], + 'rate' => ['required', 'numeric', 'min:0.000001'], + 'effective_date' => [ + 'required', + 'date', + Rule::unique('exchange_rates')->where(fn ($q) => $q + ->where('base_currency', $request->input('base_currency')) + ->where('quote_currency', $request->input('quote_currency')) + ->where('tenant_id', $tenantId) + ->whereDate('effective_date', $request->input('effective_date')) + ), + ], + 'source' => ['nullable', 'string', 'max:100'], + ]); + + ExchangeRate::create(array_merge($validated, ['tenant_id' => $tenantId])); + + return redirect()->route('finance.exchange-rates.index') + ->with('success', 'Exchange rate created.'); + } + + public function destroy(ExchangeRate $exchangeRate): RedirectResponse + { + $this->authorize('delete', $exchangeRate); + + $exchangeRate->delete(); + + return redirect()->route('finance.exchange-rates.index') + ->with('success', 'Exchange rate deleted.'); + } + + public function report(Request $request): Response + { + $this->authorize('viewAny', ExchangeRate::class); + + $tenantId = $request->user()->tenant_id; + $today = now()->toDateString(); + $ago30 = now()->subDays(30)->toDateString(); + + // Get all unique currency pairs for this tenant + $pairs = ExchangeRate::withoutGlobalScopes() + ->where('tenant_id', $tenantId) + ->select('base_currency', 'quote_currency') + ->distinct() + ->get(); + + $rows = []; + foreach ($pairs as $pair) { + $currentRate = ExchangeRate::getRate($tenantId, $pair->base_currency, $pair->quote_currency, $today); + $priorRate = ExchangeRate::getRate($tenantId, $pair->base_currency, $pair->quote_currency, $ago30); + + $change = null; + if ($priorRate !== null && $priorRate != 0 && $currentRate !== null) { + $change = round((($currentRate - $priorRate) / $priorRate) * 100, 2); + } + + $rows[] = [ + 'pair' => $pair->base_currency . '/' . $pair->quote_currency, + 'base_currency' => $pair->base_currency, + 'quote_currency' => $pair->quote_currency, + 'current_rate' => $currentRate, + 'prior_rate' => $priorRate, + 'change_pct' => $change, + ]; + } + + return Inertia::render('Finance/ExchangeRates/Report', [ + 'rows' => $rows, + 'asOf' => $today, + 'ago30' => $ago30, + ]); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/FixedAssetController.php b/erp/app/Modules/Finance/Http/Controllers/FixedAssetController.php new file mode 100644 index 00000000000..d8e9f8cbca0 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/FixedAssetController.php @@ -0,0 +1,174 @@ +authorize('viewAny', FixedAsset::class); + + $assets = FixedAsset::orderBy('name') + ->get() + ->map(fn ($a) => [ + 'id' => $a->id, + 'code' => $a->code, + 'name' => $a->name, + 'category' => $a->category, + 'purchase_cost' => $a->purchase_cost, + 'accumulated_depreciation' => $a->accumulated_depreciation, + 'net_book_value' => $a->net_book_value, + 'status' => $a->status, + ]); + + return Inertia::render('Finance/FixedAssets/Index', [ + 'assets' => $assets, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Fixed Assets'], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', FixedAsset::class); + + $assetAccounts = Account::where('type', 'asset') + ->where('is_active', true) + ->orderBy('code') + ->get(['id', 'code', 'name']); + + $expenseAccounts = Account::where('type', 'expense') + ->where('is_active', true) + ->orderBy('code') + ->get(['id', 'code', 'name']); + + return Inertia::render('Finance/FixedAssets/Create', [ + 'assetAccounts' => $assetAccounts, + 'expenseAccounts' => $expenseAccounts, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Fixed Assets', 'href' => '/finance/fixed-assets'], + ['label' => 'New Asset'], + ], + ]); + } + + public function store(StoreFixedAssetRequest $request): RedirectResponse + { + $this->authorize('create', FixedAsset::class); + + $asset = FixedAsset::create(array_merge( + $request->validated(), + [ + 'tenant_id' => $request->user()->tenant_id, + 'created_by' => $request->user()->id, + ] + )); + + $asset->code = 'FA-' . str_pad($asset->id, 5, '0', STR_PAD_LEFT); + $asset->save(); + + return redirect()->route('finance.fixed-assets.show', $asset) + ->with('success', 'Fixed asset created successfully.'); + } + + public function show(FixedAsset $fixedAsset): Response + { + $this->authorize('view', $fixedAsset); + + $entries = $fixedAsset->depreciationEntries() + ->orderByDesc('period_date') + ->get() + ->map(fn ($e) => [ + 'id' => $e->id, + 'period_date' => $e->period_date->toDateString(), + 'amount' => (float) $e->amount, + 'journal_entry_id' => $e->journal_entry_id, + ]); + + return Inertia::render('Finance/FixedAssets/Show', [ + 'asset' => [ + 'id' => $fixedAsset->id, + 'code' => $fixedAsset->code, + 'name' => $fixedAsset->name, + 'category' => $fixedAsset->category, + 'description' => $fixedAsset->description, + 'purchase_date' => $fixedAsset->purchase_date->toDateString(), + 'purchase_cost' => $fixedAsset->purchase_cost, + 'salvage_value' => $fixedAsset->salvage_value, + 'useful_life_years' => $fixedAsset->useful_life_years, + 'accumulated_depreciation' => $fixedAsset->accumulated_depreciation, + 'net_book_value' => $fixedAsset->net_book_value, + 'annual_depreciation' => $fixedAsset->annual_depreciation, + 'status' => $fixedAsset->status, + 'disposal_date' => $fixedAsset->disposal_date?->toDateString(), + 'disposal_proceeds' => $fixedAsset->disposal_proceeds, + 'asset_account_id' => $fixedAsset->asset_account_id, + 'depreciation_account_id' => $fixedAsset->depreciation_account_id, + ], + 'entries' => $entries, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Fixed Assets', 'href' => '/finance/fixed-assets'], + ['label' => $fixedAsset->name], + ], + ]); + } + + public function depreciate(Request $request, FixedAsset $fixedAsset): RedirectResponse + { + $this->authorize('update', $fixedAsset); + + $validated = $request->validate([ + 'period_date' => ['required', 'date'], + ]); + + try { + $fixedAsset->runDepreciation($validated['period_date']); + } catch (\DomainException $e) { + return back()->withErrors(['period_date' => $e->getMessage()]); + } + + return redirect()->route('finance.fixed-assets.show', $fixedAsset) + ->with('success', 'Depreciation recorded successfully.'); + } + + public function dispose(Request $request, FixedAsset $fixedAsset): RedirectResponse + { + $this->authorize('update', $fixedAsset); + + $validated = $request->validate([ + 'disposal_date' => ['required', 'date'], + 'disposal_proceeds' => ['nullable', 'numeric', 'min:0'], + ]); + + $fixedAsset->status = 'disposed'; + $fixedAsset->disposal_date = $validated['disposal_date']; + $fixedAsset->disposal_proceeds = $validated['disposal_proceeds'] ?? null; + $fixedAsset->save(); + + return redirect()->route('finance.fixed-assets.show', $fixedAsset) + ->with('success', 'Asset disposed successfully.'); + } + + public function destroy(FixedAsset $fixedAsset): RedirectResponse + { + $this->authorize('delete', $fixedAsset); + + $fixedAsset->delete(); + + return redirect()->route('finance.fixed-assets.index') + ->with('success', 'Fixed asset deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/InvoiceController.php b/erp/app/Modules/Finance/Http/Controllers/InvoiceController.php new file mode 100644 index 00000000000..aa30e2b51ef --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/InvoiceController.php @@ -0,0 +1,234 @@ +authorize('viewAny', Invoice::class); + + $invoices = Invoice::with('contact') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->contact_id, fn ($q) => $q->where('contact_id', $request->contact_id)) + ->when($request->search, fn ($q) => $q->where('number', 'like', "%{$request->search}%")) + ->latest('issue_date') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/Invoices/Index', [ + 'invoices' => InvoiceResource::collection($invoices), + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'contact_id', 'search']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Invoices', 'href' => route('finance.invoices.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Invoice::class); + + return Inertia::render('Finance/Invoices/Create', [ + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Invoices', 'href' => route('finance.invoices.index')], + ['label' => 'New Invoice'], + ], + ]); + } + + public function store(StoreInvoiceRequest $request): RedirectResponse + { + $this->authorize('create', Invoice::class); + + $data = $request->validated(); + + $invoice = DB::transaction(function () use ($data) { + $invoice = Invoice::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'] ?? null, + 'issue_date' => $data['issue_date'], + 'due_date' => $data['due_date'] ?? null, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + 'currency_code' => $data['currency_code'] ?? 'USD', + 'exchange_rate' => $data['exchange_rate'] ?? 1.0, + ]); + + $invoice->update([ + 'number' => 'INV-' . now()->format('Y') . '-' . str_pad((string) $invoice->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($data['items'] as $item) { + InvoiceItem::create([ + 'invoice_id' => $invoice->id, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + ]); + } + + return $invoice; + }); + + return redirect()->route('finance.invoices.show', $invoice) + ->with('success', 'Invoice created.'); + } + + public function show(Invoice $invoice): Response + { + $this->authorize('view', $invoice); + + $invoice->load(['contact', 'items', 'payments', 'creator', 'attachments']); + + return Inertia::render('Finance/Invoices/Show', [ + 'invoice' => new InvoiceResource($invoice), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Invoices', 'href' => route('finance.invoices.index')], + ['label' => $invoice->number ?? "Invoice #{$invoice->id}"], + ], + ]); + } + + public function send(Invoice $invoice): RedirectResponse + { + $this->authorize('update', $invoice); + + try { + $invoice->transitionTo('sent'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Invoice marked as sent.'); + } + + public function cancel(Invoice $invoice): RedirectResponse + { + $this->authorize('update', $invoice); + + try { + $invoice->transitionTo('cancelled'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Invoice cancelled.'); + } + + public function recordPayment(StorePaymentRequest $request, Invoice $invoice): RedirectResponse + { + $this->authorize('update', $invoice); + + $data = $request->validated(); + + DB::transaction(function () use ($data, $invoice) { + Payment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'invoice_id' => $invoice->id, + 'amount' => $data['amount'], + 'payment_date' => $data['payment_date'], + 'method' => $data['method'], + 'reference' => $data['reference'] ?? null, + 'notes' => $data['notes'] ?? null, + ]); + + $invoice->load(['items', 'payments']); + + if ($invoice->amount_due <= 0 && $invoice->canTransitionTo('paid')) { + $invoice->transitionTo('paid'); + } + }); + + return back()->with('success', 'Payment recorded.'); + } + + public function print(Invoice $invoice): Response + { + $this->authorize('view', $invoice); + + $invoice->load(['contact', 'items', 'payments', 'creator', 'attachments']); + + $tenantId = auth()->user()->tenant_id; + + return Inertia::render('Finance/Invoices/Print', [ + 'invoice' => new InvoiceResource($invoice), + 'company' => TenantSetting::getValue($tenantId, 'company_name', 'My Company'), + 'currency' => TenantSetting::getValue($tenantId, 'currency', 'USD'), + ]); + } + + public function destroy(Invoice $invoice): RedirectResponse + { + $this->authorize('delete', $invoice); + + $invoice->delete(); + + return redirect()->route('finance.invoices.index') + ->with('success', 'Invoice deleted.'); + } + + public function pdf(Invoice $invoice): \Illuminate\Http\Response + { + $this->authorize('view', $invoice); + $invoice->load(['items', 'contact', 'payments']); + $pdf = $this->renderDocumentPdf('pdf.invoice', [ + 'invoice' => $invoice, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'invoice-' . $invoice->number . '.pdf'; + return response($pdf, 200, [ + 'Content-Type' => 'application/pdf', + 'Content-Disposition' => 'attachment; filename="' . $filename . '"', + ]); + } + + public function email(Request $request, Invoice $invoice): \Illuminate\Http\RedirectResponse + { + $this->authorize('update', $invoice); + $request->validate(['email' => 'required|email', 'message' => 'nullable|string|max:1000']); + + $invoice->load(['items', 'contact', 'payments']); + $pdf = $this->renderDocumentPdf('pdf.invoice', [ + 'invoice' => $invoice, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'invoice-' . $invoice->number . '.pdf'; + + $this->sendDocumentEmail($request, $request->input('email'), 'Invoice ' . $invoice->number, $pdf, $filename); + + if ($invoice->status === 'draft') { + $invoice->transitionTo('sent'); + } + + return back()->with('success', 'Invoice emailed successfully.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/JournalEntryController.php b/erp/app/Modules/Finance/Http/Controllers/JournalEntryController.php new file mode 100644 index 00000000000..b27af22f9e8 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/JournalEntryController.php @@ -0,0 +1,127 @@ +authorize('viewAny', JournalEntry::class); + + $entries = JournalEntry::with('lines') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->search, fn ($q) => $q->where('description', 'like', "%{$request->search}%") + ->orWhere('reference', 'like', "%{$request->search}%")) + ->latest('date') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/JournalEntries/Index', [ + 'entries' => JournalEntryResource::collection($entries), + 'filters' => $request->only(['status', 'search']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Journal Entries', 'href' => route('finance.journal-entries.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', JournalEntry::class); + + return Inertia::render('Finance/JournalEntries/Create', [ + 'accounts' => Account::active()->orderBy('code')->get(['id', 'code', 'name', 'type']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Journal Entries', 'href' => route('finance.journal-entries.index')], + ['label' => 'New Entry'], + ], + ]); + } + + public function store(StoreJournalEntryRequest $request): RedirectResponse + { + $this->authorize('create', JournalEntry::class); + + $data = $request->validated(); + + $entry = DB::transaction(function () use ($data) { + $entry = JournalEntry::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'date' => $data['date'], + 'reference' => $data['reference'] ?? null, + 'description' => $data['description'], + 'created_by' => auth()->id(), + ]); + + foreach ($data['lines'] as $line) { + JournalLine::create([ + 'journal_entry_id' => $entry->id, + 'account_id' => $line['account_id'], + 'debit' => $line['debit'], + 'credit' => $line['credit'], + 'description' => $line['description'] ?? null, + ]); + } + + return $entry; + }); + + return redirect()->route('finance.journal-entries.show', $entry) + ->with('success', 'Journal entry created.'); + } + + public function show(JournalEntry $journalEntry): Response + { + $this->authorize('view', $journalEntry); + + $journalEntry->load(['lines.account', 'creator']); + + return Inertia::render('Finance/JournalEntries/Show', [ + 'entry' => new JournalEntryResource($journalEntry), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Journal Entries', 'href' => route('finance.journal-entries.index')], + ['label' => "JE #{$journalEntry->id}"], + ], + ]); + } + + public function post(JournalEntry $journalEntry): RedirectResponse + { + $this->authorize('update', $journalEntry); + + $journalEntry->load('lines'); + + try { + $journalEntry->post(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Journal entry posted.'); + } + + public function destroy(JournalEntry $journalEntry): RedirectResponse + { + $this->authorize('delete', $journalEntry); + + $journalEntry->delete(); + + return redirect()->route('finance.journal-entries.index') + ->with('success', 'Journal entry deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/PriceListController.php b/erp/app/Modules/Finance/Http/Controllers/PriceListController.php new file mode 100644 index 00000000000..73e2752be40 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/PriceListController.php @@ -0,0 +1,173 @@ +authorize('viewAny', PriceList::class); + + $priceLists = PriceList::withCount(['items', 'contacts']) + ->orderBy('name') + ->get(); + + return Inertia::render('Finance/PriceLists/Index', [ + 'priceLists' => $priceLists, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Price Lists', 'href' => route('finance.price-lists.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', PriceList::class); + + return Inertia::render('Finance/PriceLists/Create', [ + 'products' => Product::orderBy('name')->get(['id', 'name', 'sku', 'sale_price']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Price Lists', 'href' => route('finance.price-lists.index')], + ['label' => 'New Price List'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', PriceList::class); + + $data = $request->validate([ + 'name' => 'required|string|max:191', + 'description' => 'nullable|string', + 'currency_code' => 'nullable|string|size:3', + 'discount_percent' => 'nullable|numeric|min:0|max:100', + 'is_active' => 'boolean', + 'items' => 'nullable|array', + 'items.*.product_id' => 'required|exists:products,id', + 'items.*.unit_price' => 'required|numeric|min:0', + ]); + + $priceList = DB::transaction(function () use ($data, $request) { + $list = PriceList::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'name' => $data['name'], + 'description' => $data['description'] ?? null, + 'currency_code' => $data['currency_code'] ?? 'USD', + 'discount_percent' => $data['discount_percent'] ?? 0, + 'is_active' => $data['is_active'] ?? true, + ]); + + foreach ($data['items'] ?? [] as $item) { + PriceListItem::create([ + 'price_list_id' => $list->id, + 'product_id' => $item['product_id'], + 'unit_price' => $item['unit_price'], + ]); + } + + return $list; + }); + + return redirect()->route('finance.price-lists.show', $priceList) + ->with('success', 'Price list created.'); + } + + public function show(PriceList $priceList): Response + { + $this->authorize('view', $priceList); + + $priceList->load(['items.product', 'contacts']); + + return Inertia::render('Finance/PriceLists/Show', [ + 'priceList' => $priceList, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Price Lists', 'href' => route('finance.price-lists.index')], + ['label' => $priceList->name], + ], + ]); + } + + public function update(Request $request, PriceList $priceList): RedirectResponse + { + $this->authorize('update', $priceList); + + $data = $request->validate([ + 'name' => 'required|string|max:191', + 'description' => 'nullable|string', + 'currency_code' => 'nullable|string|size:3', + 'discount_percent' => 'nullable|numeric|min:0|max:100', + 'is_active' => 'boolean', + 'items' => 'nullable|array', + 'items.*.product_id' => 'required|exists:products,id', + 'items.*.unit_price' => 'required|numeric|min:0', + ]); + + DB::transaction(function () use ($data, $priceList) { + $priceList->update([ + 'name' => $data['name'], + 'description' => $data['description'] ?? null, + 'currency_code' => $data['currency_code'] ?? 'USD', + 'discount_percent' => $data['discount_percent'] ?? 0, + 'is_active' => $data['is_active'] ?? true, + ]); + + // Sync items + $priceList->items()->delete(); + foreach ($data['items'] ?? [] as $item) { + PriceListItem::create([ + 'price_list_id' => $priceList->id, + 'product_id' => $item['product_id'], + 'unit_price' => $item['unit_price'], + ]); + } + }); + + return redirect()->route('finance.price-lists.show', $priceList) + ->with('success', 'Price list updated.'); + } + + public function destroy(PriceList $priceList): RedirectResponse + { + $this->authorize('delete', $priceList); + + $priceList->delete(); + + return redirect()->route('finance.price-lists.index') + ->with('success', 'Price list deleted.'); + } + + public function priceForContact(Request $request) + { + $this->authorize('viewAny', PriceList::class); + + $data = $request->validate([ + 'contact_id' => 'required|exists:contacts,id', + 'product_id' => 'required|exists:products,id', + ]); + + $contact = Contact::find($data['contact_id']); + $product = Product::find($data['product_id']); + + if (!$contact->price_list_id) { + return response()->json(['price' => (float) $product->sale_price]); + } + + $price = PriceList::priceFor($contact->price_list_id, $data['product_id'], (float) $product->sale_price); + return response()->json(['price' => $price]); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ProjectController.php b/erp/app/Modules/Finance/Http/Controllers/ProjectController.php new file mode 100644 index 00000000000..deacae38dfb --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ProjectController.php @@ -0,0 +1,197 @@ +authorize('viewAny', Project::class); + + $projects = Project::withCount(['timeEntries']) + ->with('contact') + ->orderByDesc('created_at') + ->get() + ->map(fn ($p) => [ + 'id' => $p->id, + 'name' => $p->name, + 'description' => $p->description, + 'status' => $p->status, + 'budget' => $p->budget, + 'contact_id' => $p->contact_id, + 'invoice_id' => $p->invoice_id, + 'starts_on' => $p->starts_on?->toDateString(), + 'ends_on' => $p->ends_on?->toDateString(), + 'contact' => $p->contact ? ['id' => $p->contact->id, 'name' => $p->contact->name] : null, + 'time_entries_count' => $p->time_entries_count, + ]); + + return Inertia::render('Finance/Projects/Index', [ + 'projects' => $projects, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Projects'], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Project::class); + + $contacts = Contact::orderBy('name')->get(['id', 'name']); + + return Inertia::render('Finance/Projects/Create', [ + 'contacts' => $contacts, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Projects', 'href' => '/finance/projects'], + ['label' => 'New Project'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Project::class); + + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'description' => ['nullable', 'string'], + 'status' => ['required', 'in:draft,active,completed,cancelled'], + 'budget' => ['nullable', 'numeric', 'min:0'], + 'contact_id' => ['nullable', 'exists:contacts,id'], + 'invoice_id' => ['nullable', 'exists:invoices,id'], + 'starts_on' => ['nullable', 'date'], + 'ends_on' => ['nullable', 'date'], + ]); + + $project = Project::create(array_merge($validated, [ + 'tenant_id' => $request->user()->tenant_id, + ])); + + return redirect()->route('finance.projects.show', $project) + ->with('success', 'Project created successfully.'); + } + + public function show(Project $project): Response + { + $this->authorize('view', $project); + + $project->load(['timeEntries.user', 'contact', 'invoice', 'attachments']); + + return Inertia::render('Finance/Projects/Show', [ + 'project' => [ + 'id' => $project->id, + 'name' => $project->name, + 'description' => $project->description, + 'status' => $project->status, + 'budget' => $project->budget, + 'contact_id' => $project->contact_id, + 'invoice_id' => $project->invoice_id, + 'starts_on' => $project->starts_on?->toDateString(), + 'ends_on' => $project->ends_on?->toDateString(), + 'contact' => $project->contact ? ['id' => $project->contact->id, 'name' => $project->contact->name] : null, + 'invoice' => $project->invoice ? ['id' => $project->invoice->id, 'reference' => $project->invoice->number ?? '#' . $project->invoice->id] : null, + 'total_hours' => $project->total_hours, + 'billable_hours' => $project->billable_hours, + 'attachments' => $project->attachments->map(fn ($a) => [ + 'id' => $a->id, 'filename' => $a->filename, 'disk' => $a->disk, + 'path' => $a->path, 'mime_type' => $a->mime_type, 'size' => $a->size, + 'uploaded_by' => $a->uploaded_by, 'created_at' => $a->created_at?->toIso8601String(), + ]), + 'time_entries' => $project->timeEntries->map(fn ($e) => [ + 'id' => $e->id, + 'project_id' => $e->project_id, + 'user_id' => $e->user_id, + 'description' => $e->description, + 'hours' => $e->hours, + 'billable' => $e->billable, + 'billed' => $e->billed, + 'entry_date' => $e->entry_date->toDateString(), + 'user' => $e->user ? ['id' => $e->user->id, 'name' => $e->user->name] : null, + ]), + ], + 'contacts' => Contact::orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Projects', 'href' => '/finance/projects'], + ['label' => $project->name], + ], + ]); + } + + public function update(Request $request, Project $project): RedirectResponse + { + $this->authorize('update', $project); + + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'description' => ['nullable', 'string'], + 'status' => ['required', 'in:draft,active,completed,cancelled'], + 'budget' => ['nullable', 'numeric', 'min:0'], + 'contact_id' => ['nullable', 'exists:contacts,id'], + 'invoice_id' => ['nullable', 'exists:invoices,id'], + 'starts_on' => ['nullable', 'date'], + 'ends_on' => ['nullable', 'date'], + ]); + + $project->update($validated); + + return redirect()->route('finance.projects.show', $project) + ->with('success', 'Project updated successfully.'); + } + + public function destroy(Project $project): RedirectResponse + { + $this->authorize('delete', $project); + + $project->delete(); + + return redirect()->route('finance.projects.index') + ->with('success', 'Project deleted.'); + } + + public function storeTimeEntry(Request $request, Project $project): RedirectResponse + { + $this->authorize('update', $project); + + $validated = $request->validate([ + 'description' => ['required', 'string'], + 'hours' => ['required', 'numeric', 'min:0.1'], + 'billable' => ['boolean'], + 'entry_date' => ['required', 'date'], + ]); + + $project->timeEntries()->create(array_merge($validated, [ + 'user_id' => auth()->id(), + ])); + + return back()->with('success', 'Time entry logged.'); + } + + public function markBilled(Request $request, Project $project): RedirectResponse + { + $this->authorize('update', $project); + + $validated = $request->validate([ + 'entry_ids' => ['array'], + 'entry_ids.*' => ['exists:project_time_entries,id'], + ]); + + ProjectTimeEntry::whereIn('id', $validated['entry_ids'] ?? []) + ->where('project_id', $project->id) + ->update(['billed' => true]); + + return back()->with('success', 'Entries marked as billed.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/QuoteController.php b/erp/app/Modules/Finance/Http/Controllers/QuoteController.php new file mode 100644 index 00000000000..b49323b9063 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/QuoteController.php @@ -0,0 +1,244 @@ +authorize('viewAny', Quote::class); + + $quotes = Quote::with('contact') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->contact_id, fn ($q) => $q->where('contact_id', $request->contact_id)) + ->when($request->search, fn ($q) => $q->where('number', 'like', "%{$request->search}%")) + ->latest('issue_date') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/Quotes/Index', [ + 'quotes' => QuoteResource::collection($quotes), + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'contact_id', 'search']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Quotes', 'href' => route('finance.quotes.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Quote::class); + + return Inertia::render('Finance/Quotes/Create', [ + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'currencies' => $this->currencies, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Quotes', 'href' => route('finance.quotes.index')], + ['label' => 'New Quote'], + ], + ]); + } + + public function store(StoreQuoteRequest $request): RedirectResponse + { + $this->authorize('create', Quote::class); + + $data = $request->validated(); + + $quote = DB::transaction(function () use ($data) { + $quote = Quote::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'] ?? null, + 'issue_date' => $data['issue_date'], + 'expiry_date' => $data['expiry_date'] ?? null, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + 'currency_code' => $data['currency_code'] ?? 'USD', + 'exchange_rate' => $data['exchange_rate'] ?? 1.0, + ]); + + $quote->update([ + 'number' => 'QUOTE-' . now()->format('Y') . '-' . str_pad((string) $quote->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($data['items'] as $item) { + QuoteItem::create([ + 'quote_id' => $quote->id, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + ]); + } + + return $quote; + }); + + return redirect()->route('finance.quotes.show', $quote) + ->with('success', 'Quote created.'); + } + + public function show(Quote $quote): Response + { + $this->authorize('view', $quote); + + $quote->load(['contact', 'items', 'creator']); + + return Inertia::render('Finance/Quotes/Show', [ + 'quote' => new QuoteResource($quote), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Quotes', 'href' => route('finance.quotes.index')], + ['label' => $quote->number ?? "Quote #{$quote->id}"], + ], + ]); + } + + public function send(Quote $quote): RedirectResponse + { + $this->authorize('update', $quote); + + try { + $quote->transitionTo('sent'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Quote marked as sent.'); + } + + public function accept(Quote $quote): RedirectResponse + { + $this->authorize('update', $quote); + + try { + $quote->transitionTo('accepted'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Quote accepted.'); + } + + public function decline(Quote $quote): RedirectResponse + { + $this->authorize('update', $quote); + + try { + $quote->transitionTo('declined'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Quote declined.'); + } + + public function convertToInvoice(Quote $quote): RedirectResponse + { + $this->authorize('update', $quote); + + if ($quote->status !== 'accepted') { + return back()->withErrors(['status' => 'Only accepted quotes can be converted to invoices.']); + } + + $invoice = DB::transaction(function () use ($quote) { + $quote->load('items'); + + $invoice = Invoice::create([ + 'tenant_id' => $quote->tenant_id, + 'contact_id' => $quote->contact_id, + 'issue_date' => now()->toDateString(), + 'status' => 'draft', + 'created_by' => auth()->id(), + ]); + + $invoice->update([ + 'number' => 'INV-' . now()->format('Y') . '-' . str_pad((string) $invoice->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($quote->items as $item) { + InvoiceItem::create([ + 'invoice_id' => $invoice->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + ]); + } + + return $invoice; + }); + + return redirect()->route('finance.invoices.show', $invoice) + ->with('success', 'Quote converted to invoice.'); + } + + public function destroy(Quote $quote): RedirectResponse + { + $this->authorize('delete', $quote); + + $quote->delete(); + + return redirect()->route('finance.quotes.index') + ->with('success', 'Quote deleted.'); + } + + public function pdf(Quote $quote): \Illuminate\Http\Response + { + $this->authorize('view', $quote); + $quote->load(['items', 'contact']); + $pdf = $this->renderDocumentPdf('pdf.quote', [ + 'quote' => $quote, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'quote-' . $quote->number . '.pdf'; + return response($pdf, 200, [ + 'Content-Type' => 'application/pdf', + 'Content-Disposition' => 'attachment; filename="' . $filename . '"', + ]); + } + + public function email(Request $request, Quote $quote): \Illuminate\Http\RedirectResponse + { + $this->authorize('update', $quote); + $request->validate(['email' => 'required|email', 'message' => 'nullable|string|max:1000']); + + $quote->load(['items', 'contact']); + $pdf = $this->renderDocumentPdf('pdf.quote', [ + 'quote' => $quote, + 'company' => $this->resolveCompanyName(), + ]); + $filename = 'quote-' . $quote->number . '.pdf'; + + $this->sendDocumentEmail($request, $request->input('email'), 'Quote ' . $quote->number, $pdf, $filename); + + if ($quote->status === 'draft') { + $quote->transitionTo('sent'); + } + + return back()->with('success', 'Quote emailed successfully.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ReconciliationController.php b/erp/app/Modules/Finance/Http/Controllers/ReconciliationController.php new file mode 100644 index 00000000000..d729604c150 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ReconciliationController.php @@ -0,0 +1,70 @@ +authorize('viewAny', BankTransaction::class); + $tenantId = $request->user()->tenant_id; + $accountId = $request->query('account_id'); + + $query = BankTransaction::where('tenant_id', $tenantId) + ->where('reconciled', false) + ->with(['bankAccount']) + ->orderBy('transaction_date'); + + if ($accountId) { + $query->where('bank_account_id', $accountId); + } + + $accounts = BankAccount::where('tenant_id', $tenantId)->get(); + + return Inertia::render('Finance/Reconciliation/Index', [ + 'transactions' => $query->paginate(50), + 'accounts' => $accounts, + 'account_id' => $accountId ? (int) $accountId : null, + ]); + } + + public function match(Request $request, BankTransaction $bankTransaction): RedirectResponse + { + $this->authorize('update', $bankTransaction); + $data = $request->validate([ + 'payment_id' => 'nullable|exists:payments,id', + 'journal_entry_id' => 'nullable|exists:journal_entries,id', + ]); + + if (empty($data['payment_id']) && empty($data['journal_entry_id'])) { + return back()->withErrors(['match' => 'Select a payment or journal entry to match.']); + } + + $bankTransaction->update([ + 'payment_id' => $data['payment_id'] ?? null, + 'journal_entry_id' => $data['journal_entry_id'] ?? null, + 'reconciled' => true, + ]); + + return back()->with('success', 'Transaction reconciled.'); + } + + public function unmatch(BankTransaction $bankTransaction): RedirectResponse + { + $this->authorize('update', $bankTransaction); + $bankTransaction->update([ + 'payment_id' => null, + 'journal_entry_id' => null, + 'reconciled' => false, + ]); + return back()->with('success', 'Transaction unmatched.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/RecurringInvoiceController.php b/erp/app/Modules/Finance/Http/Controllers/RecurringInvoiceController.php new file mode 100644 index 00000000000..656ce287267 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/RecurringInvoiceController.php @@ -0,0 +1,166 @@ +authorize('viewAny', RecurringInvoice::class); + + $recurringInvoices = RecurringInvoice::with('contact') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->contact_id, fn ($q) => $q->where('contact_id', $request->contact_id)) + ->latest() + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/RecurringInvoices/Index', [ + 'recurringInvoices' => RecurringInvoiceResource::collection($recurringInvoices), + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'contact_id']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Recurring Invoices', 'href' => route('finance.recurring-invoices.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', RecurringInvoice::class); + + return Inertia::render('Finance/RecurringInvoices/Create', [ + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Recurring Invoices', 'href' => route('finance.recurring-invoices.index')], + ['label' => 'New Recurring Invoice'], + ], + ]); + } + + public function store(StoreRecurringInvoiceRequest $request): RedirectResponse + { + $this->authorize('create', RecurringInvoice::class); + + $data = $request->validated(); + + $recurringInvoice = DB::transaction(function () use ($data) { + $recurringInvoice = RecurringInvoice::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'] ?? null, + 'reference_prefix' => $data['reference_prefix'] ?? 'REC-INV', + 'frequency' => $data['frequency'], + 'interval' => $data['interval'] ?? 1, + 'start_date' => $data['start_date'], + 'next_run_date' => $data['start_date'], + 'end_date' => $data['end_date'] ?? null, + 'due_days' => $data['due_days'], + 'auto_send' => (bool) ($data['auto_send'] ?? false), + 'currency_code' => $data['currency_code'] ?? 'USD', + 'exchange_rate' => $data['exchange_rate'] ?? 1, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + ]); + + foreach ($data['items'] as $item) { + RecurringInvoiceItem::create([ + 'recurring_invoice_id' => $recurringInvoice->id, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + ]); + } + + return $recurringInvoice; + }); + + return redirect()->route('finance.recurring-invoices.show', $recurringInvoice) + ->with('success', 'Recurring invoice created.'); + } + + public function show(RecurringInvoice $recurringInvoice): Response + { + $this->authorize('view', $recurringInvoice); + + $recurringInvoice->load(['contact', 'items', 'creator']); + + $generatedInvoices = $recurringInvoice->invoices() + ->latest('issue_date') + ->take(20) + ->get(['id', 'number', 'issue_date', 'status']); + + return Inertia::render('Finance/RecurringInvoices/Show', [ + 'recurringInvoice' => new RecurringInvoiceResource($recurringInvoice), + 'generatedInvoices' => $generatedInvoices, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Recurring Invoices', 'href' => route('finance.recurring-invoices.index')], + ['label' => "Recurring #{$recurringInvoice->id}"], + ], + ]); + } + + public function pause(RecurringInvoice $recurringInvoice): RedirectResponse + { + $this->authorize('update', $recurringInvoice); + + if ($recurringInvoice->status === 'active') { + $recurringInvoice->status = 'paused'; + $recurringInvoice->save(); + } + + return back()->with('success', 'Recurring invoice paused.'); + } + + public function resume(RecurringInvoice $recurringInvoice): RedirectResponse + { + $this->authorize('update', $recurringInvoice); + + if ($recurringInvoice->status === 'paused') { + $recurringInvoice->status = 'active'; + $recurringInvoice->save(); + } + + return back()->with('success', 'Recurring invoice resumed.'); + } + + public function generateNow(RecurringInvoice $recurringInvoice): RedirectResponse + { + $this->authorize('update', $recurringInvoice); + + if ($recurringInvoice->status !== 'active') { + return back()->withErrors(['status' => 'Only active templates can generate invoices.']); + } + + $invoice = $recurringInvoice->generateInvoice(); + + return redirect()->route('finance.invoices.show', $invoice) + ->with('success', 'Invoice generated.'); + } + + public function destroy(RecurringInvoice $recurringInvoice): RedirectResponse + { + $this->authorize('delete', $recurringInvoice); + + $recurringInvoice->delete(); + + return redirect()->route('finance.recurring-invoices.index') + ->with('success', 'Recurring invoice deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/ReportController.php b/erp/app/Modules/Finance/Http/Controllers/ReportController.php new file mode 100644 index 00000000000..47e83ad3732 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/ReportController.php @@ -0,0 +1,1432 @@ +authorize('viewAny', Account::class); + + $totals = JournalLine::select('account_id', + DB::raw('SUM(debit) as total_debit'), + DB::raw('SUM(credit) as total_credit') + ) + ->whereHas('journalEntry', fn ($q) => $q->where('status', 'posted')) + ->groupBy('account_id') + ->get() + ->keyBy('account_id'); + + $accounts = Account::with('parent') + ->orderBy('code') + ->get() + ->map(function (Account $account) use ($totals) { + $row = $totals->get($account->id); + return [ + 'id' => $account->id, + 'code' => $account->code, + 'name' => $account->name, + 'type' => $account->type, + 'parent_name' => $account->parent?->name, + 'total_debit' => (float) ($row?->total_debit ?? 0), + 'total_credit' => (float) ($row?->total_credit ?? 0), + ]; + }); + + return Inertia::render('Finance/Reports/TrialBalance', [ + 'accounts' => $accounts, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Reports'], + ['label' => 'Trial Balance'], + ], + ]); + } + + public function profitAndLoss(Request $request): Response + { + $this->authorize('viewAny', Account::class); + + $from = $request->from ?? now()->startOfYear()->toDateString(); + $to = $request->to ?? now()->toDateString(); + + $totals = $this->aggregateJournalLines($from, $to); + + $accounts = Account::whereIn('type', ['income', 'expense']) + ->orderBy('code') + ->get(); + + $revenue = []; + $expenses = []; + + foreach ($accounts as $account) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + + $net = $account->type === 'income' + ? $credit - $debit + : $debit - $credit; + + $entry = [ + 'id' => $account->id, + 'code' => $account->code, + 'name' => $account->name, + 'type' => $account->type, + 'net' => $net, + ]; + + if ($account->type === 'income') { + $revenue[] = $entry; + } else { + $expenses[] = $entry; + } + } + + $totalRevenue = (float) array_sum(array_column($revenue, 'net')); + $totalExpenses = (float) array_sum(array_column($expenses, 'net')); + + return Inertia::render('Finance/Reports/ProfitLoss', [ + 'revenue' => $revenue, + 'expenses' => $expenses, + 'total_revenue' => $totalRevenue, + 'total_expenses' => $totalExpenses, + 'net' => $totalRevenue - $totalExpenses, + 'from' => $from, + 'to' => $to, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Reports'], + ['label' => 'Profit & Loss'], + ], + ]); + } + + public function balanceSheet(Request $request): Response + { + $this->authorize('viewAny', Account::class); + + $asOf = $request->as_of ?? now()->toDateString(); + + $totals = $this->aggregateJournalLines(null, $asOf); + + $accounts = Account::whereIn('type', ['asset', 'liability', 'equity']) + ->orderBy('code') + ->get(); + + $assets = []; + $liabilities = []; + $equity = []; + + foreach ($accounts as $account) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + + $net = $account->type === 'asset' + ? $debit - $credit + : $credit - $debit; + + $entry = [ + 'id' => $account->id, + 'code' => $account->code, + 'name' => $account->name, + 'type' => $account->type, + 'net' => $net, + ]; + + if ($account->type === 'asset') { + $assets[] = $entry; + } elseif ($account->type === 'liability') { + $liabilities[] = $entry; + } else { + $equity[] = $entry; + } + } + + $totalAssets = (float) array_sum(array_column($assets, 'net')); + $totalLiabilities = (float) array_sum(array_column($liabilities, 'net')); + $totalEquity = (float) array_sum(array_column($equity, 'net')); + + return Inertia::render('Finance/Reports/BalanceSheet', [ + 'assets' => $assets, + 'liabilities' => $liabilities, + 'equity' => $equity, + 'total_assets' => $totalAssets, + 'total_liabilities' => $totalLiabilities, + 'total_equity' => $totalEquity, + 'as_of' => $asOf, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Reports'], + ['label' => 'Balance Sheet'], + ], + ]); + } + + public function agedReceivables(Request $request): Response + { + $this->authorize('viewAny', Account::class); + $asOf = $request->as_of ?? now()->toDateString(); + + $invoices = Invoice::with(['contact', 'items', 'payments']) + ->whereNotIn('status', ['draft', 'paid', 'cancelled']) + ->get() + ->map(function ($inv) use ($asOf) { + $daysOverdue = 0; + if ($inv->due_date) { + $diff = \Carbon\Carbon::parse($asOf)->diffInDays($inv->due_date, false); + $daysOverdue = (int) max(0, $diff * -1); + } + $bucket = match(true) { + $daysOverdue === 0 => 'current', + $daysOverdue <= 30 => '1-30', + $daysOverdue <= 60 => '31-60', + $daysOverdue <= 90 => '61-90', + default => '90+', + }; + return [ + 'id' => $inv->id, + 'number' => $inv->number, + 'contact' => $inv->contact?->name ?? '—', + 'due_date' => $inv->due_date?->toDateString(), + 'amount_due' => (float) $inv->amount_due, + 'days_overdue'=> $daysOverdue, + 'bucket' => $bucket, + ]; + }); + + $bucketKeys = ['current', '1-30', '31-60', '61-90', '90+']; + $totals = collect($bucketKeys)->mapWithKeys(fn ($k) => + [$k => (float) $invoices->where('bucket', $k)->sum('amount_due')] + )->all(); + + return Inertia::render('Finance/Reports/AgedReceivables', [ + 'rows' => $invoices->values(), + 'totals' => $totals, + 'grand_total' => (float) $invoices->sum('amount_due'), + 'as_of' => $asOf, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Reports'], + ['label' => 'Aged Receivables'], + ], + ]); + } + + public function agedPayables(Request $request): Response + { + $this->authorize('viewAny', Account::class); + $asOf = $request->as_of ?? now()->toDateString(); + + $bills = Bill::with(['contact', 'items', 'payments']) + ->whereNotIn('status', ['draft', 'paid', 'cancelled']) + ->get() + ->map(function ($bill) use ($asOf) { + $daysOverdue = 0; + if ($bill->due_date) { + $diff = \Carbon\Carbon::parse($asOf)->diffInDays($bill->due_date, false); + $daysOverdue = (int) max(0, $diff * -1); + } + $bucket = match(true) { + $daysOverdue === 0 => 'current', + $daysOverdue <= 30 => '1-30', + $daysOverdue <= 60 => '31-60', + $daysOverdue <= 90 => '61-90', + default => '90+', + }; + return [ + 'id' => $bill->id, + 'number' => $bill->number, + 'contact' => $bill->contact?->name ?? '—', + 'due_date' => $bill->due_date?->toDateString(), + 'amount_due' => (float) $bill->amount_due, + 'days_overdue'=> $daysOverdue, + 'bucket' => $bucket, + ]; + }); + + $bucketKeys = ['current', '1-30', '31-60', '61-90', '90+']; + $totals = collect($bucketKeys)->mapWithKeys(fn ($k) => + [$k => (float) $bills->where('bucket', $k)->sum('amount_due')] + )->all(); + + return Inertia::render('Finance/Reports/AgedPayables', [ + 'rows' => $bills->values(), + 'totals' => $totals, + 'grand_total' => (float) $bills->sum('amount_due'), + 'as_of' => $asOf, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Reports'], + ['label' => 'Aged Payables'], + ], + ]); + } + + public function accountLedgerIndex(Request $request): Response + { + $this->authorize('viewAny', Account::class); + $accounts = Account::orderBy('code')->get(['id', 'code', 'name', 'type']); + return Inertia::render('Finance/Reports/AccountLedger', [ + 'accounts' => $accounts, + 'account' => null, + 'rows' => [], + 'from' => now()->startOfYear()->toDateString(), + 'to' => now()->toDateString(), + 'breadcrumbs' => [['label' => 'Finance'], ['label' => 'Reports'], ['label' => 'Account Ledger']], + ]); + } + + public function accountLedger(Request $request, Account $account): Response + { + $this->authorize('viewAny', Account::class); + $from = $request->from ?? now()->startOfYear()->toDateString(); + $to = $request->to ?? now()->toDateString(); + + // Use JOIN (not whereHas) so ordering by journal_entries.date works correctly + $lines = JournalLine::join('journal_entries', 'journal_entries.id', '=', 'journal_lines.journal_entry_id') + ->where('journal_lines.account_id', $account->id) + ->where('journal_entries.status', 'posted') + ->when($from, fn ($q) => $q->whereDate('journal_entries.date', '>=', $from)) + ->when($to, fn ($q) => $q->whereDate('journal_entries.date', '<=', $to)) + ->orderBy('journal_entries.date') + ->orderBy('journal_lines.id') + ->select('journal_lines.*', 'journal_entries.date as entry_date', + 'journal_entries.reference as entry_reference', + 'journal_entries.description as entry_description') + ->get(); + + $isDebitNormal = in_array($account->type, ['asset', 'expense'], true); + $runningBalance = 0.0; + $rows = []; + foreach ($lines as $line) { + $debit = (float) $line->debit; + $credit = (float) $line->credit; + $runningBalance += $isDebitNormal ? ($debit - $credit) : ($credit - $debit); + $rows[] = [ + 'id' => $line->id, + 'date' => $line->entry_date instanceof \Carbon\Carbon + ? $line->entry_date->toDateString() + : (string) $line->entry_date, + 'reference' => $line->entry_reference, + 'description' => $line->description ?? $line->entry_description, + 'debit' => $debit, + 'credit' => $credit, + 'balance' => $runningBalance, + ]; + } + + $accounts = Account::orderBy('code')->get(['id', 'code', 'name', 'type']); + + return Inertia::render('Finance/Reports/AccountLedger', [ + 'accounts' => $accounts, + 'account' => ['id' => $account->id, 'code' => $account->code, 'name' => $account->name, 'type' => $account->type], + 'rows' => $rows, + 'from' => $from, + 'to' => $to, + 'breadcrumbs' => [ + ['label' => 'Finance'], ['label' => 'Reports'], + ['label' => "Ledger: {$account->name}"], + ], + ]); + } + + public function customerStatementIndex(Request $request): Response + { + $this->authorize('viewAny', Account::class); + + $contactId = $request->get('contact_id'); + $from = $request->get('from', now()->startOfMonth()->toDateString()); + $to = $request->get('to', now()->toDateString()); + + $contacts = Contact::customers()->orderBy('name')->get(['id', 'name', 'email']); + + if (!$contactId) { + return Inertia::render('Finance/Reports/CustomerStatement', [ + 'contacts' => $contacts, + 'contact' => null, + 'lines' => [], + 'summary' => null, + 'from' => $from, + 'to' => $to, + 'breadcrumbs' => [['label' => 'Finance'], ['label' => 'Reports'], ['label' => 'Customer Statement']], + ]); + } + + $contact = Contact::findOrFail($contactId); + + // Opening balance: sum of (total - amount_paid) for invoices before $from + $priorInvoices = Invoice::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->where('issue_date', '<', $from) + ->whereNotIn('status', ['draft', 'cancelled']) + ->get(); + + $openingBalance = (float) $priorInvoices->sum(fn ($inv) => $inv->total - $inv->amount_paid); + + // All invoices within date range + $invoices = Invoice::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->whereBetween('issue_date', [$from, $to]) + ->whereNotIn('status', ['draft', 'cancelled']) + ->orderBy('issue_date') + ->get(); + + $lines = []; + $balance = $openingBalance; + + foreach ($invoices as $inv) { + $balance += $inv->total; + $lines[] = [ + 'date' => $inv->issue_date instanceof \Carbon\Carbon ? $inv->issue_date->toDateString() : (string) $inv->issue_date, + 'type' => 'Invoice', + 'reference' => $inv->number, + 'debit' => $inv->total, + 'credit' => 0, + 'balance' => round($balance, 2), + 'status' => $inv->status, + ]; + + if ($inv->amount_paid > 0) { + $balance -= $inv->amount_paid; + $lines[] = [ + 'date' => $inv->issue_date instanceof \Carbon\Carbon ? $inv->issue_date->toDateString() : (string) $inv->issue_date, + 'type' => 'Payment', + 'reference' => 'PMT-' . $inv->number, + 'debit' => 0, + 'credit' => $inv->amount_paid, + 'balance' => round($balance, 2), + 'status' => '', + ]; + } + } + + $summary = [ + 'opening_balance' => round($openingBalance, 2), + 'total_invoiced' => round($invoices->sum('total'), 2), + 'total_paid' => round($invoices->sum('amount_paid'), 2), + 'closing_balance' => round($balance, 2), + ]; + + return Inertia::render('Finance/Reports/CustomerStatement', [ + 'contacts' => $contacts, + 'contact' => $contact, + 'lines' => $lines, + 'summary' => $summary, + 'from' => $from, + 'to' => $to, + 'breadcrumbs' => [ + ['label' => 'Finance'], ['label' => 'Reports'], + ['label' => "Statement: {$contact->name}"], + ], + ]); + } + + public function customerStatement(Request $request, Contact $contact): Response + { + $this->authorize('viewAny', Account::class); + + $from = $request->from ?? now()->startOfYear()->toDateString(); + $to = $request->to ?? now()->toDateString(); + + $transactions = []; + + $invoices = Invoice::with(['items', 'payments']) + ->where('contact_id', $contact->id) + ->where('status', '!=', 'cancelled') + ->whereDate('issue_date', '>=', $from) + ->whereDate('issue_date', '<=', $to) + ->get(); + + foreach ($invoices as $invoice) { + $transactions[] = [ + 'date' => $invoice->issue_date?->toDateString(), + 'type' => 'Invoice', + 'reference' => $invoice->number, + 'debit' => (float) $invoice->total, + 'credit' => 0.0, + ]; + } + + $paymentInvoices = Invoice::with('payments') + ->where('contact_id', $contact->id) + ->where('status', '!=', 'cancelled') + ->get(); + + foreach ($paymentInvoices as $invoice) { + foreach ($invoice->payments as $payment) { + $paymentDate = $payment->payment_date instanceof \Carbon\Carbon + ? $payment->payment_date->toDateString() + : (string) $payment->payment_date; + + if ($paymentDate < $from || $paymentDate > $to) { + continue; + } + + $transactions[] = [ + 'date' => $paymentDate, + 'type' => 'Payment', + 'reference' => $invoice->number, + 'debit' => 0.0, + 'credit' => (float) $payment->amount, + ]; + } + } + + $creditNotes = CreditNote::with('items') + ->where('contact_id', $contact->id) + ->whereIn('status', ['issued', 'applied']) + ->whereDate('issue_date', '>=', $from) + ->whereDate('issue_date', '<=', $to) + ->get(); + + foreach ($creditNotes as $creditNote) { + $transactions[] = [ + 'date' => $creditNote->issue_date?->toDateString(), + 'type' => 'Credit Note', + 'reference' => $creditNote->number, + 'debit' => 0.0, + 'credit' => (float) $creditNote->total, + ]; + } + + usort($transactions, fn ($a, $b) => strcmp((string) $a['date'], (string) $b['date'])); + + $balance = 0.0; + $totalDebit = 0.0; + $totalCredit = 0.0; + $rows = []; + foreach ($transactions as $txn) { + $balance += $txn['debit'] - $txn['credit']; + $totalDebit += $txn['debit']; + $totalCredit += $txn['credit']; + $rows[] = array_merge($txn, ['balance' => $balance]); + } + + return Inertia::render('Finance/Reports/CustomerStatement', [ + 'contacts' => Contact::customers()->orderBy('name')->get(['id', 'name']), + 'contact' => ['id' => $contact->id, 'name' => $contact->name], + 'rows' => $rows, + 'from' => $from, + 'to' => $to, + 'total_debit' => $totalDebit, + 'total_credit' => $totalCredit, + 'closing_balance' => $balance, + 'breadcrumbs' => [ + ['label' => 'Finance'], ['label' => 'Reports'], + ['label' => "Statement: {$contact->name}"], + ], + ]); + } + + public function exportCustomerStatement(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Invoice::class); + + $contactId = $request->get('contact_id'); + $from = $request->get('from', now()->startOfMonth()->toDateString()); + $to = $request->get('to', now()->toDateString()); + + abort_unless($contactId, 422, 'contact_id is required.'); + $contact = Contact::findOrFail($contactId); + + $priorInvoices = Invoice::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->where('issue_date', '<', $from) + ->whereNotIn('status', ['draft', 'cancelled']) + ->get(); + + $openingBalance = (float) $priorInvoices->sum(fn ($inv) => $inv->total - $inv->amount_paid); + + $invoices = Invoice::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->whereBetween('issue_date', [$from, $to]) + ->whereNotIn('status', ['draft', 'cancelled']) + ->orderBy('issue_date') + ->get(); + + $balance = $openingBalance; + $rows = [['Opening Balance', '', '', '', '', round($balance, 2)]]; + + foreach ($invoices as $inv) { + $balance += $inv->total; + $issueDate = $inv->issue_date instanceof \Carbon\Carbon ? $inv->issue_date->toDateString() : (string) $inv->issue_date; + $rows[] = [$issueDate, 'Invoice', $inv->number, $inv->total, 0, round($balance, 2)]; + if ($inv->amount_paid > 0) { + $balance -= $inv->amount_paid; + $rows[] = [$issueDate, 'Payment', 'PMT-' . $inv->number, 0, $inv->amount_paid, round($balance, 2)]; + } + } + + $filename = "statement-{$contact->name}-{$from}-{$to}.csv"; + + return $this->streamCsv( + $filename, + ['Date', 'Type', 'Reference', 'Debit', 'Credit', 'Balance'], + $rows + ); + } + + public function vatReport(Request $request): Response + { + $this->authorize('viewAny', Invoice::class); + + $tenantId = $request->user()->tenant_id; + $from = $request->query('from', now()->startOfQuarter()->toDateString()); + $to = $request->query('to', now()->endOfQuarter()->toDateString()); + + // Output VAT: tax collected on invoices (not cancelled) within the period + $invoices = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereBetween('issue_date', [$from, $to]) + ->with('items') + ->get(); + + $outputLines = $invoices->map(function ($invoice) { + $net = $invoice->subtotal; + $tax = $invoice->tax_total; + return [ + 'id' => $invoice->id, + 'number' => $invoice->number, + 'date' => $invoice->issue_date, + 'contact' => $invoice->contact?->name, + 'net' => round($net, 2), + 'tax' => round($tax, 2), + 'type' => 'invoice', + ]; + })->filter(fn ($line) => $line['tax'] != 0)->values(); + + // Input VAT: tax paid on bills (not cancelled) within the period + $bills = Bill::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereBetween('issue_date', [$from, $to]) + ->with('items') + ->get(); + + $inputLines = $bills->map(function ($bill) { + $net = $bill->subtotal; + $tax = $bill->tax_total; + return [ + 'id' => $bill->id, + 'number' => $bill->number, + 'date' => $bill->issue_date, + 'contact' => $bill->contact?->name, + 'net' => round($net, 2), + 'tax' => round($tax, 2), + 'type' => 'bill', + ]; + })->filter(fn ($line) => $line['tax'] != 0)->values(); + + $totalOutputVat = round($outputLines->sum('tax'), 2); + $totalInputVat = round($inputLines->sum('tax'), 2); + $netVat = round($totalOutputVat - $totalInputVat, 2); + + return Inertia::render('Finance/Reports/VatReport', [ + 'output_lines' => $outputLines, + 'input_lines' => $inputLines, + 'total_output_vat' => $totalOutputVat, + 'total_input_vat' => $totalInputVat, + 'net_vat' => $netVat, + 'from' => $from, + 'to' => $to, + ]); + } + + public function cashFlowForecast(Request $request): Response + { + $this->authorize('viewAny', Invoice::class); + + $weeks = (int) $request->get('weeks', 12); + $openingBalance = (float) $request->get('opening_balance', 0); + $from = now()->startOfDay(); + $to = now()->addWeeks($weeks)->endOfDay(); + + // Collect open invoices (inflows) due within horizon + $invoices = Invoice::with('contact') + ->whereIn('status', ['sent', 'partial']) + ->whereBetween('due_date', [$from->toDateString(), $to->toDateString()]) + ->get(); + + // Collect open bills (outflows) due within horizon + $bills = Bill::with('contact') + ->whereIn('status', ['received', 'partial']) + ->whereBetween('due_date', [$from->toDateString(), $to->toDateString()]) + ->get(); + + // Build weekly buckets + $buckets = []; + for ($i = 0; $i < $weeks; $i++) { + $weekStart = now()->addWeeks($i)->startOfWeek()->toDateString(); + $weekEnd = now()->addWeeks($i)->endOfWeek()->toDateString(); + $buckets[$weekStart] = [ + 'week_start' => $weekStart, + 'week_end' => $weekEnd, + 'inflows' => [], + 'outflows' => [], + ]; + } + + // Place invoices into their week bucket + foreach ($invoices as $inv) { + $due = $inv->due_date instanceof \Carbon\Carbon + ? $inv->due_date->toDateString() + : (string) $inv->due_date; + foreach ($buckets as $weekStart => $bucket) { + if ($due >= $bucket['week_start'] && $due <= $bucket['week_end']) { + $buckets[$weekStart]['inflows'][] = [ + 'reference' => $inv->reference, + 'contact' => $inv->contact?->name ?? '—', + 'due_date' => $due, + 'amount' => $inv->total - $inv->amount_paid, + ]; + break; + } + } + } + + // Place bills into their week bucket + foreach ($bills as $bill) { + $due = $bill->due_date instanceof \Carbon\Carbon + ? $bill->due_date->toDateString() + : (string) $bill->due_date; + foreach ($buckets as $weekStart => $bucket) { + if ($due >= $bucket['week_start'] && $due <= $bucket['week_end']) { + $buckets[$weekStart]['outflows'][] = [ + 'reference' => $bill->reference, + 'contact' => $bill->contact?->name ?? '—', + 'due_date' => $due, + 'amount' => $bill->total - $bill->amount_paid, + ]; + break; + } + } + } + + // Compute running balance per week + $balance = $openingBalance; + $result = []; + foreach ($buckets as $bucket) { + $inflow = array_sum(array_column($bucket['inflows'], 'amount')); + $outflow = array_sum(array_column($bucket['outflows'], 'amount')); + $balance += $inflow - $outflow; + $result[] = [ + 'week_start' => $bucket['week_start'], + 'week_end' => $bucket['week_end'], + 'inflows' => $bucket['inflows'], + 'outflows' => $bucket['outflows'], + 'total_inflow' => round($inflow, 2), + 'total_outflow' => round($outflow, 2), + 'net' => round($inflow - $outflow, 2), + 'closing_balance' => round($balance, 2), + ]; + } + + return Inertia::render('Finance/Reports/CashFlowForecast', [ + 'buckets' => $result, + 'openingBalance' => $openingBalance, + 'weeks' => $weeks, + 'totalInflow' => round(array_sum(array_column($result, 'total_inflow')), 2), + 'totalOutflow' => round(array_sum(array_column($result, 'total_outflow')), 2), + ]); + } + + public function exportCashFlowForecast(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Invoice::class); + + $weeks = (int) $request->get('weeks', 12); + $openingBalance = (float) $request->get('opening_balance', 0); + $from = now()->startOfDay(); + $to = now()->addWeeks($weeks)->endOfDay(); + + $invoices = Invoice::whereIn('status', ['sent', 'partial']) + ->whereBetween('due_date', [$from->toDateString(), $to->toDateString()])->get(); + $bills = Bill::whereIn('status', ['received', 'partial']) + ->whereBetween('due_date', [$from->toDateString(), $to->toDateString()])->get(); + + // Rebuild buckets same as above, minimal version for export + $buckets = []; + for ($i = 0; $i < $weeks; $i++) { + $ws = now()->addWeeks($i)->startOfWeek()->toDateString(); + $we = now()->addWeeks($i)->endOfWeek()->toDateString(); + $buckets[$ws] = ['week_start' => $ws, 'week_end' => $we, 'inflow' => 0.0, 'outflow' => 0.0]; + } + foreach ($invoices as $inv) { + $due = $inv->due_date instanceof \Carbon\Carbon ? $inv->due_date->toDateString() : (string) $inv->due_date; + foreach ($buckets as $ws => &$b) { + if ($due >= $b['week_start'] && $due <= $b['week_end']) { + $b['inflow'] += $inv->total - $inv->amount_paid; + break; + } + } + } + foreach ($bills as $bill) { + $due = $bill->due_date instanceof \Carbon\Carbon ? $bill->due_date->toDateString() : (string) $bill->due_date; + foreach ($buckets as $ws => &$b) { + if ($due >= $b['week_start'] && $due <= $b['week_end']) { + $b['outflow'] += $bill->total - $bill->amount_paid; + break; + } + } + } + + $balance = $openingBalance; + $rows = []; + foreach ($buckets as $b) { + $balance += $b['inflow'] - $b['outflow']; + $rows[] = [ + $b['week_start'], + $b['week_end'], + round($b['inflow'], 2), + round($b['outflow'], 2), + round($b['inflow'] - $b['outflow'], 2), + round($balance, 2), + ]; + } + + return $this->streamCsv( + 'cash-flow-forecast.csv', + ['Week Start', 'Week End', 'Inflows', 'Outflows', 'Net', 'Closing Balance'], + $rows + ); + } + + public function supplierStatement(Request $request): Response + { + $this->authorize('viewAny', Bill::class); + + $contactId = $request->get('contact_id'); + $from = $request->get('from', now()->startOfMonth()->toDateString()); + $to = $request->get('to', now()->toDateString()); + + $contacts = Contact::vendors()->orderBy('name')->get(['id', 'name', 'email']); + + if (!$contactId) { + return Inertia::render('Finance/Reports/SupplierStatement', [ + 'contacts' => $contacts, + 'contact' => null, + 'lines' => [], + 'summary' => null, + 'from' => $from, + 'to' => $to, + ]); + } + + $contact = Contact::findOrFail($contactId); + + // Opening balance: unpaid bill amounts before $from + $openingBalance = (float) Bill::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->where('issue_date', '<', $from) + ->whereNotIn('status', ['draft', 'cancelled']) + ->get() + ->sum(fn ($b) => $b->total - $b->amount_paid); + + $bills = Bill::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->whereBetween('issue_date', [$from, $to]) + ->whereNotIn('status', ['draft', 'cancelled']) + ->orderBy('issue_date') + ->get(); + + $lines = []; + $balance = $openingBalance; + + foreach ($bills as $bill) { + $balance += $bill->total; + $lines[] = [ + 'date' => $bill->issue_date instanceof \Carbon\Carbon ? $bill->issue_date->toDateString() : (string) $bill->issue_date, + 'type' => 'Bill', + 'reference' => $bill->number, + 'debit' => $bill->total, + 'credit' => 0, + 'balance' => round($balance, 2), + 'status' => $bill->status, + ]; + + if ($bill->amount_paid > 0) { + $balance -= $bill->amount_paid; + $lines[] = [ + 'date' => $bill->issue_date instanceof \Carbon\Carbon ? $bill->issue_date->toDateString() : (string) $bill->issue_date, + 'type' => 'Payment', + 'reference' => 'PMT-' . $bill->number, + 'debit' => 0, + 'credit' => $bill->amount_paid, + 'balance' => round($balance, 2), + 'status' => '', + ]; + } + } + + $summary = [ + 'opening_balance' => round($openingBalance, 2), + 'total_billed' => round($bills->sum('total'), 2), + 'total_paid' => round($bills->sum('amount_paid'), 2), + 'closing_balance' => round($balance, 2), + ]; + + return Inertia::render('Finance/Reports/SupplierStatement', [ + 'contacts' => $contacts, + 'contact' => $contact, + 'lines' => $lines, + 'summary' => $summary, + 'from' => $from, + 'to' => $to, + ]); + } + + public function exportSupplierStatement(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Bill::class); + + $contactId = $request->get('contact_id'); + $from = $request->get('from', now()->startOfMonth()->toDateString()); + $to = $request->get('to', now()->toDateString()); + + abort_unless($contactId, 422, 'contact_id is required.'); + $contact = Contact::findOrFail($contactId); + + $openingBalance = (float) Bill::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->where('issue_date', '<', $from) + ->whereNotIn('status', ['draft', 'cancelled']) + ->get() + ->sum(fn ($b) => $b->total - $b->amount_paid); + + $bills = Bill::with(['items', 'payments']) + ->where('contact_id', $contactId) + ->whereBetween('issue_date', [$from, $to]) + ->whereNotIn('status', ['draft', 'cancelled']) + ->orderBy('issue_date') + ->get(); + + $balance = $openingBalance; + $rows = [['Opening Balance', '', '', '', '', round($balance, 2)]]; + + foreach ($bills as $bill) { + $balance += $bill->total; + $rows[] = [(string)$bill->issue_date, 'Bill', $bill->number, $bill->total, 0, round($balance, 2)]; + if ($bill->amount_paid > 0) { + $balance -= $bill->amount_paid; + $rows[] = [(string)$bill->issue_date, 'Payment', 'PMT-' . $bill->number, 0, $bill->amount_paid, round($balance, 2)]; + } + } + + $filename = "supplier-statement-{$contact->name}-{$from}-{$to}.csv"; + + return $this->streamCsv( + $filename, + ['Date', 'Type', 'Reference', 'Debit', 'Credit', 'Balance'], + $rows + ); + } + + public function comparativeProfitLoss(Request $request): Response + { + $this->authorize('viewAny', Account::class); + + $currentFrom = $request->get('current_from', now()->startOfMonth()->toDateString()); + $currentTo = $request->get('current_to', now()->toDateString()); + $priorFrom = $request->get('prior_from', now()->subMonth()->startOfMonth()->toDateString()); + $priorTo = $request->get('prior_to', now()->subMonth()->endOfMonth()->toDateString()); + + $buildSection = function (string $type, string $from, string $to): array { + $totals = $this->aggregateJournalLines($from, $to); + + return Account::where('type', $type) + ->orderBy('name') + ->get() + ->map(function (Account $account) use ($totals, $type) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + $balance = $type === 'income' + ? $credit - $debit + : $debit - $credit; + return [ + 'id' => $account->id, + 'name' => $account->name, + 'code' => $account->code ?? '', + 'balance' => round($balance, 2), + ]; + }) + ->filter(fn ($row) => $row['balance'] != 0) + ->values() + ->toArray(); + }; + + $currentIncome = $buildSection('income', $currentFrom, $currentTo); + $currentExpenses = $buildSection('expense', $currentFrom, $currentTo); + $priorIncome = $buildSection('income', $priorFrom, $priorTo); + $priorExpenses = $buildSection('expense', $priorFrom, $priorTo); + + // Merge account lists (union of both periods) + $allIncomeIds = collect(array_merge($currentIncome, $priorIncome))->pluck('id')->unique(); + $allExpenseIds = collect(array_merge($currentExpenses, $priorExpenses))->pluck('id')->unique(); + + $indexBy = fn (array $rows) => collect($rows)->keyBy('id'); + + $currentIncomeIdx = $indexBy($currentIncome); + $priorIncomeIdx = $indexBy($priorIncome); + $currentExpenseIdx = $indexBy($currentExpenses); + $priorExpenseIdx = $indexBy($priorExpenses); + + $mergeRows = function ($ids, $currentIdx, $priorIdx) { + return $ids->map(function ($id) use ($currentIdx, $priorIdx) { + $cur = $currentIdx->get($id); + $pri = $priorIdx->get($id); + return [ + 'id' => $id, + 'name' => ($cur ?? $pri)['name'], + 'code' => ($cur ?? $pri)['code'], + 'current' => $cur['balance'] ?? 0, + 'prior' => $pri['balance'] ?? 0, + 'change' => round(($cur['balance'] ?? 0) - ($pri['balance'] ?? 0), 2), + ]; + })->sortBy('name')->values()->toArray(); + }; + + $incomeRows = $mergeRows($allIncomeIds, $currentIncomeIdx, $priorIncomeIdx); + $expenseRows = $mergeRows($allExpenseIds, $currentExpenseIdx, $priorExpenseIdx); + + $totalCurrentIncome = round(collect($incomeRows)->sum('current'), 2); + $totalPriorIncome = round(collect($incomeRows)->sum('prior'), 2); + $totalCurrentExpenses = round(collect($expenseRows)->sum('current'), 2); + $totalPriorExpenses = round(collect($expenseRows)->sum('prior'), 2); + + return Inertia::render('Finance/Reports/ComparativeProfitLoss', [ + 'incomeRows' => $incomeRows, + 'expenseRows' => $expenseRows, + 'totalCurrentIncome' => $totalCurrentIncome, + 'totalPriorIncome' => $totalPriorIncome, + 'totalCurrentExpenses' => $totalCurrentExpenses, + 'totalPriorExpenses' => $totalPriorExpenses, + 'netCurrentProfit' => round($totalCurrentIncome - $totalCurrentExpenses, 2), + 'netPriorProfit' => round($totalPriorIncome - $totalPriorExpenses, 2), + 'currentFrom' => $currentFrom, + 'currentTo' => $currentTo, + 'priorFrom' => $priorFrom, + 'priorTo' => $priorTo, + ]); + } + + public function exportComparativeProfitLoss(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $currentFrom = $request->get('current_from', now()->startOfMonth()->toDateString()); + $currentTo = $request->get('current_to', now()->toDateString()); + $priorFrom = $request->get('prior_from', now()->subMonth()->startOfMonth()->toDateString()); + $priorTo = $request->get('prior_to', now()->subMonth()->endOfMonth()->toDateString()); + + $buildSection = function (string $type, string $from, string $to): array { + $totals = $this->aggregateJournalLines($from, $to); + + return Account::where('type', $type) + ->orderBy('name') + ->get() + ->map(function (Account $account) use ($totals, $type) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + $balance = $type === 'income' + ? $credit - $debit + : $debit - $credit; + return [ + 'id' => $account->id, + 'name' => $account->name, + 'code' => $account->code ?? '', + 'balance' => round($balance, 2), + ]; + }) + ->filter(fn ($row) => $row['balance'] != 0) + ->values() + ->toArray(); + }; + + $currentIncome = $buildSection('income', $currentFrom, $currentTo); + $currentExpenses = $buildSection('expense', $currentFrom, $currentTo); + $priorIncome = $buildSection('income', $priorFrom, $priorTo); + $priorExpenses = $buildSection('expense', $priorFrom, $priorTo); + + $allIncomeIds = collect(array_merge($currentIncome, $priorIncome))->pluck('id')->unique(); + $allExpenseIds = collect(array_merge($currentExpenses, $priorExpenses))->pluck('id')->unique(); + + $indexBy = fn (array $rows) => collect($rows)->keyBy('id'); + + $currentIncomeIdx = $indexBy($currentIncome); + $priorIncomeIdx = $indexBy($priorIncome); + $currentExpenseIdx = $indexBy($currentExpenses); + $priorExpenseIdx = $indexBy($priorExpenses); + + $rows = []; + + foreach ($allIncomeIds as $id) { + $cur = $currentIncomeIdx->get($id); + $pri = $priorIncomeIdx->get($id); + $name = ($cur ?? $pri)['name']; + $code = ($cur ?? $pri)['code']; + $rows[] = [ + 'Income', + $code, + $name, + number_format($cur['balance'] ?? 0, 2, '.', ''), + number_format($pri['balance'] ?? 0, 2, '.', ''), + number_format(($cur['balance'] ?? 0) - ($pri['balance'] ?? 0), 2, '.', ''), + ]; + } + + foreach ($allExpenseIds as $id) { + $cur = $currentExpenseIdx->get($id); + $pri = $priorExpenseIdx->get($id); + $name = ($cur ?? $pri)['name']; + $code = ($cur ?? $pri)['code']; + $rows[] = [ + 'Expense', + $code, + $name, + number_format($cur['balance'] ?? 0, 2, '.', ''), + number_format($pri['balance'] ?? 0, 2, '.', ''), + number_format(($cur['balance'] ?? 0) - ($pri['balance'] ?? 0), 2, '.', ''), + ]; + } + + $totalCurrentIncome = collect($currentIncome)->sum('balance'); + $totalPriorIncome = collect($priorIncome)->sum('balance'); + $totalCurrentExpenses = collect($currentExpenses)->sum('balance'); + $totalPriorExpenses = collect($priorExpenses)->sum('balance'); + + $netCurrent = $totalCurrentIncome - $totalCurrentExpenses; + $netPrior = $totalPriorIncome - $totalPriorExpenses; + $rows[] = ['Net Profit', '', '', number_format($netCurrent, 2, '.', ''), number_format($netPrior, 2, '.', ''), number_format($netCurrent - $netPrior, 2, '.', '')]; + + return $this->streamCsv( + "comparative-profit-loss-{$currentFrom}-{$currentTo}.csv", + ['Section', 'Code', 'Account', 'Current Period', 'Prior Period', 'Change'], + $rows + ); + } + + // ─── CSV Export Methods ─────────────────────────────────────────────────── + + public function exportProfitLoss(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $from = $request->from ?? now()->startOfYear()->toDateString(); + $to = $request->to ?? now()->toDateString(); + + $totals = $this->aggregateJournalLines($from, $to); + $accounts = Account::whereIn('type', ['income', 'expense'])->orderBy('code')->get(); + + $revenue = []; + $expenses = []; + + foreach ($accounts as $account) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + $net = $account->type === 'income' ? $credit - $debit : $debit - $credit; + + $entry = ['type' => $account->type === 'income' ? 'Revenue' : 'Expense', 'name' => $account->name, 'net' => $net]; + + if ($account->type === 'income') { + $revenue[] = $entry; + } else { + $expenses[] = $entry; + } + } + + $totalRevenue = array_sum(array_column($revenue, 'net')); + $totalExpenses = array_sum(array_column($expenses, 'net')); + + $rows = []; + foreach ($revenue as $r) { $rows[] = [$r['type'], $r['name'], number_format($r['net'], 2, '.', '')]; } + foreach ($expenses as $r) { $rows[] = [$r['type'], $r['name'], number_format($r['net'], 2, '.', '')]; } + $rows[] = ['Net', 'Net Profit / Loss', number_format($totalRevenue - $totalExpenses, 2, '.', '')]; + + return $this->streamCsv( + "profit-loss-{$from}-{$to}.csv", + ['Type', 'Account', 'Amount'], + $rows + ); + } + + public function exportBalanceSheet(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $asOf = $request->as_of ?? now()->toDateString(); + $totals = $this->aggregateJournalLines(null, $asOf); + + $accounts = Account::whereIn('type', ['asset', 'liability', 'equity'])->orderBy('code')->get(); + + $rows = []; + foreach ($accounts as $account) { + $row = $totals->get($account->id); + $debit = (float) ($row?->total_debit ?? 0); + $credit = (float) ($row?->total_credit ?? 0); + $net = $account->type === 'asset' ? $debit - $credit : $credit - $debit; + + $section = ucfirst($account->type); + $rows[] = [$section, $account->name, number_format($net, 2, '.', '')]; + } + + return $this->streamCsv( + "balance-sheet-{$asOf}.csv", + ['Section', 'Account', 'Balance'], + $rows + ); + } + + public function exportAgedReceivables(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $asOf = $request->as_of ?? now()->toDateString(); + + $invoices = Invoice::with(['contact', 'items', 'payments']) + ->whereNotIn('status', ['draft', 'paid', 'cancelled']) + ->get(); + + $rows = []; + foreach ($invoices as $inv) { + $daysOverdue = 0; + if ($inv->due_date) { + $diff = \Carbon\Carbon::parse($asOf)->diffInDays($inv->due_date, false); + $daysOverdue = (int) max(0, $diff * -1); + } + $bucket = match (true) { + $daysOverdue === 0 => 'current', + $daysOverdue <= 30 => '1-30', + $daysOverdue <= 60 => '31-60', + $daysOverdue <= 90 => '61-90', + default => '90+', + }; + $amountDue = (float) $inv->amount_due; + $rows[] = [ + $inv->contact?->name ?? '—', + $inv->number ?? '', + $inv->issue_date?->toDateString() ?? '', + $inv->due_date?->toDateString() ?? '', + $bucket === 'current' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '1-30' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '31-60' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '61-90' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '90+' ? number_format($amountDue, 2, '.', '') : '0.00', + number_format($amountDue, 2, '.', ''), + ]; + } + + return $this->streamCsv( + "aged-receivables-{$asOf}.csv", + ['Customer', 'Invoice #', 'Issue Date', 'Due Date', 'Current', '1-30', '31-60', '61-90', '90+', 'Total'], + $rows + ); + } + + public function exportAgedPayables(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $asOf = $request->as_of ?? now()->toDateString(); + + $bills = Bill::with(['contact', 'items', 'payments']) + ->whereNotIn('status', ['draft', 'paid', 'cancelled']) + ->get(); + + $rows = []; + foreach ($bills as $bill) { + $daysOverdue = 0; + if ($bill->due_date) { + $diff = \Carbon\Carbon::parse($asOf)->diffInDays($bill->due_date, false); + $daysOverdue = (int) max(0, $diff * -1); + } + $bucket = match (true) { + $daysOverdue === 0 => 'current', + $daysOverdue <= 30 => '1-30', + $daysOverdue <= 60 => '31-60', + $daysOverdue <= 90 => '61-90', + default => '90+', + }; + $amountDue = (float) $bill->amount_due; + $rows[] = [ + $bill->contact?->name ?? '—', + $bill->number ?? '', + $bill->issue_date?->toDateString() ?? '', + $bill->due_date?->toDateString() ?? '', + $bucket === 'current' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '1-30' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '31-60' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '61-90' ? number_format($amountDue, 2, '.', '') : '0.00', + $bucket === '90+' ? number_format($amountDue, 2, '.', '') : '0.00', + number_format($amountDue, 2, '.', ''), + ]; + } + + return $this->streamCsv( + "aged-payables-{$asOf}.csv", + ['Vendor', 'Bill #', 'Issue Date', 'Due Date', 'Current', '1-30', '31-60', '61-90', '90+', 'Total'], + $rows + ); + } + + public function exportAccountLedger(Request $request, Account $account): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Account::class); + + $from = $request->from ?? now()->startOfYear()->toDateString(); + $to = $request->to ?? now()->toDateString(); + + $lines = JournalLine::join('journal_entries', 'journal_entries.id', '=', 'journal_lines.journal_entry_id') + ->where('journal_lines.account_id', $account->id) + ->where('journal_entries.status', 'posted') + ->when($from, fn ($q) => $q->whereDate('journal_entries.date', '>=', $from)) + ->when($to, fn ($q) => $q->whereDate('journal_entries.date', '<=', $to)) + ->orderBy('journal_entries.date') + ->orderBy('journal_lines.id') + ->select('journal_lines.*', 'journal_entries.date as entry_date', + 'journal_entries.reference as entry_reference', + 'journal_entries.description as entry_description') + ->get(); + + $isDebitNormal = in_array($account->type, ['asset', 'expense'], true); + $runningBalance = 0.0; + $rows = []; + + foreach ($lines as $line) { + $debit = (float) $line->debit; + $credit = (float) $line->credit; + $runningBalance += $isDebitNormal ? ($debit - $credit) : ($credit - $debit); + $description = $line->description ?? $line->entry_description; + $rows[] = [ + $line->entry_date instanceof \Carbon\Carbon + ? $line->entry_date->toDateString() + : (string) $line->entry_date, + $description ?? '', + number_format($debit, 2, '.', ''), + number_format($credit, 2, '.', ''), + number_format($runningBalance, 2, '.', ''), + ]; + } + + return $this->streamCsv( + "ledger-{$account->code}-{$from}-{$to}.csv", + ['Date', 'Description', 'Debit', 'Credit', 'Balance'], + $rows + ); + } + + public function exportVatReport(Request $request): \Symfony\Component\HttpFoundation\StreamedResponse + { + $this->authorize('viewAny', Invoice::class); + + $tenantId = $request->user()->tenant_id; + $from = $request->query('from', now()->startOfQuarter()->toDateString()); + $to = $request->query('to', now()->endOfQuarter()->toDateString()); + + $invoices = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereBetween('issue_date', [$from, $to]) + ->with('items') + ->get(); + + $outputLines = $invoices->map(function ($invoice) { + return [ + 'number' => $invoice->number, + 'date' => $invoice->issue_date, + 'contact' => $invoice->contact?->name, + 'net' => round((float) $invoice->subtotal, 2), + 'tax' => round((float) $invoice->tax_total, 2), + 'type' => 'Output', + ]; + })->filter(fn ($l) => $l['tax'] != 0)->values(); + + $bills = Bill::where('tenant_id', $tenantId) + ->whereNotIn('status', ['cancelled']) + ->whereBetween('issue_date', [$from, $to]) + ->with('items') + ->get(); + + $inputLines = $bills->map(function ($bill) { + return [ + 'number' => $bill->number, + 'date' => $bill->issue_date, + 'contact' => $bill->contact?->name, + 'net' => round((float) $bill->subtotal, 2), + 'tax' => round((float) $bill->tax_total, 2), + 'type' => 'Input', + ]; + })->filter(fn ($l) => $l['tax'] != 0)->values(); + + $totalOutputVat = round($outputLines->sum('tax'), 2); + $totalInputVat = round($inputLines->sum('tax'), 2); + $netVat = round($totalOutputVat - $totalInputVat, 2); + + $rows = []; + foreach ($outputLines as $line) { + $date = $line['date'] instanceof \Carbon\Carbon ? $line['date']->toDateString() : (string) $line['date']; + $rows[] = [$line['type'], $line['number'] ?? '', $date, $line['contact'] ?? '', number_format($line['net'], 2, '.', ''), number_format($line['tax'], 2, '.', '')]; + } + $rows[] = ['', '', '', '', '', '']; + foreach ($inputLines as $line) { + $date = $line['date'] instanceof \Carbon\Carbon ? $line['date']->toDateString() : (string) $line['date']; + $rows[] = [$line['type'], $line['number'] ?? '', $date, $line['contact'] ?? '', number_format($line['net'], 2, '.', ''), number_format($line['tax'], 2, '.', '')]; + } + $rows[] = ['', '', '', '', '', '']; + $rows[] = ['Total Output VAT', '', '', '', '', number_format($totalOutputVat, 2, '.', '')]; + $rows[] = ['Total Input VAT', '', '', '', '', number_format($totalInputVat, 2, '.', '')]; + $rows[] = ['Net VAT', '', '', '', '', number_format($netVat, 2, '.', '')]; + + return $this->streamCsv( + "vat-report-{$from}-{$to}.csv", + ['Type', 'Document #', 'Date', 'Contact', 'Net', 'Tax'], + $rows + ); + } + + // ─── Private Helpers ───────────────────────────────────────────────────── + + private function streamCsv(string $filename, array $headers, iterable $rows): \Symfony\Component\HttpFoundation\StreamedResponse + { + return response()->streamDownload(function () use ($headers, $rows) { + $handle = fopen('php://output', 'w'); + fputcsv($handle, $headers); + foreach ($rows as $row) { + fputcsv($handle, $row); + } + fclose($handle); + }, $filename, [ + 'Content-Type' => 'text/csv; charset=UTF-8', + ]); + } + + private function aggregateJournalLines(?string $from = null, ?string $to = null): \Illuminate\Support\Collection + { + return JournalLine::select('account_id', + DB::raw('SUM(debit) as total_debit'), + DB::raw('SUM(credit) as total_credit') + ) + ->whereHas('journalEntry', function ($q) use ($from, $to) { + $q->where('status', 'posted'); + if ($from) $q->whereDate('date', '>=', $from); + if ($to) $q->whereDate('date', '<=', $to); + }) + ->groupBy('account_id') + ->get() + ->keyBy('account_id'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/SalesOrderController.php b/erp/app/Modules/Finance/Http/Controllers/SalesOrderController.php new file mode 100644 index 00000000000..ac27d426ebe --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/SalesOrderController.php @@ -0,0 +1,219 @@ +authorize('viewAny', SalesOrder::class); + + $salesOrders = SalesOrder::with(['contact', 'warehouse']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->contact_id, fn ($q) => $q->where('contact_id', $request->contact_id)) + ->when($request->search, fn ($q) => $q->where('number', 'like', "%{$request->search}%")) + ->latest('order_date') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Finance/SalesOrders/Index', [ + 'salesOrders' => SalesOrderResource::collection($salesOrders), + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'contact_id', 'search']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Sales Orders', 'href' => route('finance.sales-orders.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', SalesOrder::class); + + return Inertia::render('Finance/SalesOrders/Create', [ + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'warehouses' => Warehouse::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'products' => Product::active()->orderBy('name')->get(['id', 'name', 'sku', 'sale_price']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Sales Orders', 'href' => route('finance.sales-orders.index')], + ['label' => 'New Sales Order'], + ], + ]); + } + + public function store(StoreSalesOrderRequest $request): RedirectResponse + { + $this->authorize('create', SalesOrder::class); + + $data = $request->validated(); + + $salesOrder = DB::transaction(function () use ($data) { + $salesOrder = SalesOrder::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'] ?? null, + 'warehouse_id' => $data['warehouse_id'] ?? null, + 'reference' => $data['reference'] ?? null, + 'order_date' => $data['order_date'], + 'expected_date' => $data['expected_date'] ?? null, + 'currency_code' => $data['currency_code'] ?? 'USD', + 'exchange_rate' => $data['exchange_rate'] ?? 1, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + ]); + + $salesOrder->update([ + 'number' => 'SO-' . now()->format('Y') . '-' . str_pad((string) $salesOrder->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($data['items'] as $item) { + SalesOrderItem::create([ + 'sales_order_id' => $salesOrder->id, + 'product_id' => $item['product_id'] ?? null, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'unit_price' => $item['unit_price'], + 'tax_rate' => $item['tax_rate'], + ]); + } + + return $salesOrder; + }); + + return redirect()->route('finance.sales-orders.show', $salesOrder) + ->with('success', 'Sales order created.'); + } + + public function show(SalesOrder $salesOrder): Response + { + $this->authorize('view', $salesOrder); + + $salesOrder->load(['contact', 'warehouse', 'invoice', 'items.product', 'creator']); + + return Inertia::render('Finance/SalesOrders/Show', [ + 'salesOrder' => new SalesOrderResource($salesOrder), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Sales Orders', 'href' => route('finance.sales-orders.index')], + ['label' => $salesOrder->number ?? "Sales Order #{$salesOrder->id}"], + ], + ]); + } + + public function confirm(SalesOrder $salesOrder): RedirectResponse + { + $this->authorize('update', $salesOrder); + + try { + $salesOrder->transitionTo('confirmed'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Sales order confirmed.'); + } + + public function fulfill(SalesOrder $salesOrder): RedirectResponse + { + $this->authorize('update', $salesOrder); + + try { + $salesOrder->fulfill(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Sales order fulfilled and stock updated.'); + } + + public function cancel(SalesOrder $salesOrder): RedirectResponse + { + $this->authorize('update', $salesOrder); + + try { + $salesOrder->transitionTo('cancelled'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Sales order cancelled.'); + } + + public function convertToInvoice(SalesOrder $salesOrder): RedirectResponse + { + $this->authorize('update', $salesOrder); + + if (! in_array($salesOrder->status, ['confirmed', 'fulfilled'], true)) { + return back()->withErrors(['status' => 'Only confirmed or fulfilled orders can be invoiced.']); + } + + if ($salesOrder->invoice_id) { + return back()->withErrors(['status' => 'This order has already been invoiced.']); + } + + $invoice = DB::transaction(function () use ($salesOrder) { + $salesOrder->load('items'); + + $invoice = Invoice::create([ + 'tenant_id' => $salesOrder->tenant_id, + 'sales_order_id' => $salesOrder->id, + 'contact_id' => $salesOrder->contact_id, + 'issue_date' => now()->toDateString(), + 'due_date' => now()->addDays(30)->toDateString(), + 'status' => 'draft', + 'notes' => $salesOrder->notes, + 'created_by' => auth()->id(), + 'currency_code' => $salesOrder->currency_code ?? 'USD', + 'exchange_rate' => $salesOrder->exchange_rate ?? 1, + ]); + + $invoice->update([ + 'number' => 'INV-' . now()->format('Y') . '-' . str_pad((string) $invoice->id, 5, '0', STR_PAD_LEFT), + ]); + + foreach ($salesOrder->items as $item) { + InvoiceItem::create([ + 'invoice_id' => $invoice->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + ]); + } + + $salesOrder->update(['invoice_id' => $invoice->id]); + + return $invoice; + }); + + return redirect()->route('finance.invoices.show', $invoice) + ->with('success', 'Invoice created from sales order.'); + } + + public function destroy(SalesOrder $salesOrder): RedirectResponse + { + $this->authorize('delete', $salesOrder); + + $salesOrder->delete(); + + return redirect()->route('finance.sales-orders.index') + ->with('success', 'Sales order deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/SubscriptionController.php b/erp/app/Modules/Finance/Http/Controllers/SubscriptionController.php new file mode 100644 index 00000000000..cdbc859e9c0 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/SubscriptionController.php @@ -0,0 +1,152 @@ +authorize('viewAny', Subscription::class); + + $subscriptions = Subscription::with(['contact', 'plan']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->latest() + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Finance/Subscriptions/Index', [ + 'subscriptions' => $subscriptions, + 'filters' => $request->only(['status']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscriptions', 'href' => route('finance.subscriptions.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Subscription::class); + + return Inertia::render('Finance/Subscriptions/Create', [ + 'contacts' => Contact::customers()->active()->orderBy('name')->get(['id', 'name']), + 'plans' => SubscriptionPlan::where('is_active', true)->orderBy('name')->get(['id', 'name', 'billing_cycle', 'price']), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscriptions', 'href' => route('finance.subscriptions.index')], + ['label' => 'New Subscription'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Subscription::class); + + $data = $request->validate([ + 'contact_id' => ['required', Rule::exists('contacts', 'id')], + 'subscription_plan_id' => ['required', Rule::exists('subscription_plans', 'id')], + 'started_at' => ['required', 'date'], + 'notes' => ['nullable', 'string'], + ]); + + $plan = SubscriptionPlan::find($data['subscription_plan_id']); + + $trialEndsAt = null; + $status = 'active'; + + if ($plan && $plan->trial_days > 0) { + $status = 'trial'; + $trialEndsAt = Carbon::parse($data['started_at'])->addDays($plan->trial_days)->toDateString(); + } + + $subscription = Subscription::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'contact_id' => $data['contact_id'], + 'subscription_plan_id' => $data['subscription_plan_id'], + 'status' => $status, + 'started_at' => $data['started_at'], + 'trial_ends_at' => $trialEndsAt, + 'notes' => $data['notes'] ?? null, + ]); + + return redirect()->route('finance.subscriptions.show', $subscription) + ->with('success', 'Subscription created.'); + } + + public function show(Subscription $subscription): Response + { + $this->authorize('view', $subscription); + + $subscription->load(['contact', 'plan']); + + return Inertia::render('Finance/Subscriptions/Show', [ + 'subscription' => $subscription, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscriptions', 'href' => route('finance.subscriptions.index')], + ['label' => "Subscription #{$subscription->id}"], + ], + ]); + } + + public function destroy(Subscription $subscription): RedirectResponse + { + $this->authorize('delete', $subscription); + + $subscription->delete(); + + return redirect()->route('finance.subscriptions.index') + ->with('success', 'Subscription deleted.'); + } + + public function activate(Subscription $subscription): RedirectResponse + { + $this->authorize('create', Subscription::class); + + $subscription->load('plan'); + $subscription->activate(); + + return back()->with('success', 'Subscription activated.'); + } + + public function cancel(Subscription $subscription): RedirectResponse + { + $this->authorize('create', Subscription::class); + + $subscription->cancel(); + + return back()->with('success', 'Subscription cancelled.'); + } + + public function pause(Subscription $subscription): RedirectResponse + { + $this->authorize('create', Subscription::class); + + $subscription->pause(); + + return back()->with('success', 'Subscription paused.'); + } + + public function generateInvoice(Subscription $subscription): RedirectResponse + { + $this->authorize('create', Subscription::class); + + $subscription->load('plan'); + $invoice = $subscription->generateInvoice(); + + return redirect()->route('finance.invoices.show', $invoice) + ->with('success', 'Invoice generated.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/SubscriptionPlanController.php b/erp/app/Modules/Finance/Http/Controllers/SubscriptionPlanController.php new file mode 100644 index 00000000000..753b1ea744b --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/SubscriptionPlanController.php @@ -0,0 +1,100 @@ +authorize('viewAny', SubscriptionPlan::class); + + $plans = SubscriptionPlan::withCount('subscriptions') + ->latest() + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Finance/SubscriptionPlans/Index', [ + 'plans' => $plans, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscription Plans', 'href' => route('finance.subscription-plans.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', SubscriptionPlan::class); + + return Inertia::render('Finance/SubscriptionPlans/Create', [ + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscription Plans', 'href' => route('finance.subscription-plans.index')], + ['label' => 'New Plan'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', SubscriptionPlan::class); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'billing_cycle' => ['required', Rule::in(['monthly', 'quarterly', 'annually'])], + 'price' => ['required', 'numeric', 'min:0'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'trial_days' => ['nullable', 'integer', 'min:0'], + 'description' => ['nullable', 'string'], + 'is_active' => ['nullable', 'boolean'], + ]); + + $plan = SubscriptionPlan::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'name' => $data['name'], + 'billing_cycle' => $data['billing_cycle'], + 'price' => $data['price'], + 'currency_code' => $data['currency_code'] ?? 'USD', + 'trial_days' => $data['trial_days'] ?? 0, + 'description' => $data['description'] ?? null, + 'is_active' => $data['is_active'] ?? true, + ]); + + return redirect()->route('finance.subscription-plans.show', $plan) + ->with('success', 'Subscription plan created.'); + } + + public function show(SubscriptionPlan $subscriptionPlan): Response + { + $this->authorize('view', $subscriptionPlan); + + $subscriptionPlan->loadCount('subscriptions'); + + return Inertia::render('Finance/SubscriptionPlans/Show', [ + 'plan' => $subscriptionPlan, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Subscription Plans', 'href' => route('finance.subscription-plans.index')], + ['label' => $subscriptionPlan->name], + ], + ]); + } + + public function destroy(SubscriptionPlan $subscriptionPlan): RedirectResponse + { + $this->authorize('delete', $subscriptionPlan); + + $subscriptionPlan->delete(); + + return redirect()->route('finance.subscription-plans.index') + ->with('success', 'Subscription plan deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/VendorEvaluationController.php b/erp/app/Modules/Finance/Http/Controllers/VendorEvaluationController.php new file mode 100644 index 00000000000..6f1bd8b72bf --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/VendorEvaluationController.php @@ -0,0 +1,73 @@ +id) + ->with('evaluator') + ->latest('evaluation_date') + ->paginate(25); + + return Inertia::render('Finance/Vendors/Evaluations', [ + 'contact' => $contact, + 'evaluations' => $evaluations, + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contacts', 'href' => route('finance.contacts.index')], + ['label' => $contact->name], + ['label' => 'Evaluations'], + ], + ]); + } + + public function store(Request $request, Contact $contact): RedirectResponse + { + abort_unless(Gate::allows('finance.create'), 403); + + $data = $request->validate([ + 'evaluation_date' => ['required', 'date'], + 'quality_rating' => ['required', 'integer', 'min:1', 'max:5'], + 'delivery_rating' => ['required', 'integer', 'min:1', 'max:5'], + 'price_rating' => ['required', 'integer', 'min:1', 'max:5'], + 'communication_rating' => ['required', 'integer', 'min:1', 'max:5'], + 'comments' => ['nullable', 'string'], + ]); + + $overall = round( + ($data['quality_rating'] + $data['delivery_rating'] + $data['price_rating'] + $data['communication_rating']) / 4, + 2 + ); + + VendorEvaluation::create(array_merge($data, [ + 'tenant_id' => $contact->tenant_id, + 'contact_id' => $contact->id, + 'evaluated_by' => auth()->id(), + 'overall_rating' => $overall, + ])); + + return redirect()->back()->with('success', 'Evaluation added.'); + } + + public function destroy(Contact $contact, VendorEvaluation $evaluation): RedirectResponse + { + abort_unless(Gate::allows('finance.delete'), 403); + + $evaluation->delete(); + + return redirect()->back()->with('success', 'Evaluation deleted.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Controllers/VendorProfileController.php b/erp/app/Modules/Finance/Http/Controllers/VendorProfileController.php new file mode 100644 index 00000000000..56b0d8a8b9b --- /dev/null +++ b/erp/app/Modules/Finance/Http/Controllers/VendorProfileController.php @@ -0,0 +1,65 @@ + $contact->id], + [ + 'tenant_id' => $contact->tenant_id, + 'payment_terms_days' => 30, + ] + ); + + $profile->load('contact'); + + return Inertia::render('Finance/Vendors/Profile', [ + 'contact' => $contact, + 'profile' => array_merge($profile->toArray(), [ + 'is_over_credit_limit' => $profile->is_over_credit_limit, + ]), + 'breadcrumbs' => [ + ['label' => 'Finance'], + ['label' => 'Contacts', 'href' => route('finance.contacts.index')], + ['label' => $contact->name], + ['label' => 'Vendor Profile'], + ], + ]); + } + + public function update(Request $request, Contact $contact): RedirectResponse + { + abort_unless(Gate::allows('finance.create'), 403); + + $data = $request->validate([ + 'credit_limit' => ['nullable', 'numeric', 'min:0'], + 'payment_terms_days' => ['required', 'integer', 'min:0', 'max:365'], + 'preferred_currency' => ['nullable', 'string', 'size:3'], + 'bank_name' => ['nullable', 'string', 'max:255'], + 'bank_account_number' => ['nullable', 'string', 'max:100'], + 'bank_routing_number' => ['nullable', 'string', 'max:100'], + 'notes' => ['nullable', 'string'], + ]); + + VendorProfile::updateOrCreate( + ['contact_id' => $contact->id], + array_merge($data, ['tenant_id' => $contact->tenant_id]) + ); + + return redirect()->back()->with('success', 'Vendor profile updated.'); + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreAccountRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreAccountRequest.php new file mode 100644 index 00000000000..19ad9322b7d --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreAccountRequest.php @@ -0,0 +1,26 @@ + ['required', 'string', 'max:20', + Rule::unique('accounts')->where('tenant_id', auth()->user()->tenant_id) + ->ignore($this->route('account')), + ], + 'name' => ['required', 'string', 'max:255'], + 'type' => ['required', Rule::in(['asset', 'liability', 'equity', 'income', 'expense'])], + 'parent_id' => ['nullable', 'integer', 'exists:accounts,id'], + 'description' => ['nullable', 'string'], + 'is_active' => ['boolean'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreBillRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreBillRequest.php new file mode 100644 index 00000000000..b34aba36ca8 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreBillRequest.php @@ -0,0 +1,29 @@ + ['nullable', 'integer', Rule::exists('contacts', 'id') + ->where(fn ($q) => $q->whereIn('type', ['vendor', 'both']))], + 'issue_date' => ['required', 'date'], + 'due_date' => ['nullable', 'date', 'after_or_equal:issue_date'], + 'notes' => ['nullable', 'string'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'exchange_rate' => ['nullable', 'numeric', 'min:0.000001'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.description' => ['required', 'string', 'max:500'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreContactRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreContactRequest.php new file mode 100644 index 00000000000..741076e41d2 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreContactRequest.php @@ -0,0 +1,25 @@ + ['required', 'string', 'max:255'], + 'email' => ['nullable', 'email', 'max:255'], + 'phone' => ['nullable', 'string', 'max:50'], + 'address' => ['nullable', 'string'], + 'type' => ['required', Rule::in(['customer', 'vendor', 'both'])], + 'notes' => ['nullable', 'string'], + 'is_active' => ['boolean'], + 'price_list_id' => ['nullable', 'exists:price_lists,id'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreCreditNoteRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreCreditNoteRequest.php new file mode 100644 index 00000000000..2e3890f766a --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreCreditNoteRequest.php @@ -0,0 +1,27 @@ + ['nullable', Rule::exists('contacts', 'id')], + 'invoice_id' => ['nullable', Rule::exists('invoices', 'id')], + 'issue_date' => ['required', 'date'], + 'reason' => ['nullable', 'string'], + 'notes' => ['nullable', 'string'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.description' => ['required', 'string'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreFixedAssetRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreFixedAssetRequest.php new file mode 100644 index 00000000000..809d2ebad4b --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreFixedAssetRequest.php @@ -0,0 +1,25 @@ + ['required', 'string', 'max:191'], + 'category' => ['required', 'in:equipment,vehicle,building,furniture,intangible,other'], + 'purchase_date' => ['required', 'date'], + 'purchase_cost' => ['required', 'numeric', 'min:0.01'], + 'salvage_value' => ['nullable', 'numeric', 'min:0'], + 'useful_life_years' => ['required', 'integer', 'min:1', 'max:100'], + 'asset_account_id' => ['nullable', 'exists:accounts,id'], + 'depreciation_account_id' => ['nullable', 'exists:accounts,id'], + 'description' => ['nullable', 'string'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreInvoiceRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreInvoiceRequest.php new file mode 100644 index 00000000000..3a423aee4a3 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreInvoiceRequest.php @@ -0,0 +1,27 @@ + ['nullable', 'integer', 'exists:contacts,id'], + 'issue_date' => ['required', 'date'], + 'due_date' => ['nullable', 'date', 'after_or_equal:issue_date'], + 'notes' => ['nullable', 'string'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'exchange_rate' => ['nullable', 'numeric', 'min:0.000001'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.description' => ['required', 'string', 'max:500'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreJournalEntryRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreJournalEntryRequest.php new file mode 100644 index 00000000000..edbd35dffe2 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreJournalEntryRequest.php @@ -0,0 +1,24 @@ + ['required', 'date'], + 'reference' => ['nullable', 'string', 'max:100'], + 'description' => ['required', 'string', 'max:500'], + 'lines' => ['required', 'array', 'min:2'], + 'lines.*.account_id' => ['required', 'integer', 'exists:accounts,id'], + 'lines.*.debit' => ['required', 'numeric', 'min:0'], + 'lines.*.credit' => ['required', 'numeric', 'min:0'], + 'lines.*.description' => ['nullable', 'string', 'max:255'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StorePaymentRequest.php b/erp/app/Modules/Finance/Http/Requests/StorePaymentRequest.php new file mode 100644 index 00000000000..b6cf0ce74f2 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StorePaymentRequest.php @@ -0,0 +1,22 @@ + ['required', 'numeric', 'min:0.01'], + 'payment_date' => ['required', 'date'], + 'method' => ['required', Rule::in(['cash', 'bank_transfer', 'cheque', 'card', 'other'])], + 'reference' => ['nullable', 'string', 'max:100'], + 'notes' => ['nullable', 'string'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreQuoteRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreQuoteRequest.php new file mode 100644 index 00000000000..ad210a28d11 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreQuoteRequest.php @@ -0,0 +1,28 @@ + ['nullable', Rule::exists('contacts', 'id')], + 'issue_date' => ['required', 'date'], + 'expiry_date' => ['nullable', 'date', 'after_or_equal:issue_date'], + 'notes' => ['nullable', 'string'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'exchange_rate' => ['nullable', 'numeric', 'min:0.000001'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.description' => ['required', 'string'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreRecurringInvoiceRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreRecurringInvoiceRequest.php new file mode 100644 index 00000000000..6fbf5d89b2c --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreRecurringInvoiceRequest.php @@ -0,0 +1,33 @@ + ['nullable', Rule::exists('contacts', 'id')], + 'reference_prefix' => ['nullable', 'string', 'max:50'], + 'frequency' => ['required', Rule::in(['weekly', 'monthly', 'quarterly', 'yearly'])], + 'interval' => ['nullable', 'integer', 'min:1', 'max:12'], + 'start_date' => ['required', 'date'], + 'end_date' => ['nullable', 'date', 'after_or_equal:start_date'], + 'due_days' => ['required', 'integer', 'min:0', 'max:365'], + 'auto_send' => ['boolean'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'exchange_rate' => ['nullable', 'numeric', 'min:0.000001'], + 'notes' => ['nullable', 'string'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.description' => ['required', 'string'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Requests/StoreSalesOrderRequest.php b/erp/app/Modules/Finance/Http/Requests/StoreSalesOrderRequest.php new file mode 100644 index 00000000000..064c38e855d --- /dev/null +++ b/erp/app/Modules/Finance/Http/Requests/StoreSalesOrderRequest.php @@ -0,0 +1,31 @@ + ['nullable', Rule::exists('contacts', 'id')], + 'warehouse_id' => ['nullable', Rule::exists('warehouses', 'id')], + 'reference' => ['nullable', 'string', 'max:100', Rule::unique('sales_orders', 'reference')], + 'order_date' => ['required', 'date'], + 'expected_date' => ['nullable', 'date', 'after_or_equal:order_date'], + 'currency_code' => ['nullable', 'string', 'size:3'], + 'exchange_rate' => ['nullable', 'numeric', 'min:0.000001'], + 'notes' => ['nullable', 'string'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.product_id' => ['nullable', Rule::exists('products', 'id')], + 'items.*.description' => ['required', 'string'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_price' => ['required', 'numeric', 'min:0'], + 'items.*.tax_rate' => ['required', 'numeric', 'min:0', 'max:100'], + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/AccountResource.php b/erp/app/Modules/Finance/Http/Resources/AccountResource.php new file mode 100644 index 00000000000..8121a441f62 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/AccountResource.php @@ -0,0 +1,26 @@ + $this->id, + 'code' => $this->code, + 'name' => $this->name, + 'type' => $this->type, + 'description' => $this->description, + 'is_active' => $this->is_active, + 'parent_id' => $this->parent_id, + 'parent' => $this->whenLoaded('parent', fn () => [ + 'id' => $this->parent->id, 'name' => $this->parent->name, 'code' => $this->parent->code, + ]), + 'balance' => $this->when(isset($this->resource->balance), $this->balance), + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/BillResource.php b/erp/app/Modules/Finance/Http/Resources/BillResource.php new file mode 100644 index 00000000000..768cb7b61c7 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/BillResource.php @@ -0,0 +1,61 @@ + $this->id, + 'number' => $this->number, + 'status' => $this->status, + 'issue_date' => $this->issue_date?->toDateString(), + 'due_date' => $this->due_date?->toDateString(), + 'notes' => $this->notes, + 'is_overdue' => $this->isOverdue(), + 'currency_code' => $this->currency_code ?? 'USD', + 'exchange_rate' => $this->exchange_rate ?? 1.0, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($i) => [ + 'id' => $i->id, + 'description' => $i->description, + 'quantity' => $i->quantity, + 'unit_price' => $i->unit_price, + 'tax_rate' => $i->tax_rate, + 'subtotal' => $i->subtotal, + 'tax' => $i->tax, + 'line_total' => $i->line_total, + ])), + 'payments' => $this->whenLoaded('payments', fn () => $this->payments->map(fn ($p) => [ + 'id' => $p->id, + 'amount' => $p->amount, + 'payment_date' => $p->payment_date?->toDateString(), + 'method' => $p->method, + 'reference' => $p->reference, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'base_total' => $this->whenLoaded('items', fn () => $this->base_total), + 'amount_paid' => $this->whenLoaded('payments', fn () => $this->amount_paid), + 'amount_due' => $this->when( + $this->relationLoaded('items') && $this->relationLoaded('payments'), + fn () => $this->amount_due + ), + 'transitions' => $this->availableTransitions(), + 'attachments' => $this->whenLoaded('attachments', fn () => $this->attachments->map(fn ($a) => [ + 'id' => $a->id, 'filename' => $a->filename, 'disk' => $a->disk, + 'path' => $a->path, 'mime_type' => $a->mime_type, 'size' => $a->size, + 'uploaded_by' => $a->uploaded_by, 'created_at' => $a->created_at?->toIso8601String(), + ])), + 'creator' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/ContactResource.php b/erp/app/Modules/Finance/Http/Resources/ContactResource.php new file mode 100644 index 00000000000..4c8bd56187e --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/ContactResource.php @@ -0,0 +1,24 @@ + $this->id, + 'name' => $this->name, + 'email' => $this->email, + 'phone' => $this->phone, + 'address' => $this->address, + 'type' => $this->type, + 'notes' => $this->notes, + 'is_active' => $this->is_active, + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/CreditNoteResource.php b/erp/app/Modules/Finance/Http/Resources/CreditNoteResource.php new file mode 100644 index 00000000000..b74898f897a --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/CreditNoteResource.php @@ -0,0 +1,41 @@ + $this->id, + 'number' => $this->number, + 'status' => $this->status, + 'issue_date' => $this->issue_date?->toDateString(), + 'reason' => $this->reason, + 'notes' => $this->notes, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'invoice' => $this->whenLoaded('invoice', fn () => $this->invoice ? [ + 'id' => $this->invoice->id, 'number' => $this->invoice->number, + ] : null), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + 'line_total' => $item->line_total, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'transitions' => $this->availableTransitions(), + 'created_by' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/InvoiceResource.php b/erp/app/Modules/Finance/Http/Resources/InvoiceResource.php new file mode 100644 index 00000000000..81da7a1a51b --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/InvoiceResource.php @@ -0,0 +1,61 @@ + $this->id, + 'number' => $this->number, + 'status' => $this->status, + 'issue_date' => $this->issue_date?->toDateString(), + 'due_date' => $this->due_date?->toDateString(), + 'notes' => $this->notes, + 'is_overdue' => $this->isOverdue(), + 'currency_code' => $this->currency_code ?? 'USD', + 'exchange_rate' => $this->exchange_rate ?? 1.0, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($i) => [ + 'id' => $i->id, + 'description' => $i->description, + 'quantity' => $i->quantity, + 'unit_price' => $i->unit_price, + 'tax_rate' => $i->tax_rate, + 'subtotal' => $i->subtotal, + 'tax' => $i->tax, + 'line_total' => $i->line_total, + ])), + 'payments' => $this->whenLoaded('payments', fn () => $this->payments->map(fn ($p) => [ + 'id' => $p->id, + 'amount' => $p->amount, + 'payment_date' => $p->payment_date?->toDateString(), + 'method' => $p->method, + 'reference' => $p->reference, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'base_total' => $this->whenLoaded('items', fn () => $this->base_total), + 'amount_paid' => $this->whenLoaded('payments', fn () => $this->amount_paid), + 'amount_due' => $this->when( + $this->relationLoaded('items') && $this->relationLoaded('payments'), + fn () => $this->amount_due + ), + 'transitions' => $this->availableTransitions(), + 'attachments' => $this->whenLoaded('attachments', fn () => $this->attachments->map(fn ($a) => [ + 'id' => $a->id, 'filename' => $a->filename, 'disk' => $a->disk, + 'path' => $a->path, 'mime_type' => $a->mime_type, 'size' => $a->size, + 'uploaded_by' => $a->uploaded_by, 'created_at' => $a->created_at?->toIso8601String(), + ])), + 'creator' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/JournalEntryResource.php b/erp/app/Modules/Finance/Http/Resources/JournalEntryResource.php new file mode 100644 index 00000000000..d00f1533f99 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/JournalEntryResource.php @@ -0,0 +1,32 @@ + $this->id, + 'date' => $this->date?->toDateString(), + 'reference' => $this->reference, + 'description' => $this->description, + 'status' => $this->status, + 'total_debits' => $this->whenLoaded('lines', fn () => $this->total_debits), + 'total_credits'=> $this->whenLoaded('lines', fn () => $this->total_credits), + 'creator' => $this->whenLoaded('creator', fn () => ['id' => $this->creator->id, 'name' => $this->creator->name]), + 'lines' => $this->whenLoaded('lines', fn () => $this->lines->map(fn ($line) => [ + 'id' => $line->id, + 'account_id' => $line->account_id, + 'account' => $line->relationLoaded('account') ? ['id' => $line->account->id, 'code' => $line->account->code, 'name' => $line->account->name] : null, + 'debit' => $line->debit, + 'credit' => $line->credit, + 'description' => $line->description, + ])), + 'created_at' => $this->created_at?->toDateTimeString(), + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/QuoteResource.php b/erp/app/Modules/Finance/Http/Resources/QuoteResource.php new file mode 100644 index 00000000000..175403302e6 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/QuoteResource.php @@ -0,0 +1,41 @@ + $this->id, + 'number' => $this->number, + 'status' => $this->status, + 'issue_date' => $this->issue_date?->toDateString(), + 'expiry_date' => $this->expiry_date?->toDateString(), + 'notes' => $this->notes, + 'currency_code' => $this->currency_code ?? 'USD', + 'exchange_rate' => $this->exchange_rate ?? 1.0, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + 'line_total' => $item->line_total, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'base_total' => $this->whenLoaded('items', fn () => $this->base_total), + 'transitions' => $this->availableTransitions(), + 'created_by' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/RecurringInvoiceResource.php b/erp/app/Modules/Finance/Http/Resources/RecurringInvoiceResource.php new file mode 100644 index 00000000000..2a6c9fc6bc5 --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/RecurringInvoiceResource.php @@ -0,0 +1,46 @@ + $this->id, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'reference_prefix' => $this->reference_prefix, + 'frequency' => $this->frequency, + 'interval' => $this->interval, + 'start_date' => $this->start_date?->toDateString(), + 'next_run_date' => $this->next_run_date?->toDateString(), + 'end_date' => $this->end_date?->toDateString(), + 'due_days' => $this->due_days, + 'status' => $this->status, + 'auto_send' => (bool) $this->auto_send, + 'currency_code' => $this->currency_code, + 'exchange_rate' => $this->exchange_rate, + 'notes' => $this->notes, + 'last_generated_at' => $this->last_generated_at, + 'generated_count' => $this->generated_count, + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + 'line_total' => $item->line_total, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'created_by' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Finance/Http/Resources/SalesOrderResource.php b/erp/app/Modules/Finance/Http/Resources/SalesOrderResource.php new file mode 100644 index 00000000000..0e90aecf57e --- /dev/null +++ b/erp/app/Modules/Finance/Http/Resources/SalesOrderResource.php @@ -0,0 +1,48 @@ + $this->id, + 'number' => $this->number, + 'status' => $this->status, + 'order_date' => $this->order_date?->toDateString(), + 'expected_date' => $this->expected_date?->toDateString(), + 'notes' => $this->notes, + 'contact' => $this->whenLoaded('contact', fn () => $this->contact ? [ + 'id' => $this->contact->id, 'name' => $this->contact->name, + ] : null), + 'warehouse' => $this->whenLoaded('warehouse', fn () => $this->warehouse ? [ + 'id' => $this->warehouse->id, 'name' => $this->warehouse->name, + ] : null), + 'invoice' => $this->whenLoaded('invoice', fn () => $this->invoice ? [ + 'id' => $this->invoice->id, 'number' => $this->invoice->number, + ] : null), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'product_id' => $item->product_id, + 'product_name' => $item->product?->name, + 'product_sku' => $item->product?->sku, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + 'quantity_fulfilled' => $item->quantity_fulfilled, + 'line_total' => $item->line_total, + ])), + 'subtotal' => $this->whenLoaded('items', fn () => $this->subtotal), + 'tax_total' => $this->whenLoaded('items', fn () => $this->tax_total), + 'total' => $this->whenLoaded('items', fn () => $this->total), + 'transitions' => $this->availableTransitions(), + 'created_by' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Finance/Mail/DocumentMail.php b/erp/app/Modules/Finance/Mail/DocumentMail.php new file mode 100644 index 00000000000..590dc039849 --- /dev/null +++ b/erp/app/Modules/Finance/Mail/DocumentMail.php @@ -0,0 +1,48 @@ +mailSubject); + } + + public function content(): Content + { + return new Content(view: 'emails.document', with: [ + 'subject' => $this->mailSubject, + 'message_body' => $this->messageBody, + 'company' => $this->company, + ]); + } + + public function attachments(): array + { + $pdfData = $this->pdfData; + $filename = $this->filename; + + return [ + Attachment::fromData(fn () => $pdfData, $filename) + ->withMime('application/pdf'), + ]; + } +} diff --git a/erp/app/Modules/Finance/Models/Account.php b/erp/app/Modules/Finance/Models/Account.php new file mode 100644 index 00000000000..47b2b16a93b --- /dev/null +++ b/erp/app/Modules/Finance/Models/Account.php @@ -0,0 +1,66 @@ + 'boolean']; + + /** Types whose normal balance is debit */ + private const DEBIT_NORMAL = ['asset', 'expense']; + + public function parent(): BelongsTo + { + return $this->belongsTo(Account::class, 'parent_id'); + } + + public function children(): HasMany + { + return $this->hasMany(Account::class, 'parent_id'); + } + + public function journalLines(): HasMany + { + return $this->hasMany(JournalLine::class); + } + + public function getBalanceAttribute(): float + { + $debits = (float) $this->journalLines() + ->whereHas('journalEntry', fn ($q) => $q->where('status', 'posted')) + ->sum('debit'); + $credits = (float) $this->journalLines() + ->whereHas('journalEntry', fn ($q) => $q->where('status', 'posted')) + ->sum('credit'); + + return in_array($this->type, self::DEBIT_NORMAL, true) + ? $debits - $credits + : $credits - $debits; + } + + public function scopeActive($query) + { + return $query->where('is_active', true); + } + + public function scopeOfType($query, string $type) + { + return $query->where('type', $type); + } +} diff --git a/erp/app/Modules/Finance/Models/Attachment.php b/erp/app/Modules/Finance/Models/Attachment.php new file mode 100644 index 00000000000..6cf60e994db --- /dev/null +++ b/erp/app/Modules/Finance/Models/Attachment.php @@ -0,0 +1,28 @@ +morphTo(); + } + + public function uploader(): BelongsTo + { + return $this->belongsTo(\App\Models\User::class, 'uploaded_by'); + } +} diff --git a/erp/app/Modules/Finance/Models/BankAccount.php b/erp/app/Modules/Finance/Models/BankAccount.php new file mode 100644 index 00000000000..811f1cf4bbe --- /dev/null +++ b/erp/app/Modules/Finance/Models/BankAccount.php @@ -0,0 +1,38 @@ + 'float', + ]; + + public function transactions(): HasMany + { + return $this->hasMany(BankTransaction::class); + } + + public function getBalanceAttribute(): float + { + return $this->opening_balance + $this->transactions()->sum('amount'); + } + + public function getUnreconciledCountAttribute(): int + { + return $this->transactions()->where('reconciled', false)->count(); + } +} diff --git a/erp/app/Modules/Finance/Models/BankTransaction.php b/erp/app/Modules/Finance/Models/BankTransaction.php new file mode 100644 index 00000000000..8de09ca7395 --- /dev/null +++ b/erp/app/Modules/Finance/Models/BankTransaction.php @@ -0,0 +1,39 @@ + 'date', + 'reconciled' => 'boolean', + 'amount' => 'float', + ]; + + public function bankAccount(): BelongsTo + { + return $this->belongsTo(BankAccount::class); + } + + public function payment(): BelongsTo + { + return $this->belongsTo(Payment::class); + } + + public function journalEntry(): BelongsTo + { + return $this->belongsTo(JournalEntry::class); + } +} diff --git a/erp/app/Modules/Finance/Models/BatchPayment.php b/erp/app/Modules/Finance/Models/BatchPayment.php new file mode 100644 index 00000000000..8cec30e434a --- /dev/null +++ b/erp/app/Modules/Finance/Models/BatchPayment.php @@ -0,0 +1,28 @@ + 'date', + 'total_amount' => 'decimal:2', + ]; + + public function payments(): HasMany + { + return $this->hasMany(Payment::class); + } +} diff --git a/erp/app/Modules/Finance/Models/Bill.php b/erp/app/Modules/Finance/Models/Bill.php new file mode 100644 index 00000000000..3306c2ee406 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Bill.php @@ -0,0 +1,74 @@ + 'date', + 'due_date' => 'date', + 'exchange_rate' => 'float', + ]; + + protected $attributes = ['status' => 'draft']; + + protected function getTransitions(): array + { + return [ + 'draft' => ['received', 'cancelled'], + 'received' => ['partial', 'paid', 'cancelled'], + 'partial' => ['paid', 'cancelled'], + 'paid' => [], + 'cancelled' => [], + ]; + } + + public function getBaseTotalAttribute(): float + { + return round($this->total * (float) $this->exchange_rate, 2); + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function items(): HasMany + { + return $this->hasMany(BillItem::class); + } + + public function payments(): HasMany + { + return $this->hasMany(BillPayment::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } +} diff --git a/erp/app/Modules/Finance/Models/BillItem.php b/erp/app/Modules/Finance/Models/BillItem.php new file mode 100644 index 00000000000..1e48369bd1c --- /dev/null +++ b/erp/app/Modules/Finance/Models/BillItem.php @@ -0,0 +1,39 @@ + 'decimal:2', + 'unit_price' => 'decimal:2', + 'tax_rate' => 'decimal:2', + ]; + + public function bill(): BelongsTo + { + return $this->belongsTo(Bill::class); + } + + public function getSubtotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_price; + } + + public function getTaxAttribute(): float + { + return $this->subtotal * ((float) $this->tax_rate / 100); + } + + public function getLineTotalAttribute(): float + { + return $this->subtotal + $this->tax; + } +} diff --git a/erp/app/Modules/Finance/Models/BillPayment.php b/erp/app/Modules/Finance/Models/BillPayment.php new file mode 100644 index 00000000000..df84811cc39 --- /dev/null +++ b/erp/app/Modules/Finance/Models/BillPayment.php @@ -0,0 +1,24 @@ + 'decimal:2', + 'payment_date' => 'date', + ]; + + public function bill(): BelongsTo + { + return $this->belongsTo(Bill::class); + } +} diff --git a/erp/app/Modules/Finance/Models/Budget.php b/erp/app/Modules/Finance/Models/Budget.php new file mode 100644 index 00000000000..d81212ec678 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Budget.php @@ -0,0 +1,52 @@ + 'integer', + 'year' => 'integer', + ]; + + public function lines(): HasMany + { + return $this->hasMany(BudgetLine::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public function activate(): void + { + $this->status = 'active'; + $this->save(); + } + + public function close(): void + { + $this->status = 'closed'; + $this->save(); + } + + public function getTotalBudgetedAttribute(): float + { + return (float) $this->lines->sum('amount'); + } +} diff --git a/erp/app/Modules/Finance/Models/BudgetLine.php b/erp/app/Modules/Finance/Models/BudgetLine.php new file mode 100644 index 00000000000..ac1d670c23a --- /dev/null +++ b/erp/app/Modules/Finance/Models/BudgetLine.php @@ -0,0 +1,43 @@ + 'decimal:2', + 'period' => 'integer', + ]; + + public function budget(): BelongsTo + { + return $this->belongsTo(Budget::class); + } + + public function account(): BelongsTo + { + return $this->belongsTo(Account::class); + } + + public function getActualAmountAttribute(): float + { + return 0.0; + } + + public function getVarianceAttribute(): float + { + return $this->actual_amount - (float) $this->amount; + } +} diff --git a/erp/app/Modules/Finance/Models/Commission.php b/erp/app/Modules/Finance/Models/Commission.php new file mode 100644 index 00000000000..29482bf74e6 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Commission.php @@ -0,0 +1,57 @@ + 'decimal:2', + 'commission_amount' => 'decimal:2', + 'approved_at' => 'datetime', + 'paid_at' => 'datetime', + ]; + + public function rule(): BelongsTo + { + return $this->belongsTo(CommissionRule::class, 'commission_rule_id'); + } + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + public function approve(): void + { + $this->status = 'approved'; + $this->approved_at = now(); + $this->save(); + } + + public function markPaid(): void + { + $this->status = 'paid'; + $this->paid_at = now(); + $this->save(); + } +} diff --git a/erp/app/Modules/Finance/Models/CommissionRule.php b/erp/app/Modules/Finance/Models/CommissionRule.php new file mode 100644 index 00000000000..fee61abc132 --- /dev/null +++ b/erp/app/Modules/Finance/Models/CommissionRule.php @@ -0,0 +1,47 @@ + 'decimal:4', + 'fixed_amount' => 'decimal:2', + 'is_active' => 'boolean', + ]; + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function commissions(): HasMany + { + return $this->hasMany(Commission::class); + } + + public function calculateCommission(float $invoiceAmount): float + { + if ($this->type === 'percentage') { + return round($invoiceAmount * (float) $this->rate, 2); + } + + if ($this->type === 'fixed') { + return (float) $this->fixed_amount; + } + + return 0.0; + } +} diff --git a/erp/app/Modules/Finance/Models/Contact.php b/erp/app/Modules/Finance/Models/Contact.php new file mode 100644 index 00000000000..eda5a131595 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Contact.php @@ -0,0 +1,73 @@ + 'boolean']; + + public function invoices(): HasMany + { + return $this->hasMany(Invoice::class); + } + + public function bills(): HasMany + { + return $this->hasMany(Bill::class); + } + + public function priceList(): BelongsTo + { + return $this->belongsTo(PriceList::class); + } + + public function vendorProfile(): HasOne + { + return $this->hasOne(VendorProfile::class); + } + + public function vendorEvaluations(): HasMany + { + return $this->hasMany(VendorEvaluation::class)->latest('evaluation_date'); + } + + public function scopeCustomers($query) + { + return $query->whereIn('type', ['customer', 'both']); + } + + public function scopeVendors($query) + { + return $query->whereIn('type', ['vendor', 'both']); + } + + public function scopeActive($query) + { + return $query->where('is_active', true); + } + + public function scopeSearch($query, string $term) + { + return $query->where(function ($q) use ($term) { + $q->where('name', 'like', "%{$term}%") + ->orWhere('email', 'like', "%{$term}%"); + }); + } +} diff --git a/erp/app/Modules/Finance/Models/Contract.php b/erp/app/Modules/Finance/Models/Contract.php new file mode 100644 index 00000000000..f418acd580b --- /dev/null +++ b/erp/app/Modules/Finance/Models/Contract.php @@ -0,0 +1,70 @@ + 'decimal:2', + 'start_date' => 'date', + 'end_date' => 'date', + 'signed_at' => 'date', + 'auto_renew' => 'boolean', + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function getIsExpiringAttribute(): bool + { + return $this->status === 'active' + && $this->end_date !== null + && $this->end_date->diffInDays(now(), false) >= -$this->renewal_notice_days + && $this->end_date->isFuture(); + } + + public function getIsExpiredAttribute(): bool + { + return $this->end_date !== null && $this->end_date->isPast(); + } + + public function activate(): void + { + $this->status = 'active'; + $this->signed_at = $this->signed_at ?? today(); + $this->save(); + } + + public function terminate(): void + { + $this->status = 'terminated'; + $this->save(); + } + + public function scopeExpiringSoon($query) + { + return $query->where('status', 'active') + ->whereBetween('end_date', [now(), now()->addDays(30)]); + } + + public function scopeActive($query) + { + return $query->where('status', 'active'); + } +} diff --git a/erp/app/Modules/Finance/Models/CreditNote.php b/erp/app/Modules/Finance/Models/CreditNote.php new file mode 100644 index 00000000000..5ef556c32e4 --- /dev/null +++ b/erp/app/Modules/Finance/Models/CreditNote.php @@ -0,0 +1,58 @@ + 'date']; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class, 'original_invoice_id'); + } + + public function bill(): BelongsTo + { + return $this->belongsTo(Bill::class, 'original_bill_id'); + } + + public function items(): HasMany + { + return $this->hasMany(CreditNoteItem::class); + } + + public function getAmountRemainingAttribute(): float + { + return max(0, (float) $this->total - (float) $this->amount_applied); + } + + protected static function booted(): void + { + static::saving(function (self $cn) { + if ($cn->relationLoaded('items') && $cn->items->count() > 0) { + $cn->subtotal = $cn->items->sum('line_total'); + $cn->tax_total = $cn->items->sum(fn ($i) => $i->line_total * $i->tax_rate / 100); + $cn->total = $cn->subtotal + $cn->tax_total; + } + }); + } +} diff --git a/erp/app/Modules/Finance/Models/CreditNoteItem.php b/erp/app/Modules/Finance/Models/CreditNoteItem.php new file mode 100644 index 00000000000..a8389814afe --- /dev/null +++ b/erp/app/Modules/Finance/Models/CreditNoteItem.php @@ -0,0 +1,25 @@ +belongsTo(CreditNote::class); + } + + protected static function booted(): void + { + static::saving(function (self $item) { + $item->line_total = round((float) $item->quantity * (float) $item->unit_price, 2); + }); + } +} diff --git a/erp/app/Modules/Finance/Models/CustomerPortalToken.php b/erp/app/Modules/Finance/Models/CustomerPortalToken.php new file mode 100644 index 00000000000..678ea9461c3 --- /dev/null +++ b/erp/app/Modules/Finance/Models/CustomerPortalToken.php @@ -0,0 +1,54 @@ + 'datetime', + 'last_accessed_at' => 'datetime', + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function getIsExpiredAttribute(): bool + { + if ($this->expires_at === null) { + return false; + } + + return $this->expires_at->isPast(); + } + + public static function generate(int $tenantId, int $contactId, string $email, int $days = 30): self + { + $token = bin2hex(random_bytes(32)); // 64-char hex string + + return static::create([ + 'tenant_id' => $tenantId, + 'contact_id' => $contactId, + 'token' => $token, + 'email' => $email, + 'expires_at' => now()->addDays($days), + ]); + } +} diff --git a/erp/app/Modules/Finance/Models/DeliveryNote.php b/erp/app/Modules/Finance/Models/DeliveryNote.php new file mode 100644 index 00000000000..691de109549 --- /dev/null +++ b/erp/app/Modules/Finance/Models/DeliveryNote.php @@ -0,0 +1,44 @@ + 'date', + 'delivery_date' => 'date', + ]; + + public function salesOrder(): BelongsTo + { + return $this->belongsTo(SalesOrder::class); + } + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function items(): HasMany + { + return $this->hasMany(DeliveryNoteItem::class); + } +} diff --git a/erp/app/Modules/Finance/Models/DeliveryNoteItem.php b/erp/app/Modules/Finance/Models/DeliveryNoteItem.php new file mode 100644 index 00000000000..b03be8483ff --- /dev/null +++ b/erp/app/Modules/Finance/Models/DeliveryNoteItem.php @@ -0,0 +1,22 @@ +belongsTo(DeliveryNote::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } +} diff --git a/erp/app/Modules/Finance/Models/DepreciationEntry.php b/erp/app/Modules/Finance/Models/DepreciationEntry.php new file mode 100644 index 00000000000..45e522f67ee --- /dev/null +++ b/erp/app/Modules/Finance/Models/DepreciationEntry.php @@ -0,0 +1,35 @@ + 'date', + 'amount' => 'float', + ]; + + public function fixedAsset(): BelongsTo + { + return $this->belongsTo(FixedAsset::class); + } + + public function journalEntry(): BelongsTo + { + return $this->belongsTo(JournalEntry::class); + } +} diff --git a/erp/app/Modules/Finance/Models/DocumentTemplate.php b/erp/app/Modules/Finance/Models/DocumentTemplate.php new file mode 100644 index 00000000000..465319a2514 --- /dev/null +++ b/erp/app/Modules/Finance/Models/DocumentTemplate.php @@ -0,0 +1,42 @@ + 'array', + 'is_default' => 'boolean', + 'is_active' => 'boolean', + ]; + + public function render(array $data): string + { + $rendered = $this->body; + foreach ($data as $key => $value) { + $rendered = str_replace('{{' . $key . '}}', $value, $rendered); + } + return $rendered; + } + + public function scopeForType(Builder $query, string $type): Builder + { + return $query->where('type', $type); + } + + public function scopeActive(Builder $query): Builder + { + return $query->where('is_active', true); + } +} diff --git a/erp/app/Modules/Finance/Models/ExchangeRate.php b/erp/app/Modules/Finance/Models/ExchangeRate.php new file mode 100644 index 00000000000..575ccd79ded --- /dev/null +++ b/erp/app/Modules/Finance/Models/ExchangeRate.php @@ -0,0 +1,108 @@ + 'date', + 'rate' => 'decimal:6', + ]; + + /** + * Get the most recent rate on or before $date where base=from AND quote=to. + * Returns the rate as float, or null if not found. + */ + public static function getRate(int $tenantId, string $from, string $to, ?string $date = null): ?float + { + $date = $date ?? now()->toDateString(); + + $value = static::withoutGlobalScopes() + ->where('tenant_id', $tenantId) + ->where('base_currency', $from) + ->where('quote_currency', $to) + ->where('effective_date', '<=', $date) + ->orderByDesc('effective_date') + ->value('rate'); + + return $value !== null ? (float) $value : null; + } + + /** + * Convert an amount from one currency to another. + * Returns null if no rate found. + */ + public static function convert(float $amount, string $from, string $to, int $tenantId, ?string $date = null): ?float + { + if ($from === $to) { + return $amount; + } + + $rate = static::getRate($tenantId, $from, $to, $date); + + if ($rate === null) { + return null; + } + + return round($amount * $rate, 2); + } + + /** + * Legacy helper: get rate for a currency code vs USD. + * Returns 1.0 if currency is USD or no rate found. + */ + public static function rateFor(string $currencyCode, string $tenantIdOrDate, ?string $date = null): float + { + if ($currencyCode === 'USD') { + return 1.0; + } + + if ($date === null) { + $date = $tenantIdOrDate; + $tenantId = app('tenant')->id; + } else { + $tenantId = (int) $tenantIdOrDate; + } + + $record = static::withoutGlobalScopes() + ->where('tenant_id', $tenantId) + ->where(function ($q) use ($currencyCode) { + $q->where(function ($q2) use ($currencyCode) { + $q2->where('base_currency', 'USD') + ->where('quote_currency', $currencyCode); + })->orWhere(function ($q2) use ($currencyCode) { + $q2->where('base_currency', $currencyCode) + ->where('quote_currency', 'USD'); + }); + }) + ->whereDate('effective_date', '<=', $date) + ->orderByDesc('effective_date') + ->first(); + + if (!$record) { + return 1.0; + } + + // If base is USD, quote is the currency: rate = quote per USD + if ($record->base_currency === 'USD') { + return (float) $record->rate; + } + + // If base is currency and quote is USD: inverse + return $record->rate != 0 ? round(1 / (float) $record->rate, 6) : 1.0; + } +} diff --git a/erp/app/Modules/Finance/Models/FixedAsset.php b/erp/app/Modules/Finance/Models/FixedAsset.php new file mode 100644 index 00000000000..15d2806890d --- /dev/null +++ b/erp/app/Modules/Finance/Models/FixedAsset.php @@ -0,0 +1,154 @@ + 'date', + 'disposal_date' => 'date', + 'purchase_cost' => 'float', + 'salvage_value' => 'float', + 'accumulated_depreciation' => 'float', + 'disposal_proceeds' => 'float', + ]; + + // Relations + + public function depreciationEntries(): HasMany + { + return $this->hasMany(DepreciationEntry::class); + } + + public function assetAccount(): BelongsTo + { + return $this->belongsTo(Account::class, 'asset_account_id'); + } + + public function depreciationAccount(): BelongsTo + { + return $this->belongsTo(Account::class, 'depreciation_account_id'); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + // Computed attributes + + public function getNetBookValueAttribute(): float + { + return $this->purchase_cost - $this->accumulated_depreciation; + } + + public function getAnnualDepreciationAttribute(): float + { + return ($this->purchase_cost - $this->salvage_value) / $this->useful_life_years; + } + + public function getDepreciableAmountAttribute(): float + { + return $this->purchase_cost - $this->salvage_value; + } + + // Business logic + + public function runDepreciation(string $periodDate, string $method = 'straight_line'): DepreciationEntry + { + if ($this->status !== 'active') { + throw new DomainException('Cannot depreciate asset with status: ' . $this->status); + } + + $annualDepreciation = $this->annual_depreciation; + $remaining = $this->depreciable_amount - $this->accumulated_depreciation; + + if ($remaining <= 0) { + throw new DomainException('Asset is fully depreciated'); + } + + $periodAmount = min($annualDepreciation, $remaining); + + return DB::transaction(function () use ($periodDate, $periodAmount) { + $journalEntryId = null; + + if ($this->depreciation_account_id && $this->asset_account_id) { + $journalEntry = JournalEntry::create([ + 'tenant_id' => $this->tenant_id, + 'date' => $periodDate, + 'reference' => 'DEP-' . $this->code, + 'description' => 'Depreciation for ' . $this->name, + 'status' => 'posted', + 'created_by' => $this->created_by, + ]); + + // Debit depreciation expense account + $journalEntry->lines()->create([ + 'account_id' => $this->depreciation_account_id, + 'debit' => $periodAmount, + 'credit' => 0, + 'description' => 'Depreciation expense: ' . $this->name, + ]); + + // Credit asset account + $journalEntry->lines()->create([ + 'account_id' => $this->asset_account_id, + 'debit' => 0, + 'credit' => $periodAmount, + 'description' => 'Accumulated depreciation: ' . $this->name, + ]); + + $journalEntryId = $journalEntry->id; + } + + $entry = DepreciationEntry::create([ + 'tenant_id' => $this->tenant_id, + 'fixed_asset_id' => $this->id, + 'journal_entry_id' => $journalEntryId, + 'period_date' => $periodDate, + 'amount' => $periodAmount, + ]); + + $this->accumulated_depreciation += $periodAmount; + + if ($this->accumulated_depreciation >= $this->depreciable_amount) { + $this->status = 'fully_depreciated'; + } + + $this->save(); + + return $entry; + }); + } +} diff --git a/erp/app/Modules/Finance/Models/Invoice.php b/erp/app/Modules/Finance/Models/Invoice.php new file mode 100644 index 00000000000..a8db1cb7754 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Invoice.php @@ -0,0 +1,89 @@ + 'date', + 'due_date' => 'date', + 'exchange_rate' => 'float', + ]; + + protected $attributes = ['status' => 'draft']; + + protected function getTransitions(): array + { + return [ + 'draft' => ['sent', 'cancelled'], + 'sent' => ['partial', 'paid', 'cancelled'], + 'partial' => ['paid', 'cancelled'], + 'paid' => [], + 'cancelled' => [], + ]; + } + + public function getBaseTotalAttribute(): float + { + return round($this->total * (float) $this->exchange_rate, 2); + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function items(): HasMany + { + return $this->hasMany(InvoiceItem::class); + } + + public function payments(): HasMany + { + return $this->hasMany(Payment::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public function recurringInvoice(): BelongsTo + { + return $this->belongsTo(RecurringInvoice::class); + } + + public function salesOrder(): BelongsTo + { + return $this->belongsTo(SalesOrder::class); + } + + public function assignedTo(): BelongsTo + { + return $this->belongsTo(User::class, 'assigned_to_user_id'); + } +} \ No newline at end of file diff --git a/erp/app/Modules/Finance/Models/InvoiceItem.php b/erp/app/Modules/Finance/Models/InvoiceItem.php new file mode 100644 index 00000000000..395bbb63e66 --- /dev/null +++ b/erp/app/Modules/Finance/Models/InvoiceItem.php @@ -0,0 +1,39 @@ + 'decimal:2', + 'unit_price' => 'decimal:2', + 'tax_rate' => 'decimal:2', + ]; + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + public function getSubtotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_price; + } + + public function getTaxAttribute(): float + { + return $this->subtotal * ((float) $this->tax_rate / 100); + } + + public function getLineTotalAttribute(): float + { + return $this->subtotal + $this->tax; + } +} diff --git a/erp/app/Modules/Finance/Models/JournalEntry.php b/erp/app/Modules/Finance/Models/JournalEntry.php new file mode 100644 index 00000000000..a96564993b2 --- /dev/null +++ b/erp/app/Modules/Finance/Models/JournalEntry.php @@ -0,0 +1,73 @@ + 'date', + 'status' => 'string', + ]; + + protected $attributes = ['status' => 'draft']; + + public function lines(): HasMany + { + return $this->hasMany(JournalLine::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public function getTotalDebitsAttribute(): float + { + return (float) $this->lines->sum('debit'); + } + + public function getTotalCreditsAttribute(): float + { + return (float) $this->lines->sum('credit'); + } + + public function isBalanced(): bool + { + return abs($this->total_debits - $this->total_credits) < 0.001; + } + + public function post(): void + { + if ($this->status === 'posted') { + throw new \DomainException('Journal entry is already posted.'); + } + + if (! $this->isBalanced()) { + throw new \DomainException( + sprintf( + 'Journal entry is not balanced (debits %.2f ≠ credits %.2f).', + $this->total_debits, + $this->total_credits + ) + ); + } + + $this->update(['status' => 'posted']); + } +} diff --git a/erp/app/Modules/Finance/Models/JournalLine.php b/erp/app/Modules/Finance/Models/JournalLine.php new file mode 100644 index 00000000000..0b2abdc8e73 --- /dev/null +++ b/erp/app/Modules/Finance/Models/JournalLine.php @@ -0,0 +1,28 @@ + 'decimal:2', + 'credit' => 'decimal:2', + ]; + + public function journalEntry(): BelongsTo + { + return $this->belongsTo(JournalEntry::class); + } + + public function account(): BelongsTo + { + return $this->belongsTo(Account::class); + } +} diff --git a/erp/app/Modules/Finance/Models/Payment.php b/erp/app/Modules/Finance/Models/Payment.php new file mode 100644 index 00000000000..b65446b2c29 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Payment.php @@ -0,0 +1,34 @@ + 'decimal:2', + 'payment_date' => 'date', + ]; + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + public function batchPayment(): BelongsTo + { + return $this->belongsTo(BatchPayment::class); + } +} diff --git a/erp/app/Modules/Finance/Models/PriceList.php b/erp/app/Modules/Finance/Models/PriceList.php new file mode 100644 index 00000000000..5f7e1bb9e41 --- /dev/null +++ b/erp/app/Modules/Finance/Models/PriceList.php @@ -0,0 +1,50 @@ + 'float', + 'is_active' => 'boolean', + ]; + + public function items(): HasMany + { + return $this->hasMany(PriceListItem::class); + } + + public function contacts(): HasMany + { + return $this->hasMany(Contact::class, 'price_list_id'); + } + + public static function priceFor(int $priceListId, int $productId, float $defaultPrice): float + { + // First check for a product-specific override + $item = PriceListItem::where('price_list_id', $priceListId) + ->where('product_id', $productId) + ->first(); + if ($item) return (float) $item->unit_price; + + // Fall back to global discount + $list = static::find($priceListId); + if ($list && $list->discount_percent > 0) { + return round($defaultPrice * (1 - $list->discount_percent / 100), 4); + } + + return $defaultPrice; + } +} diff --git a/erp/app/Modules/Finance/Models/PriceListItem.php b/erp/app/Modules/Finance/Models/PriceListItem.php new file mode 100644 index 00000000000..e1ebc4c0fbe --- /dev/null +++ b/erp/app/Modules/Finance/Models/PriceListItem.php @@ -0,0 +1,27 @@ + 'float', + ]; + + public function priceList(): BelongsTo + { + return $this->belongsTo(PriceList::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(\App\Modules\Inventory\Models\Product::class); + } +} diff --git a/erp/app/Modules/Finance/Models/Project.php b/erp/app/Modules/Finance/Models/Project.php new file mode 100644 index 00000000000..5a7f1dcfa64 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Project.php @@ -0,0 +1,75 @@ + 'float', + 'starts_on' => 'date', + 'ends_on' => 'date', + ]; + + // Relations + + public function timeEntries(): HasMany + { + return $this->hasMany(ProjectTimeEntry::class); + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + // Accessors + + public function getTotalHoursAttribute(): float + { + return (float) $this->timeEntries()->sum('hours'); + } + + public function getBillableHoursAttribute(): float + { + return (float) $this->timeEntries() + ->where('billable', true) + ->where('billed', false) + ->sum('hours'); + } + + // Scopes + + public function scopeActive(Builder $query): Builder + { + return $query->where('status', 'active'); + } +} diff --git a/erp/app/Modules/Finance/Models/ProjectTimeEntry.php b/erp/app/Modules/Finance/Models/ProjectTimeEntry.php new file mode 100644 index 00000000000..ee02a137725 --- /dev/null +++ b/erp/app/Modules/Finance/Models/ProjectTimeEntry.php @@ -0,0 +1,37 @@ + 'float', + 'billable' => 'boolean', + 'billed' => 'boolean', + 'entry_date' => 'date', + ]; + + public function project(): BelongsTo + { + return $this->belongsTo(Project::class); + } + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } +} diff --git a/erp/app/Modules/Finance/Models/Quote.php b/erp/app/Modules/Finance/Models/Quote.php new file mode 100644 index 00000000000..5f217429ff0 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Quote.php @@ -0,0 +1,67 @@ + 'date', + 'expiry_date' => 'date', + 'exchange_rate' => 'float', + ]; + + protected $attributes = ['status' => 'draft']; + + protected function getTransitions(): array + { + return [ + 'draft' => ['sent', 'cancelled'], + 'sent' => ['accepted', 'declined', 'cancelled'], + 'accepted' => [], + 'declined' => [], + 'cancelled' => [], + ]; + } + + public function getBaseTotalAttribute(): float + { + return round($this->total * (float) $this->exchange_rate, 2); + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function items(): HasMany + { + return $this->hasMany(QuoteItem::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } +} diff --git a/erp/app/Modules/Finance/Models/QuoteItem.php b/erp/app/Modules/Finance/Models/QuoteItem.php new file mode 100644 index 00000000000..90425b6539a --- /dev/null +++ b/erp/app/Modules/Finance/Models/QuoteItem.php @@ -0,0 +1,31 @@ + 'decimal:2', + 'unit_price' => 'decimal:2', + 'tax_rate' => 'decimal:2', + ]; + + public function quote(): BelongsTo + { + return $this->belongsTo(Quote::class); + } + + public function getLineTotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_price * (1 + (float) $this->tax_rate / 100); + } +} diff --git a/erp/app/Modules/Finance/Models/RecurringInvoice.php b/erp/app/Modules/Finance/Models/RecurringInvoice.php new file mode 100644 index 00000000000..f927683c3a5 --- /dev/null +++ b/erp/app/Modules/Finance/Models/RecurringInvoice.php @@ -0,0 +1,153 @@ + 'date', + 'next_run_date' => 'date', + 'end_date' => 'date', + 'auto_send' => 'boolean', + 'last_generated_at' => 'datetime', + ]; + + protected $attributes = [ + 'status' => 'active', + 'frequency' => 'monthly', + 'interval' => 1, + 'reference_prefix' => 'REC-INV', + 'currency_code' => 'USD', + 'exchange_rate' => 1, + 'due_days' => 30, + 'generated_count' => 0, + 'auto_send' => false, + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function items(): HasMany + { + return $this->hasMany(RecurringInvoiceItem::class); + } + + public function invoices(): HasMany + { + return $this->hasMany(Invoice::class, 'recurring_invoice_id'); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + /** + * Compute the next run date relative to a given Carbon date, + * respecting both the frequency and the interval multiplier. + */ + public function computeNextRunDate(\Carbon\Carbon $from): \Carbon\Carbon + { + $n = (int) ($this->interval ?? 1); + + return match ($this->frequency) { + 'weekly' => $from->copy()->addWeeks($n), + 'quarterly' => $from->copy()->addMonthsNoOverflow($n * 3), + 'yearly' => $from->copy()->addYears($n), + default => $from->copy()->addMonthsNoOverflow($n), + }; + } + + public function scopeDue($query) + { + return $query->where('status', 'active') + ->whereDate('next_run_date', '<=', now()->toDateString()); + } + + protected function intervalAdvance(\Carbon\Carbon $date): \Carbon\Carbon + { + return $this->computeNextRunDate($date); + } + + public function advanceSchedule(): void + { + $next = $this->computeNextRunDate(\Carbon\Carbon::parse($this->next_run_date)); + + if ($this->end_date && $next->gt(\Carbon\Carbon::parse($this->end_date))) { + $this->status = 'ended'; + } else { + $this->next_run_date = $next->toDateString(); + } + + $this->save(); + } + + public function generateInvoice(): Invoice + { + return DB::transaction(function () { + if (! $this->relationLoaded('items')) { + $this->load('items'); + } + + $nextCount = $this->generated_count + 1; + $prefix = $this->reference_prefix ?: 'REC-INV'; + $refNumber = "{$prefix}-{$nextCount}"; + + $invoice = Invoice::create([ + 'tenant_id' => $this->tenant_id, + 'recurring_invoice_id' => $this->id, + 'contact_id' => $this->contact_id, + 'number' => $refNumber, + 'issue_date' => now()->toDateString(), + 'due_date' => now()->addDays($this->due_days)->toDateString(), + 'status' => $this->auto_send ? 'sent' : 'draft', + 'currency_code' => $this->currency_code ?? 'USD', + 'exchange_rate' => $this->exchange_rate ?? 1, + 'notes' => $this->notes, + 'created_by' => $this->created_by, + ]); + + foreach ($this->items as $item) { + InvoiceItem::create([ + 'invoice_id' => $invoice->id, + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + ]); + } + + $this->generated_count = $nextCount; + $this->last_generated_at = now(); + $this->save(); + + $this->advanceSchedule(); + + return $invoice; + }); + } +} diff --git a/erp/app/Modules/Finance/Models/RecurringInvoiceItem.php b/erp/app/Modules/Finance/Models/RecurringInvoiceItem.php new file mode 100644 index 00000000000..adcbb5a27d5 --- /dev/null +++ b/erp/app/Modules/Finance/Models/RecurringInvoiceItem.php @@ -0,0 +1,31 @@ + 'decimal:2', + 'unit_price' => 'decimal:2', + 'tax_rate' => 'decimal:2', + ]; + + public function recurringInvoice(): BelongsTo + { + return $this->belongsTo(RecurringInvoice::class); + } + + public function getLineTotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_price * (1 + (float) $this->tax_rate / 100); + } +} diff --git a/erp/app/Modules/Finance/Models/SalesOrder.php b/erp/app/Modules/Finance/Models/SalesOrder.php new file mode 100644 index 00000000000..78d21eb3a15 --- /dev/null +++ b/erp/app/Modules/Finance/Models/SalesOrder.php @@ -0,0 +1,154 @@ + 'date', + 'expected_date' => 'date', + ]; + + protected $attributes = ['status' => 'draft']; + + protected function getTransitions(): array + { + return [ + 'draft' => ['confirmed', 'cancelled'], + 'confirmed' => ['fulfilled', 'invoiced', 'cancelled'], + 'fulfilled' => ['invoiced'], + 'invoiced' => [], + 'cancelled' => [], + ]; + } + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function warehouse(): BelongsTo + { + return $this->belongsTo(\App\Modules\Inventory\Models\Warehouse::class); + } + + public function invoice(): BelongsTo + { + return $this->belongsTo(Invoice::class); + } + + public function generatedInvoice(): HasOne + { + return $this->hasOne(Invoice::class, 'sales_order_id'); + } + + public function items(): HasMany + { + return $this->hasMany(SalesOrderItem::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + /** Convert this confirmed SO to a new Invoice and mark SO as invoiced. */ + public function convertToInvoice(): Invoice + { + abort_unless($this->status === 'confirmed', 422, 'Only confirmed orders can be invoiced.'); + $this->load('items'); + + $ref = $this->reference ?? $this->number; + $invoiceRef = $ref ? 'INV-' . preg_replace('/^SO-/', '', $ref) : null; + + $invoice = Invoice::create([ + 'tenant_id' => $this->tenant_id, + 'sales_order_id' => $this->id, + 'contact_id' => $this->contact_id, + 'issue_date' => now()->toDateString(), + 'due_date' => now()->addDays(30)->toDateString(), + 'status' => 'draft', + 'notes' => $this->notes, + 'created_by' => auth()->id(), + 'currency_code' => $this->currency_code ?? 'USD', + 'exchange_rate' => $this->exchange_rate ?? 1, + ]); + + if ($invoiceRef) { + $invoice->update(['number' => $invoiceRef]); + } else { + $invoice->update([ + 'number' => 'INV-' . now()->format('Y') . '-' . str_pad((string) $invoice->id, 5, '0', STR_PAD_LEFT), + ]); + } + + foreach ($this->items as $item) { + $invoice->items()->create([ + 'description' => $item->description, + 'quantity' => $item->quantity, + 'unit_price' => $item->unit_price, + 'tax_rate' => $item->tax_rate, + ]); + } + + $this->update(['status' => 'invoiced', 'invoice_id' => $invoice->id]); + + return $invoice; + } + + public function fulfill(): void + { + if (! $this->canTransitionTo('fulfilled')) { + throw new \DomainException("Sales order cannot be fulfilled in status '{$this->status}'."); + } + + if (! $this->warehouse_id) { + throw new \DomainException('A warehouse is required to fulfill this order.'); + } + + \Illuminate\Support\Facades\DB::transaction(function () { + foreach ($this->items as $item) { + if (! $item->product_id) { + $item->update(['quantity_fulfilled' => $item->quantity]); + continue; + } + + \App\Modules\Inventory\Models\StockMovement::record([ + 'product_id' => $item->product_id, + 'warehouse_id' => $this->warehouse_id, + 'type' => 'out', + 'quantity' => (float) $item->quantity, + 'reference' => $this->number, + 'notes' => "Fulfilled SO #{$this->id}", + ]); + + $item->update(['quantity_fulfilled' => $item->quantity]); + } + + $this->update(['status' => 'fulfilled']); + }); + } +} diff --git a/erp/app/Modules/Finance/Models/SalesOrderItem.php b/erp/app/Modules/Finance/Models/SalesOrderItem.php new file mode 100644 index 00000000000..bea01e65ee5 --- /dev/null +++ b/erp/app/Modules/Finance/Models/SalesOrderItem.php @@ -0,0 +1,38 @@ + 'decimal:2', + 'unit_price' => 'decimal:2', + 'tax_rate' => 'decimal:2', + 'quantity_fulfilled' => 'decimal:2', + ]; + + public function salesOrder(): BelongsTo + { + return $this->belongsTo(SalesOrder::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(\App\Modules\Inventory\Models\Product::class); + } + + public function getLineTotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_price * (1 + (float) $this->tax_rate / 100); + } +} diff --git a/erp/app/Modules/Finance/Models/Subscription.php b/erp/app/Modules/Finance/Models/Subscription.php new file mode 100644 index 00000000000..bbaaa98f8e8 --- /dev/null +++ b/erp/app/Modules/Finance/Models/Subscription.php @@ -0,0 +1,104 @@ + 'date', + 'trial_ends_at' => 'date', + 'current_period_start' => 'date', + 'current_period_end' => 'date', + 'cancelled_at' => 'datetime', + 'next_invoice_date' => 'date', + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function plan(): BelongsTo + { + return $this->belongsTo(SubscriptionPlan::class, 'subscription_plan_id'); + } + + public function activate(): void + { + $today = Carbon::today()->toDateString(); + $this->status = 'active'; + $this->current_period_start = $today; + $this->current_period_end = $this->plan->getNextBillingDate($today); + $this->next_invoice_date = $today; + $this->save(); + } + + public function cancel(): void + { + $this->status = 'cancelled'; + $this->cancelled_at = Carbon::now(); + $this->save(); + } + + public function pause(): void + { + $this->status = 'paused'; + $this->save(); + } + + public function generateInvoice(): Invoice + { + $today = Carbon::today()->toDateString(); + $plan = $this->plan; + + $periodStart = $this->current_period_start + ? $this->current_period_start->toDateString() + : $today; + $periodEnd = $this->current_period_end + ? $this->current_period_end->toDateString() + : $plan->getNextBillingDate($today); + + $period = "{$periodStart} - {$periodEnd}"; + + $invoice = DB::transaction(function () use ($today, $plan, $period) { + $inv = Invoice::create([ + 'tenant_id' => $this->tenant_id, + 'contact_id' => $this->contact_id, + 'status' => 'draft', + 'issue_date' => $today, + 'due_date' => Carbon::today()->addDays(30)->toDateString(), + ]); + + InvoiceItem::create([ + 'invoice_id' => $inv->id, + 'description' => "Subscription: {$plan->name} ({$period})", + 'quantity' => 1, + 'unit_price' => $plan->price, + 'tax_rate' => 0, + ]); + + return $inv; + }); + + $this->next_invoice_date = $plan->getNextBillingDate($today); + $this->save(); + + return $invoice; + } +} diff --git a/erp/app/Modules/Finance/Models/SubscriptionPlan.php b/erp/app/Modules/Finance/Models/SubscriptionPlan.php new file mode 100644 index 00000000000..0dd1aa8e86f --- /dev/null +++ b/erp/app/Modules/Finance/Models/SubscriptionPlan.php @@ -0,0 +1,40 @@ + 'decimal:2', + 'is_active' => 'boolean', + ]; + + public function subscriptions(): HasMany + { + return $this->hasMany(Subscription::class); + } + + public function getNextBillingDate(string $from): string + { + return match ($this->billing_cycle) { + 'monthly' => Carbon::parse($from)->addMonth()->toDateString(), + 'quarterly' => Carbon::parse($from)->addMonths(3)->toDateString(), + 'annually' => Carbon::parse($from)->addYear()->toDateString(), + default => Carbon::parse($from)->addMonth()->toDateString(), + }; + } +} diff --git a/erp/app/Modules/Finance/Models/VendorEvaluation.php b/erp/app/Modules/Finance/Models/VendorEvaluation.php new file mode 100644 index 00000000000..d6d5a11b523 --- /dev/null +++ b/erp/app/Modules/Finance/Models/VendorEvaluation.php @@ -0,0 +1,43 @@ + 'date', + 'overall_rating' => 'decimal:2', + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function evaluator(): BelongsTo + { + return $this->belongsTo(User::class, 'evaluated_by'); + } +} diff --git a/erp/app/Modules/Finance/Models/VendorProfile.php b/erp/app/Modules/Finance/Models/VendorProfile.php new file mode 100644 index 00000000000..3a3489f3331 --- /dev/null +++ b/erp/app/Modules/Finance/Models/VendorProfile.php @@ -0,0 +1,57 @@ + 'decimal:2', + ]; + + public function contact(): BelongsTo + { + return $this->belongsTo(Contact::class); + } + + public function getIsOverCreditLimitAttribute(): bool + { + if (is_null($this->credit_limit)) { + return false; + } + + if (! $this->relationLoaded('contact')) { + $this->load('contact'); + } + + if (! $this->contact) { + return false; + } + + $bills = $this->contact->bills() + ->whereIn('status', ['received', 'partial']) + ->with(['items', 'payments']) + ->get(); + + $outstanding = $bills->sum(fn ($bill) => $bill->amount_due); + + return $outstanding > (float) $this->credit_limit; + } +} diff --git a/erp/app/Modules/Finance/Policies/AccountPolicy.php b/erp/app/Modules/Finance/Policies/AccountPolicy.php new file mode 100644 index 00000000000..97f461d6e57 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/AccountPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, Account $account): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Account $account): bool { return $user->can('finance.update'); } + public function delete(User $user, Account $account): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/AttachmentPolicy.php b/erp/app/Modules/Finance/Policies/AttachmentPolicy.php new file mode 100644 index 00000000000..7c2a53d47d1 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/AttachmentPolicy.php @@ -0,0 +1,14 @@ +can('finance.view'); } + public function view(User $user, Attachment $attachment): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function delete(User $user, Attachment $attachment): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/BankAccountPolicy.php b/erp/app/Modules/Finance/Policies/BankAccountPolicy.php new file mode 100644 index 00000000000..571d10d49ed --- /dev/null +++ b/erp/app/Modules/Finance/Policies/BankAccountPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, BankAccount $bankAccount): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, BankAccount $bankAccount): bool { return $user->can('finance.create'); } + public function delete(User $user, BankAccount $bankAccount): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/BankTransactionPolicy.php b/erp/app/Modules/Finance/Policies/BankTransactionPolicy.php new file mode 100644 index 00000000000..29250b8562f --- /dev/null +++ b/erp/app/Modules/Finance/Policies/BankTransactionPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, BankTransaction $bankTransaction): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, BankTransaction $bankTransaction): bool { return $user->can('finance.create'); } + public function delete(User $user, BankTransaction $bankTransaction): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/BatchPaymentPolicy.php b/erp/app/Modules/Finance/Policies/BatchPaymentPolicy.php new file mode 100644 index 00000000000..a66e295e99f --- /dev/null +++ b/erp/app/Modules/Finance/Policies/BatchPaymentPolicy.php @@ -0,0 +1,29 @@ +can('finance.view'); + } + + public function view(User $user, BatchPayment $batchPayment): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function delete(User $user, BatchPayment $batchPayment): bool + { + return $user->can('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/BillPolicy.php b/erp/app/Modules/Finance/Policies/BillPolicy.php new file mode 100644 index 00000000000..02a46866efb --- /dev/null +++ b/erp/app/Modules/Finance/Policies/BillPolicy.php @@ -0,0 +1,17 @@ +can('finance.view'); } + public function view(User $user, Bill $bill): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Bill $bill): bool { return $user->can('finance.update'); } + public function delete(User $user, Bill $bill): bool { + return $user->can('finance.delete') && $bill->status === 'draft'; + } +} diff --git a/erp/app/Modules/Finance/Policies/BudgetPolicy.php b/erp/app/Modules/Finance/Policies/BudgetPolicy.php new file mode 100644 index 00000000000..2947680230e --- /dev/null +++ b/erp/app/Modules/Finance/Policies/BudgetPolicy.php @@ -0,0 +1,34 @@ +hasPermissionTo('finance.view'); + } + + public function view(User $user, Budget $budget): bool + { + return $user->hasPermissionTo('finance.view'); + } + + public function create(User $user): bool + { + return $user->hasPermissionTo('finance.create'); + } + + public function update(User $user, Budget $budget): bool + { + return $user->hasPermissionTo('finance.create'); + } + + public function delete(User $user, Budget $budget): bool + { + return $user->hasPermissionTo('finance.delete') && $budget->status === 'draft'; + } +} diff --git a/erp/app/Modules/Finance/Policies/CommissionPolicy.php b/erp/app/Modules/Finance/Policies/CommissionPolicy.php new file mode 100644 index 00000000000..0aba8c04df8 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/CommissionPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, Commission $commission): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Commission $commission): bool { return $user->can('finance.create'); } + public function delete(User $user, Commission $commission): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/CommissionRulePolicy.php b/erp/app/Modules/Finance/Policies/CommissionRulePolicy.php new file mode 100644 index 00000000000..d92d38e5afb --- /dev/null +++ b/erp/app/Modules/Finance/Policies/CommissionRulePolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, CommissionRule $rule): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, CommissionRule $rule): bool { return $user->can('finance.create'); } + public function delete(User $user, CommissionRule $rule): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/ContactPolicy.php b/erp/app/Modules/Finance/Policies/ContactPolicy.php new file mode 100644 index 00000000000..6bc040e0758 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/ContactPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, Contact $contact): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Contact $contact): bool { return $user->can('finance.update'); } + public function delete(User $user, Contact $contact): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/ContractPolicy.php b/erp/app/Modules/Finance/Policies/ContractPolicy.php new file mode 100644 index 00000000000..25995512560 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/ContractPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, Contract $contract): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Contract $contract): bool { return $user->can('finance.create'); } + public function delete(User $user, Contract $contract): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/CreditNotePolicy.php b/erp/app/Modules/Finance/Policies/CreditNotePolicy.php new file mode 100644 index 00000000000..7483f2a4d4c --- /dev/null +++ b/erp/app/Modules/Finance/Policies/CreditNotePolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, CreditNote $creditNote): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, CreditNote $creditNote): bool + { + return $user->can('finance.create'); + } + + public function delete(User $user, CreditNote $creditNote): bool + { + return $user->can('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/DeliveryNotePolicy.php b/erp/app/Modules/Finance/Policies/DeliveryNotePolicy.php new file mode 100644 index 00000000000..256b4e58eb0 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/DeliveryNotePolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, DeliveryNote $dn): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, DeliveryNote $dn): bool + { + return $user->can('finance.create'); + } + + public function delete(User $user, DeliveryNote $dn): bool + { + return $user->can('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/DocumentTemplatePolicy.php b/erp/app/Modules/Finance/Policies/DocumentTemplatePolicy.php new file mode 100644 index 00000000000..9efefca8b62 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/DocumentTemplatePolicy.php @@ -0,0 +1,34 @@ +hasPermissionTo('finance.view'); + } + + public function view(User $user, DocumentTemplate $model): bool + { + return $user->hasPermissionTo('finance.view'); + } + + public function create(User $user): bool + { + return $user->hasPermissionTo('finance.create'); + } + + public function update(User $user, DocumentTemplate $model): bool + { + return $user->hasPermissionTo('finance.create'); + } + + public function delete(User $user, DocumentTemplate $model): bool + { + return $user->hasPermissionTo('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/ExchangeRatePolicy.php b/erp/app/Modules/Finance/Policies/ExchangeRatePolicy.php new file mode 100644 index 00000000000..f293e2ca312 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/ExchangeRatePolicy.php @@ -0,0 +1,29 @@ +hasPermissionTo('finance.view'); + } + + public function view(User $user, ExchangeRate $model): bool + { + return $user->hasPermissionTo('finance.view'); + } + + public function create(User $user): bool + { + return $user->hasPermissionTo('finance.create'); + } + + public function delete(User $user, ExchangeRate $model): bool + { + return $user->hasPermissionTo('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/FixedAssetPolicy.php b/erp/app/Modules/Finance/Policies/FixedAssetPolicy.php new file mode 100644 index 00000000000..105821036f9 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/FixedAssetPolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, FixedAsset $fixedAsset): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, FixedAsset $fixedAsset): bool + { + return $user->can('finance.create'); + } + + public function delete(User $user, FixedAsset $fixedAsset): bool + { + return $user->can('finance.delete') && $fixedAsset->status === 'active'; + } +} diff --git a/erp/app/Modules/Finance/Policies/InvoicePolicy.php b/erp/app/Modules/Finance/Policies/InvoicePolicy.php new file mode 100644 index 00000000000..af34d4bb258 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/InvoicePolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, Invoice $invoice): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, Invoice $invoice): bool { return $user->can('finance.update'); } + public function delete(User $user, Invoice $invoice): bool { return $user->can('finance.delete') && $invoice->status === 'draft'; } +} diff --git a/erp/app/Modules/Finance/Policies/JournalEntryPolicy.php b/erp/app/Modules/Finance/Policies/JournalEntryPolicy.php new file mode 100644 index 00000000000..7838029e749 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/JournalEntryPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, JournalEntry $entry): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, JournalEntry $entry): bool { return $user->can('finance.update') && $entry->status === 'draft'; } + public function delete(User $user, JournalEntry $entry): bool { return $user->can('finance.delete') && $entry->status === 'draft'; } +} diff --git a/erp/app/Modules/Finance/Policies/PriceListPolicy.php b/erp/app/Modules/Finance/Policies/PriceListPolicy.php new file mode 100644 index 00000000000..fbe91eae725 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/PriceListPolicy.php @@ -0,0 +1,15 @@ +can('finance.view'); } + public function view(User $user, PriceList $priceList): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user, PriceList $priceList): bool { return $user->can('finance.create'); } + public function delete(User $user, PriceList $priceList): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Policies/ProjectPolicy.php b/erp/app/Modules/Finance/Policies/ProjectPolicy.php new file mode 100644 index 00000000000..c15c2f8f007 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/ProjectPolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, Project $project): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, Project $project): bool + { + return $user->can('finance.create'); + } + + public function delete(User $user, Project $project): bool + { + return $user->can('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/QuotePolicy.php b/erp/app/Modules/Finance/Policies/QuotePolicy.php new file mode 100644 index 00000000000..03c271665ca --- /dev/null +++ b/erp/app/Modules/Finance/Policies/QuotePolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, Quote $quote): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, Quote $quote): bool + { + return $user->can('finance.update'); + } + + public function delete(User $user, Quote $quote): bool + { + return $user->can('finance.delete') && $quote->status === 'draft'; + } +} diff --git a/erp/app/Modules/Finance/Policies/RecurringInvoicePolicy.php b/erp/app/Modules/Finance/Policies/RecurringInvoicePolicy.php new file mode 100644 index 00000000000..240562ca85c --- /dev/null +++ b/erp/app/Modules/Finance/Policies/RecurringInvoicePolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, RecurringInvoice $recurringInvoice): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, RecurringInvoice $recurringInvoice): bool + { + return $user->can('finance.update'); + } + + public function delete(User $user, RecurringInvoice $recurringInvoice): bool + { + return $user->can('finance.delete'); + } +} diff --git a/erp/app/Modules/Finance/Policies/SalesOrderPolicy.php b/erp/app/Modules/Finance/Policies/SalesOrderPolicy.php new file mode 100644 index 00000000000..04105afacb2 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/SalesOrderPolicy.php @@ -0,0 +1,34 @@ +can('finance.view'); + } + + public function view(User $user, SalesOrder $salesOrder): bool + { + return $user->can('finance.view'); + } + + public function create(User $user): bool + { + return $user->can('finance.create'); + } + + public function update(User $user, SalesOrder $salesOrder): bool + { + return $user->can('finance.update'); + } + + public function delete(User $user, SalesOrder $salesOrder): bool + { + return $user->can('finance.delete') && $salesOrder->status === 'draft'; + } +} diff --git a/erp/app/Modules/Finance/Policies/SubscriptionPolicy.php b/erp/app/Modules/Finance/Policies/SubscriptionPolicy.php new file mode 100644 index 00000000000..38c9ca0d381 --- /dev/null +++ b/erp/app/Modules/Finance/Policies/SubscriptionPolicy.php @@ -0,0 +1,14 @@ +can('finance.view'); } + public function view(User $user): bool { return $user->can('finance.view'); } + public function create(User $user): bool { return $user->can('finance.create'); } + public function update(User $user): bool { return $user->can('finance.create'); } + public function delete(User $user): bool { return $user->can('finance.delete'); } +} diff --git a/erp/app/Modules/Finance/Providers/FinanceServiceProvider.php b/erp/app/Modules/Finance/Providers/FinanceServiceProvider.php new file mode 100644 index 00000000000..d66a37bb94a --- /dev/null +++ b/erp/app/Modules/Finance/Providers/FinanceServiceProvider.php @@ -0,0 +1,99 @@ +loadRoutesFrom(__DIR__ . '/../routes/finance.php'); + + Gate::policy(Account::class, AccountPolicy::class); + Gate::policy(Budget::class, BudgetPolicy::class); + Gate::policy(BudgetLine::class, BudgetPolicy::class); + Gate::policy(Contact::class, ContactPolicy::class); + Gate::policy(DeliveryNote::class, DeliveryNotePolicy::class); + Gate::policy(JournalEntry::class, JournalEntryPolicy::class); + Gate::policy(Invoice::class, InvoicePolicy::class); + Gate::policy(Bill::class, BillPolicy::class); + Gate::policy(Quote::class, QuotePolicy::class); + Gate::policy(CreditNote::class, CreditNotePolicy::class); + Gate::policy(RecurringInvoice::class, RecurringInvoicePolicy::class); + Gate::policy(SalesOrder::class, SalesOrderPolicy::class); + Gate::policy(ExchangeRate::class, ExchangeRatePolicy::class); + Gate::policy(BankAccount::class, BankAccountPolicy::class); + Gate::policy(BankTransaction::class, BankTransactionPolicy::class); + Gate::policy(FixedAsset::class, FixedAssetPolicy::class); + Gate::policy(DepreciationEntry::class, FixedAssetPolicy::class); + Gate::policy(PriceList::class, PriceListPolicy::class); + Gate::policy(Project::class, ProjectPolicy::class); + Gate::policy(Attachment::class, AttachmentPolicy::class); + Gate::policy(BatchPayment::class, BatchPaymentPolicy::class); + Gate::policy(DocumentTemplate::class, DocumentTemplatePolicy::class); + Gate::policy(SubscriptionPlan::class, SubscriptionPolicy::class); + Gate::policy(Subscription::class, SubscriptionPolicy::class); + Gate::policy(Commission::class, CommissionPolicy::class); + Gate::policy(CommissionRule::class, CommissionRulePolicy::class); + Gate::policy(Contract::class, ContractPolicy::class); + + if ($this->app->runningInConsole()) { + $this->commands([\App\Modules\Finance\Console\Commands\GenerateRecurringInvoices::class]); + } + } +} diff --git a/erp/app/Modules/Finance/Traits/HasAttachments.php b/erp/app/Modules/Finance/Traits/HasAttachments.php new file mode 100644 index 00000000000..94dd41902c6 --- /dev/null +++ b/erp/app/Modules/Finance/Traits/HasAttachments.php @@ -0,0 +1,14 @@ +morphMany(Attachment::class, 'attachable'); + } +} diff --git a/erp/app/Modules/Finance/Traits/HasLineItemTotals.php b/erp/app/Modules/Finance/Traits/HasLineItemTotals.php new file mode 100644 index 00000000000..ceabc900f62 --- /dev/null +++ b/erp/app/Modules/Finance/Traits/HasLineItemTotals.php @@ -0,0 +1,41 @@ +items->sum(fn ($i) => (float) $i->quantity * (float) $i->unit_price); + } + + public function getTaxTotalAttribute(): float + { + return $this->items->sum(function ($i) { + $sub = (float) $i->quantity * (float) $i->unit_price; + return $sub * ((float) $i->tax_rate / 100); + }); + } + + public function getTotalAttribute(): float + { + return $this->subtotal + $this->tax_total; + } + + public function getAmountPaidAttribute(): float + { + return (float) $this->payments->sum('amount'); + } + + public function getAmountDueAttribute(): float + { + return $this->total - $this->amount_paid; + } + + public function isOverdue(): bool + { + return $this->due_date !== null + && now()->startOfDay()->gt($this->due_date) + && ! in_array($this->status, ['paid', 'cancelled'], true); + } +} diff --git a/erp/app/Modules/Finance/Traits/HasStatusTransitions.php b/erp/app/Modules/Finance/Traits/HasStatusTransitions.php new file mode 100644 index 00000000000..11bdd08e97d --- /dev/null +++ b/erp/app/Modules/Finance/Traits/HasStatusTransitions.php @@ -0,0 +1,29 @@ +getTransitions()[$this->status] ?? [], true); + } + + public function availableTransitions(): array + { + return $this->getTransitions()[$this->status] ?? []; + } + + public function transitionTo(string $status): void + { + if (! $this->canTransitionTo($status)) { + throw new \DomainException( + "Cannot transition from '{$this->status}' to '{$status}'." + ); + } + + $this->update(['status' => $status]); + } +} diff --git a/erp/app/Modules/Finance/routes/finance.php b/erp/app/Modules/Finance/routes/finance.php new file mode 100644 index 00000000000..027952c4b61 --- /dev/null +++ b/erp/app/Modules/Finance/routes/finance.php @@ -0,0 +1,234 @@ +prefix('finance')->name('finance.')->group(function () { + + // Chart of Accounts + Route::resource('accounts', AccountController::class)->except(['show']); + + // Contacts + Route::resource('contacts', ContactController::class)->except(['show']); + + // Journal Entries + Route::resource('journal-entries', JournalEntryController::class)->except(['edit', 'update']); + Route::patch('journal-entries/{journalEntry}/post', [JournalEntryController::class, 'post']) + ->name('journal-entries.post'); + + // Invoices + Route::resource('invoices', InvoiceController::class)->except(['edit', 'update']); + Route::patch('invoices/{invoice}/send', [InvoiceController::class, 'send'])->name('invoices.send'); + Route::patch('invoices/{invoice}/cancel', [InvoiceController::class, 'cancel'])->name('invoices.cancel'); + Route::post('invoices/{invoice}/payments', [InvoiceController::class, 'recordPayment']) + ->name('invoices.payments.store'); + Route::get('invoices/{invoice}/print', [InvoiceController::class, 'print']) + ->name('invoices.print'); + + // PDF + Email routes + Route::get('/invoices/{invoice}/pdf', [InvoiceController::class, 'pdf'])->name('finance.invoices.pdf'); + Route::post('/invoices/{invoice}/email', [InvoiceController::class, 'email'])->name('finance.invoices.email'); + Route::get('/quotes/{quote}/pdf', [QuoteController::class, 'pdf'])->name('finance.quotes.pdf'); + Route::post('/quotes/{quote}/email', [QuoteController::class, 'email'])->name('finance.quotes.email'); + Route::get('/bills/{bill}/pdf', [BillController::class, 'pdf'])->name('finance.bills.pdf'); + Route::post('/bills/{bill}/email', [BillController::class, 'email'])->name('finance.bills.email'); + + // Bills (AP) + Route::resource('bills', BillController::class)->except(['edit', 'update']); + Route::patch('bills/{bill}/receive', [BillController::class, 'receive'])->name('bills.receive'); + Route::patch('bills/{bill}/cancel', [BillController::class, 'cancel'])->name('bills.cancel'); + Route::post('bills/{bill}/payments', [BillController::class, 'recordPayment']) + ->name('bills.payments.store'); + + // Quotes + Route::get('quotes', [QuoteController::class, 'index'])->name('quotes.index'); + Route::get('quotes/create', [QuoteController::class, 'create'])->name('quotes.create'); + Route::post('quotes', [QuoteController::class, 'store'])->name('quotes.store'); + Route::get('quotes/{quote}', [QuoteController::class, 'show'])->name('quotes.show'); + Route::patch('quotes/{quote}/send', [QuoteController::class, 'send'])->name('quotes.send'); + Route::patch('quotes/{quote}/accept', [QuoteController::class, 'accept'])->name('quotes.accept'); + Route::patch('quotes/{quote}/decline', [QuoteController::class, 'decline'])->name('quotes.decline'); + Route::post('quotes/{quote}/convert', [QuoteController::class, 'convertToInvoice'])->name('quotes.convert'); + Route::delete('quotes/{quote}', [QuoteController::class, 'destroy'])->name('quotes.destroy'); + + // Sales Orders + Route::get('sales-orders', [SalesOrderController::class, 'index'])->name('sales-orders.index'); + Route::get('sales-orders/create', [SalesOrderController::class, 'create'])->name('sales-orders.create'); + Route::post('sales-orders', [SalesOrderController::class, 'store'])->name('sales-orders.store'); + Route::get('sales-orders/{salesOrder}', [SalesOrderController::class, 'show'])->name('sales-orders.show'); + Route::patch('sales-orders/{salesOrder}/confirm', [SalesOrderController::class, 'confirm'])->name('sales-orders.confirm'); + Route::post('sales-orders/{salesOrder}/confirm', [SalesOrderController::class, 'confirm'])->name('sales-orders.confirm-post'); + Route::post('sales-orders/{salesOrder}/fulfill', [SalesOrderController::class, 'fulfill'])->name('sales-orders.fulfill'); + Route::patch('sales-orders/{salesOrder}/cancel', [SalesOrderController::class, 'cancel'])->name('sales-orders.cancel'); + Route::post('sales-orders/{salesOrder}/cancel', [SalesOrderController::class, 'cancel'])->name('sales-orders.cancel-post'); + Route::post('sales-orders/{salesOrder}/convert', [SalesOrderController::class, 'convertToInvoice'])->name('sales-orders.convert'); + Route::post('sales-orders/{salesOrder}/convert-to-invoice', [SalesOrderController::class, 'convertToInvoice'])->name('sales-orders.convert-to-invoice'); + Route::delete('sales-orders/{salesOrder}', [SalesOrderController::class, 'destroy'])->name('sales-orders.destroy'); + + // Recurring Invoices + Route::get('recurring-invoices', [RecurringInvoiceController::class, 'index'])->name('recurring-invoices.index'); + Route::get('recurring-invoices/create', [RecurringInvoiceController::class, 'create'])->name('recurring-invoices.create'); + Route::post('recurring-invoices', [RecurringInvoiceController::class, 'store'])->name('recurring-invoices.store'); + Route::get('recurring-invoices/{recurringInvoice}', [RecurringInvoiceController::class, 'show'])->name('recurring-invoices.show'); + Route::patch('recurring-invoices/{recurringInvoice}/pause', [RecurringInvoiceController::class, 'pause'])->name('recurring-invoices.pause'); + Route::patch('recurring-invoices/{recurringInvoice}/resume', [RecurringInvoiceController::class, 'resume'])->name('recurring-invoices.resume'); + Route::post('recurring-invoices/{recurringInvoice}/generate', [RecurringInvoiceController::class, 'generateNow'])->name('recurring-invoices.generate'); + Route::delete('recurring-invoices/{recurringInvoice}', [RecurringInvoiceController::class, 'destroy'])->name('recurring-invoices.destroy'); + + // Credit Notes + Route::resource('credit-notes', CreditNoteController::class)->except(['edit', 'update']); + Route::post('credit-notes/{creditNote}/issue', [CreditNoteController::class, 'issue'])->name('credit-notes.issue'); + Route::post('credit-notes/{creditNote}/void', [CreditNoteController::class, 'void'])->name('credit-notes.void'); + + // Reports + Route::get('reports/trial-balance', [ReportController::class, 'trialBalance']) + ->name('reports.trial-balance'); + Route::get('reports/profit-loss', [ReportController::class, 'profitAndLoss']) + ->name('reports.profit-loss'); + Route::get('reports/balance-sheet', [ReportController::class, 'balanceSheet']) + ->name('reports.balance-sheet'); + Route::get('reports/aged-receivables', [ReportController::class, 'agedReceivables'])->name('reports.aged-receivables'); + Route::get('reports/aged-payables', [ReportController::class, 'agedPayables'])->name('reports.aged-payables'); + Route::get('reports/account-ledger', [ReportController::class, 'accountLedgerIndex'])->name('reports.account-ledger.index'); + Route::get('reports/account-ledger/{account}', [ReportController::class, 'accountLedger'])->name('reports.account-ledger'); + Route::get('reports/customer-statement', [ReportController::class, 'customerStatementIndex'])->name('reports.customer-statement.index'); + Route::get('reports/customer-statement/export', [ReportController::class, 'exportCustomerStatement'])->name('reports.customer-statement.export'); + Route::get('reports/customer-statement/{contact}', [ReportController::class, 'customerStatement'])->name('reports.customer-statement'); + Route::get('reports/supplier-statement', [ReportController::class, 'supplierStatement'])->name('reports.supplier-statement'); + Route::get('reports/supplier-statement/export', [ReportController::class, 'exportSupplierStatement'])->name('reports.supplier-statement.export'); + Route::get('reports/vat-report', [ReportController::class, 'vatReport'])->name('reports.vat-report'); + Route::get('reports/cash-flow-forecast', [ReportController::class, 'cashFlowForecast'])->name('reports.cash-flow-forecast'); + + // CSV exports + Route::get('reports/profit-loss/export', [ReportController::class, 'exportProfitLoss'])->name('reports.profit-loss.export'); + Route::get('reports/balance-sheet/export', [ReportController::class, 'exportBalanceSheet'])->name('reports.balance-sheet.export'); + Route::get('reports/aged-receivables/export', [ReportController::class, 'exportAgedReceivables'])->name('reports.aged-receivables.export'); + Route::get('reports/aged-payables/export', [ReportController::class, 'exportAgedPayables'])->name('reports.aged-payables.export'); + Route::get('reports/account-ledger/{account}/export', [ReportController::class, 'exportAccountLedger'])->name('reports.account-ledger.export'); + Route::get('reports/vat-report/export', [ReportController::class, 'exportVatReport'])->name('reports.vat-report.export'); + Route::get('reports/comparative-profit-loss', [ReportController::class, 'comparativeProfitLoss'])->name('reports.comparative-profit-loss'); + Route::get('reports/comparative-profit-loss/export', [ReportController::class, 'exportComparativeProfitLoss'])->name('reports.comparative-profit-loss.export'); + Route::get('reports/cash-flow-forecast/export', [ReportController::class, 'exportCashFlowForecast'])->name('reports.cash-flow-forecast.export'); + + // Exchange Rates — report must come before resource to avoid 'report' being treated as an ID + Route::get('exchange-rates/report', [ExchangeRateController::class, 'report'])->name('exchange-rates.report'); + Route::resource('exchange-rates', ExchangeRateController::class)->only(['index', 'create', 'store', 'destroy']); + + // Budgets + Route::post('budgets/{budget}/activate', [BudgetController::class, 'activate'])->name('budgets.activate'); + Route::post('budgets/{budget}/close', [BudgetController::class, 'close'])->name('budgets.close'); + Route::resource('budgets', BudgetController::class)->except(['edit', 'update']); + + // Budget Lines + Route::patch('budget-lines/{budgetLine}', [BudgetLineController::class, 'update'])->name('budget-lines.update'); + Route::delete('budget-lines/{budgetLine}', [BudgetLineController::class, 'destroy'])->name('budget-lines.destroy'); + + // Bank Accounts + Route::resource('bank-accounts', BankAccountController::class); + Route::post('bank-accounts/{bankAccount}/import', [BankStatementController::class, 'import'])->name('bank-accounts.import'); + + // Reconciliation + Route::get('reconciliation', [ReconciliationController::class, 'index'])->name('reconciliation.index'); + Route::post('reconciliation/{bankTransaction}/match', [ReconciliationController::class, 'match'])->name('reconciliation.match'); + Route::post('reconciliation/{bankTransaction}/unmatch', [ReconciliationController::class, 'unmatch'])->name('reconciliation.unmatch'); + + // Fixed Assets + Route::post('fixed-assets/{fixedAsset}/depreciate', [FixedAssetController::class, 'depreciate'])->name('fixed-assets.depreciate'); + Route::post('fixed-assets/{fixedAsset}/dispose', [FixedAssetController::class, 'dispose'])->name('fixed-assets.dispose'); + Route::resource('fixed-assets', FixedAssetController::class)->except(['edit', 'update']); + + // Price Lists + Route::get('price-lists/price-for-contact', [PriceListController::class, 'priceForContact'])->name('price-lists.price-for-contact'); + Route::resource('price-lists', PriceListController::class)->except(['edit']); + + // Projects + Route::resource('projects', ProjectController::class)->except(['edit']); + Route::post('projects/{project}/time-entries', [ProjectController::class, 'storeTimeEntry'])->name('projects.time-entries.store'); + Route::post('projects/{project}/mark-billed', [ProjectController::class, 'markBilled'])->name('projects.mark-billed'); + + // Batch Payments + Route::resource('batch-payments', BatchPaymentController::class)->except(['edit', 'update']); + + // File Attachments + Route::post('attachments/{modelType}/{modelId}', [AttachmentController::class, 'store'])->name('attachments.store'); + Route::get('attachments/{attachment}/download', [AttachmentController::class, 'download'])->name('attachments.download'); + Route::delete('attachments/{attachment}', [AttachmentController::class, 'destroy'])->name('attachments.destroy'); + // Delivery Notes + Route::resource('delivery-notes', DeliveryNoteController::class)->except(['edit', 'update']); + Route::post('delivery-notes/{deliveryNote}/dispatch', [DeliveryNoteController::class, 'dispatch'])->name('delivery-notes.dispatch'); + Route::post('delivery-notes/{deliveryNote}/deliver', [DeliveryNoteController::class, 'deliver'])->name('delivery-notes.deliver'); + + // Vendor Profiles (nested under contacts) + Route::get('vendors/{contact}/profile', [VendorProfileController::class, 'show'])->name('vendors.profile.show'); + Route::put('vendors/{contact}/profile', [VendorProfileController::class, 'update'])->name('vendors.profile.update'); + + // Vendor Evaluations (nested under contacts) + Route::get('vendors/{contact}/evaluations', [VendorEvaluationController::class, 'index'])->name('vendors.evaluations.index'); + Route::post('vendors/{contact}/evaluations', [VendorEvaluationController::class, 'store'])->name('vendors.evaluations.store'); + Route::delete('vendors/{contact}/evaluations/{evaluation}', [VendorEvaluationController::class, 'destroy'])->name('vendors.evaluations.destroy'); + + // Document Templates + Route::get('document-templates/preview', [DocumentTemplateController::class, 'preview'])->name('document-templates.preview'); + Route::resource('document-templates', DocumentTemplateController::class)->except(['show']); + Route::get('document-templates/{documentTemplate}', [DocumentTemplateController::class, 'show'])->name('document-templates.show'); + + // Subscription Plans + Route::resource('subscription-plans', SubscriptionPlanController::class)->except(['edit', 'update']); + + // Subscriptions + Route::post('subscriptions/{subscription}/activate', [SubscriptionController::class, 'activate'])->name('subscriptions.activate'); + Route::post('subscriptions/{subscription}/cancel', [SubscriptionController::class, 'cancel'])->name('subscriptions.cancel'); + Route::post('subscriptions/{subscription}/pause', [SubscriptionController::class, 'pause'])->name('subscriptions.pause'); + Route::post('subscriptions/{subscription}/generate-invoice',[SubscriptionController::class, 'generateInvoice'])->name('subscriptions.generate-invoice'); + Route::resource('subscriptions', SubscriptionController::class)->except(['edit', 'update']); + + // Customer Portal Token (admin generates token for a contact) + Route::post('contacts/{contact}/portal-token', [\App\Modules\Finance\Http\Controllers\CustomerPortalController::class, 'generateToken'])->name('contacts.portal-token'); + + + // Commission Rules + Route::resource('commission-rules', CommissionRuleController::class)->except(['edit', 'update']); + + // Commissions + Route::post('commissions/{commission}/approve', [CommissionController::class, 'approve'])->name('commissions.approve'); + Route::post('commissions/{commission}/mark-paid',[CommissionController::class, 'markPaid'])->name('commissions.mark-paid'); + Route::post('commissions/generate', [CommissionController::class, 'generate'])->name('commissions.generate'); + Route::resource('commissions', CommissionController::class)->except(['edit', 'update']); + + + // Contracts + Route::post('contracts/{contract}/activate', [ContractController::class, 'activate'])->name('contracts.activate'); + Route::post('contracts/{contract}/terminate', [ContractController::class, 'terminate'])->name('contracts.terminate'); + Route::resource('contracts', ContractController::class)->except(['show']); + Route::get('contracts/{contract}', [ContractController::class, 'show'])->name('contracts.show'); + +}); \ No newline at end of file diff --git a/erp/app/Modules/HR/Http/Controllers/AttendanceController.php b/erp/app/Modules/HR/Http/Controllers/AttendanceController.php new file mode 100644 index 00000000000..c054558f82b --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/AttendanceController.php @@ -0,0 +1,115 @@ +authorize('viewAny', AttendanceRecord::class); + + $query = AttendanceRecord::with('employee'); + + if ($request->filled('employee_id')) { + $query->where('employee_id', $request->employee_id); + } + + if ($request->filled('month')) { + [$year, $month] = explode('-', $request->month); + $query->whereYear('work_date', $year)->whereMonth('work_date', $month); + } + + $records = $query->orderByDesc('work_date')->paginate(20)->withQueryString(); + $employees = Employee::where('status', 'active')->orderBy('first_name')->get(['id', 'first_name', 'last_name']); + + return Inertia::render('HR/Attendance/Index', compact('records', 'employees')); + } + + public function create(): Response + { + $this->authorize('create', AttendanceRecord::class); + + $employees = Employee::where('status', 'active')->orderBy('first_name')->get(['id', 'first_name', 'last_name']); + + return Inertia::render('HR/Attendance/Create', compact('employees')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', AttendanceRecord::class); + + $data = $request->validate([ + 'employee_id' => ['required', Rule::exists('employees', 'id')], + 'work_date' => [ + 'required', + 'date', + function ($attribute, $value, $fail) use ($request) { + $exists = \Illuminate\Support\Facades\DB::table('attendance_records') + ->whereNull('deleted_at') + ->where('employee_id', $request->input('employee_id')) + ->whereDate('work_date', $value) + ->exists(); + if ($exists) { + $fail('The employee already has an attendance record for this date.'); + } + }, + ], + 'clock_in' => ['nullable', 'date_format:H:i'], + 'clock_out' => ['nullable', 'date_format:H:i', 'after:clock_in'], + 'break_minutes' => ['nullable', 'integer', 'min:0'], + 'status' => ['required', Rule::in(['present', 'absent', 'half_day', 'holiday', 'leave'])], + 'notes' => ['nullable', 'string'], + ]); + + AttendanceRecord::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.attendance.index')->with('success', 'Attendance record logged.'); + } + + public function show(AttendanceRecord $attendance): Response + { + $this->authorize('view', $attendance); + + $attendance->load('employee'); + + return Inertia::render('HR/Attendance/Show', compact('attendance')); + } + + public function update(Request $request, AttendanceRecord $attendance): RedirectResponse + { + $this->authorize('update', $attendance); + + $data = $request->validate([ + 'clock_in' => ['nullable', 'date_format:H:i'], + 'clock_out' => ['nullable', 'date_format:H:i', 'after:clock_in'], + 'break_minutes' => ['nullable', 'integer', 'min:0'], + 'status' => ['nullable', Rule::in(['present', 'absent', 'half_day', 'holiday', 'leave'])], + 'notes' => ['nullable', 'string'], + ]); + + $attendance->update($data); + + return back()->with('success', 'Attendance record updated.'); + } + + public function destroy(AttendanceRecord $attendance): RedirectResponse + { + $this->authorize('delete', $attendance); + + $attendance->delete(); + + return redirect()->route('hr.attendance.index')->with('success', 'Attendance record deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/DepartmentController.php b/erp/app/Modules/HR/Http/Controllers/DepartmentController.php new file mode 100644 index 00000000000..bf0220c7758 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/DepartmentController.php @@ -0,0 +1,108 @@ +authorize('viewAny', Department::class); + + $departments = Department::withCount('employees') + ->orderBy('name') + ->get(); + + return Inertia::render('HR/Departments/Index', [ + 'departments' => DepartmentResource::collection($departments), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Departments', 'href' => route('hr.departments.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Department::class); + + return Inertia::render('HR/Departments/Create', [ + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Departments', 'href' => route('hr.departments.index')], + ['label' => 'New Department'], + ], + ]); + } + + public function store(StoreDepartmentRequest $request): RedirectResponse + { + $this->authorize('create', Department::class); + + $department = Department::create([ + ...$request->validated(), + 'tenant_id' => auth()->user()->tenant_id, + ]); + + return redirect()->route('hr.departments.show', $department) + ->with('success', 'Department created.'); + } + + public function show(Department $department): Response + { + $this->authorize('view', $department); + + $department->loadCount('employees'); + + return Inertia::render('HR/Departments/Show', [ + 'department' => new DepartmentResource($department), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Departments', 'href' => route('hr.departments.index')], + ['label' => $department->name], + ], + ]); + } + + public function edit(Department $department): Response + { + $this->authorize('update', $department); + + return Inertia::render('HR/Departments/Edit', [ + 'department' => new DepartmentResource($department), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Departments', 'href' => route('hr.departments.index')], + ['label' => $department->name, 'href' => route('hr.departments.show', $department)], + ['label' => 'Edit'], + ], + ]); + } + + public function update(StoreDepartmentRequest $request, Department $department): RedirectResponse + { + $this->authorize('update', $department); + + $department->update($request->validated()); + + return redirect()->route('hr.departments.show', $department) + ->with('success', 'Department updated.'); + } + + public function destroy(Department $department): RedirectResponse + { + $this->authorize('delete', $department); + + $department->delete(); + + return redirect()->route('hr.departments.index') + ->with('success', 'Department deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/EmployeeController.php b/erp/app/Modules/HR/Http/Controllers/EmployeeController.php new file mode 100644 index 00000000000..971969ae0e4 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/EmployeeController.php @@ -0,0 +1,144 @@ +authorize('viewAny', Employee::class); + + $employees = Employee::with('department') + ->when($request->search, fn ($q) => $q->search($request->search)) + ->when($request->department_id, fn ($q) => $q->where('department_id', $request->department_id)) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->orderBy('last_name') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('HR/Employees/Index', [ + 'employees' => EmployeeResource::collection($employees), + 'departments' => Department::active()->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['search', 'department_id', 'status']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Employee::class); + + return Inertia::render('HR/Employees/Create', [ + 'departments' => Department::active()->orderBy('name')->get(['id', 'name']), + 'users' => User::orderBy('name')->get(['id', 'name', 'email']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => 'New Employee'], + ], + ]); + } + + public function store(StoreEmployeeRequest $request): RedirectResponse + { + $this->authorize('create', Employee::class); + + $employee = Employee::create([ + ...$request->validated(), + 'tenant_id' => auth()->user()->tenant_id, + ]); + + // Generate employee code + if (!$employee->employee_number) { + $employee->employee_number = 'EMP-' . str_pad((string) $employee->id, 5, '0', STR_PAD_LEFT); + $employee->save(); + } + + return redirect()->route('hr.employees.show', $employee) + ->with('success', 'Employee created.'); + } + + public function show(Employee $employee): Response + { + $this->authorize('view', $employee); + + $employee->load(['department', 'user', 'leaveRequests.leaveType']); + + return Inertia::render('HR/Employees/Show', [ + 'employee' => new EmployeeResource($employee), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => $employee->full_name], + ], + ]); + } + + public function edit(Employee $employee): Response + { + $this->authorize('update', $employee); + + return Inertia::render('HR/Employees/Edit', [ + 'employee' => new EmployeeResource($employee), + 'departments' => Department::active()->orderBy('name')->get(['id', 'name']), + 'users' => User::orderBy('name')->get(['id', 'name', 'email']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => $employee->full_name, 'href' => route('hr.employees.show', $employee)], + ['label' => 'Edit'], + ], + ]); + } + + public function update(StoreEmployeeRequest $request, Employee $employee): RedirectResponse + { + $this->authorize('update', $employee); + + $employee->update($request->validated()); + + return redirect()->route('hr.employees.show', $employee) + ->with('success', 'Employee updated.'); + } + + public function destroy(Employee $employee): RedirectResponse + { + $this->authorize('delete', $employee); + + $employee->delete(); + + return redirect()->route('hr.employees.index') + ->with('success', 'Employee deleted.'); + } + + public function terminate(Employee $employee): RedirectResponse + { + $this->authorize('update', $employee); + + if ($employee->status !== 'active') { + return back()->withErrors(['status' => 'Only active employees can be terminated.']); + } + + $employee->update([ + 'status' => 'terminated', + 'end_date' => now()->toDateString(), + ]); + + return redirect()->route('hr.employees.show', $employee) + ->with('success', 'Employee terminated.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/EmployeeLoanController.php b/erp/app/Modules/HR/Http/Controllers/EmployeeLoanController.php new file mode 100644 index 00000000000..d8933828649 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/EmployeeLoanController.php @@ -0,0 +1,144 @@ +authorize('viewAny', EmployeeLoan::class); + + $loans = EmployeeLoan::with('employee') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->orderBy('created_at', 'desc') + ->paginate(15) + ->withQueryString(); + + return Inertia::render('HR/EmployeeLoans/Index', [ + 'loans' => $loans, + 'filters' => $request->only(['status']), + ]); + } + + public function create(): Response + { + $this->authorize('create', EmployeeLoan::class); + + return Inertia::render('HR/EmployeeLoans/Create', [ + 'employees' => Employee::active()->orderBy('last_name')->get()->map(fn ($e) => [ + 'id' => $e->id, + 'full_name' => $e->full_name, + ]), + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', EmployeeLoan::class); + + $validated = $request->validate([ + 'employee_id' => ['required', Rule::exists('employees', 'id')], + 'type' => ['required', Rule::in(['loan', 'advance'])], + 'amount' => ['required', 'numeric', 'min:0.01'], + 'interest_rate' => ['nullable', 'numeric', 'min:0', 'max:100'], + 'purpose' => ['nullable', 'string', 'max:255'], + 'notes' => ['nullable', 'string'], + 'repayment_start_date' => ['nullable', 'date'], + ]); + + $loan = EmployeeLoan::create([ + ...$validated, + 'tenant_id' => auth()->user()->tenant_id, + 'outstanding_balance' => $validated['amount'], + 'status' => 'pending', + ]); + + return redirect()->route('hr.employee-loans.show', $loan) + ->with('success', 'Loan created successfully.'); + } + + public function show(EmployeeLoan $employeeLoan): Response + { + $this->authorize('view', $employeeLoan); + + $employeeLoan->load(['employee', 'repayments']); + + return Inertia::render('HR/EmployeeLoans/Show', [ + 'loan' => array_merge($employeeLoan->toArray(), [ + 'total_repaid' => $employeeLoan->total_repaid, + 'is_fully_repaid' => $employeeLoan->is_fully_repaid, + ]), + 'can' => [ + 'create' => auth()->user()->can('create', EmployeeLoan::class), + 'delete' => auth()->user()->can('delete', $employeeLoan), + ], + ]); + } + + public function destroy(EmployeeLoan $employeeLoan): RedirectResponse + { + $this->authorize('delete', $employeeLoan); + + if ($employeeLoan->status !== 'pending') { + return back()->withErrors(['status' => 'Only pending loans can be deleted.']); + } + + $employeeLoan->delete(); + + return redirect()->route('hr.employee-loans.index') + ->with('success', 'Loan deleted.'); + } + + public function approve(EmployeeLoan $employeeLoan): RedirectResponse + { + $this->authorize('create', EmployeeLoan::class); + + $employeeLoan->approve(auth()->user()); + + return back()->with('success', 'Loan approved.'); + } + + public function cancel(EmployeeLoan $employeeLoan): RedirectResponse + { + $this->authorize('create', EmployeeLoan::class); + + $employeeLoan->cancel(); + + return back()->with('success', 'Loan cancelled.'); + } + + public function addRepayment(Request $request, EmployeeLoan $employeeLoan): RedirectResponse + { + $this->authorize('create', EmployeeLoan::class); + + $validated = $request->validate([ + 'amount' => ['required', 'numeric', 'min:0.01'], + 'payment_date' => ['required', 'date'], + 'notes' => ['nullable', 'string'], + ]); + + $repayment = LoanRepayment::create([ + ...$validated, + 'tenant_id' => auth()->user()->tenant_id, + 'employee_loan_id' => $employeeLoan->id, + ]); + + $employeeLoan->decrement('outstanding_balance', $repayment->amount); + + if ($employeeLoan->fresh()->outstanding_balance <= 0) { + $employeeLoan->update(['status' => 'completed', 'outstanding_balance' => 0]); + } + + return back()->with('success', 'Repayment recorded.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/EmployeeOnboardingController.php b/erp/app/Modules/HR/Http/Controllers/EmployeeOnboardingController.php new file mode 100644 index 00000000000..b1be1286375 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/EmployeeOnboardingController.php @@ -0,0 +1,159 @@ +authorize('viewAny', EmployeeOnboarding::class); + + $onboardings = $employee->onboardings() + ->withCount('tasks') + ->orderByDesc('created_at') + ->get() + ->map(function ($onboarding) { + $onboarding->progress = $onboarding->progress; + return $onboarding; + }); + + return Inertia::render('HR/Employees/Onboardings/Index', [ + 'employee' => $employee, + 'onboardings' => $onboardings, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => $employee->full_name, 'href' => route('hr.employees.show', $employee)], + ['label' => 'Onboardings'], + ], + ]); + } + + public function create(Employee $employee): Response + { + $this->authorize('create', EmployeeOnboarding::class); + + $templates = OnboardingTemplate::where('is_active', true) + ->orderBy('name') + ->get(['id', 'name', 'description']); + + return Inertia::render('HR/Employees/Onboardings/Create', [ + 'employee' => $employee, + 'templates' => $templates, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => $employee->full_name, 'href' => route('hr.employees.show', $employee)], + ['label' => 'Onboardings', 'href' => route('hr.employees.onboardings.index', $employee)], + ['label' => 'New Onboarding'], + ], + ]); + } + + public function store(Request $request, Employee $employee): RedirectResponse + { + $this->authorize('create', EmployeeOnboarding::class); + + $validated = $request->validate([ + 'template_id' => 'nullable|exists:onboarding_templates,id', + 'title' => 'nullable|string|max:255', + 'started_at' => 'required|date', + ]); + + if ($validated['template_id']) { + $template = OnboardingTemplate::findOrFail($validated['template_id']); + $onboarding = EmployeeOnboarding::fromTemplate($employee, $template); + // Override started_at if explicitly provided + if ($validated['started_at']) { + $onboarding->update(['started_at' => $validated['started_at']]); + } + } else { + $onboarding = EmployeeOnboarding::create([ + 'tenant_id' => $employee->tenant_id, + 'employee_id' => $employee->id, + 'template_id' => null, + 'title' => $validated['title'] ?? 'Onboarding', + 'status' => 'in_progress', + 'started_at' => $validated['started_at'], + ]); + } + + return redirect()->route('hr.employees.onboardings.show', [$employee, $onboarding]) + ->with('success', 'Onboarding created.'); + } + + public function show(Employee $employee, EmployeeOnboarding $onboarding): Response + { + $this->authorize('view', $onboarding); + + $onboarding->load('tasks'); + + return Inertia::render('HR/Employees/Onboardings/Show', [ + 'employee' => $employee, + 'onboarding' => array_merge($onboarding->toArray(), ['progress' => $onboarding->progress]), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Employees', 'href' => route('hr.employees.index')], + ['label' => $employee->full_name, 'href' => route('hr.employees.show', $employee)], + ['label' => 'Onboardings', 'href' => route('hr.employees.onboardings.index', $employee)], + ['label' => $onboarding->title], + ], + ]); + } + + public function completeTask(Employee $employee, EmployeeOnboarding $onboarding, EmployeeOnboardingTask $task): RedirectResponse + { + $this->authorize('update', $onboarding); + + $task->update([ + 'completed_at' => now(), + 'completed_by' => auth()->id(), + ]); + + return back()->with('success', 'Task marked as complete.'); + } + + public function uncompleteTask(Employee $employee, EmployeeOnboarding $onboarding, EmployeeOnboardingTask $task): RedirectResponse + { + $this->authorize('update', $onboarding); + + $task->update([ + 'completed_at' => null, + 'completed_by' => null, + ]); + + return back()->with('success', 'Task marked as incomplete.'); + } + + public function complete(Employee $employee, EmployeeOnboarding $onboarding): RedirectResponse + { + $this->authorize('update', $onboarding); + + $onboarding->update([ + 'status' => 'completed', + 'completed_at' => now()->toDateString(), + ]); + + return back()->with('success', 'Onboarding marked as complete.'); + } + + public function destroy(Employee $employee, EmployeeOnboarding $onboarding): RedirectResponse + { + $this->authorize('delete', $onboarding); + + $onboarding->delete(); + + return redirect()->route('hr.employees.onboardings.index', $employee) + ->with('success', 'Onboarding deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/EmployeeTrainingRecordController.php b/erp/app/Modules/HR/Http/Controllers/EmployeeTrainingRecordController.php new file mode 100644 index 00000000000..d2bcde55863 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/EmployeeTrainingRecordController.php @@ -0,0 +1,96 @@ +authorize('viewAny', EmployeeTrainingRecord::class); + + $records = EmployeeTrainingRecord::with(['employee', 'trainingCourse']) + ->orderByDesc('completed_date') + ->paginate(25); + + return Inertia::render('HR/TrainingRecords/Index', compact('records')); + } + + public function create(Request $request): Response + { + $this->authorize('create', EmployeeTrainingRecord::class); + + $employees = Employee::where('status', 'active') + ->orderBy('first_name') + ->get(['id', 'first_name', 'last_name']); + + $courses = TrainingCourse::where('is_active', true) + ->orderBy('title') + ->get(['id', 'title']); + + $employeeId = $request->get('employee_id'); + $courseId = $request->get('training_course_id'); + + return Inertia::render('HR/TrainingRecords/Create', compact('employees', 'courses', 'employeeId', 'courseId')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', EmployeeTrainingRecord::class); + + $data = $request->validate([ + 'employee_id' => 'required|exists:employees,id', + 'training_course_id' => 'nullable|exists:training_courses,id', + 'course_title' => 'required|string|max:255', + 'completed_date' => 'required|date', + 'expiry_date' => 'nullable|date|after_or_equal:completed_date', + 'score' => 'nullable|numeric|min:0', + 'passed' => 'boolean', + 'certificate_number' => 'nullable|string|max:255', + 'notes' => 'nullable|string', + ]); + + // Snapshot course_title from selected course if not provided or if course is selected + if (!empty($data['training_course_id'])) { + $course = TrainingCourse::find($data['training_course_id']); + if ($course) { + $data['course_title'] = $course->title; + } + } + + $record = EmployeeTrainingRecord::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.training-records.show', $record) + ->with('success', 'Training record created.'); + } + + public function show(EmployeeTrainingRecord $trainingRecord): Response + { + $this->authorize('view', $trainingRecord); + + $trainingRecord->load(['employee', 'trainingCourse']); + + return Inertia::render('HR/TrainingRecords/Show', compact('trainingRecord')); + } + + public function destroy(EmployeeTrainingRecord $trainingRecord): RedirectResponse + { + $this->authorize('delete', $trainingRecord); + + $trainingRecord->delete(); + + return redirect()->route('hr.training-records.index') + ->with('success', 'Training record deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/ExpenseClaimController.php b/erp/app/Modules/HR/Http/Controllers/ExpenseClaimController.php new file mode 100644 index 00000000000..4c7491ed449 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/ExpenseClaimController.php @@ -0,0 +1,166 @@ +authorize('viewAny', ExpenseClaim::class); + + $claims = ExpenseClaim::with(['employee', 'reviewer']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->orderBy('created_at', 'desc') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('HR/ExpenseClaims/Index', [ + 'claims' => ExpenseClaimResource::collection($claims), + 'filters' => $request->only(['status']), + 'categories' => self::CATEGORIES, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Expense Claims', 'href' => route('hr.expense-claims.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', ExpenseClaim::class); + + return Inertia::render('HR/ExpenseClaims/Create', [ + 'employees' => Employee::active()->orderBy('last_name')->get()->map(fn ($e) => [ + 'id' => $e->id, 'full_name' => $e->full_name, + ]), + 'categories' => self::CATEGORIES, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Expense Claims', 'href' => route('hr.expense-claims.index')], + ['label' => 'New Claim'], + ], + ]); + } + + public function store(StoreExpenseClaimRequest $request): RedirectResponse + { + $this->authorize('create', ExpenseClaim::class); + + $data = $request->validated(); + + $claim = ExpenseClaim::create([ + ...$data, + 'tenant_id' => auth()->user()->tenant_id, + 'status' => 'draft', + 'created_by' => Auth::id(), + ]); + + return redirect()->route('hr.expense-claims.show', $claim) + ->with('success', 'Expense claim created.'); + } + + public function show(ExpenseClaim $expenseClaim): Response + { + $this->authorize('view', $expenseClaim); + + $expenseClaim->load(['employee', 'submitter', 'reviewer']); + + return Inertia::render('HR/ExpenseClaims/Show', [ + 'claim' => new ExpenseClaimResource($expenseClaim), + 'categories' => self::CATEGORIES, + 'can' => [ + 'update' => auth()->user()->can('update', $expenseClaim), + 'delete' => auth()->user()->can('delete', $expenseClaim), + 'approve' => auth()->user()->can('approve', $expenseClaim), + ], + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Expense Claims', 'href' => route('hr.expense-claims.index')], + ['label' => $expenseClaim->title], + ], + ]); + } + + public function submit(ExpenseClaim $expenseClaim): RedirectResponse + { + $this->authorize('update', $expenseClaim); + + try { + $expenseClaim->submit(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Expense claim submitted.'); + } + + public function approve(ExpenseClaim $expenseClaim, Request $request): RedirectResponse + { + $this->authorize('approve', $expenseClaim); + + $request->validate([ + 'notes' => 'nullable|string', + ]); + + try { + $expenseClaim->approve($request->input('notes', '')); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Expense claim approved.'); + } + + public function reject(ExpenseClaim $expenseClaim, Request $request): RedirectResponse + { + $this->authorize('approve', $expenseClaim); + + $request->validate([ + 'notes' => 'required|string', + ]); + + try { + $expenseClaim->reject($request->input('notes', '')); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Expense claim rejected.'); + } + + public function reimburse(ExpenseClaim $expenseClaim): RedirectResponse + { + $this->authorize('approve', $expenseClaim); + + try { + $expenseClaim->reimburse(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Expense claim marked as reimbursed.'); + } + + public function destroy(ExpenseClaim $expenseClaim): RedirectResponse + { + $this->authorize('delete', $expenseClaim); + + $expenseClaim->delete(); + + return redirect()->route('hr.expense-claims.index') + ->with('success', 'Expense claim deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/JobApplicationController.php b/erp/app/Modules/HR/Http/Controllers/JobApplicationController.php new file mode 100644 index 00000000000..f6d25810a00 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/JobApplicationController.php @@ -0,0 +1,109 @@ +authorize('viewAny', JobApplication::class); + + $query = JobApplication::with('jobPosition')->latest(); + + if ($request->filled('job_position_id')) { + $query->where('job_position_id', $request->job_position_id); + } + + $applications = $query->paginate(15); + + return Inertia::render('HR/JobApplications/Index', compact('applications')); + } + + public function create(): Response + { + $this->authorize('create', JobApplication::class); + + $positions = JobPosition::where('status', 'open')->orderBy('title')->get(['id', 'title']); + + return Inertia::render('HR/JobApplications/Create', compact('positions')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', JobApplication::class); + + $data = $request->validate([ + 'job_position_id' => ['required', Rule::exists('job_positions', 'id')], + 'applicant_name' => ['required', 'string', 'max:255'], + 'applicant_email' => ['required', 'email', 'max:255'], + 'applicant_phone' => ['nullable', 'string', 'max:50'], + 'cover_letter' => ['nullable', 'string'], + 'source' => ['nullable', 'string', 'max:100'], + 'rating' => ['nullable', 'integer', 'min:1', 'max:5'], + ]); + + $application = JobApplication::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.job-applications.show', $application) + ->with('success', 'Job application created.'); + } + + public function show(JobApplication $jobApplication): Response + { + $this->authorize('view', $jobApplication); + + $jobApplication->load('jobPosition'); + + return Inertia::render('HR/JobApplications/Show', [ + 'application' => $jobApplication, + ]); + } + + public function destroy(JobApplication $jobApplication): RedirectResponse + { + $this->authorize('delete', $jobApplication); + + $jobApplication->delete(); + + return redirect()->route('hr.job-applications.index') + ->with('success', 'Job application deleted.'); + } + + public function advance(Request $request, JobApplication $jobApplication): RedirectResponse + { + $this->authorize('update', $jobApplication); + + $data = $request->validate([ + 'stage' => ['required', Rule::in(['applied', 'screening', 'interview', 'offer', 'hired', 'rejected'])], + ]); + + $jobApplication->advance($data['stage']); + + return redirect()->back()->with('success', 'Application stage updated.'); + } + + public function reject(Request $request, JobApplication $jobApplication): RedirectResponse + { + $this->authorize('update', $jobApplication); + + $request->validate([ + 'reason' => ['nullable', 'string'], + ]); + + $jobApplication->reject($request->reason); + + return redirect()->back()->with('success', 'Application rejected.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/JobPositionController.php b/erp/app/Modules/HR/Http/Controllers/JobPositionController.php new file mode 100644 index 00000000000..230afa21f77 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/JobPositionController.php @@ -0,0 +1,101 @@ +authorize('viewAny', JobPosition::class); + + $positions = JobPosition::with('department') + ->withCount('applications') + ->latest() + ->paginate(15); + + return Inertia::render('HR/JobPositions/Index', compact('positions')); + } + + public function create(): Response + { + $this->authorize('create', JobPosition::class); + + $departments = Department::orderBy('name')->get(['id', 'name']); + + return Inertia::render('HR/JobPositions/Create', compact('departments')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', JobPosition::class); + + $data = $request->validate([ + 'title' => ['required', 'string', 'max:255'], + 'department_id' => ['nullable', Rule::exists('departments', 'id')], + 'location' => ['nullable', 'string', 'max:255'], + 'employment_type' => ['required', Rule::in(['full_time', 'part_time', 'contract', 'internship'])], + 'description' => ['nullable', 'string'], + 'requirements' => ['nullable', 'string'], + 'openings' => ['required', 'integer', 'min:1'], + ]); + + $position = JobPosition::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.job-positions.show', $position) + ->with('success', 'Job position created.'); + } + + public function show(JobPosition $jobPosition): Response + { + $this->authorize('view', $jobPosition); + + $jobPosition->load([ + 'department', + 'applications' => fn ($q) => $q->latest(), + ]); + + return Inertia::render('HR/JobPositions/Show', [ + 'position' => $jobPosition, + ]); + } + + public function destroy(JobPosition $jobPosition): RedirectResponse + { + $this->authorize('delete', $jobPosition); + + $jobPosition->delete(); + + return redirect()->route('hr.job-positions.index') + ->with('success', 'Job position deleted.'); + } + + public function publish(JobPosition $jobPosition): RedirectResponse + { + $this->authorize('update', $jobPosition); + + $jobPosition->publish(); + + return redirect()->back()->with('success', 'Job position published.'); + } + + public function close(JobPosition $jobPosition): RedirectResponse + { + $this->authorize('update', $jobPosition); + + $jobPosition->close(); + + return redirect()->back()->with('success', 'Job position closed.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/LeaveRequestController.php b/erp/app/Modules/HR/Http/Controllers/LeaveRequestController.php new file mode 100644 index 00000000000..0317af4b0e8 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/LeaveRequestController.php @@ -0,0 +1,188 @@ +authorize('viewAny', LeaveRequest::class); + + $requests = LeaveRequest::with(['employee', 'leaveType', 'reviewer']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->employee_id, fn ($q) => $q->where('employee_id', $request->employee_id)) + ->latest() + ->paginate(25) + ->withQueryString(); + + return Inertia::render('HR/LeaveRequests/Index', [ + 'requests' => LeaveRequestResource::collection($requests), + 'employees' => Employee::active()->orderBy('last_name')->get()->map(fn ($e) => [ + 'id' => $e->id, 'full_name' => $e->full_name, + ]), + 'filters' => $request->only(['status', 'employee_id']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Leave Requests', 'href' => route('hr.leave-requests.index')], + ], + ]); + } + + /** Legacy index for /hr/leave (backward compat) */ + public function legacyIndex(Request $request): Response + { + $this->authorize('viewAny', Employee::class); + + $requests = LeaveRequest::with(['employee', 'leaveType', 'reviewer']) + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->employee_id, fn ($q) => $q->where('employee_id', $request->employee_id)) + ->latest() + ->paginate(25) + ->withQueryString(); + + return Inertia::render('HR/Leave/Index', [ + 'requests' => $requests->through(fn ($lr) => [ + 'id' => $lr->id, + 'employee' => ['id' => $lr->employee->id, 'full_name' => $lr->employee->full_name], + 'leave_type' => $lr->leaveType?->name, + 'start_date' => $lr->start_date?->toDateString(), + 'end_date' => $lr->end_date?->toDateString(), + 'days' => $lr->days, + 'status' => $lr->status, + 'notes' => $lr->notes, + 'reviewed_by' => $lr->reviewer?->name, + 'reviewed_at' => $lr->reviewed_at?->toDateTimeString(), + ]), + 'employees' => Employee::active()->orderBy('last_name')->get()->map(fn ($e) => [ + 'id' => $e->id, 'full_name' => $e->full_name, + ]), + 'filters' => $request->only(['status', 'employee_id']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Leave Requests', 'href' => route('hr.leave.index')], + ], + ]); + } + + /** Legacy store for /hr/leave (backward compat) */ + public function legacyStore(StoreLeaveRequestRequest $request): RedirectResponse + { + $this->authorize('create', Employee::class); + + $data = $request->validated(); + + LeaveRequest::create([ + ...$data, + 'tenant_id' => auth()->user()->tenant_id, + ]); + + return back()->with('success', 'Leave request submitted.'); + } + + public function create(): Response + { + $this->authorize('create', LeaveRequest::class); + + return Inertia::render('HR/LeaveRequests/Create', [ + 'employees' => Employee::active()->orderBy('last_name')->get()->map(fn ($e) => [ + 'id' => $e->id, 'full_name' => $e->full_name, + ]), + 'leaveTypes' => LeaveType::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Leave Requests', 'href' => route('hr.leave-requests.index')], + ['label' => 'New Request'], + ], + ]); + } + + public function store(StoreLeaveRequestRequest $request): RedirectResponse + { + $this->authorize('create', LeaveRequest::class); + + $data = $request->validated(); + + $leaveRequest = LeaveRequest::create([ + ...$data, + 'tenant_id' => auth()->user()->tenant_id, + ]); + + return redirect()->route('hr.leave-requests.show', $leaveRequest) + ->with('success', 'Leave request submitted.'); + } + + public function show(LeaveRequest $leaveRequest): Response + { + $this->authorize('view', $leaveRequest); + + $leaveRequest->load(['employee', 'leaveType', 'reviewer']); + + return Inertia::render('HR/LeaveRequests/Show', [ + 'leaveRequest' => new LeaveRequestResource($leaveRequest), + 'can' => [ + 'update' => auth()->user()->can('update', $leaveRequest), + ], + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Leave Requests', 'href' => route('hr.leave-requests.index')], + ['label' => "Leave Request #{$leaveRequest->id}"], + ], + ]); + } + + public function destroy(LeaveRequest $leaveRequest): RedirectResponse + { + $this->authorize('delete', $leaveRequest); + + $leaveRequest->delete(); + + return redirect()->route('hr.leave-requests.index') + ->with('success', 'Leave request deleted.'); + } + + public function approve(LeaveRequest $leaveRequest): RedirectResponse + { + $this->authorize('update', $leaveRequest); + + if ($leaveRequest->status !== 'pending') { + return back()->withErrors(['status' => 'Only pending leave requests can be approved.']); + } + + $leaveRequest->update([ + 'status' => 'approved', + 'reviewed_by' => Auth::id(), + 'reviewed_at' => now(), + ]); + + return back()->with('success', 'Leave request approved.'); + } + + public function reject(LeaveRequest $leaveRequest): RedirectResponse + { + $this->authorize('update', $leaveRequest); + + if ($leaveRequest->status !== 'pending') { + return back()->withErrors(['status' => 'Only pending leave requests can be rejected.']); + } + + $leaveRequest->update([ + 'status' => 'rejected', + 'reviewed_by' => Auth::id(), + 'reviewed_at' => now(), + ]); + + return back()->with('success', 'Leave request rejected.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/OnboardingTemplateController.php b/erp/app/Modules/HR/Http/Controllers/OnboardingTemplateController.php new file mode 100644 index 00000000000..dc97a7baede --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/OnboardingTemplateController.php @@ -0,0 +1,112 @@ +authorize('viewAny', OnboardingTemplate::class); + + $templates = OnboardingTemplate::withCount('tasks') + ->orderBy('name') + ->get(); + + return Inertia::render('HR/OnboardingTemplates/Index', [ + 'templates' => $templates, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Onboarding Templates', 'href' => route('hr.onboarding-templates.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', OnboardingTemplate::class); + + return Inertia::render('HR/OnboardingTemplates/Create', [ + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Onboarding Templates', 'href' => route('hr.onboarding-templates.index')], + ['label' => 'New Template'], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', OnboardingTemplate::class); + + $validated = $request->validate([ + 'name' => 'required|string|max:255', + 'description' => 'nullable|string', + 'is_active' => 'boolean', + 'tasks' => 'array', + 'tasks.*.title' => 'required|string|max:255', + 'tasks.*.description' => 'nullable|string', + 'tasks.*.due_days' => 'integer|min:0|max:255', + 'tasks.*.sort_order' => 'integer|min:0|max:255', + ]); + + $template = OnboardingTemplate::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'name' => $validated['name'], + 'description' => $validated['description'] ?? null, + 'is_active' => $validated['is_active'] ?? true, + ]); + + foreach ($validated['tasks'] ?? [] as $taskData) { + $template->tasks()->create([ + 'title' => $taskData['title'], + 'description' => $taskData['description'] ?? null, + 'due_days' => $taskData['due_days'] ?? 0, + 'sort_order' => $taskData['sort_order'] ?? 0, + ]); + } + + return redirect()->route('hr.onboarding-templates.show', $template) + ->with('success', 'Onboarding template created.'); + } + + public function show(OnboardingTemplate $onboardingTemplate): Response + { + $this->authorize('view', $onboardingTemplate); + + $onboardingTemplate->load('tasks'); + + return Inertia::render('HR/OnboardingTemplates/Show', [ + 'template' => $onboardingTemplate, + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Onboarding Templates', 'href' => route('hr.onboarding-templates.index')], + ['label' => $onboardingTemplate->name], + ], + ]); + } + + public function destroy(OnboardingTemplate $onboardingTemplate): RedirectResponse + { + $this->authorize('delete', $onboardingTemplate); + + $hasActiveOnboardings = $onboardingTemplate->onboardings() + ->where('status', 'in_progress') + ->exists(); + + if ($hasActiveOnboardings) { + return back()->withErrors(['template' => 'Cannot delete a template with in-progress onboardings.']); + } + + $onboardingTemplate->delete(); + + return redirect()->route('hr.onboarding-templates.index') + ->with('success', 'Onboarding template deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/PayrollController.php b/erp/app/Modules/HR/Http/Controllers/PayrollController.php new file mode 100644 index 00000000000..ffe40576ccd --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/PayrollController.php @@ -0,0 +1,124 @@ +authorize('viewAny', Employee::class); + + $runs = PayrollRun::with('items') + ->latest('period_start') + ->paginate(25); + + return Inertia::render('HR/Payroll/Index', [ + 'runs' => PayrollRunResource::collection($runs), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll', 'href' => route('hr.payroll.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Employee::class); + + $employees = Employee::active()->with('department')->orderBy('last_name')->get(); + + return Inertia::render('HR/Payroll/Create', [ + 'employees' => $employees->map(fn ($e) => [ + 'id' => $e->id, + 'full_name' => $e->full_name, + 'position' => $e->position, + 'department' => $e->department?->name, + 'salary_type' => $e->salary_type, + 'salary_amount' => $e->salary_amount, + ]), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll', 'href' => route('hr.payroll.index')], + ['label' => 'New Run'], + ], + ]); + } + + public function store(StorePayrollRunRequest $request): RedirectResponse + { + $this->authorize('create', Employee::class); + + $data = $request->validated(); + + $run = DB::transaction(function () use ($data, $request) { + $run = PayrollRun::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'period_start' => $data['period_start'], + 'period_end' => $data['period_end'], + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + ]); + + $items = $request->input('items', []); + + foreach ($items as $item) { + $gross = (float) ($item['gross_salary'] ?? 0); + $deductions = (float) ($item['deductions'] ?? 0); + + PayrollItem::create([ + 'payroll_run_id' => $run->id, + 'employee_id' => $item['employee_id'], + 'gross_salary' => $gross, + 'deductions' => $deductions, + 'net_salary' => max(0, $gross - $deductions), + 'notes' => $item['notes'] ?? null, + ]); + } + + return $run; + }); + + return redirect()->route('hr.payroll.show', $run) + ->with('success', 'Payroll run created.'); + } + + public function show(PayrollRun $payrollRun): Response + { + $this->authorize('viewAny', Employee::class); + + $payrollRun->load(['items.employee.department', 'creator']); + + return Inertia::render('HR/Payroll/Show', [ + 'run' => new PayrollRunResource($payrollRun), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll', 'href' => route('hr.payroll.index')], + ['label' => "Run #{$payrollRun->id}"], + ], + ]); + } + + public function process(PayrollRun $payrollRun): RedirectResponse + { + $this->authorize('update', Employee::class); + + try { + $payrollRun->process(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Payroll run processed.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/PayrollRunController.php b/erp/app/Modules/HR/Http/Controllers/PayrollRunController.php new file mode 100644 index 00000000000..38ed566b465 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/PayrollRunController.php @@ -0,0 +1,99 @@ +authorize('viewAny', PayrollRun::class); + + $runs = PayrollRun::latest('period_start') + ->paginate(25); + + return Inertia::render('HR/PayrollRuns/Index', [ + 'payrollRuns' => PayrollRunResource::collection($runs), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll Runs', 'href' => route('hr.payroll-runs.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', PayrollRun::class); + + return Inertia::render('HR/PayrollRuns/Create', [ + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll Runs', 'href' => route('hr.payroll-runs.index')], + ['label' => 'New Payroll Run'], + ], + ]); + } + + public function store(StorePayrollRunRequest $request): RedirectResponse + { + $this->authorize('create', PayrollRun::class); + + $data = $request->validated(); + + $run = PayrollRun::create([ + ...$data, + 'tenant_id' => auth()->user()->tenant_id, + 'created_by' => auth()->id(), + ]); + + return redirect()->route('hr.payroll-runs.show', $run) + ->with('success', 'Payroll run created.'); + } + + public function show(PayrollRun $payrollRun): Response + { + $this->authorize('view', $payrollRun); + + $payrollRun->load(['creator']); + + return Inertia::render('HR/PayrollRuns/Show', [ + 'payrollRun' => new PayrollRunResource($payrollRun), + 'breadcrumbs' => [ + ['label' => 'HR'], + ['label' => 'Payroll Runs', 'href' => route('hr.payroll-runs.index')], + ['label' => $payrollRun->period_label ?? "Payroll Run #{$payrollRun->id}"], + ], + ]); + } + + public function destroy(PayrollRun $payrollRun): RedirectResponse + { + $this->authorize('delete', $payrollRun); + + $payrollRun->delete(); + + return redirect()->route('hr.payroll-runs.index') + ->with('success', 'Payroll run deleted.'); + } + + public function process(PayrollRun $payrollRun): RedirectResponse + { + $this->authorize('update', $payrollRun); + + try { + $payrollRun->process(); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return redirect()->route('hr.payroll-runs.show', $payrollRun) + ->with('success', 'Payroll run processed.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/PerformanceReviewController.php b/erp/app/Modules/HR/Http/Controllers/PerformanceReviewController.php new file mode 100644 index 00000000000..9e7933afe91 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/PerformanceReviewController.php @@ -0,0 +1,124 @@ +authorize('viewAny', PerformanceReview::class); + $reviews = PerformanceReview::with(['employee', 'reviewer']) + ->orderByDesc('period_end') + ->paginate(25); + return Inertia::render('HR/PerformanceReviews/Index', compact('reviews')); + } + + public function create(Request $request): Response + { + $this->authorize('create', PerformanceReview::class); + $employees = Employee::where('status', 'active')->orderBy('first_name')->get(['id', 'first_name', 'last_name']); + $employeeId = $request->get('employee_id'); + return Inertia::render('HR/PerformanceReviews/Create', compact('employees', 'employeeId')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', PerformanceReview::class); + $data = $request->validate([ + 'employee_id' => 'required|exists:employees,id', + 'period_start' => 'required|date', + 'period_end' => 'required|date|after_or_equal:period_start', + 'comments' => 'nullable|string', + 'goals' => 'nullable|array', + 'goals.*.title' => 'required_with:goals|string', + 'goals.*.description' => 'nullable|string', + 'competencies' => 'nullable|array', + 'competencies.*.name' => 'required_with:competencies|string', + 'competencies.*.rating' => 'nullable|integer|min:1|max:5', + 'competencies.*.notes' => 'nullable|string', + ]); + + $review = PerformanceReview::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'employee_id' => $data['employee_id'], + 'reviewer_id' => auth()->id(), + 'period_start' => $data['period_start'], + 'period_end' => $data['period_end'], + 'status' => 'draft', + 'comments' => $data['comments'] ?? null, + ]); + + foreach ($data['goals'] ?? [] as $goal) { + $review->goals()->create([ + 'title' => $goal['title'], + 'description' => $goal['description'] ?? null, + ]); + } + + foreach ($data['competencies'] ?? [] as $comp) { + $review->competencies()->create([ + 'name' => $comp['name'], + 'rating' => $comp['rating'] ?? null, + 'notes' => $comp['notes'] ?? null, + ]); + } + + return redirect()->route('hr.performance-reviews.show', $review)->with('success', 'Review created.'); + } + + public function show(PerformanceReview $performanceReview): Response + { + $this->authorize('view', $performanceReview); + $performanceReview->load(['employee', 'reviewer', 'goals', 'competencies']); + return Inertia::render('HR/PerformanceReviews/Show', compact('performanceReview')); + } + + public function startReview(PerformanceReview $performanceReview): RedirectResponse + { + $this->authorize('update', $performanceReview); + abort_unless($performanceReview->status === 'draft', 422, 'Only draft reviews can be started.'); + $performanceReview->update(['status' => 'in_review']); + return back()->with('success', 'Review started.'); + } + + public function complete(PerformanceReview $performanceReview, Request $request): RedirectResponse + { + $this->authorize('update', $performanceReview); + abort_unless($performanceReview->status === 'in_review', 422, 'Only in-review reviews can be completed.'); + $request->validate(['overall_rating' => 'required|integer|min:1|max:5']); + $performanceReview->update([ + 'status' => 'completed', + 'overall_rating' => $request->overall_rating, + 'completed_at' => now(), + ]); + return back()->with('success', 'Review completed.'); + } + + public function updateGoal(PerformanceReview $performanceReview, Request $request, int $goalId): RedirectResponse + { + $this->authorize('update', $performanceReview); + $goal = $performanceReview->goals()->findOrFail($goalId); + $request->validate([ + 'achieved' => 'boolean', + 'achievement_notes' => 'nullable|string', + ]); + $goal->update($request->only('achieved', 'achievement_notes')); + return back()->with('success', 'Goal updated.'); + } + + public function destroy(PerformanceReview $performanceReview): RedirectResponse + { + $this->authorize('delete', $performanceReview); + abort_unless($performanceReview->status === 'draft', 422, 'Only draft reviews can be deleted.'); + $performanceReview->delete(); + return redirect()->route('hr.performance-reviews.index')->with('success', 'Review deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/TrainingCourseController.php b/erp/app/Modules/HR/Http/Controllers/TrainingCourseController.php new file mode 100644 index 00000000000..5ccdef85b21 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/TrainingCourseController.php @@ -0,0 +1,76 @@ +authorize('viewAny', TrainingCourse::class); + + $courses = TrainingCourse::withCount('trainingRecords') + ->orderBy('title') + ->paginate(25); + + return Inertia::render('HR/TrainingCourses/Index', compact('courses')); + } + + public function create(): Response + { + $this->authorize('create', TrainingCourse::class); + + return Inertia::render('HR/TrainingCourses/Create'); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', TrainingCourse::class); + + $data = $request->validate([ + 'title' => 'required|string|max:255', + 'provider' => 'nullable|string|max:255', + 'type' => 'required|in:internal,external,online,certification', + 'duration_hours' => 'nullable|numeric|min:0', + 'description' => 'nullable|string', + 'is_active' => 'boolean', + ]); + + $course = TrainingCourse::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.training-courses.show', $course) + ->with('success', 'Training course created.'); + } + + public function show(TrainingCourse $trainingCourse): Response + { + $this->authorize('view', $trainingCourse); + + $trainingCourse->load([ + 'trainingRecords' => fn ($q) => $q->with('employee')->latest()->limit(20), + ]); + + return Inertia::render('HR/TrainingCourses/Show', [ + 'course' => $trainingCourse, + ]); + } + + public function destroy(TrainingCourse $trainingCourse): RedirectResponse + { + $this->authorize('delete', $trainingCourse); + + $trainingCourse->delete(); + + return redirect()->route('hr.training-courses.index') + ->with('success', 'Training course deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Controllers/WorkScheduleController.php b/erp/app/Modules/HR/Http/Controllers/WorkScheduleController.php new file mode 100644 index 00000000000..c2baafe7b58 --- /dev/null +++ b/erp/app/Modules/HR/Http/Controllers/WorkScheduleController.php @@ -0,0 +1,76 @@ +authorize('viewAny', WorkSchedule::class); + + $schedules = WorkSchedule::orderBy('name')->get(); + + return Inertia::render('HR/WorkSchedules/Index', compact('schedules')); + } + + public function create(): Response + { + $this->authorize('create', WorkSchedule::class); + + return Inertia::render('HR/WorkSchedules/Create'); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', WorkSchedule::class); + + $data = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'is_default' => ['boolean'], + 'monday_start' => ['nullable', 'date_format:H:i'], + 'monday_end' => ['nullable', 'date_format:H:i', 'after:monday_start'], + 'tuesday_start' => ['nullable', 'date_format:H:i'], + 'tuesday_end' => ['nullable', 'date_format:H:i', 'after:tuesday_start'], + 'wednesday_start' => ['nullable', 'date_format:H:i'], + 'wednesday_end' => ['nullable', 'date_format:H:i', 'after:wednesday_start'], + 'thursday_start' => ['nullable', 'date_format:H:i'], + 'thursday_end' => ['nullable', 'date_format:H:i', 'after:thursday_start'], + 'friday_start' => ['nullable', 'date_format:H:i'], + 'friday_end' => ['nullable', 'date_format:H:i', 'after:friday_start'], + 'saturday_start' => ['nullable', 'date_format:H:i'], + 'saturday_end' => ['nullable', 'date_format:H:i', 'after:saturday_start'], + 'sunday_start' => ['nullable', 'date_format:H:i'], + 'sunday_end' => ['nullable', 'date_format:H:i', 'after:sunday_start'], + ]); + + $schedule = WorkSchedule::create([ + 'tenant_id' => auth()->user()->tenant_id, + ...$data, + ]); + + return redirect()->route('hr.work-schedules.show', $schedule)->with('success', 'Work schedule created.'); + } + + public function show(WorkSchedule $workSchedule): Response + { + $this->authorize('view', $workSchedule); + + return Inertia::render('HR/WorkSchedules/Show', compact('workSchedule')); + } + + public function destroy(WorkSchedule $workSchedule): RedirectResponse + { + $this->authorize('delete', $workSchedule); + + $workSchedule->delete(); + + return redirect()->route('hr.work-schedules.index')->with('success', 'Work schedule deleted.'); + } +} diff --git a/erp/app/Modules/HR/Http/Requests/StoreDepartmentRequest.php b/erp/app/Modules/HR/Http/Requests/StoreDepartmentRequest.php new file mode 100644 index 00000000000..fcdb6076605 --- /dev/null +++ b/erp/app/Modules/HR/Http/Requests/StoreDepartmentRequest.php @@ -0,0 +1,18 @@ + ['required', 'string', 'max:191'], + 'description' => ['nullable', 'string'], + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Requests/StoreEmployeeRequest.php b/erp/app/Modules/HR/Http/Requests/StoreEmployeeRequest.php new file mode 100644 index 00000000000..2890a8b463b --- /dev/null +++ b/erp/app/Modules/HR/Http/Requests/StoreEmployeeRequest.php @@ -0,0 +1,78 @@ + ['required', 'string', 'max:100'], + 'last_name' => ['required', 'string', 'max:100'], + 'email' => ['nullable', 'email'], + 'phone' => ['nullable', 'string', 'max:50'], + 'employee_number' => ['nullable', 'string', 'max:30', + Rule::unique('employees')->where('tenant_id', auth()->user()?->tenant_id) + ->ignore($this->route('employee')), + ], + 'department_id' => ['nullable', 'integer', 'exists:departments,id'], + 'user_id' => ['nullable', 'integer', 'exists:users,id'], + // spec: job_title maps to position + 'job_title' => ['nullable', 'string', 'max:191'], + 'position' => ['nullable', 'string', 'max:150'], + 'employment_type' => ['required', Rule::in(['full_time', 'part_time', 'contract', 'intern'])], + 'status' => ['sometimes', Rule::in(['active', 'on_leave', 'terminated'])], + 'start_date' => ['nullable', 'date'], + 'hire_date' => ['nullable', 'date'], // alias for start_date + 'end_date' => ['nullable', 'date'], + 'termination_date' => ['nullable', 'date'], // alias for end_date + 'salary_type' => ['sometimes', Rule::in(['hourly', 'monthly'])], + 'salary_amount' => ['nullable', 'numeric', 'min:0'], + 'salary' => ['nullable', 'numeric', 'min:0'], // alias + ]; + } + + public function validated($key = null, $default = null): array + { + $data = parent::validated($key, $default); + + // Map spec field names to DB column names + if (isset($data['job_title']) && !isset($data['position'])) { + $data['position'] = $data['job_title']; + } + unset($data['job_title']); + + if (isset($data['hire_date']) && !isset($data['start_date'])) { + $data['start_date'] = $data['hire_date']; + } + unset($data['hire_date']); + + if (isset($data['termination_date']) && !isset($data['end_date'])) { + $data['end_date'] = $data['termination_date']; + } + unset($data['termination_date']); + + if (isset($data['salary']) && !isset($data['salary_amount'])) { + $data['salary_amount'] = $data['salary']; + } + unset($data['salary']); + + // Default values + if (!isset($data['status'])) { + $data['status'] = 'active'; + } + if (!isset($data['salary_type'])) { + $data['salary_type'] = 'monthly'; + } + if (!isset($data['start_date']) && !isset($data['hire_date'])) { + $data['start_date'] = now()->toDateString(); + } + + return $data; + } +} diff --git a/erp/app/Modules/HR/Http/Requests/StoreExpenseClaimRequest.php b/erp/app/Modules/HR/Http/Requests/StoreExpenseClaimRequest.php new file mode 100644 index 00000000000..e16372b4d9b --- /dev/null +++ b/erp/app/Modules/HR/Http/Requests/StoreExpenseClaimRequest.php @@ -0,0 +1,26 @@ + 'required|exists:employees,id', + 'title' => 'required|string|max:191', + 'description' => 'nullable|string', + 'expense_date' => 'required|date', + 'amount' => 'required|numeric|min:0.01', + 'currency_code' => 'nullable|string|size:3', + 'category' => 'required|in:travel,meals,supplies,accommodation,other', + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Requests/StoreLeaveRequestRequest.php b/erp/app/Modules/HR/Http/Requests/StoreLeaveRequestRequest.php new file mode 100644 index 00000000000..5600587dbe6 --- /dev/null +++ b/erp/app/Modules/HR/Http/Requests/StoreLeaveRequestRequest.php @@ -0,0 +1,44 @@ + ['required', 'integer', 'exists:employees,id'], + 'leave_type_id' => ['nullable', 'integer', 'exists:leave_types,id'], + 'type' => ['nullable', 'string', 'in:annual,sick,unpaid,maternity,paternity,other'], + 'start_date' => ['required', 'date'], + 'end_date' => ['required', 'date', 'after_or_equal:start_date'], + 'reason' => ['nullable', 'string'], + 'notes' => ['nullable', 'string'], + ]; + } + + public function validated($key = null, $default = null): array + { + $data = parent::validated($key, $default); + + // Map reason -> notes + if (isset($data['reason']) && !isset($data['notes'])) { + $data['notes'] = $data['reason']; + } + unset($data['reason']); + unset($data['type']); // type is not a DB column, it's derived from leave_type + + // Compute days if not provided + if (!isset($data['days'])) { + $start = \Carbon\Carbon::parse($data['start_date']); + $end = \Carbon\Carbon::parse($data['end_date']); + $data['days'] = max(1, (int) $start->diffInDays($end) + 1); + } + + return $data; + } +} diff --git a/erp/app/Modules/HR/Http/Requests/StorePayrollRunRequest.php b/erp/app/Modules/HR/Http/Requests/StorePayrollRunRequest.php new file mode 100644 index 00000000000..6fd65ef52eb --- /dev/null +++ b/erp/app/Modules/HR/Http/Requests/StorePayrollRunRequest.php @@ -0,0 +1,20 @@ + ['nullable', 'string', 'max:100'], + 'period_start' => ['required', 'date'], + 'period_end' => ['required', 'date', 'after_or_equal:period_start'], + 'notes' => ['nullable', 'string'], + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Resources/DepartmentResource.php b/erp/app/Modules/HR/Http/Resources/DepartmentResource.php new file mode 100644 index 00000000000..64196fd16ee --- /dev/null +++ b/erp/app/Modules/HR/Http/Resources/DepartmentResource.php @@ -0,0 +1,21 @@ + $this->id, + 'name' => $this->name, + 'description' => $this->description, + 'is_active' => $this->is_active, + 'employees_count' => $this->when(isset($this->employees_count), $this->employees_count), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Resources/EmployeeResource.php b/erp/app/Modules/HR/Http/Resources/EmployeeResource.php new file mode 100644 index 00000000000..ea3f386d164 --- /dev/null +++ b/erp/app/Modules/HR/Http/Resources/EmployeeResource.php @@ -0,0 +1,51 @@ + $this->id, + 'employee_number' => $this->employee_number, + 'code' => $this->code, + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'full_name' => $this->full_name, + 'email' => $this->email, + 'phone' => $this->phone, + 'position' => $this->position, + 'job_title' => $this->position, + 'employment_type' => $this->employment_type, + 'status' => $this->status, + 'start_date' => $this->start_date?->toDateString(), + 'hire_date' => $this->start_date?->toDateString(), + 'end_date' => $this->end_date?->toDateString(), + 'termination_date' => $this->end_date?->toDateString(), + 'salary_type' => $this->salary_type, + 'salary_amount' => $this->salary_amount, + 'salary' => $this->salary_amount, + 'department_id' => $this->department_id, + 'user_id' => $this->user_id, + 'department' => $this->whenLoaded('department', fn () => $this->department + ? ['id' => $this->department->id, 'name' => $this->department->name] + : null), + 'user' => $this->whenLoaded('user', fn () => $this->user + ? ['id' => $this->user->id, 'name' => $this->user->name] + : null), + 'leave_requests' => $this->whenLoaded('leaveRequests', fn () => $this->leaveRequests->map(fn ($lr) => [ + 'id' => $lr->id, + 'leave_type' => $lr->leaveType?->name, + 'start_date' => $lr->start_date?->toDateString(), + 'end_date' => $lr->end_date?->toDateString(), + 'days' => $lr->days, + 'status' => $lr->status, + ])), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Resources/ExpenseClaimResource.php b/erp/app/Modules/HR/Http/Resources/ExpenseClaimResource.php new file mode 100644 index 00000000000..2fca99e96af --- /dev/null +++ b/erp/app/Modules/HR/Http/Resources/ExpenseClaimResource.php @@ -0,0 +1,39 @@ + $this->id, + 'tenant_id' => $this->tenant_id, + 'employee_id' => $this->employee_id, + 'employee_name' => $this->whenLoaded('employee', fn () => $this->employee?->full_name), + 'employee' => $this->whenLoaded('employee', fn () => $this->employee + ? ['id' => $this->employee->id, 'full_name' => $this->employee->full_name] + : null), + 'submitted_by' => $this->submitted_by, + 'submitted_by_name' => $this->whenLoaded('submitter', fn () => $this->submitter?->name), + 'title' => $this->title, + 'description' => $this->description, + 'expense_date' => $this->expense_date?->toDateString(), + 'amount' => $this->amount, + 'currency_code' => $this->currency_code, + 'category' => $this->category, + 'receipt_path' => $this->receipt_path, + 'status' => $this->status, + 'reviewed_by' => $this->reviewed_by, + 'reviewed_by_name' => $this->whenLoaded('reviewer', fn () => $this->reviewer?->name), + 'reviewed_at' => $this->reviewed_at?->toDateTimeString(), + 'review_notes' => $this->review_notes, + 'created_by' => $this->created_by, + 'created_at' => $this->created_at?->toDateTimeString(), + 'updated_at' => $this->updated_at?->toDateTimeString(), + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Resources/LeaveRequestResource.php b/erp/app/Modules/HR/Http/Resources/LeaveRequestResource.php new file mode 100644 index 00000000000..269d69ca0d0 --- /dev/null +++ b/erp/app/Modules/HR/Http/Resources/LeaveRequestResource.php @@ -0,0 +1,35 @@ + $this->id, + 'employee_id' => $this->employee_id, + 'employee' => $this->whenLoaded('employee', fn () => $this->employee + ? ['id' => $this->employee->id, 'full_name' => $this->employee->full_name] + : null), + 'leave_type_id' => $this->leave_type_id, + 'leave_type' => $this->whenLoaded('leaveType', fn () => $this->leaveType?->name), + 'type' => $this->leaveType?->name ?? 'other', + 'start_date' => $this->start_date?->toDateString(), + 'end_date' => $this->end_date?->toDateString(), + 'days' => $this->days, + 'reason' => $this->notes, + 'notes' => $this->notes, + 'status' => $this->status, + 'approved_by' => $this->reviewed_by, + 'approved_at' => $this->reviewed_at?->toDateTimeString(), + 'reviewed_by' => $this->reviewed_by, + 'reviewed_at' => $this->reviewed_at?->toDateTimeString(), + 'approver' => $this->whenLoaded('reviewer', fn () => $this->reviewer?->name), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/HR/Http/Resources/PayrollRunResource.php b/erp/app/Modules/HR/Http/Resources/PayrollRunResource.php new file mode 100644 index 00000000000..a5bd1b2d09c --- /dev/null +++ b/erp/app/Modules/HR/Http/Resources/PayrollRunResource.php @@ -0,0 +1,41 @@ + $this->id, + 'period_label' => $this->period_label ?? $this->period_start?->format('F Y'), + 'period_start' => $this->period_start?->toDateString(), + 'period_end' => $this->period_end?->toDateString(), + 'status' => $this->status, + 'notes' => $this->notes, + 'total_gross' => $this->total_gross, + 'total_deductions' => $this->attributes['total_deductions'] ?? 0, + 'total_net' => $this->total_net, + 'employee_count' => $this->employee_count ?? ($this->relationLoaded('items') ? $this->items->count() : 0), + 'processed_at' => $this->processed_at?->toDateTimeString(), + 'items_count' => $this->whenLoaded('items', fn () => $this->items->count()), + 'items' => $this->whenLoaded('items', fn () => $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'employee' => $item->relationLoaded('employee') ? [ + 'id' => $item->employee->id, + 'full_name' => $item->employee->full_name, + 'position' => $item->employee->position, + ] : null, + 'gross_salary' => $item->gross_salary, + 'deductions' => $item->deductions, + 'net_salary' => $item->net_salary, + 'notes' => $item->notes, + ])), + 'creator' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at?->toDateString(), + ]; + } +} diff --git a/erp/app/Modules/HR/Models/AttendanceRecord.php b/erp/app/Modules/HR/Models/AttendanceRecord.php new file mode 100644 index 00000000000..c6b5338600a --- /dev/null +++ b/erp/app/Modules/HR/Models/AttendanceRecord.php @@ -0,0 +1,54 @@ + 'date', + ]; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function getWorkedHoursAttribute(): ?float + { + if (empty($this->clock_in) || empty($this->clock_out)) { + return null; + } + + $clockIn = Carbon::createFromFormat('H:i:s', $this->clock_in); + $clockOut = Carbon::createFromFormat('H:i:s', $this->clock_out); + + $minutes = $clockIn->diffInMinutes($clockOut) - ($this->break_minutes ?? 0); + + return round($minutes / 60, 2); + } + + public function getIsLateAttribute(): bool + { + return false; + } +} diff --git a/erp/app/Modules/HR/Models/Department.php b/erp/app/Modules/HR/Models/Department.php new file mode 100644 index 00000000000..bd3e297ef0f --- /dev/null +++ b/erp/app/Modules/HR/Models/Department.php @@ -0,0 +1,28 @@ + 'boolean']; + + public function employees(): HasMany + { + return $this->hasMany(Employee::class); + } + + public function scopeActive($query) + { + return $query->where('is_active', true); + } +} diff --git a/erp/app/Modules/HR/Models/Employee.php b/erp/app/Modules/HR/Models/Employee.php new file mode 100644 index 00000000000..45bf0898586 --- /dev/null +++ b/erp/app/Modules/HR/Models/Employee.php @@ -0,0 +1,101 @@ + 'date', + 'end_date' => 'date', + 'salary_amount' => 'decimal:2', + ]; + + public function department(): BelongsTo + { + return $this->belongsTo(Department::class); + } + + public function user(): BelongsTo + { + return $this->belongsTo(User::class); + } + + public function leaveRequests(): HasMany + { + return $this->hasMany(LeaveRequest::class); + } + + public function payrollItems(): HasMany + { + return $this->hasMany(PayrollItem::class); + } + + public function onboardings(): HasMany + { + return $this->hasMany(EmployeeOnboarding::class); + } + + public function getFullNameAttribute(): string + { + return "{$this->first_name} {$this->last_name}"; + } + + /** @return string The employee code (e.g. EMP-00001) */ + public function getCodeAttribute(): string + { + if ($this->employee_number) { + return $this->employee_number; + } + return 'EMP-' . str_pad((string) $this->id, 5, '0', STR_PAD_LEFT); + } + + /** hire_date alias for start_date */ + public function getHireDateAttribute() + { + return $this->start_date; + } + + /** salary alias for salary_amount */ + public function getSalaryAttribute() + { + return $this->salary_amount; + } + + /** termination_date alias for end_date */ + public function getTerminationDateAttribute() + { + return $this->end_date; + } + + public function scopeActive($query) + { + return $query->where('status', 'active'); + } + + public function scopeSearch($query, string $term) + { + return $query->where(function ($q) use ($term) { + $q->where('first_name', 'like', "%{$term}%") + ->orWhere('last_name', 'like', "%{$term}%") + ->orWhere('email', 'like', "%{$term}%") + ->orWhere('employee_number', 'like', "%{$term}%"); + }); + } +} diff --git a/erp/app/Modules/HR/Models/EmployeeLoan.php b/erp/app/Modules/HR/Models/EmployeeLoan.php new file mode 100644 index 00000000000..dc9a6cfade2 --- /dev/null +++ b/erp/app/Modules/HR/Models/EmployeeLoan.php @@ -0,0 +1,71 @@ + 'decimal:2', + 'outstanding_balance' => 'decimal:2', + 'interest_rate' => 'decimal:2', + 'approved_at' => 'datetime', + 'disbursed_at' => 'datetime', + 'repayment_start_date' => 'date', + ]; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function approver(): BelongsTo + { + return $this->belongsTo(User::class, 'approved_by'); + } + + public function repayments(): HasMany + { + return $this->hasMany(LoanRepayment::class); + } + + public function approve(User $user): void + { + $this->status = 'active'; + $this->approved_by = $user->id; + $this->approved_at = now(); + $this->disbursed_at = now(); + $this->save(); + } + + public function cancel(): void + { + $this->status = 'cancelled'; + $this->save(); + } + + public function getTotalRepaidAttribute(): float + { + return (float) $this->repayments->sum('amount'); + } + + public function getIsFullyRepaidAttribute(): bool + { + return (float) $this->outstanding_balance <= 0; + } +} diff --git a/erp/app/Modules/HR/Models/EmployeeOnboarding.php b/erp/app/Modules/HR/Models/EmployeeOnboarding.php new file mode 100644 index 00000000000..38ed29d0097 --- /dev/null +++ b/erp/app/Modules/HR/Models/EmployeeOnboarding.php @@ -0,0 +1,72 @@ + 'date', 'completed_at' => 'date']; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function template(): BelongsTo + { + return $this->belongsTo(OnboardingTemplate::class, 'template_id'); + } + + public function tasks(): HasMany + { + return $this->hasMany(EmployeeOnboardingTask::class)->orderBy('sort_order'); + } + + public function getProgressAttribute(): int + { + $total = $this->tasks()->count(); + if ($total === 0) return 0; + return (int) round($this->tasks()->whereNotNull('completed_at')->count() / $total * 100); + } + + /** + * Instantiate from a template, creating task copies for the employee. + */ + public static function fromTemplate(Employee $employee, OnboardingTemplate $template): self + { + $startDate = $employee->start_date ?? now()->toDateString(); + + $onboarding = self::create([ + 'tenant_id' => $employee->tenant_id, + 'employee_id' => $employee->id, + 'template_id' => $template->id, + 'title' => $template->name, + 'status' => 'in_progress', + 'started_at' => $startDate, + ]); + + foreach ($template->tasks as $task) { + $dueDate = $task->due_days > 0 + ? \Carbon\Carbon::parse($onboarding->started_at)->addDays($task->due_days)->toDateString() + : null; + + $onboarding->tasks()->create([ + 'title' => $task->title, + 'description' => $task->description, + 'due_date' => $dueDate, + 'sort_order' => $task->sort_order, + ]); + } + + return $onboarding; + } +} diff --git a/erp/app/Modules/HR/Models/EmployeeOnboardingTask.php b/erp/app/Modules/HR/Models/EmployeeOnboardingTask.php new file mode 100644 index 00000000000..acc442cabbf --- /dev/null +++ b/erp/app/Modules/HR/Models/EmployeeOnboardingTask.php @@ -0,0 +1,29 @@ + 'datetime', 'due_date' => 'date']; + + public function onboarding(): BelongsTo + { + return $this->belongsTo(EmployeeOnboarding::class, 'employee_onboarding_id'); + } + + public function completer(): BelongsTo + { + return $this->belongsTo(User::class, 'completed_by'); + } + + public function getIsCompletedAttribute(): bool + { + return $this->completed_at !== null; + } +} diff --git a/erp/app/Modules/HR/Models/EmployeeTrainingRecord.php b/erp/app/Modules/HR/Models/EmployeeTrainingRecord.php new file mode 100644 index 00000000000..0a51de987ca --- /dev/null +++ b/erp/app/Modules/HR/Models/EmployeeTrainingRecord.php @@ -0,0 +1,47 @@ + 'date', + 'expiry_date' => 'date', + 'passed' => 'boolean', + 'score' => 'float', + ]; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function trainingCourse(): BelongsTo + { + return $this->belongsTo(TrainingCourse::class); + } + + public function getIsExpiredAttribute(): bool + { + return $this->expiry_date && $this->expiry_date->isPast(); + } + + public function getIsExpiringAttribute(): bool + { + return $this->expiry_date + && !$this->expiry_date->isPast() + && $this->expiry_date->diffInDays(now()) <= 30; + } +} diff --git a/erp/app/Modules/HR/Models/ExpenseClaim.php b/erp/app/Modules/HR/Models/ExpenseClaim.php new file mode 100644 index 00000000000..5b585af71a4 --- /dev/null +++ b/erp/app/Modules/HR/Models/ExpenseClaim.php @@ -0,0 +1,99 @@ + 'date', + 'reviewed_at' => 'datetime', + 'amount' => 'float', + ]; + + protected $attributes = ['status' => 'draft']; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function submitter(): BelongsTo + { + return $this->belongsTo(User::class, 'submitted_by'); + } + + public function reviewer(): BelongsTo + { + return $this->belongsTo(User::class, 'reviewed_by'); + } + + public function submit(): void + { + if ($this->status !== 'draft') { + throw new DomainException("Only draft claims can be submitted. Current status: {$this->status}."); + } + + $this->update([ + 'status' => 'submitted', + 'submitted_by' => Auth::id(), + ]); + } + + public function approve(string $notes = ''): void + { + if ($this->status !== 'submitted') { + throw new DomainException("Only submitted claims can be approved. Current status: {$this->status}."); + } + + $this->update([ + 'status' => 'approved', + 'reviewed_by' => Auth::id(), + 'reviewed_at' => now(), + 'review_notes' => $notes, + ]); + } + + public function reject(string $notes = ''): void + { + if ($this->status !== 'submitted') { + throw new DomainException("Only submitted claims can be rejected. Current status: {$this->status}."); + } + + $this->update([ + 'status' => 'rejected', + 'reviewed_by' => Auth::id(), + 'reviewed_at' => now(), + 'review_notes' => $notes, + ]); + } + + public function reimburse(): void + { + if ($this->status !== 'approved') { + throw new DomainException("Only approved claims can be reimbursed. Current status: {$this->status}."); + } + + $this->update([ + 'status' => 'reimbursed', + ]); + } +} diff --git a/erp/app/Modules/HR/Models/JobApplication.php b/erp/app/Modules/HR/Models/JobApplication.php new file mode 100644 index 00000000000..18b0c38f152 --- /dev/null +++ b/erp/app/Modules/HR/Models/JobApplication.php @@ -0,0 +1,60 @@ + 'datetime', + 'hired_at' => 'datetime', + ]; + + public function jobPosition(): BelongsTo + { + return $this->belongsTo(JobPosition::class); + } + + public function advance(string $stage): void + { + $this->stage = $stage; + if ($stage === 'hired') { + $this->hired_at = now(); + } + if ($stage === 'rejected') { + $this->rejected_at = now(); + } + $this->save(); + } + + public function reject(?string $reason = null): void + { + $this->advance('rejected'); + if ($reason !== null) { + $this->notes = trim(($this->notes ? $this->notes . "\n" : '') . $reason); + $this->save(); + } + } +} diff --git a/erp/app/Modules/HR/Models/JobPosition.php b/erp/app/Modules/HR/Models/JobPosition.php new file mode 100644 index 00000000000..002d3660cc0 --- /dev/null +++ b/erp/app/Modules/HR/Models/JobPosition.php @@ -0,0 +1,62 @@ + 'datetime', + 'closed_at' => 'datetime', + ]; + + public function department(): BelongsTo + { + return $this->belongsTo(Department::class); + } + + public function applications(): HasMany + { + return $this->hasMany(JobApplication::class); + } + + public function getOpenApplicationsCountAttribute(): int + { + return $this->applications()->whereNotIn('stage', ['hired', 'rejected'])->count(); + } + + public function publish(): void + { + $this->status = 'open'; + $this->posted_at = now(); + $this->save(); + } + + public function close(): void + { + $this->status = 'closed'; + $this->closed_at = now(); + $this->save(); + } +} diff --git a/erp/app/Modules/HR/Models/LeaveRequest.php b/erp/app/Modules/HR/Models/LeaveRequest.php new file mode 100644 index 00000000000..27184f0d349 --- /dev/null +++ b/erp/app/Modules/HR/Models/LeaveRequest.php @@ -0,0 +1,98 @@ + 'date', + 'end_date' => 'date', + 'reviewed_at' => 'datetime', + ]; + + protected $attributes = ['status' => 'pending']; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function leaveType(): BelongsTo + { + return $this->belongsTo(LeaveType::class); + } + + public function reviewer(): BelongsTo + { + return $this->belongsTo(User::class, 'reviewed_by'); + } + + /** Alias for reviewer (spec: approver()) */ + public function approver(): BelongsTo + { + return $this->belongsTo(User::class, 'reviewed_by'); + } + + /** approved_by accessor -> reviewed_by */ + public function getApprovedByAttribute() + { + return $this->reviewed_by; + } + + /** approved_at accessor -> reviewed_at */ + public function getApprovedAtAttribute() + { + return $this->reviewed_at; + } + + /** days accessor */ + public function getDaysAttribute(): int + { + if (isset($this->attributes['days']) && $this->attributes['days'] !== null) { + return (int) $this->attributes['days']; + } + if ($this->start_date && $this->end_date) { + return $this->start_date->diffInDays($this->end_date) + 1; + } + return 0; + } + + public function approve(User $reviewer): void + { + if ($this->status !== 'pending') { + throw new \DomainException("Leave request is already {$this->status}."); + } + + $this->update([ + 'status' => 'approved', + 'reviewed_by' => $reviewer->id, + 'reviewed_at' => now(), + ]); + } + + public function reject(User $reviewer): void + { + if ($this->status !== 'pending') { + throw new \DomainException("Leave request is already {$this->status}."); + } + + $this->update([ + 'status' => 'rejected', + 'reviewed_by' => $reviewer->id, + 'reviewed_at' => now(), + ]); + } +} diff --git a/erp/app/Modules/HR/Models/LeaveType.php b/erp/app/Modules/HR/Models/LeaveType.php new file mode 100644 index 00000000000..ff5507d5f98 --- /dev/null +++ b/erp/app/Modules/HR/Models/LeaveType.php @@ -0,0 +1,26 @@ + 'boolean', 'is_active' => 'boolean']; + + public function leaveRequests(): HasMany + { + return $this->hasMany(LeaveRequest::class); + } + + public function scopeActive($query) + { + return $query->where('is_active', true); + } +} diff --git a/erp/app/Modules/HR/Models/LoanRepayment.php b/erp/app/Modules/HR/Models/LoanRepayment.php new file mode 100644 index 00000000000..c7a113741bb --- /dev/null +++ b/erp/app/Modules/HR/Models/LoanRepayment.php @@ -0,0 +1,26 @@ + 'decimal:2', + 'payment_date' => 'date', + ]; + + public function loan(): BelongsTo + { + return $this->belongsTo(EmployeeLoan::class, 'employee_loan_id'); + } +} diff --git a/erp/app/Modules/HR/Models/OnboardingTemplate.php b/erp/app/Modules/HR/Models/OnboardingTemplate.php new file mode 100644 index 00000000000..60607b3f02d --- /dev/null +++ b/erp/app/Modules/HR/Models/OnboardingTemplate.php @@ -0,0 +1,27 @@ + 'boolean']; + + public function tasks(): HasMany + { + return $this->hasMany(OnboardingTemplateTask::class)->orderBy('sort_order'); + } + + public function onboardings(): HasMany + { + return $this->hasMany(EmployeeOnboarding::class, 'template_id'); + } +} diff --git a/erp/app/Modules/HR/Models/OnboardingTemplateTask.php b/erp/app/Modules/HR/Models/OnboardingTemplateTask.php new file mode 100644 index 00000000000..1b21fb5f1fd --- /dev/null +++ b/erp/app/Modules/HR/Models/OnboardingTemplateTask.php @@ -0,0 +1,16 @@ +belongsTo(OnboardingTemplate::class, 'onboarding_template_id'); + } +} diff --git a/erp/app/Modules/HR/Models/PayrollItem.php b/erp/app/Modules/HR/Models/PayrollItem.php new file mode 100644 index 00000000000..bcb49f0629a --- /dev/null +++ b/erp/app/Modules/HR/Models/PayrollItem.php @@ -0,0 +1,29 @@ + 'decimal:2', + 'deductions' => 'decimal:2', + 'net_salary' => 'decimal:2', + ]; + + public function payrollRun(): BelongsTo + { + return $this->belongsTo(PayrollRun::class); + } + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } +} diff --git a/erp/app/Modules/HR/Models/PayrollRun.php b/erp/app/Modules/HR/Models/PayrollRun.php new file mode 100644 index 00000000000..53c4d55d59f --- /dev/null +++ b/erp/app/Modules/HR/Models/PayrollRun.php @@ -0,0 +1,91 @@ + 'date', + 'period_end' => 'date', + 'processed_at' => 'datetime', + 'total_gross' => 'decimal:2', + 'total_net' => 'decimal:2', + 'total_deductions' => 'decimal:2', + ]; + + protected $attributes = ['status' => 'draft']; + + public function items(): HasMany + { + return $this->hasMany(PayrollItem::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public function getTotalGrossAttribute(): float + { + // If items are loaded, compute from items; otherwise use stored value + if ($this->relationLoaded('items') && $this->items->isNotEmpty()) { + return (float) $this->items->sum('gross_salary'); + } + return (float) ($this->attributes['total_gross'] ?? 0); + } + + public function getTotalNetAttribute(): float + { + if ($this->relationLoaded('items') && $this->items->isNotEmpty()) { + return (float) $this->items->sum('net_salary'); + } + return (float) ($this->attributes['total_net'] ?? 0); + } + + /** + * Process the payroll run. + * Computes totals from active employees' salary_amount for this tenant. + */ + public function process(): void + { + if ($this->status !== 'draft') { + throw new \DomainException('Payroll run is already processed.'); + } + + // Compute totals from active employees for this tenant + $employees = Employee::withoutGlobalScopes() + ->where('tenant_id', $this->tenant_id) + ->where('status', 'active') + ->get(); + + $totalGross = $employees->sum('salary_amount'); + $totalDeductions = 0; + $totalNet = $totalGross - $totalDeductions; + $employeeCount = $employees->count(); + + $this->update([ + 'status' => 'processed', + 'total_gross' => $totalGross, + 'total_deductions' => $totalDeductions, + 'total_net' => $totalNet, + 'employee_count' => $employeeCount, + 'processed_at' => now(), + ]); + } +} diff --git a/erp/app/Modules/HR/Models/PerformanceReview.php b/erp/app/Modules/HR/Models/PerformanceReview.php new file mode 100644 index 00000000000..182e749340b --- /dev/null +++ b/erp/app/Modules/HR/Models/PerformanceReview.php @@ -0,0 +1,55 @@ + 'date', + 'period_end' => 'date', + 'completed_at' => 'datetime', + ]; + + public function employee(): BelongsTo + { + return $this->belongsTo(Employee::class); + } + + public function reviewer(): BelongsTo + { + return $this->belongsTo(User::class, 'reviewer_id'); + } + + public function goals(): HasMany + { + return $this->hasMany(PerformanceReviewGoal::class); + } + + public function competencies(): HasMany + { + return $this->hasMany(PerformanceReviewCompetency::class); + } + + public function getAverageCompetencyRatingAttribute(): ?float + { + $ratings = $this->competencies->whereNotNull('rating')->pluck('rating'); + if ($ratings->isEmpty()) { + return null; + } + return round($ratings->avg(), 1); + } +} diff --git a/erp/app/Modules/HR/Models/PerformanceReviewCompetency.php b/erp/app/Modules/HR/Models/PerformanceReviewCompetency.php new file mode 100644 index 00000000000..8f225ae4065 --- /dev/null +++ b/erp/app/Modules/HR/Models/PerformanceReviewCompetency.php @@ -0,0 +1,16 @@ +belongsTo(PerformanceReview::class, 'performance_review_id'); + } +} diff --git a/erp/app/Modules/HR/Models/PerformanceReviewGoal.php b/erp/app/Modules/HR/Models/PerformanceReviewGoal.php new file mode 100644 index 00000000000..69d20487a70 --- /dev/null +++ b/erp/app/Modules/HR/Models/PerformanceReviewGoal.php @@ -0,0 +1,18 @@ + 'boolean']; + + public function review(): BelongsTo + { + return $this->belongsTo(PerformanceReview::class, 'performance_review_id'); + } +} diff --git a/erp/app/Modules/HR/Models/TrainingCourse.php b/erp/app/Modules/HR/Models/TrainingCourse.php new file mode 100644 index 00000000000..18e0e994474 --- /dev/null +++ b/erp/app/Modules/HR/Models/TrainingCourse.php @@ -0,0 +1,25 @@ + 'boolean', + 'duration_hours' => 'float', + ]; + + public function trainingRecords(): HasMany + { + return $this->hasMany(EmployeeTrainingRecord::class); + } +} diff --git a/erp/app/Modules/HR/Models/WorkSchedule.php b/erp/app/Modules/HR/Models/WorkSchedule.php new file mode 100644 index 00000000000..38c92d85bff --- /dev/null +++ b/erp/app/Modules/HR/Models/WorkSchedule.php @@ -0,0 +1,54 @@ + 'boolean', + ]; + + public function scopeDefault($query) + { + return $query->where('is_default', true); + } + + public function getDayHours(string $day): ?array + { + $start = $this->{"{$day}_start"}; + $end = $this->{"{$day}_end"}; + + if (empty($start)) { + return null; + } + + return ['start' => $start, 'end' => $end]; + } +} diff --git a/erp/app/Modules/HR/Policies/AttendancePolicy.php b/erp/app/Modules/HR/Policies/AttendancePolicy.php new file mode 100644 index 00000000000..8d9ec27f6f9 --- /dev/null +++ b/erp/app/Modules/HR/Policies/AttendancePolicy.php @@ -0,0 +1,34 @@ +can('hr.view'); + } + + public function view(User $user, Model $model): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, Model $model): bool + { + return $user->can('hr.create'); + } + + public function delete(User $user, Model $model): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/DepartmentPolicy.php b/erp/app/Modules/HR/Policies/DepartmentPolicy.php new file mode 100644 index 00000000000..56da3cbc51e --- /dev/null +++ b/erp/app/Modules/HR/Policies/DepartmentPolicy.php @@ -0,0 +1,15 @@ +can('hr.view'); } + public function view(User $user, Department $department): bool { return $user->can('hr.view'); } + public function create(User $user): bool { return $user->can('hr.create'); } + public function update(User $user, Department $department): bool { return $user->can('hr.update'); } + public function delete(User $user, Department $department): bool { return $user->can('hr.delete'); } +} diff --git a/erp/app/Modules/HR/Policies/EmployeeOnboardingPolicy.php b/erp/app/Modules/HR/Policies/EmployeeOnboardingPolicy.php new file mode 100644 index 00000000000..c2404274f06 --- /dev/null +++ b/erp/app/Modules/HR/Policies/EmployeeOnboardingPolicy.php @@ -0,0 +1,34 @@ +can('hr.view'); + } + + public function view(User $user, EmployeeOnboarding $onboarding): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, EmployeeOnboarding $onboarding): bool + { + return $user->can('hr.update'); + } + + public function delete(User $user, EmployeeOnboarding $onboarding): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/EmployeePolicy.php b/erp/app/Modules/HR/Policies/EmployeePolicy.php new file mode 100644 index 00000000000..34f9869dc69 --- /dev/null +++ b/erp/app/Modules/HR/Policies/EmployeePolicy.php @@ -0,0 +1,19 @@ +can('hr.view'); } + public function view(User $user, Employee $employee): bool { return $user->can('hr.view'); } + public function create(User $user): bool { return $user->can('hr.create'); } + public function update(User $user, Employee $employee): bool { return $user->can('hr.update'); } + public function delete(User $user, Employee $employee): bool + { + return $user->can('hr.delete') + && in_array($employee->status, ['active', 'terminated']); + } +} diff --git a/erp/app/Modules/HR/Policies/ExpenseClaimPolicy.php b/erp/app/Modules/HR/Policies/ExpenseClaimPolicy.php new file mode 100644 index 00000000000..cd96a1b5f83 --- /dev/null +++ b/erp/app/Modules/HR/Policies/ExpenseClaimPolicy.php @@ -0,0 +1,40 @@ +can('hr.view'); + } + + public function view(User $user, ExpenseClaim $expenseClaim): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, ExpenseClaim $expenseClaim): bool + { + return $user->can('hr.update'); + } + + public function delete(User $user, ExpenseClaim $expenseClaim): bool + { + return $user->can('hr.delete') && $expenseClaim->status === 'draft'; + } + + public function approve(User $user, ExpenseClaim $expenseClaim): bool + { + return $user->can('hr.update') + && $user->hasAnyRole(['admin', 'manager', 'super-admin']); + } +} diff --git a/erp/app/Modules/HR/Policies/LeaveRequestPolicy.php b/erp/app/Modules/HR/Policies/LeaveRequestPolicy.php new file mode 100644 index 00000000000..794392667d3 --- /dev/null +++ b/erp/app/Modules/HR/Policies/LeaveRequestPolicy.php @@ -0,0 +1,19 @@ +can('hr.view'); } + public function view(User $user, LeaveRequest $leaveRequest): bool { return $user->can('hr.view'); } + public function create(User $user): bool { return $user->can('hr.create'); } + public function update(User $user, LeaveRequest $leaveRequest): bool { return $user->can('hr.update'); } + public function delete(User $user, LeaveRequest $leaveRequest): bool + { + return $user->can('hr.delete') + && in_array($leaveRequest->status, ['pending', 'cancelled']); + } +} diff --git a/erp/app/Modules/HR/Policies/LoanPolicy.php b/erp/app/Modules/HR/Policies/LoanPolicy.php new file mode 100644 index 00000000000..4e56ef58e77 --- /dev/null +++ b/erp/app/Modules/HR/Policies/LoanPolicy.php @@ -0,0 +1,34 @@ +can('hr.view'); + } + + public function view(User $user, EmployeeLoan $loan): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, EmployeeLoan $loan): bool + { + return $user->can('hr.create'); + } + + public function delete(User $user, EmployeeLoan $loan): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/OnboardingTemplatePolicy.php b/erp/app/Modules/HR/Policies/OnboardingTemplatePolicy.php new file mode 100644 index 00000000000..941cb1f71a5 --- /dev/null +++ b/erp/app/Modules/HR/Policies/OnboardingTemplatePolicy.php @@ -0,0 +1,34 @@ +can('hr.view'); + } + + public function view(User $user, OnboardingTemplate $template): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, OnboardingTemplate $template): bool + { + return $user->can('hr.update'); + } + + public function delete(User $user, OnboardingTemplate $template): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/PayrollRunPolicy.php b/erp/app/Modules/HR/Policies/PayrollRunPolicy.php new file mode 100644 index 00000000000..0ae458d547f --- /dev/null +++ b/erp/app/Modules/HR/Policies/PayrollRunPolicy.php @@ -0,0 +1,18 @@ +can('hr.view'); } + public function view(User $user, PayrollRun $payrollRun): bool { return $user->can('hr.view'); } + public function create(User $user): bool { return $user->can('hr.create'); } + public function update(User $user, PayrollRun $payrollRun): bool { return $user->can('hr.update'); } + public function delete(User $user, PayrollRun $payrollRun): bool + { + return $user->can('hr.delete') && $payrollRun->status === 'draft'; + } +} diff --git a/erp/app/Modules/HR/Policies/PerformanceReviewPolicy.php b/erp/app/Modules/HR/Policies/PerformanceReviewPolicy.php new file mode 100644 index 00000000000..e1ce74d762c --- /dev/null +++ b/erp/app/Modules/HR/Policies/PerformanceReviewPolicy.php @@ -0,0 +1,34 @@ +can('hr.view'); + } + + public function view(User $user, PerformanceReview $performanceReview): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user, PerformanceReview $performanceReview): bool + { + return $user->can('hr.update'); + } + + public function delete(User $user, PerformanceReview $performanceReview): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/RecruitmentPolicy.php b/erp/app/Modules/HR/Policies/RecruitmentPolicy.php new file mode 100644 index 00000000000..9a152b21998 --- /dev/null +++ b/erp/app/Modules/HR/Policies/RecruitmentPolicy.php @@ -0,0 +1,33 @@ +can('hr.view'); + } + + public function view(User $user): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function update(User $user): bool + { + return $user->can('hr.create'); + } + + public function delete(User $user): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Policies/TrainingPolicy.php b/erp/app/Modules/HR/Policies/TrainingPolicy.php new file mode 100644 index 00000000000..f64ca533bce --- /dev/null +++ b/erp/app/Modules/HR/Policies/TrainingPolicy.php @@ -0,0 +1,28 @@ +can('hr.view'); + } + + public function view(User $user): bool + { + return $user->can('hr.view'); + } + + public function create(User $user): bool + { + return $user->can('hr.create'); + } + + public function delete(User $user): bool + { + return $user->can('hr.delete'); + } +} diff --git a/erp/app/Modules/HR/Providers/HRServiceProvider.php b/erp/app/Modules/HR/Providers/HRServiceProvider.php new file mode 100644 index 00000000000..455de9e846b --- /dev/null +++ b/erp/app/Modules/HR/Providers/HRServiceProvider.php @@ -0,0 +1,61 @@ +loadRoutesFrom(__DIR__ . '/../routes/hr.php'); + + Gate::policy(AttendanceRecord::class, AttendancePolicy::class); + Gate::policy(WorkSchedule::class, AttendancePolicy::class); + Gate::policy(Department::class, DepartmentPolicy::class); + Gate::policy(Employee::class, EmployeePolicy::class); + Gate::policy(EmployeeLoan::class, LoanPolicy::class); + Gate::policy(EmployeeOnboarding::class, EmployeeOnboardingPolicy::class); + Gate::policy(ExpenseClaim::class, ExpenseClaimPolicy::class); + Gate::policy(JobApplication::class, RecruitmentPolicy::class); + Gate::policy(JobPosition::class, RecruitmentPolicy::class); + Gate::policy(LeaveRequest::class, LeaveRequestPolicy::class); + Gate::policy(LoanRepayment::class, LoanPolicy::class); + Gate::policy(OnboardingTemplate::class, OnboardingTemplatePolicy::class); + Gate::policy(PayrollRun::class, PayrollRunPolicy::class); + Gate::policy(PerformanceReview::class, PerformanceReviewPolicy::class); + Gate::policy(TrainingCourse::class, TrainingPolicy::class); + Gate::policy(EmployeeTrainingRecord::class, TrainingPolicy::class); + } +} diff --git a/erp/app/Modules/HR/routes/hr.php b/erp/app/Modules/HR/routes/hr.php new file mode 100644 index 00000000000..fd958d7c9e6 --- /dev/null +++ b/erp/app/Modules/HR/routes/hr.php @@ -0,0 +1,115 @@ +prefix('hr')->name('hr.')->group(function () { + + // Departments — full CRUD + Route::resource('departments', DepartmentController::class); + + // Employees + Route::post('employees/{employee}/terminate', [EmployeeController::class, 'terminate']) + ->name('employees.terminate'); + Route::resource('employees', EmployeeController::class)->names([ + 'index' => 'employees.index', + 'create' => 'employees.create', + 'store' => 'employees.store', + 'show' => 'employees.show', + 'edit' => 'employees.edit', + 'update' => 'employees.update', + 'destroy' => 'employees.destroy', + ]); + + // Leave Requests (new spec-compliant routes) + Route::post('leave-requests/{leaveRequest}/approve', [LeaveRequestController::class, 'approve']) + ->name('leave-requests.approve'); + Route::post('leave-requests/{leaveRequest}/reject', [LeaveRequestController::class, 'reject']) + ->name('leave-requests.reject'); + Route::resource('leave-requests', LeaveRequestController::class)->except(['edit', 'update']); + + // Legacy leave routes (for backward compat with existing tests) + Route::get('leave', [LeaveRequestController::class, 'legacyIndex'])->name('leave.index'); + Route::post('leave', [LeaveRequestController::class, 'legacyStore'])->name('leave.store'); + Route::patch('leave/{leaveRequest}/approve', [LeaveRequestController::class, 'approve']) + ->name('leave.approve'); + Route::patch('leave/{leaveRequest}/reject', [LeaveRequestController::class, 'reject']) + ->name('leave.reject'); + + // Payroll Runs (new spec-compliant routes) + Route::post('payroll-runs/{payrollRun}/process', [PayrollRunController::class, 'process']) + ->name('payroll-runs.process'); + Route::resource('payroll-runs', PayrollRunController::class)->except(['edit', 'update']); + + // Legacy payroll routes (for backward compat with existing tests) + Route::get('payroll', [PayrollController::class, 'index'])->name('payroll.index'); + Route::get('payroll/create', [PayrollController::class, 'create'])->name('payroll.create'); + Route::post('payroll', [PayrollController::class, 'store'])->name('payroll.store'); + Route::get('payroll/{payrollRun}', [PayrollController::class, 'show'])->name('payroll.show'); + Route::patch('payroll/{payrollRun}/process', [PayrollController::class, 'process'])->name('payroll.process'); + + // Onboarding Templates + Route::resource('onboarding-templates', OnboardingTemplateController::class)->except(['edit', 'update']); + + // Employee Onboardings (nested under employees) + Route::prefix('employees/{employee}')->name('employees.')->group(function () { + Route::resource('onboardings', EmployeeOnboardingController::class)->except(['edit', 'update']); + Route::post('onboardings/{onboarding}/complete', [EmployeeOnboardingController::class, 'complete'])->name('onboardings.complete'); + Route::post('onboardings/{onboarding}/tasks/{task}/complete', [EmployeeOnboardingController::class, 'completeTask'])->name('onboardings.tasks.complete'); + Route::post('onboardings/{onboarding}/tasks/{task}/uncomplete', [EmployeeOnboardingController::class, 'uncompleteTask'])->name('onboardings.tasks.uncomplete'); + }); + + // Performance Reviews + Route::resource('performance-reviews', PerformanceReviewController::class)->except(['edit', 'update']); + Route::post('performance-reviews/{performanceReview}/start', [PerformanceReviewController::class, 'startReview'])->name('performance-reviews.start'); + Route::post('performance-reviews/{performanceReview}/complete', [PerformanceReviewController::class, 'complete'])->name('performance-reviews.complete'); + Route::patch('performance-reviews/{performanceReview}/goals/{goal}', [PerformanceReviewController::class, 'updateGoal'])->name('performance-reviews.goals.update'); + + // Expense Claims + Route::post('expense-claims/{expenseClaim}/submit', [ExpenseClaimController::class, 'submit'])->name('expense-claims.submit'); + Route::post('expense-claims/{expenseClaim}/approve', [ExpenseClaimController::class, 'approve'])->name('expense-claims.approve'); + Route::post('expense-claims/{expenseClaim}/reject', [ExpenseClaimController::class, 'reject'])->name('expense-claims.reject'); + Route::post('expense-claims/{expenseClaim}/reimburse', [ExpenseClaimController::class, 'reimburse'])->name('expense-claims.reimburse'); + Route::resource('expense-claims', ExpenseClaimController::class)->except(['edit', 'update']); + + // Training + Route::resource('training-courses', TrainingCourseController::class)->except(['edit', 'update']); + Route::resource('training-records', EmployeeTrainingRecordController::class)->except(['edit', 'update']); + + // Job Positions + Route::post('job-positions/{jobPosition}/publish', [JobPositionController::class, 'publish'])->name('job-positions.publish'); + Route::post('job-positions/{jobPosition}/close', [JobPositionController::class, 'close'])->name('job-positions.close'); + Route::resource('job-positions', JobPositionController::class)->except(['edit', 'update']); + + // Job Applications + Route::patch('job-applications/{jobApplication}/advance', [JobApplicationController::class, 'advance'])->name('job-applications.advance'); + Route::post('job-applications/{jobApplication}/reject', [JobApplicationController::class, 'reject'])->name('job-applications.reject'); + Route::resource('job-applications', JobApplicationController::class)->except(['edit', 'update']); + + // Attendance + Route::resource('attendance', AttendanceController::class)->except(['edit']); + + // Work Schedules + Route::resource('work-schedules', WorkScheduleController::class)->except(['edit', 'update']); + + // Employee Loans + Route::post('employee-loans/{employeeLoan}/approve', [EmployeeLoanController::class, 'approve'])->name('employee-loans.approve'); + Route::post('employee-loans/{employeeLoan}/cancel', [EmployeeLoanController::class, 'cancel'])->name('employee-loans.cancel'); + Route::post('employee-loans/{employeeLoan}/repayments', [EmployeeLoanController::class, 'addRepayment'])->name('employee-loans.repayments.add'); + Route::resource('employee-loans', EmployeeLoanController::class)->except(['edit', 'update']); +}); diff --git a/erp/app/Modules/Inventory/Http/Controllers/AssetController.php b/erp/app/Modules/Inventory/Http/Controllers/AssetController.php new file mode 100644 index 00000000000..601bd101c04 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/AssetController.php @@ -0,0 +1,119 @@ +authorize('viewAny', Asset::class); + + $assets = Asset::withCount('maintenances') + ->with('assignedEmployee') + ->when($request->status, fn ($q) => $q->where('status', $request->status)) + ->orderBy('name') + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Inventory/Assets/Index', [ + 'assets' => $assets, + 'filters' => $request->only(['status']), + ]); + } + + public function create(): Response + { + $this->authorize('create', Asset::class); + + $tenantId = auth()->user()->tenant_id; + + return Inertia::render('Inventory/Assets/Create', [ + 'employees' => Employee::where('tenant_id', $tenantId) + ->where('status', 'active') + ->orderBy('first_name') + ->get(['id', 'first_name', 'last_name']), + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Asset::class); + + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'asset_code' => ['nullable', 'string', 'max:100'], + 'category' => ['nullable', 'string', 'max:100'], + 'location' => ['nullable', 'string', 'max:255'], + 'purchase_date' => ['nullable', 'date'], + 'purchase_cost' => ['nullable', 'numeric', 'min:0'], + 'current_value' => ['nullable', 'numeric', 'min:0'], + 'serial_number' => ['nullable', 'string', 'max:100'], + 'status' => ['required', Rule::in(['active', 'inactive', 'disposed', 'under_maintenance'])], + 'notes' => ['nullable', 'string'], + ]); + + $asset = Asset::create([...$validated, 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('inventory.assets.show', $asset) + ->with('success', 'Asset created successfully.'); + } + + public function show(Asset $asset): Response + { + $this->authorize('view', $asset); + + $asset->load('assignedEmployee'); + $asset->setRelation('maintenances', $asset->maintenances()->latest('scheduled_date')->get()); + + return Inertia::render('Inventory/Assets/Show', [ + 'asset' => $asset->append('depreciation'), + 'employees' => Employee::where('tenant_id', auth()->user()->tenant_id) + ->where('status', 'active') + ->orderBy('first_name') + ->get(['id', 'first_name', 'last_name']), + ]); + } + + public function destroy(Asset $asset): RedirectResponse + { + $this->authorize('delete', $asset); + + $asset->delete(); + + return redirect()->route('inventory.assets.index') + ->with('success', 'Asset deleted.'); + } + + public function dispose(Asset $asset): RedirectResponse + { + $this->authorize('delete', $asset); + + $asset->dispose(); + + return redirect()->back() + ->with('success', 'Asset disposed.'); + } + + public function assign(Request $request, Asset $asset): RedirectResponse + { + $this->authorize('update', $asset); + + $validated = $request->validate([ + 'employee_id' => ['required', 'integer', Rule::exists('employees', 'id')], + ]); + + $asset->assignTo($validated['employee_id']); + + return redirect()->back() + ->with('success', 'Asset assigned.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/AssetMaintenanceController.php b/erp/app/Modules/Inventory/Http/Controllers/AssetMaintenanceController.php new file mode 100644 index 00000000000..4d05153f2fc --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/AssetMaintenanceController.php @@ -0,0 +1,98 @@ +authorize('viewAny', AssetMaintenance::class); + + $maintenances = AssetMaintenance::with('asset') + ->when($request->asset_id, fn ($q) => $q->where('asset_id', $request->asset_id)) + ->orderBy('scheduled_date', 'desc') + ->paginate(15) + ->withQueryString(); + + return Inertia::render('Inventory/AssetMaintenances/Index', [ + 'maintenances' => $maintenances, + 'filters' => $request->only(['asset_id']), + ]); + } + + public function create(): Response + { + $this->authorize('create', AssetMaintenance::class); + + return Inertia::render('Inventory/AssetMaintenances/Create', [ + 'assets' => Asset::orderBy('name')->get(['id', 'name']), + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', AssetMaintenance::class); + + $validated = $request->validate([ + 'asset_id' => ['required', Rule::exists('assets', 'id')], + 'scheduled_date' => ['required', 'date'], + 'type' => ['required', Rule::in(['routine', 'repair', 'inspection', 'calibration'])], + 'description' => ['nullable', 'string'], + 'cost' => ['nullable', 'numeric', 'min:0'], + 'performed_by' => ['nullable', 'string', 'max:255'], + ]); + + $maintenance = AssetMaintenance::create([...$validated, 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('inventory.asset-maintenances.show', $maintenance) + ->with('success', 'Maintenance scheduled successfully.'); + } + + public function show(AssetMaintenance $assetMaintenance): Response + { + $this->authorize('view', $assetMaintenance); + + $assetMaintenance->load('asset'); + + return Inertia::render('Inventory/AssetMaintenances/Show', [ + 'maintenance' => $assetMaintenance, + ]); + } + + public function destroy(AssetMaintenance $assetMaintenance): RedirectResponse + { + $this->authorize('delete', $assetMaintenance); + + $assetMaintenance->delete(); + + return redirect()->route('inventory.asset-maintenances.index') + ->with('success', 'Maintenance record deleted.'); + } + + public function complete(Request $request, AssetMaintenance $assetMaintenance): RedirectResponse + { + $this->authorize('update', $assetMaintenance); + + $validated = $request->validate([ + 'completed_date' => ['required', 'date'], + 'cost' => ['nullable', 'numeric', 'min:0'], + ]); + + $assetMaintenance->complete( + $validated['completed_date'], + isset($validated['cost']) ? (float) $validated['cost'] : null + ); + + return redirect()->back() + ->with('success', 'Maintenance completed.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/CategoryController.php b/erp/app/Modules/Inventory/Http/Controllers/CategoryController.php new file mode 100644 index 00000000000..feac2de64dd --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/CategoryController.php @@ -0,0 +1,63 @@ +whereNull('parent_id') + ->withCount('products') + ->orderBy('name') + ->get(); + + return Inertia::render('Inventory/Categories/Index', [ + 'categories' => $categories, + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Categories', 'href' => route('inventory.categories.index')], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'parent_id' => ['nullable', 'integer', 'exists:categories,id'], + 'description' => ['nullable', 'string'], + ]); + + Category::create([...$validated, 'tenant_id' => auth()->user()->tenant_id]); + + return back()->with('success', 'Category created.'); + } + + public function update(Request $request, Category $category): RedirectResponse + { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'parent_id' => ['nullable', 'integer', 'exists:categories,id'], + 'description' => ['nullable', 'string'], + ]); + + $category->update($validated); + + return back()->with('success', 'Category updated.'); + } + + public function destroy(Category $category): RedirectResponse + { + $category->delete(); + + return back()->with('success', 'Category deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/ProductBundleController.php b/erp/app/Modules/Inventory/Http/Controllers/ProductBundleController.php new file mode 100644 index 00000000000..2d8d7b2a459 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/ProductBundleController.php @@ -0,0 +1,144 @@ +authorize('viewAny', Product::class); + + $bundles = Product::with('bundleItems.componentProduct') + ->where('is_bundle', true) + ->paginate(15); + + return Inertia::render('Inventory/ProductBundles/Index', [ + 'bundles' => $bundles, + ]); + } + + public function create(): Response + { + $this->authorize('create', Product::class); + + $products = Product::where('is_bundle', false) + ->orderBy('name') + ->get(['id', 'name', 'sku']); + + return Inertia::render('Inventory/ProductBundles/Create', [ + 'products' => $products, + ]); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', Product::class); + + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'sku' => ['nullable', 'string', 'max:100'], + 'description' => ['nullable', 'string'], + 'selling_price' => ['nullable', 'numeric', 'min:0'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.component_product_id' => ['required', Rule::exists('products', 'id')], + 'items.*.quantity' => ['required', 'numeric', 'min:0.0001'], + ]); + + $bundleId = null; + + DB::transaction(function () use ($validated, &$bundleId) { + $bundle = Product::create([ + 'name' => $validated['name'], + 'sku' => $validated['sku'] ?? null, + 'description' => $validated['description'] ?? null, + 'sale_price' => $validated['selling_price'] ?? 0, + 'is_bundle' => true, + 'is_active' => true, + 'cost_price' => 0, + ]); + + foreach ($validated['items'] as $item) { + ProductBundleItem::create([ + 'bundle_product_id' => $bundle->id, + 'component_product_id' => $item['component_product_id'], + 'quantity' => $item['quantity'], + ]); + } + + $bundleId = $bundle->id; + }); + + return redirect()->route('inventory.product-bundles.show', $bundleId) + ->with('success', 'Bundle created successfully.'); + } + + public function show(Product $productBundle): Response + { + $this->authorize('view', $productBundle); + + $productBundle->load('bundleItems.componentProduct'); + + $products = Product::where('is_bundle', false) + ->orderBy('name') + ->get(['id', 'name', 'sku']); + + return Inertia::render('Inventory/ProductBundles/Show', [ + 'bundle' => $productBundle, + 'products' => $products, + ]); + } + + public function destroy(Product $productBundle): RedirectResponse + { + $this->authorize('delete', $productBundle); + + $productBundle->delete(); + + return redirect()->route('inventory.product-bundles.index') + ->with('success', 'Bundle deleted.'); + } + + public function addItem(Request $request, Product $productBundle): RedirectResponse + { + $this->authorize('create', Product::class); + + $validated = $request->validate([ + 'component_product_id' => [ + 'required', + Rule::exists('products', 'id'), + Rule::unique('product_bundle_items') + ->where(fn ($q) => $q->where('bundle_product_id', $productBundle->id)), + ], + 'quantity' => ['required', 'numeric', 'min:0.0001'], + ]); + + ProductBundleItem::create([ + 'bundle_product_id' => $productBundle->id, + 'component_product_id' => $validated['component_product_id'], + 'quantity' => $validated['quantity'], + ]); + + return redirect()->route('inventory.product-bundles.show', $productBundle) + ->with('success', 'Component added.'); + } + + public function removeItem(Product $productBundle, ProductBundleItem $item): RedirectResponse + { + $this->authorize('delete', $productBundle); + + $item->delete(); + + return redirect()->route('inventory.product-bundles.show', $productBundle) + ->with('success', 'Component removed.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/ProductCategoryController.php b/erp/app/Modules/Inventory/Http/Controllers/ProductCategoryController.php new file mode 100644 index 00000000000..7bbad9dcc32 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/ProductCategoryController.php @@ -0,0 +1,82 @@ +authorize('viewAny', ProductCategory::class); + $tenantId = $request->user()->tenant_id; + $categories = ProductCategory::where('tenant_id', $tenantId) + ->withCount('products') + ->orderBy('name') + ->get() + ->map(fn ($c) => [ + 'id' => $c->id, + 'name' => $c->name, + 'slug' => $c->slug, + 'description' => $c->description, + 'colour' => $c->colour, + 'products_count' => $c->products_count, + ]); + return Inertia::render('Inventory/ProductCategories/Index', compact('categories')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', ProductCategory::class); + $data = $request->validate([ + 'name' => 'required|string|max:100', + 'description' => 'nullable|string', + 'colour' => 'nullable|string|regex:/^#[0-9A-Fa-f]{6}$/', + ]); + $data['tenant_id'] = $request->user()->tenant_id; + $data['slug'] = $this->uniqueSlug($data['tenant_id'], \Str::slug($data['name'])); + $data['colour'] = $data['colour'] ?? '#6366f1'; + ProductCategory::create($data); + return back()->with('success', 'Category created.'); + } + + public function update(Request $request, ProductCategory $productCategory): RedirectResponse + { + $this->authorize('update', $productCategory); + $data = $request->validate([ + 'name' => 'required|string|max:100', + 'description' => 'nullable|string', + 'colour' => 'nullable|string|regex:/^#[0-9A-Fa-f]{6}$/', + ]); + $data['slug'] = $this->uniqueSlug($productCategory->tenant_id, \Str::slug($data['name']), $productCategory->id); + $productCategory->update($data); + return back()->with('success', 'Category updated.'); + } + + public function destroy(ProductCategory $productCategory): RedirectResponse + { + $this->authorize('delete', $productCategory); + $productCategory->delete(); // products become uncategorised (nullOnDelete) + return back()->with('success', 'Category deleted.'); + } + + private function uniqueSlug(int $tenantId, string $base, ?int $excludeId = null): string + { + $slug = $base; + $count = 2; + while ( + ProductCategory::where('tenant_id', $tenantId) + ->where('slug', $slug) + ->when($excludeId, fn ($q) => $q->where('id', '!=', $excludeId)) + ->exists() + ) { + $slug = $base . '-' . $count++; + } + return $slug; + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/ProductController.php b/erp/app/Modules/Inventory/Http/Controllers/ProductController.php new file mode 100644 index 00000000000..310d1ecec24 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/ProductController.php @@ -0,0 +1,133 @@ +authorize('viewAny', Product::class); + + $products = Product::with(['category', 'uom', 'stockLevels']) + ->when($request->search, fn ($q) => $q->search($request->search)) + ->when($request->category_id, fn ($q) => $q->where('category_id', $request->category_id)) + ->when($request->status !== null, fn ($q) => match ($request->status) { + 'active' => $q->active(), + 'inactive' => $q->where('is_active', false), + default => $q, + }) + ->orderBy($request->sort ?? 'name', $request->direction ?? 'asc') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Inventory/Products/Index', [ + 'products' => ProductResource::collection($products), + 'categories' => ProductCategory::orderBy('name')->get(['id', 'name', 'colour']), + 'filters' => $request->only(['search', 'category_id', 'status', 'sort', 'direction']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Products', 'href' => route('inventory.products.index')], + ], + ]); + } + + public function create(): Response + { + $this->authorize('create', Product::class); + + return Inertia::render('Inventory/Products/Create', [ + 'categories' => ProductCategory::orderBy('name')->get(['id', 'name', 'colour']), + 'uoms' => UnitOfMeasure::orderBy('name')->get(['id', 'name', 'abbreviation']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Products', 'href' => route('inventory.products.index')], + ['label' => 'New Product'], + ], + ]); + } + + public function store(StoreProductRequest $request): RedirectResponse + { + $this->authorize('create', Product::class); + + Product::create([...$request->validated(), 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('inventory.products.index') + ->with('success', 'Product created successfully.'); + } + + public function show(Product $product): Response + { + $this->authorize('view', $product); + + $product->load(['category', 'uom', 'stockLevels.warehouse', 'preferredSupplier']); + + $movements = $product->stockMovements() + ->with('warehouse', 'creator') + ->latest('created_at') + ->paginate(20); + + $tenantId = auth()->user()->tenant_id; + + return Inertia::render('Inventory/Products/Show', [ + 'product' => new ProductResource($product), + 'movements' => $movements, + 'suppliers' => Supplier::where('tenant_id', $tenantId)->orderBy('name')->get(['id', 'name']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Products', 'href' => route('inventory.products.index')], + ['label' => $product->name], + ], + ]); + } + + public function edit(Product $product): Response + { + $this->authorize('update', $product); + + return Inertia::render('Inventory/Products/Edit', [ + 'product' => new ProductResource($product), + 'categories' => ProductCategory::orderBy('name')->get(['id', 'name', 'colour']), + 'uoms' => UnitOfMeasure::orderBy('name')->get(['id', 'name', 'abbreviation']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Products', 'href' => route('inventory.products.index')], + ['label' => $product->name, 'href' => route('inventory.products.show', $product)], + ['label' => 'Edit'], + ], + ]); + } + + public function update(UpdateProductRequest $request, Product $product): RedirectResponse + { + $this->authorize('update', $product); + + $product->update($request->validated()); + + return redirect()->route('inventory.products.show', $product) + ->with('success', 'Product updated successfully.'); + } + + public function destroy(Product $product): RedirectResponse + { + $this->authorize('delete', $product); + + $product->delete(); + + return redirect()->route('inventory.products.index') + ->with('success', 'Product deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/PurchaseOrderController.php b/erp/app/Modules/Inventory/Http/Controllers/PurchaseOrderController.php new file mode 100644 index 00000000000..fc4785a818e --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/PurchaseOrderController.php @@ -0,0 +1,180 @@ +when($request->status, fn ($q) => $q->where('status', $request->status)) + ->when($request->supplier_id, fn ($q) => $q->where('supplier_id', $request->supplier_id)) + ->latest() + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Inventory/PurchaseOrders/Index', [ + 'orders' => PurchaseOrderResource::collection($orders), + 'suppliers' => Supplier::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['status', 'supplier_id']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Purchase Orders', 'href' => route('inventory.purchase-orders.index')], + ], + ]); + } + + public function create(): Response + { + return Inertia::render('Inventory/PurchaseOrders/Create', [ + 'suppliers' => Supplier::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'warehouses' => Warehouse::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'products' => Product::active()->with('uom')->orderBy('name') + ->get(['id', 'name', 'sku', 'cost_price', 'uom_id']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Purchase Orders', 'href' => route('inventory.purchase-orders.index')], + ['label' => 'New Order'], + ], + ]); + } + + public function store(StorePurchaseOrderRequest $request): RedirectResponse + { + $data = $request->validated(); + + $po = PurchaseOrder::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'supplier_id' => $data['supplier_id'], + 'warehouse_id' => $data['warehouse_id'], + 'expected_date' => $data['expected_date'] ?? null, + 'notes' => $data['notes'] ?? null, + 'created_by' => auth()->id(), + ]); + + foreach ($data['items'] as $item) { + $po->items()->create([ + 'product_id' => $item['product_id'], + 'quantity' => $item['quantity'], + 'unit_cost' => $item['unit_cost'], + ]); + } + + return redirect()->route('inventory.purchase-orders.show', $po) + ->with('success', 'Purchase order created.'); + } + + public function show(PurchaseOrder $purchaseOrder): Response + { + $purchaseOrder->load(['supplier', 'warehouse', 'items.product', 'creator']); + + return Inertia::render('Inventory/PurchaseOrders/Show', [ + 'order' => new PurchaseOrderResource($purchaseOrder), + 'transitions' => $purchaseOrder->availableTransitions(), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Purchase Orders', 'href' => route('inventory.purchase-orders.index')], + ['label' => "PO #{$purchaseOrder->id}"], + ], + ]); + } + + public function receiveForm(PurchaseOrder $purchaseOrder): Response + { + if (! $purchaseOrder->canTransitionTo('received')) { + return redirect()->route('inventory.purchase-orders.show', $purchaseOrder) + ->withErrors(['status' => 'This purchase order cannot be received in its current status.']); + } + + $purchaseOrder->load(['supplier', 'warehouse', 'items.product']); + + return Inertia::render('Inventory/PurchaseOrders/Receive', [ + 'order' => new PurchaseOrderResource($purchaseOrder), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Purchase Orders', 'href' => route('inventory.purchase-orders.index')], + ['label' => "PO-" . str_pad($purchaseOrder->id, 4, '0', STR_PAD_LEFT), 'href' => route('inventory.purchase-orders.show', $purchaseOrder)], + ['label' => 'Receive Items'], + ], + ]); + } + + public function transition(Request $request, PurchaseOrder $purchaseOrder): RedirectResponse + { + $status = $request->validate(['status' => ['required', 'string']])['status']; + + try { + if ($status === 'received') { + $lines = $purchaseOrder->items->map(fn ($i) => [ + 'id' => $i->id, + 'received_quantity' => $i->quantity, + ])->all(); + $purchaseOrder->receive($lines); + } else { + $purchaseOrder->transitionTo($status); + } + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', "Order {$status}."); + } + + public function submit(PurchaseOrder $purchaseOrder): RedirectResponse + { + try { + $purchaseOrder->transitionTo('submitted'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Purchase order submitted.'); + } + + public function approve(PurchaseOrder $purchaseOrder): RedirectResponse + { + try { + $purchaseOrder->transitionTo('approved'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Purchase order approved.'); + } + + public function receive(ReceivePurchaseOrderRequest $request, PurchaseOrder $purchaseOrder): RedirectResponse + { + try { + $purchaseOrder->receive($request->validated()['lines']); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return redirect()->route('inventory.purchase-orders.show', $purchaseOrder) + ->with('success', 'Items received and stock updated.'); + } + + public function cancel(PurchaseOrder $purchaseOrder): RedirectResponse + { + try { + $purchaseOrder->transitionTo('cancelled'); + } catch (\DomainException $e) { + return back()->withErrors(['status' => $e->getMessage()]); + } + + return back()->with('success', 'Purchase order cancelled.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/PurchaseRequisitionController.php b/erp/app/Modules/Inventory/Http/Controllers/PurchaseRequisitionController.php new file mode 100644 index 00000000000..90b711448da --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/PurchaseRequisitionController.php @@ -0,0 +1,113 @@ +authorize('viewAny', PurchaseRequisition::class); + $requisitions = PurchaseRequisition::with(['requester', 'approver']) + ->orderByDesc('created_at') + ->paginate(25); + return Inertia::render('Inventory/PurchaseRequisitions/Index', compact('requisitions')); + } + + public function create(): Response + { + $this->authorize('create', PurchaseRequisition::class); + $products = Product::orderBy('name')->get(['id', 'name', 'sku', 'cost_price']); + return Inertia::render('Inventory/PurchaseRequisitions/Create', compact('products')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', PurchaseRequisition::class); + $data = $request->validate([ + 'reference' => 'required|string|max:100|unique:purchase_requisitions,reference', + 'needed_by' => 'nullable|date', + 'notes' => 'nullable|string', + 'items' => 'required|array|min:1', + 'items.*.description' => 'required|string', + 'items.*.product_id' => 'nullable|exists:products,id', + 'items.*.quantity' => 'required|numeric|min:0.01', + 'items.*.estimated_unit_cost' => 'required|numeric|min:0', + ]); + + $pr = PurchaseRequisition::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'reference' => $data['reference'], + 'requested_by' => auth()->id(), + 'status' => 'draft', + 'needed_by' => $data['needed_by'] ?? null, + 'notes' => $data['notes'] ?? null, + ]); + + foreach ($data['items'] as $item) { + $pr->items()->create([ + 'product_id' => $item['product_id'] ?? null, + 'description' => $item['description'], + 'quantity' => $item['quantity'], + 'estimated_unit_cost' => $item['estimated_unit_cost'], + ]); + } + + return redirect()->route('inventory.purchase-requisitions.show', $pr) + ->with('success', 'Purchase requisition created.'); + } + + public function show(PurchaseRequisition $purchaseRequisition): Response + { + $this->authorize('view', $purchaseRequisition); + $purchaseRequisition->load(['requester', 'approver', 'items.product']); + return Inertia::render('Inventory/PurchaseRequisitions/Show', compact('purchaseRequisition')); + } + + public function submit(PurchaseRequisition $purchaseRequisition): RedirectResponse + { + $this->authorize('update', $purchaseRequisition); + abort_unless($purchaseRequisition->status === 'draft', 422, 'Only drafts can be submitted.'); + $purchaseRequisition->update(['status' => 'submitted']); + return back()->with('success', 'Requisition submitted for approval.'); + } + + public function approve(PurchaseRequisition $purchaseRequisition): RedirectResponse + { + $this->authorize('approve', $purchaseRequisition); + abort_unless($purchaseRequisition->status === 'submitted', 422, 'Only submitted requisitions can be approved.'); + $purchaseRequisition->update([ + 'status' => 'approved', + 'approved_by' => auth()->id(), + 'approved_at' => now(), + ]); + return back()->with('success', 'Requisition approved.'); + } + + public function reject(PurchaseRequisition $purchaseRequisition, Request $request): RedirectResponse + { + $this->authorize('approve', $purchaseRequisition); + abort_unless($purchaseRequisition->status === 'submitted', 422, 'Only submitted requisitions can be rejected.'); + $request->validate(['rejection_reason' => 'required|string']); + $purchaseRequisition->update([ + 'status' => 'rejected', + 'rejection_reason' => $request->rejection_reason, + ]); + return back()->with('success', 'Requisition rejected.'); + } + + public function destroy(PurchaseRequisition $purchaseRequisition): RedirectResponse + { + $this->authorize('delete', $purchaseRequisition); + abort_unless($purchaseRequisition->status === 'draft', 422, 'Only drafts can be deleted.'); + $purchaseRequisition->delete(); + return redirect()->route('inventory.purchase-requisitions.index')->with('success', 'Requisition deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/ReorderController.php b/erp/app/Modules/Inventory/Http/Controllers/ReorderController.php new file mode 100644 index 00000000000..681c88ea704 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/ReorderController.php @@ -0,0 +1,87 @@ +authorize('viewAny', Product::class); + $tenantId = $request->user()->tenant_id; + + $suggestions = Product::where('tenant_id', $tenantId) + ->where('is_active', true) + ->where('reorder_point', '>', 0) + ->with(['stockLevels', 'preferredSupplier', 'category']) + ->get() + ->filter(fn ($p) => $p->needsReorder()) + ->map(fn ($p) => [ + 'id' => $p->id, + 'sku' => $p->sku, + 'name' => $p->name, + 'category' => $p->category?->name, + 'total_stock' => round($p->total_stock, 4), + 'reorder_point' => round((float) $p->reorder_point, 4), + 'reorder_quantity' => round((float) $p->reorder_quantity, 4), + 'preferred_supplier' => $p->preferredSupplier?->name, + 'preferred_supplier_id' => $p->preferred_supplier_id, + 'cost_price' => (float) $p->cost_price, + ]) + ->values(); + + $suppliers = Supplier::where('tenant_id', $tenantId)->orderBy('name')->get(['id', 'name']); + $warehouses = Warehouse::where('tenant_id', $tenantId)->orderBy('name')->get(['id', 'name']); + + return Inertia::render('Inventory/Reorder/Index', [ + 'suggestions' => $suggestions, + 'suppliers' => $suppliers, + 'warehouses' => $warehouses, + ]); + } + + public function createPurchaseOrder(Request $request) + { + $this->authorize('create', Product::class); + + $data = $request->validate([ + 'supplier_id' => 'required|exists:suppliers,id', + 'warehouse_id' => 'required|exists:warehouses,id', + 'items' => 'required|array|min:1', + 'items.*.product_id' => 'required|exists:products,id', + 'items.*.quantity' => 'required|numeric|min:0.001', + 'items.*.unit_cost' => 'required|numeric|min:0', + ]); + + $tenantId = $request->user()->tenant_id; + + $po = PurchaseOrder::create([ + 'tenant_id' => $tenantId, + 'supplier_id' => $data['supplier_id'], + 'warehouse_id' => $data['warehouse_id'], + 'status' => 'draft', + 'created_by' => $request->user()->id, + ]); + + foreach ($data['items'] as $item) { + PurchaseOrderItem::create([ + 'purchase_order_id' => $po->id, + 'product_id' => $item['product_id'], + 'quantity' => $item['quantity'], + 'unit_cost' => $item['unit_cost'], + 'received_quantity' => 0, + ]); + } + + return redirect("/inventory/purchase-orders/{$po->id}") + ->with('success', 'Purchase order created from reorder suggestions.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/StockAdjustmentController.php b/erp/app/Modules/Inventory/Http/Controllers/StockAdjustmentController.php new file mode 100644 index 00000000000..25bc98d13f9 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/StockAdjustmentController.php @@ -0,0 +1,101 @@ +authorize('viewAny', StockAdjustment::class); + $adjustments = StockAdjustment::with(['warehouse', 'adjuster']) + ->orderByDesc('created_at') + ->paginate(25); + return Inertia::render('Inventory/StockAdjustments/Index', compact('adjustments')); + } + + public function create(): Response + { + $this->authorize('create', StockAdjustment::class); + $warehouses = Warehouse::orderBy('name')->get(['id', 'name']); + $products = Product::orderBy('name')->get(['id', 'name', 'sku']); + return Inertia::render('Inventory/StockAdjustments/Create', compact('warehouses', 'products')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', StockAdjustment::class); + $data = $request->validate([ + 'warehouse_id' => 'required|exists:warehouses,id', + 'reference' => 'required|string|max:100|unique:stock_adjustments,reference', + 'reason' => 'required|in:count,damage,theft,expiry,correction,other', + 'notes' => 'nullable|string', + 'items' => 'required|array|min:1', + 'items.*.product_id' => 'required|exists:products,id', + 'items.*.expected_quantity' => 'required|numeric|min:0', + 'items.*.actual_quantity' => 'required|numeric|min:0', + ]); + + $adj = StockAdjustment::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'warehouse_id' => $data['warehouse_id'], + 'reference' => $data['reference'], + 'reason' => $data['reason'], + 'status' => 'draft', + 'notes' => $data['notes'] ?? null, + ]); + + foreach ($data['items'] as $item) { + $adj->items()->create([ + 'product_id' => $item['product_id'], + 'expected_quantity' => $item['expected_quantity'], + 'actual_quantity' => $item['actual_quantity'], + 'difference' => $item['actual_quantity'] - $item['expected_quantity'], + ]); + } + + return redirect()->route('inventory.stock-adjustments.show', $adj) + ->with('success', 'Stock adjustment created.'); + } + + public function show(StockAdjustment $stockAdjustment): Response + { + $this->authorize('view', $stockAdjustment); + $stockAdjustment->load(['warehouse', 'adjuster', 'items.product']); + return Inertia::render('Inventory/StockAdjustments/Show', compact('stockAdjustment')); + } + + public function confirm(StockAdjustment $stockAdjustment): RedirectResponse + { + $this->authorize('update', $stockAdjustment); + /** @var User $user */ + $user = auth()->user(); + $stockAdjustment->confirm($user); + return back()->with('success', 'Adjustment confirmed and stock updated.'); + } + + public function cancel(StockAdjustment $stockAdjustment): RedirectResponse + { + $this->authorize('update', $stockAdjustment); + abort_unless($stockAdjustment->status === 'draft', 422, 'Only draft adjustments can be cancelled.'); + $stockAdjustment->update(['status' => 'cancelled']); + return back()->with('success', 'Adjustment cancelled.'); + } + + public function destroy(StockAdjustment $stockAdjustment): RedirectResponse + { + $this->authorize('delete', $stockAdjustment); + abort_unless($stockAdjustment->status === 'draft', 422, 'Only draft adjustments can be deleted.'); + $stockAdjustment->delete(); + return redirect()->route('inventory.stock-adjustments.index')->with('success', 'Adjustment deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/StockMovementController.php b/erp/app/Modules/Inventory/Http/Controllers/StockMovementController.php new file mode 100644 index 00000000000..c8680b22d9d --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/StockMovementController.php @@ -0,0 +1,59 @@ +when($request->product_id, fn ($q) => $q->where('product_id', $request->product_id)) + ->when($request->warehouse_id, fn ($q) => $q->where('warehouse_id', $request->warehouse_id)) + ->when($request->type, fn ($q) => $q->where('type', $request->type)) + ->when($request->date_from, fn ($q) => $q->whereDate('created_at', '>=', $request->date_from)) + ->when($request->date_to, fn ($q) => $q->whereDate('created_at', '<=', $request->date_to)) + ->latest('created_at') + ->paginate(50) + ->withQueryString(); + + return Inertia::render('Inventory/StockMovements/Index', [ + 'movements' => $movements, + 'products' => Product::active()->orderBy('name')->get(['id', 'name', 'sku']), + 'warehouses' => Warehouse::where('is_active', true)->orderBy('name')->get(['id', 'name']), + 'filters' => $request->only(['product_id', 'warehouse_id', 'type', 'date_from', 'date_to']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Stock Movements', 'href' => route('inventory.stock-movements.index')], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $validated = $request->validate([ + 'product_id' => ['required', 'integer', 'exists:products,id'], + 'warehouse_id' => ['required', 'integer', 'exists:warehouses,id'], + 'type' => ['required', 'in:in,out,adjustment'], + 'quantity' => ['required', 'numeric', 'min:0.01'], + 'reference' => ['nullable', 'string', 'max:255'], + 'notes' => ['nullable', 'string'], + ]); + + try { + StockMovement::record($validated); + } catch (\DomainException $e) { + return back()->withErrors(['quantity' => $e->getMessage()]); + } + + return back()->with('success', 'Stock movement recorded.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/StockTransferController.php b/erp/app/Modules/Inventory/Http/Controllers/StockTransferController.php new file mode 100644 index 00000000000..3b90b72a97a --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/StockTransferController.php @@ -0,0 +1,105 @@ +authorize('viewAny', StockTransfer::class); + + $transfers = StockTransfer::with(['fromWarehouse', 'toWarehouse']) + ->withCount('items') + ->orderByDesc('created_at') + ->paginate(15); + + return Inertia::render('Inventory/StockTransfers/Index', compact('transfers')); + } + + public function create(): Response + { + $this->authorize('create', StockTransfer::class); + + $warehouses = Warehouse::orderBy('name')->get(['id', 'name']); + $products = Product::orderBy('name')->get(['id', 'name', 'sku']); + + return Inertia::render('Inventory/StockTransfers/Create', compact('warehouses', 'products')); + } + + public function store(Request $request): RedirectResponse + { + $this->authorize('create', StockTransfer::class); + + $data = $request->validate([ + 'from_warehouse_id' => ['required', Rule::exists('warehouses', 'id')], + 'to_warehouse_id' => ['required', Rule::exists('warehouses', 'id'), 'different:from_warehouse_id'], + 'notes' => ['nullable', 'string'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.product_id' => ['required', Rule::exists('products', 'id')], + 'items.*.quantity' => ['required', 'numeric', 'min:0.0001'], + ]); + + $transfer = StockTransfer::create([ + 'tenant_id' => auth()->user()->tenant_id, + 'from_warehouse_id' => $data['from_warehouse_id'], + 'to_warehouse_id' => $data['to_warehouse_id'], + 'status' => 'draft', + 'notes' => $data['notes'] ?? null, + ]); + + foreach ($data['items'] as $item) { + $transfer->items()->create([ + 'tenant_id' => auth()->user()->tenant_id, + 'product_id' => $item['product_id'], + 'quantity' => $item['quantity'], + ]); + } + + return redirect()->route('inventory.stock-transfers.show', $transfer) + ->with('success', 'Stock transfer created.'); + } + + public function show(StockTransfer $stockTransfer): Response + { + $this->authorize('view', $stockTransfer); + $stockTransfer->load(['fromWarehouse', 'toWarehouse', 'items.product']); + + return Inertia::render('Inventory/StockTransfers/Show', compact('stockTransfer')); + } + + public function destroy(StockTransfer $stockTransfer): RedirectResponse + { + $this->authorize('delete', $stockTransfer); + abort_unless($stockTransfer->status === 'draft', 422, 'Only draft transfers can be deleted.'); + $stockTransfer->delete(); + + return redirect()->route('inventory.stock-transfers.index') + ->with('success', 'Transfer deleted.'); + } + + public function complete(StockTransfer $stockTransfer): RedirectResponse + { + $this->authorize('update', $stockTransfer); + $stockTransfer->complete(); + + return back()->with('success', 'Transfer completed and stock updated.'); + } + + public function cancel(StockTransfer $stockTransfer): RedirectResponse + { + $this->authorize('update', $stockTransfer); + $stockTransfer->cancel(); + + return back()->with('success', 'Transfer cancelled.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/SupplierController.php b/erp/app/Modules/Inventory/Http/Controllers/SupplierController.php new file mode 100644 index 00000000000..a6043663ad9 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/SupplierController.php @@ -0,0 +1,83 @@ +search, fn ($q) => + $q->where('name', 'like', "%{$request->search}%") + ->orWhere('email', 'like', "%{$request->search}%") + ) + ->orderBy('name') + ->paginate(25) + ->withQueryString(); + + return Inertia::render('Inventory/Suppliers/Index', [ + 'suppliers' => SupplierResource::collection($suppliers), + 'filters' => $request->only(['search']), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Suppliers', 'href' => route('inventory.suppliers.index')], + ], + ]); + } + + public function create(): Response + { + return Inertia::render('Inventory/Suppliers/Create', [ + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Suppliers', 'href' => route('inventory.suppliers.index')], + ['label' => 'New Supplier'], + ], + ]); + } + + public function store(StoreSupplierRequest $request): RedirectResponse + { + Supplier::create([...$request->validated(), 'tenant_id' => auth()->user()->tenant_id]); + + return redirect()->route('inventory.suppliers.index') + ->with('success', 'Supplier created successfully.'); + } + + public function edit(Supplier $supplier): Response + { + return Inertia::render('Inventory/Suppliers/Edit', [ + 'supplier' => new SupplierResource($supplier), + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Suppliers', 'href' => route('inventory.suppliers.index')], + ['label' => $supplier->name, 'href' => route('inventory.suppliers.edit', $supplier)], + ['label' => 'Edit'], + ], + ]); + } + + public function update(StoreSupplierRequest $request, Supplier $supplier): RedirectResponse + { + $supplier->update($request->validated()); + + return redirect()->route('inventory.suppliers.index') + ->with('success', 'Supplier updated successfully.'); + } + + public function destroy(Supplier $supplier): RedirectResponse + { + $supplier->delete(); + + return redirect()->route('inventory.suppliers.index') + ->with('success', 'Supplier deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/WarehouseController.php b/erp/app/Modules/Inventory/Http/Controllers/WarehouseController.php new file mode 100644 index 00000000000..08594aa8d32 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/WarehouseController.php @@ -0,0 +1,61 @@ +orderBy('name') + ->get(); + + return Inertia::render('Inventory/Warehouses/Index', [ + 'warehouses' => $warehouses, + 'breadcrumbs' => [ + ['label' => 'Inventory'], + ['label' => 'Warehouses', 'href' => route('inventory.warehouses.index')], + ], + ]); + } + + public function store(Request $request): RedirectResponse + { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'location' => ['nullable', 'string', 'max:255'], + 'is_active' => ['boolean'], + ]); + + Warehouse::create([...$validated, 'tenant_id' => auth()->user()->tenant_id]); + + return back()->with('success', 'Warehouse created.'); + } + + public function update(Request $request, Warehouse $warehouse): RedirectResponse + { + $validated = $request->validate([ + 'name' => ['required', 'string', 'max:255'], + 'location' => ['nullable', 'string', 'max:255'], + 'is_active' => ['boolean'], + ]); + + $warehouse->update($validated); + + return back()->with('success', 'Warehouse updated.'); + } + + public function destroy(Warehouse $warehouse): RedirectResponse + { + $warehouse->delete(); + + return back()->with('success', 'Warehouse deleted.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/WarehouseStockController.php b/erp/app/Modules/Inventory/Http/Controllers/WarehouseStockController.php new file mode 100644 index 00000000000..11600a5095c --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/WarehouseStockController.php @@ -0,0 +1,55 @@ +authorize('viewAny', WarehouseStock::class); + + $query = WarehouseStock::with(['product', 'warehouse']); + + if ($request->filled('warehouse_id')) { + $query->where('warehouse_id', $request->input('warehouse_id')); + } + + $stocks = $query->orderBy('warehouse_id')->orderBy('product_id')->paginate(20)->withQueryString(); + $warehouses = Warehouse::orderBy('name')->get(['id', 'name']); + + return Inertia::render('Inventory/WarehouseStock/Index', [ + 'stocks' => $stocks, + 'warehouses' => $warehouses, + 'warehouse_id' => $request->input('warehouse_id'), + ]); + } + + public function show(WarehouseStock $warehouseStock): Response + { + $this->authorize('view', $warehouseStock); + $warehouseStock->load(['product', 'warehouse']); + + return Inertia::render('Inventory/WarehouseStock/Show', compact('warehouseStock')); + } + + public function update(Request $request, WarehouseStock $warehouseStock): RedirectResponse + { + $this->authorize('update', $warehouseStock); + + $data = $request->validate([ + 'reorder_point' => ['nullable', 'numeric', 'min:0'], + ]); + + $warehouseStock->update(['reorder_point' => $data['reorder_point']]); + + return back()->with('success', 'Reorder point updated.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Controllers/WarehouseTransferController.php b/erp/app/Modules/Inventory/Http/Controllers/WarehouseTransferController.php new file mode 100644 index 00000000000..04e63216a8e --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Controllers/WarehouseTransferController.php @@ -0,0 +1,65 @@ +authorize('viewAny', WarehouseTransfer::class); + $tenantId = $request->user()->tenant_id; + $transfers = WarehouseTransfer::where('tenant_id', $tenantId) + ->with(['product', 'fromWarehouse', 'toWarehouse']) + ->latest() + ->paginate(50); + return Inertia::render('Inventory/WarehouseTransfers/Index', ['transfers' => $transfers]); + } + + public function create(Request $request) + { + $this->authorize('create', WarehouseTransfer::class); + $tenantId = $request->user()->tenant_id; + $products = Product::where('tenant_id', $tenantId)->where('is_active', true)->orderBy('name')->get(['id', 'name', 'sku']); + $warehouses = Warehouse::where('tenant_id', $tenantId)->orderBy('name')->get(['id', 'name']); + return Inertia::render('Inventory/WarehouseTransfers/Create', compact('products', 'warehouses')); + } + + public function store(Request $request) + { + $this->authorize('create', WarehouseTransfer::class); + + $data = $request->validate([ + 'product_id' => 'required|exists:products,id', + 'from_warehouse_id' => 'required|exists:warehouses,id', + 'to_warehouse_id' => 'required|exists:warehouses,id|different:from_warehouse_id', + 'quantity' => 'required|numeric|min:0.0001', + 'reference' => 'nullable|string|max:100', + 'notes' => 'nullable|string|max:500', + ]); + + $data['tenant_id'] = $request->user()->tenant_id; + + // Bind tenant so StockMovement::record() can resolve tenant_id for stock levels + if (!app()->has('tenant')) { + $tenant = \App\Modules\Core\Models\Tenant::find($data['tenant_id']); + if ($tenant) { + app()->instance('tenant', $tenant); + } + } + + try { + WarehouseTransfer::execute($data); + } catch (\DomainException $e) { + return back()->withErrors(['quantity' => $e->getMessage()]); + } + + return redirect('/inventory/warehouse-transfers')->with('success', 'Transfer completed.'); + } +} diff --git a/erp/app/Modules/Inventory/Http/Requests/ReceivePurchaseOrderRequest.php b/erp/app/Modules/Inventory/Http/Requests/ReceivePurchaseOrderRequest.php new file mode 100644 index 00000000000..9fd96d33c43 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Requests/ReceivePurchaseOrderRequest.php @@ -0,0 +1,19 @@ + ['required', 'array', 'min:1'], + 'lines.*.id' => ['required', 'integer'], + 'lines.*.received_quantity' => ['required', 'numeric', 'min:0'], + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Requests/StoreProductRequest.php b/erp/app/Modules/Inventory/Http/Requests/StoreProductRequest.php new file mode 100644 index 00000000000..f89abc3b04e --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Requests/StoreProductRequest.php @@ -0,0 +1,32 @@ +user()?->tenant_id; + + return [ + 'sku' => ['required', 'string', 'max:100', + Rule::unique('products')->where('tenant_id', $tenantId), + ], + 'name' => ['required', 'string', 'max:255'], + 'description' => ['nullable', 'string'], + 'category_id' => ['nullable', 'integer', 'exists:product_categories,id'], + 'uom_id' => ['nullable', 'integer', 'exists:units_of_measure,id'], + 'cost_price' => ['required', 'numeric', 'min:0'], + 'sale_price' => ['required', 'numeric', 'min:0'], + 'reorder_point' => ['nullable', 'numeric', 'min:0'], + 'reorder_quantity' => ['nullable', 'numeric', 'min:0'], + 'preferred_supplier_id' => ['nullable', 'integer', 'exists:suppliers,id'], + 'is_active' => ['boolean'], + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Requests/StorePurchaseOrderRequest.php b/erp/app/Modules/Inventory/Http/Requests/StorePurchaseOrderRequest.php new file mode 100644 index 00000000000..a8e19e9f68c --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Requests/StorePurchaseOrderRequest.php @@ -0,0 +1,24 @@ + ['required', 'integer', 'exists:suppliers,id'], + 'warehouse_id' => ['required', 'integer', 'exists:warehouses,id'], + 'expected_date' => ['nullable', 'date', 'after_or_equal:today'], + 'notes' => ['nullable', 'string'], + 'items' => ['required', 'array', 'min:1'], + 'items.*.product_id' => ['required', 'integer', 'exists:products,id'], + 'items.*.quantity' => ['required', 'numeric', 'min:0.01'], + 'items.*.unit_cost' => ['required', 'numeric', 'min:0'], + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Requests/StoreSupplierRequest.php b/erp/app/Modules/Inventory/Http/Requests/StoreSupplierRequest.php new file mode 100644 index 00000000000..441f1bb3954 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Requests/StoreSupplierRequest.php @@ -0,0 +1,22 @@ + ['required', 'string', 'max:255'], + 'contact_person' => ['nullable', 'string', 'max:255'], + 'email' => ['nullable', 'email', 'max:255'], + 'phone' => ['nullable', 'string', 'max:50'], + 'address' => ['nullable', 'string'], + 'is_active' => ['boolean'], + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Requests/UpdateProductRequest.php b/erp/app/Modules/Inventory/Http/Requests/UpdateProductRequest.php new file mode 100644 index 00000000000..edd7475bbd9 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Requests/UpdateProductRequest.php @@ -0,0 +1,33 @@ +user()?->tenant_id; + $productId = $this->route('product'); + + return [ + 'sku' => ['required', 'string', 'max:100', + Rule::unique('products')->where('tenant_id', $tenantId)->ignore($productId), + ], + 'name' => ['required', 'string', 'max:255'], + 'description' => ['nullable', 'string'], + 'category_id' => ['nullable', 'integer', 'exists:product_categories,id'], + 'uom_id' => ['nullable', 'integer', 'exists:units_of_measure,id'], + 'cost_price' => ['required', 'numeric', 'min:0'], + 'sale_price' => ['required', 'numeric', 'min:0'], + 'reorder_point' => ['nullable', 'numeric', 'min:0'], + 'reorder_quantity' => ['nullable', 'numeric', 'min:0'], + 'preferred_supplier_id' => ['nullable', 'integer', 'exists:suppliers,id'], + 'is_active' => ['boolean'], + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Resources/ProductResource.php b/erp/app/Modules/Inventory/Http/Resources/ProductResource.php new file mode 100644 index 00000000000..c02bdda9183 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Resources/ProductResource.php @@ -0,0 +1,62 @@ + $this->id, + 'sku' => $this->sku, + 'name' => $this->name, + 'description' => $this->description, + 'category_id' => $this->category_id, + 'category' => $this->whenLoaded('category', fn () => [ + 'id' => $this->category->id, + 'name' => $this->category->name, + ]), + 'uom_id' => $this->uom_id, + 'uom' => $this->whenLoaded('uom', fn () => [ + 'id' => $this->uom->id, + 'name' => $this->uom->name, + 'abbreviation' => $this->uom->abbreviation, + ]), + 'cost_price' => $this->cost_price, + 'sale_price' => $this->sale_price, + 'reorder_point' => $this->reorder_point, + 'reorder_quantity' => $this->reorder_quantity, + 'preferred_supplier_id' => $this->preferred_supplier_id, + 'preferred_supplier' => $this->whenLoaded('preferredSupplier', fn () => $this->preferredSupplier ? [ + 'id' => $this->preferredSupplier->id, + 'name' => $this->preferredSupplier->name, + ] : null), + 'is_active' => $this->is_active, + 'stock_levels' => $this->whenLoaded('stockLevels', fn () => + $this->stockLevels->map(fn ($sl) => [ + 'warehouse_id' => $sl->warehouse_id, + 'warehouse_name' => $sl->warehouse?->name, + 'quantity' => $sl->quantity, + 'reserved_quantity' => $sl->reserved_quantity, + 'available' => $sl->available, + ]) + ), + 'total_quantity' => $this->when( + $this->relationLoaded('stockLevels'), + fn () => $this->total_quantity + ), + 'total_stock' => $this->when( + $this->relationLoaded('stockLevels'), + fn () => round($this->total_stock, 4) + ), + 'needs_reorder' => $this->when( + $this->relationLoaded('stockLevels'), + fn () => $this->needsReorder() + ), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Resources/PurchaseOrderResource.php b/erp/app/Modules/Inventory/Http/Resources/PurchaseOrderResource.php new file mode 100644 index 00000000000..570f146dd3f --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Resources/PurchaseOrderResource.php @@ -0,0 +1,42 @@ + $this->id, + 'status' => $this->status, + 'expected_date' => $this->expected_date?->toDateString(), + 'notes' => $this->notes, + 'total' => $this->total, + 'supplier' => $this->whenLoaded('supplier', fn () => [ + 'id' => $this->supplier->id, + 'name' => $this->supplier->name, + ]), + 'warehouse' => $this->whenLoaded('warehouse', fn () => [ + 'id' => $this->warehouse->id, + 'name' => $this->warehouse->name, + ]), + 'items' => $this->whenLoaded('items', fn () => + $this->items->map(fn ($item) => [ + 'id' => $item->id, + 'product_id' => $item->product_id, + 'product_name' => $item->product?->name, + 'product_sku' => $item->product?->sku, + 'quantity' => $item->quantity, + 'unit_cost' => $item->unit_cost, + 'received_quantity' => $item->received_quantity, + 'line_total' => $item->line_total, + ]) + ), + 'created_by' => $this->whenLoaded('creator', fn () => $this->creator?->name), + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Inventory/Http/Resources/SupplierResource.php b/erp/app/Modules/Inventory/Http/Resources/SupplierResource.php new file mode 100644 index 00000000000..cc8b3649ed7 --- /dev/null +++ b/erp/app/Modules/Inventory/Http/Resources/SupplierResource.php @@ -0,0 +1,23 @@ + $this->id, + 'name' => $this->name, + 'contact_person' => $this->contact_person, + 'email' => $this->email, + 'phone' => $this->phone, + 'address' => $this->address, + 'is_active' => $this->is_active, + 'created_at' => $this->created_at, + ]; + } +} diff --git a/erp/app/Modules/Inventory/Models/Asset.php b/erp/app/Modules/Inventory/Models/Asset.php new file mode 100644 index 00000000000..03eb55e0bec --- /dev/null +++ b/erp/app/Modules/Inventory/Models/Asset.php @@ -0,0 +1,62 @@ + 'date', + 'disposed_at' => 'datetime', + 'purchase_cost' => 'decimal:2', + 'current_value' => 'decimal:2', + ]; + + public function assignedEmployee(): BelongsTo + { + return $this->belongsTo(Employee::class, 'assigned_to_employee_id'); + } + + public function maintenances(): HasMany + { + return $this->hasMany(AssetMaintenance::class); + } + + public function getDepreciationAttribute(): ?float + { + if ($this->purchase_cost !== null && $this->current_value !== null) { + return round((float) $this->purchase_cost - (float) $this->current_value, 2); + } + + return null; + } + + public function dispose(): void + { + $this->status = 'disposed'; + $this->disposed_at = now(); + $this->save(); + } + + public function assignTo(int $employeeId): void + { + $this->assigned_to_employee_id = $employeeId; + $this->status = 'active'; + $this->save(); + } +} diff --git a/erp/app/Modules/Inventory/Models/AssetMaintenance.php b/erp/app/Modules/Inventory/Models/AssetMaintenance.php new file mode 100644 index 00000000000..5eabf70d3e2 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/AssetMaintenance.php @@ -0,0 +1,40 @@ + 'date', + 'completed_date' => 'date', + 'cost' => 'decimal:2', + ]; + + public function asset(): BelongsTo + { + return $this->belongsTo(Asset::class); + } + + public function complete(string $completedDate, ?float $cost = null): void + { + $this->status = 'completed'; + $this->completed_date = $completedDate; + if ($cost !== null) { + $this->cost = $cost; + } + $this->save(); + } +} diff --git a/erp/app/Modules/Inventory/Models/Category.php b/erp/app/Modules/Inventory/Models/Category.php new file mode 100644 index 00000000000..312b09d4d27 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/Category.php @@ -0,0 +1,44 @@ +slug)) { + $model->slug = Str::slug($model->name); + } + }); + } + + public function parent(): BelongsTo + { + return $this->belongsTo(self::class, 'parent_id'); + } + + public function children(): HasMany + { + return $this->hasMany(self::class, 'parent_id'); + } + + public function products(): HasMany + { + return $this->hasMany(Product::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/Product.php b/erp/app/Modules/Inventory/Models/Product.php new file mode 100644 index 00000000000..e7e5a65d432 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/Product.php @@ -0,0 +1,123 @@ + 'decimal:2', + 'sale_price' => 'decimal:2', + 'reorder_point' => 'float', + 'reorder_quantity' => 'float', + 'is_active' => 'boolean', + 'is_bundle' => 'boolean', + 'stock_quantity' => 'decimal:4', + ]; + + public function category(): BelongsTo + { + return $this->belongsTo(ProductCategory::class, 'category_id'); + } + + public function uom(): BelongsTo + { + return $this->belongsTo(UnitOfMeasure::class, 'uom_id'); + } + + public function stockLevels(): HasMany + { + return $this->hasMany(StockLevel::class); + } + + public function stockMovements(): HasMany + { + return $this->hasMany(StockMovement::class); + } + + public function preferredSupplier(): BelongsTo + { + return $this->belongsTo(Supplier::class, 'preferred_supplier_id'); + } + + public function bundleItems(): HasMany + { + return $this->hasMany(ProductBundleItem::class, 'bundle_product_id'); + } + + public function componentInBundles(): HasMany + { + return $this->hasMany(ProductBundleItem::class, 'component_product_id'); + } + + public function getStockSufficientForBundleAttribute(): bool + { + if (! $this->is_bundle) { + return true; + } + + foreach ($this->bundleItems as $item) { + $component = $item->componentProduct; + if ($component === null) { + return false; + } + if ((float) $component->stock_quantity < (float) $item->quantity) { + return false; + } + } + + return true; + } + + public function getTotalQuantityAttribute(): float + { + return (float) $this->stockLevels()->sum('quantity'); + } + + public function getTotalAvailableAttribute(): float + { + return (float) $this->stockLevels() + ->selectRaw('SUM(quantity - reserved_quantity) as available') + ->value('available') ?? 0.0; + } + + public function getTotalStockAttribute(): float + { + return (float) $this->stockLevels->sum('quantity'); + } + + public function needsReorder(): bool + { + return $this->reorder_point > 0 && $this->total_stock <= $this->reorder_point; + } + + public function scopeSearch($query, string $term) + { + return $query->where(function ($q) use ($term) { + $q->where('name', 'like', "%{$term}%") + ->orWhere('sku', 'like', "%{$term}%"); + }); + } + + public function scopeActive($query) + { + return $query->where('is_active', true); + } +} diff --git a/erp/app/Modules/Inventory/Models/ProductBundleItem.php b/erp/app/Modules/Inventory/Models/ProductBundleItem.php new file mode 100644 index 00000000000..fd01db275ff --- /dev/null +++ b/erp/app/Modules/Inventory/Models/ProductBundleItem.php @@ -0,0 +1,33 @@ + 'decimal:4', + ]; + + public function bundleProduct(): BelongsTo + { + return $this->belongsTo(Product::class, 'bundle_product_id'); + } + + public function componentProduct(): BelongsTo + { + return $this->belongsTo(Product::class, 'component_product_id'); + } +} diff --git a/erp/app/Modules/Inventory/Models/ProductCategory.php b/erp/app/Modules/Inventory/Models/ProductCategory.php new file mode 100644 index 00000000000..3ce9431f370 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/ProductCategory.php @@ -0,0 +1,36 @@ +id) + ->update(['category_id' => null]); + }); + } + + public function products(): HasMany + { + return $this->hasMany(Product::class, 'category_id'); + } +} diff --git a/erp/app/Modules/Inventory/Models/PurchaseOrder.php b/erp/app/Modules/Inventory/Models/PurchaseOrder.php new file mode 100644 index 00000000000..3f528f82b75 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/PurchaseOrder.php @@ -0,0 +1,121 @@ + 'draft']; + + protected $casts = ['expected_date' => 'date']; + + /** Allowed status transitions */ + private const TRANSITIONS = [ + 'draft' => ['submitted', 'cancelled'], + 'submitted' => ['approved', 'cancelled'], + 'approved' => ['received', 'cancelled'], + 'received' => [], + 'cancelled' => [], + ]; + + public function supplier(): BelongsTo + { + return $this->belongsTo(Supplier::class); + } + + public function warehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public function items(): HasMany + { + return $this->hasMany(PurchaseOrderItem::class); + } + + public function getTotalAttribute(): float + { + return $this->items->sum(fn ($item) => (float) $item->quantity * (float) $item->unit_cost); + } + + public function canTransitionTo(string $status): bool + { + return in_array($status, self::TRANSITIONS[$this->status] ?? [], true); + } + + /** @return string[] */ + public function availableTransitions(): array + { + return self::TRANSITIONS[$this->status] ?? []; + } + + public function transitionTo(string $status): void + { + if (! $this->canTransitionTo($status)) { + throw new \DomainException( + "Cannot transition PO from '{$this->status}' to '{$status}'." + ); + } + + $this->update(['status' => $status]); + } + + /** + * Receive items: create StockMovements and mark PO as received. + * + * @param array $lines + */ + public function receive(array $lines): void + { + if (! $this->canTransitionTo('received')) { + throw new \DomainException("PO cannot be received in status '{$this->status}'."); + } + + DB::transaction(function () use ($lines) { + foreach ($lines as $line) { + /** @var PurchaseOrderItem $item */ + $item = $this->items()->findOrFail($line['id']); + $qty = (float) $line['received_quantity']; + + if ($qty <= 0) { + continue; + } + + $item->update(['received_quantity' => $item->received_quantity + $qty]); + + StockMovement::record([ + 'product_id' => $item->product_id, + 'warehouse_id' => $this->warehouse_id, + 'type' => 'in', + 'quantity' => $qty, + 'reference' => "PO-{$this->id}", + 'notes' => "Received from PO #{$this->id}", + ]); + } + + $this->update(['status' => 'received']); + }); + } +} diff --git a/erp/app/Modules/Inventory/Models/PurchaseOrderItem.php b/erp/app/Modules/Inventory/Models/PurchaseOrderItem.php new file mode 100644 index 00000000000..7a3e471f2b6 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/PurchaseOrderItem.php @@ -0,0 +1,35 @@ + 'decimal:2', + 'unit_cost' => 'decimal:2', + 'received_quantity' => 'decimal:2', + ]; + + public function purchaseOrder(): BelongsTo + { + return $this->belongsTo(PurchaseOrder::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } + + public function getLineTotalAttribute(): float + { + return (float) $this->quantity * (float) $this->unit_cost; + } +} diff --git a/erp/app/Modules/Inventory/Models/PurchaseRequisition.php b/erp/app/Modules/Inventory/Models/PurchaseRequisition.php new file mode 100644 index 00000000000..53fb368cd3b --- /dev/null +++ b/erp/app/Modules/Inventory/Models/PurchaseRequisition.php @@ -0,0 +1,42 @@ + 'date', 'approved_at' => 'datetime']; + + public function requester(): BelongsTo + { + return $this->belongsTo(User::class, 'requested_by'); + } + + public function approver(): BelongsTo + { + return $this->belongsTo(User::class, 'approved_by'); + } + + public function items(): HasMany + { + return $this->hasMany(PurchaseRequisitionItem::class); + } + + public function getTotalEstimatedCostAttribute(): float + { + return round($this->items->sum(fn ($i) => $i->quantity * $i->estimated_unit_cost), 2); + } +} diff --git a/erp/app/Modules/Inventory/Models/PurchaseRequisitionItem.php b/erp/app/Modules/Inventory/Models/PurchaseRequisitionItem.php new file mode 100644 index 00000000000..deaa93ac20f --- /dev/null +++ b/erp/app/Modules/Inventory/Models/PurchaseRequisitionItem.php @@ -0,0 +1,23 @@ +belongsTo(PurchaseRequisition::class, 'purchase_requisition_id'); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/StockAdjustment.php b/erp/app/Modules/Inventory/Models/StockAdjustment.php new file mode 100644 index 00000000000..c7eb607b25b --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockAdjustment.php @@ -0,0 +1,68 @@ + 'datetime']; + + public function warehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class); + } + + public function adjuster(): BelongsTo + { + return $this->belongsTo(User::class, 'adjusted_by'); + } + + public function items(): HasMany + { + return $this->hasMany(StockAdjustmentItem::class); + } + + /** + * Confirm the adjustment: create stock movements for each item with a difference. + */ + public function confirm(User $user): void + { + abort_unless($this->status === 'draft', 422, 'Only draft adjustments can be confirmed.'); + $this->load('items.product', 'warehouse'); + + foreach ($this->items as $item) { + if ($item->difference == 0) { + continue; + } + + $type = $item->difference > 0 ? 'in' : 'out'; + + StockMovement::record([ + 'product_id' => $item->product_id, + 'warehouse_id' => $this->warehouse_id, + 'type' => $type, + 'quantity' => abs((float) $item->difference), + 'reference' => $this->reference, + ]); + } + + $this->update([ + 'status' => 'confirmed', + 'adjusted_by' => $user->id, + 'confirmed_at' => now(), + ]); + } +} diff --git a/erp/app/Modules/Inventory/Models/StockAdjustmentItem.php b/erp/app/Modules/Inventory/Models/StockAdjustmentItem.php new file mode 100644 index 00000000000..0a97fc3db9e --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockAdjustmentItem.php @@ -0,0 +1,29 @@ + 'decimal:2', + 'actual_quantity' => 'decimal:2', + 'difference' => 'decimal:2', + ]; + + public function stockAdjustment(): BelongsTo + { + return $this->belongsTo(StockAdjustment::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/StockLevel.php b/erp/app/Modules/Inventory/Models/StockLevel.php new file mode 100644 index 00000000000..d95c98b3be9 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockLevel.php @@ -0,0 +1,37 @@ + 'decimal:2', + 'reserved_quantity' => 'decimal:2', + ]; + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } + + public function warehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class); + } + + public function getAvailableAttribute(): float + { + return (float) $this->quantity - (float) $this->reserved_quantity; + } +} diff --git a/erp/app/Modules/Inventory/Models/StockMovement.php b/erp/app/Modules/Inventory/Models/StockMovement.php new file mode 100644 index 00000000000..746519bd06f --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockMovement.php @@ -0,0 +1,90 @@ + 'decimal:2']; + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } + + public function warehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + /** + * Record a stock movement and update StockLevel atomically. + * + * @param array{product_id:int, warehouse_id:int, type:string, quantity:float, reference?:string, notes?:string} $data + */ + public static function record(array $data): self + { + return DB::transaction(function () use ($data) { + $tenantId = app()->has('tenant') ? app('tenant')->id : null; + + $level = StockLevel::firstOrCreate( + ['product_id' => $data['product_id'], 'warehouse_id' => $data['warehouse_id']], + ['tenant_id' => $tenantId, 'quantity' => 0, 'reserved_quantity' => 0], + ); + + $qty = (float) $data['quantity']; + + match ($data['type']) { + 'in' => $level->increment('quantity', $qty), + 'out' => self::deductStock($level, $qty), + 'adjustment' => self::adjustStock($level, $qty), + default => null, + }; + + return self::create([ + ...$data, + 'tenant_id' => $tenantId, + 'created_by' => Auth::id(), + 'quantity' => $qty, + ]); + }); + } + + private static function deductStock(StockLevel $level, float $qty): void + { + $available = (float) $level->quantity - (float) $level->reserved_quantity; + + if ($qty > $available) { + throw new \DomainException( + "Insufficient stock. Available: {$available}, requested: {$qty}." + ); + } + + $level->decrement('quantity', $qty); + } + + private static function adjustStock(StockLevel $level, float $newQty): void + { + $level->update(['quantity' => max(0, $newQty)]); + } +} diff --git a/erp/app/Modules/Inventory/Models/StockTransfer.php b/erp/app/Modules/Inventory/Models/StockTransfer.php new file mode 100644 index 00000000000..80d277fb55f --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockTransfer.php @@ -0,0 +1,84 @@ + 'datetime', + ]; + + public function fromWarehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class, 'from_warehouse_id'); + } + + public function toWarehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class, 'to_warehouse_id'); + } + + public function items(): HasMany + { + return $this->hasMany(StockTransferItem::class); + } + + public function complete(): void + { + $this->loadMissing('items'); + + foreach ($this->items as $item) { + // Decrement from source + $fromStock = WarehouseStock::firstOrCreate( + [ + 'tenant_id' => $this->tenant_id, + 'warehouse_id' => $this->from_warehouse_id, + 'product_id' => $item->product_id, + ], + ['quantity' => 0] + ); + $fromStock->decrement('quantity', $item->quantity); + + // Increment at destination + $toStock = WarehouseStock::firstOrCreate( + [ + 'tenant_id' => $this->tenant_id, + 'warehouse_id' => $this->to_warehouse_id, + 'product_id' => $item->product_id, + ], + ['quantity' => 0] + ); + $toStock->increment('quantity', $item->quantity); + } + + $this->status = 'completed'; + $this->transferred_at = Carbon::now(); + $this->save(); + } + + public function cancel(): void + { + $this->status = 'cancelled'; + $this->save(); + } +} diff --git a/erp/app/Modules/Inventory/Models/StockTransferItem.php b/erp/app/Modules/Inventory/Models/StockTransferItem.php new file mode 100644 index 00000000000..15f9d9eab0c --- /dev/null +++ b/erp/app/Modules/Inventory/Models/StockTransferItem.php @@ -0,0 +1,33 @@ + 'decimal:4', + ]; + + public function stockTransfer(): BelongsTo + { + return $this->belongsTo(StockTransfer::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/Supplier.php b/erp/app/Modules/Inventory/Models/Supplier.php new file mode 100644 index 00000000000..fd0b87d5817 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/Supplier.php @@ -0,0 +1,28 @@ + 'boolean']; + + public function purchaseOrders(): HasMany + { + return $this->hasMany(PurchaseOrder::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/UnitOfMeasure.php b/erp/app/Modules/Inventory/Models/UnitOfMeasure.php new file mode 100644 index 00000000000..0739a8732a2 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/UnitOfMeasure.php @@ -0,0 +1,23 @@ +hasMany(Product::class, 'uom_id'); + } +} diff --git a/erp/app/Modules/Inventory/Models/Warehouse.php b/erp/app/Modules/Inventory/Models/Warehouse.php new file mode 100644 index 00000000000..f80494eebed --- /dev/null +++ b/erp/app/Modules/Inventory/Models/Warehouse.php @@ -0,0 +1,35 @@ + 'boolean']; + + public function stockLevels(): HasMany + { + return $this->hasMany(StockLevel::class); + } + + public function stockMovements(): HasMany + { + return $this->hasMany(StockMovement::class); + } + + public function purchaseOrders(): HasMany + { + return $this->hasMany(PurchaseOrder::class); + } +} diff --git a/erp/app/Modules/Inventory/Models/WarehouseStock.php b/erp/app/Modules/Inventory/Models/WarehouseStock.php new file mode 100644 index 00000000000..b9dd5f0067d --- /dev/null +++ b/erp/app/Modules/Inventory/Models/WarehouseStock.php @@ -0,0 +1,46 @@ + 'decimal:4', + 'reorder_point' => 'decimal:4', + ]; + + public function warehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class); + } + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } + + public function getIsBelowReorderPointAttribute(): bool + { + if ($this->reorder_point === null) { + return false; + } + + return (float) $this->quantity < (float) $this->reorder_point; + } +} diff --git a/erp/app/Modules/Inventory/Models/WarehouseTransfer.php b/erp/app/Modules/Inventory/Models/WarehouseTransfer.php new file mode 100644 index 00000000000..8f00564a6b8 --- /dev/null +++ b/erp/app/Modules/Inventory/Models/WarehouseTransfer.php @@ -0,0 +1,82 @@ + 'float', + ]; + + public function product(): BelongsTo + { + return $this->belongsTo(Product::class); + } + + public function fromWarehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class, 'from_warehouse_id'); + } + + public function toWarehouse(): BelongsTo + { + return $this->belongsTo(Warehouse::class, 'to_warehouse_id'); + } + + public function creator(): BelongsTo + { + return $this->belongsTo(User::class, 'created_by'); + } + + public static function execute(array $data): static + { + return DB::transaction(function () use ($data) { + // Record OUT from source warehouse + StockMovement::record([ + 'product_id' => $data['product_id'], + 'warehouse_id' => $data['from_warehouse_id'], + 'type' => 'out', + 'quantity' => $data['quantity'], + 'reference' => $data['reference'] ?? null, + 'notes' => $data['notes'] ?? null, + ]); + + // Record IN to destination warehouse + StockMovement::record([ + 'product_id' => $data['product_id'], + 'warehouse_id' => $data['to_warehouse_id'], + 'type' => 'in', + 'quantity' => $data['quantity'], + 'reference' => $data['reference'] ?? null, + 'notes' => $data['notes'] ?? null, + ]); + + // Create the transfer record + return static::create([ + 'tenant_id' => $data['tenant_id'], + 'product_id' => $data['product_id'], + 'from_warehouse_id' => $data['from_warehouse_id'], + 'to_warehouse_id' => $data['to_warehouse_id'], + 'quantity' => $data['quantity'], + 'reference' => $data['reference'] ?? null, + 'notes' => $data['notes'] ?? null, + 'status' => 'completed', + 'created_by' => Auth::id(), + ]); + }); + } +} diff --git a/erp/app/Modules/Inventory/Policies/AssetPolicy.php b/erp/app/Modules/Inventory/Policies/AssetPolicy.php new file mode 100644 index 00000000000..a9f74a90c4b --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/AssetPolicy.php @@ -0,0 +1,33 @@ +can('inventory.view'); + } + + public function view(User $user): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user): bool + { + return $user->can('inventory.create'); + } + + public function delete(User $user): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/ProductCategoryPolicy.php b/erp/app/Modules/Inventory/Policies/ProductCategoryPolicy.php new file mode 100644 index 00000000000..c53325c8063 --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/ProductCategoryPolicy.php @@ -0,0 +1,34 @@ +can('inventory.view'); + } + + public function view(User $user, ProductCategory $productCategory): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user, ProductCategory $productCategory): bool + { + return $user->can('inventory.create'); + } + + public function delete(User $user, ProductCategory $productCategory): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/ProductPolicy.php b/erp/app/Modules/Inventory/Policies/ProductPolicy.php new file mode 100644 index 00000000000..ba88631448d --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/ProductPolicy.php @@ -0,0 +1,34 @@ +can('inventory.view'); + } + + public function view(User $user, Product $product): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user, Product $product): bool + { + return $user->can('inventory.update'); + } + + public function delete(User $user, Product $product): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/PurchaseRequisitionPolicy.php b/erp/app/Modules/Inventory/Policies/PurchaseRequisitionPolicy.php new file mode 100644 index 00000000000..70dbafd8c73 --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/PurchaseRequisitionPolicy.php @@ -0,0 +1,39 @@ +can('inventory.view'); + } + + public function view(User $user, PurchaseRequisition $pr): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user, PurchaseRequisition $pr): bool + { + return $user->can('inventory.create'); + } + + public function approve(User $user, PurchaseRequisition $pr): bool + { + return $user->hasRole(['super-admin', 'admin', 'manager']); + } + + public function delete(User $user, PurchaseRequisition $pr): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/StockAdjustmentPolicy.php b/erp/app/Modules/Inventory/Policies/StockAdjustmentPolicy.php new file mode 100644 index 00000000000..f206c922163 --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/StockAdjustmentPolicy.php @@ -0,0 +1,34 @@ +can('inventory.view'); + } + + public function view(User $user, StockAdjustment $adj): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user, StockAdjustment $adj): bool + { + return $user->can('inventory.create'); + } + + public function delete(User $user, StockAdjustment $adj): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/StockTransferPolicy.php b/erp/app/Modules/Inventory/Policies/StockTransferPolicy.php new file mode 100644 index 00000000000..dccd4b4401b --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/StockTransferPolicy.php @@ -0,0 +1,33 @@ +can('inventory.view'); + } + + public function view(User $user): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function update(User $user): bool + { + return $user->can('inventory.create'); + } + + public function delete(User $user): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Policies/WarehouseTransferPolicy.php b/erp/app/Modules/Inventory/Policies/WarehouseTransferPolicy.php new file mode 100644 index 00000000000..a14fb38bc19 --- /dev/null +++ b/erp/app/Modules/Inventory/Policies/WarehouseTransferPolicy.php @@ -0,0 +1,29 @@ +can('inventory.view'); + } + + public function view(User $user, WarehouseTransfer $transfer): bool + { + return $user->can('inventory.view'); + } + + public function create(User $user): bool + { + return $user->can('inventory.create'); + } + + public function delete(User $user, WarehouseTransfer $transfer): bool + { + return $user->can('inventory.delete'); + } +} diff --git a/erp/app/Modules/Inventory/Providers/InventoryServiceProvider.php b/erp/app/Modules/Inventory/Providers/InventoryServiceProvider.php new file mode 100644 index 00000000000..7ea109dc177 --- /dev/null +++ b/erp/app/Modules/Inventory/Providers/InventoryServiceProvider.php @@ -0,0 +1,46 @@ +loadRoutesFrom(__DIR__ . '/../routes/inventory.php'); + + Gate::policy(Product::class, ProductPolicy::class); + Gate::policy(ProductCategory::class, ProductCategoryPolicy::class); + Gate::policy(WarehouseTransfer::class, WarehouseTransferPolicy::class); + Gate::policy(StockAdjustment::class, StockAdjustmentPolicy::class); + Gate::policy(PurchaseRequisition::class, PurchaseRequisitionPolicy::class); + Gate::policy(Asset::class, AssetPolicy::class); + Gate::policy(AssetMaintenance::class, AssetPolicy::class); + Gate::policy(ProductBundleItem::class, ProductPolicy::class); + Gate::policy(WarehouseStock::class, StockTransferPolicy::class); + Gate::policy(StockTransfer::class, StockTransferPolicy::class); + Gate::policy(StockTransferItem::class, StockTransferPolicy::class); + } +} diff --git a/erp/app/Modules/Inventory/routes/inventory.php b/erp/app/Modules/Inventory/routes/inventory.php new file mode 100644 index 00000000000..b492b5c7e25 --- /dev/null +++ b/erp/app/Modules/Inventory/routes/inventory.php @@ -0,0 +1,106 @@ +prefix('inventory')->name('inventory.')->group(function () { + + // Products + Route::resource('products', ProductController::class) + ->names('products'); + + // Product Categories (flat, colour-coded) + Route::resource('product-categories', ProductCategoryController::class) + ->except(['create', 'edit', 'show']) + ->names('product-categories'); + + // Legacy Categories (hierarchical - index + inline CRUD via back()) + Route::get('categories', [CategoryController::class, 'index'])->name('categories.index'); + Route::post('categories', [CategoryController::class, 'store'])->name('categories.store'); + Route::put('categories/{category}', [CategoryController::class, 'update'])->name('categories.update'); + Route::delete('categories/{category}', [CategoryController::class, 'destroy'])->name('categories.destroy'); + + // Warehouses (index + inline CRUD) + Route::get('warehouses', [WarehouseController::class, 'index'])->name('warehouses.index'); + Route::post('warehouses', [WarehouseController::class, 'store'])->name('warehouses.store'); + Route::put('warehouses/{warehouse}', [WarehouseController::class, 'update'])->name('warehouses.update'); + Route::delete('warehouses/{warehouse}', [WarehouseController::class, 'destroy'])->name('warehouses.destroy'); + + // Suppliers + Route::resource('suppliers', SupplierController::class) + ->except(['show']) + ->names('suppliers'); + + // Stock Movements + Route::get('stock-movements', [StockMovementController::class, 'index'])->name('stock-movements.index'); + Route::post('stock-movements', [StockMovementController::class, 'store'])->name('stock-movements.store'); + + // Purchase Orders + Route::get('purchase-orders', [PurchaseOrderController::class, 'index'])->name('purchase-orders.index'); + Route::get('purchase-orders/create', [PurchaseOrderController::class, 'create'])->name('purchase-orders.create'); + Route::post('purchase-orders', [PurchaseOrderController::class, 'store'])->name('purchase-orders.store'); + Route::get('purchase-orders/{purchaseOrder}', [PurchaseOrderController::class, 'show'])->name('purchase-orders.show'); + Route::get('purchase-orders/{purchaseOrder}/receive', [PurchaseOrderController::class, 'receiveForm'])->name('purchase-orders.receive-form'); + Route::patch('purchase-orders/{purchaseOrder}/transition', [PurchaseOrderController::class, 'transition'])->name('purchase-orders.transition'); + Route::post('purchase-orders/{purchaseOrder}/submit', [PurchaseOrderController::class, 'submit'])->name('purchase-orders.submit'); + Route::post('purchase-orders/{purchaseOrder}/approve', [PurchaseOrderController::class, 'approve'])->name('purchase-orders.approve'); + Route::post('purchase-orders/{purchaseOrder}/receive', [PurchaseOrderController::class, 'receive'])->name('purchase-orders.receive'); + Route::post('purchase-orders/{purchaseOrder}/cancel', [PurchaseOrderController::class, 'cancel'])->name('purchase-orders.cancel'); + + // Reorder Suggestions + Route::get('reorder', [ReorderController::class, 'index'])->name('reorder.index'); + Route::post('reorder/purchase-order', [ReorderController::class, 'createPurchaseOrder'])->name('reorder.create-po'); + + // Warehouse Transfers + Route::resource('warehouse-transfers', WarehouseTransferController::class)->only(['index', 'create', 'store']); + + // Stock Adjustments + Route::resource('stock-adjustments', StockAdjustmentController::class)->except(['edit', 'update']); + Route::post('stock-adjustments/{stockAdjustment}/confirm', [StockAdjustmentController::class, 'confirm'])->name('stock-adjustments.confirm'); + Route::post('stock-adjustments/{stockAdjustment}/cancel', [StockAdjustmentController::class, 'cancel'])->name('stock-adjustments.cancel'); + + // Purchase Requisitions + Route::resource('purchase-requisitions', PurchaseRequisitionController::class)->except(['edit', 'update']); + Route::post('purchase-requisitions/{purchaseRequisition}/submit', [PurchaseRequisitionController::class, 'submit'])->name('purchase-requisitions.submit'); + Route::post('purchase-requisitions/{purchaseRequisition}/approve', [PurchaseRequisitionController::class, 'approve'])->name('purchase-requisitions.approve'); + Route::post('purchase-requisitions/{purchaseRequisition}/reject', [PurchaseRequisitionController::class, 'reject'])->name('purchase-requisitions.reject'); + + // Assets + Route::post('assets/{asset}/dispose', [AssetController::class, 'dispose'])->name('assets.dispose'); + Route::patch('assets/{asset}/assign', [AssetController::class, 'assign'])->name('assets.assign'); + Route::resource('assets', AssetController::class)->except(['edit', 'update']); + + // Asset Maintenances + Route::patch('asset-maintenances/{assetMaintenance}/complete', [AssetMaintenanceController::class, 'complete'])->name('asset-maintenances.complete'); + Route::resource('asset-maintenances', AssetMaintenanceController::class)->except(['edit', 'update']); + + // Product Bundles + Route::post('product-bundles/{productBundle}/items', [ProductBundleController::class, 'addItem'])->name('product-bundles.items.add'); + Route::delete('product-bundles/{productBundle}/items/{item}', [ProductBundleController::class, 'removeItem'])->name('product-bundles.items.remove'); + Route::resource('product-bundles', ProductBundleController::class) + ->except(['edit', 'update']) + ->parameters(['product-bundles' => 'productBundle']); + + // Warehouse Stock + Route::resource('warehouse-stock', WarehouseStockController::class)->only(['index', 'show', 'update']); + + // Stock Transfers + Route::post('stock-transfers/{stockTransfer}/complete', [StockTransferController::class, 'complete'])->name('stock-transfers.complete'); + Route::post('stock-transfers/{stockTransfer}/cancel', [StockTransferController::class, 'cancel'])->name('stock-transfers.cancel'); + Route::resource('stock-transfers', StockTransferController::class)->except(['edit', 'update']); +}); diff --git a/erp/app/Notifications/LeaveRequestActioned.php b/erp/app/Notifications/LeaveRequestActioned.php new file mode 100644 index 00000000000..c72c0db9fc6 --- /dev/null +++ b/erp/app/Notifications/LeaveRequestActioned.php @@ -0,0 +1,32 @@ + "Leave request {$this->action}", + 'message' => "Your leave from {$this->request->start_date->toDateString()} to {$this->request->end_date->toDateString()} has been {$this->action}.", + 'link' => '/hr/leave', + 'type' => 'hr', + ]; + } +} diff --git a/erp/app/Providers/AppServiceProvider.php b/erp/app/Providers/AppServiceProvider.php new file mode 100644 index 00000000000..b748ab48896 --- /dev/null +++ b/erp/app/Providers/AppServiceProvider.php @@ -0,0 +1,21 @@ +tenant_id; + $cacheKey = "notifications.{$tenantId}.{$user->id}"; + + // Cache for 5 minutes to avoid N+1 on every page load + return Cache::remember($cacheKey, 300, function () use ($user, $tenantId) { + $items = []; + + // 1. Overdue invoices (finance.view permission required) + if ($user->hasAnyPermission(['finance.view', 'finance.create'])) { + $overdueCount = Invoice::where('tenant_id', $tenantId) + ->whereNotIn('status', ['paid', 'cancelled']) + ->whereNotNull('due_date') + ->where('due_date', '<', now()->startOfDay()) + ->count(); + + if ($overdueCount > 0) { + $items[] = [ + 'type' => 'overdue_invoices', + 'label' => "{$overdueCount} overdue invoice" . ($overdueCount > 1 ? 's' : ''), + 'href' => '/finance/invoices?status=overdue', + 'count' => $overdueCount, + 'severity' => 'warning', + ]; + } + } + + // 2. Low stock (inventory.view permission required) + if ($user->hasAnyPermission(['inventory.view', 'inventory.create'])) { + $lowStockCount = Product::where('tenant_id', $tenantId) + ->where('is_active', true) + ->with('stockLevels') + ->get() + ->filter(fn ($p) => $p->stockLevels->sum('quantity') < 10) + ->count(); + + if ($lowStockCount > 0) { + $items[] = [ + 'type' => 'low_stock', + 'label' => "{$lowStockCount} product" . ($lowStockCount > 1 ? 's' : '') . ' low on stock', + 'href' => '/inventory/products', + 'count' => $lowStockCount, + 'severity' => 'warning', + ]; + } + } + + // 3. Pending leave requests (hr.view + admin/manager role) + if ($user->hasAnyRole(['super-admin', 'admin', 'manager']) && $user->hasAnyPermission(['hr.view', 'hr.create'])) { + $pendingLeave = LeaveRequest::where('tenant_id', $tenantId) + ->where('status', 'pending') + ->count(); + + if ($pendingLeave > 0) { + $items[] = [ + 'type' => 'pending_leave', + 'label' => "{$pendingLeave} pending leave request" . ($pendingLeave > 1 ? 's' : ''), + 'href' => '/hr/leave-requests', + 'count' => $pendingLeave, + 'severity' => 'info', + ]; + } + } + + return $items; + }); + } + + public static function clearCache(int $tenantId): void + { + // Clear notification cache for all users in the tenant + foreach (\App\Models\User::where('tenant_id', $tenantId)->pluck('id') as $userId) { + Cache::forget("notifications.{$tenantId}.{$userId}"); + } + } +} diff --git a/erp/artisan b/erp/artisan new file mode 100755 index 00000000000..c35e31d6a29 --- /dev/null +++ b/erp/artisan @@ -0,0 +1,18 @@ +#!/usr/bin/env php +handleCommand(new ArgvInput); + +exit($status); diff --git a/erp/bootstrap/app.php b/erp/bootstrap/app.php new file mode 100644 index 00000000000..3af539452f3 --- /dev/null +++ b/erp/bootstrap/app.php @@ -0,0 +1,28 @@ +withRouting( + web: __DIR__ . '/../routes/web.php', + commands: __DIR__ . '/../routes/console.php', + health: '/up', + ) + ->withMiddleware(function (Middleware $middleware): void { + $middleware->web(append: [ + \App\Http\Middleware\HandleInertiaRequests::class, + \Illuminate\Http\Middleware\AddLinkHeadersForPreloadedAssets::class, + ]); + + $middleware->alias([ + 'tenant' => \App\Http\Middleware\TenantMiddleware::class, + 'role' => \Spatie\Permission\Middleware\RoleMiddleware::class, + 'permission' => \Spatie\Permission\Middleware\PermissionMiddleware::class, + 'role_or_permission' => \Spatie\Permission\Middleware\RoleOrPermissionMiddleware::class, + ]); + }) + ->withExceptions(function (Exceptions $exceptions): void { + // + })->create(); diff --git a/erp/bootstrap/cache/.gitignore b/erp/bootstrap/cache/.gitignore new file mode 100644 index 00000000000..d6b7ef32c84 --- /dev/null +++ b/erp/bootstrap/cache/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/erp/bootstrap/providers.php b/erp/bootstrap/providers.php new file mode 100644 index 00000000000..2ca47d9a457 --- /dev/null +++ b/erp/bootstrap/providers.php @@ -0,0 +1,9 @@ +=5.0.0" + }, + "require-dev": { + "doctrine/dbal": "^4.0.0", + "nesbot/carbon": "^2.71.0 || ^3.0.0", + "phpunit/phpunit": "^10.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Carbon\\Doctrine\\": "src/Carbon/Doctrine/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "KyleKatarn", + "email": "kylekatarnls@gmail.com" + } + ], + "description": "Types to use Carbon in Doctrine", + "keywords": [ + "carbon", + "date", + "datetime", + "doctrine", + "time" + ], + "support": { + "issues": "https://github.com/CarbonPHP/carbon-doctrine-types/issues", + "source": "https://github.com/CarbonPHP/carbon-doctrine-types/tree/3.2.0" + }, + "funding": [ + { + "url": "https://github.com/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/nesbot/carbon", + "type": "tidelift" + } + ], + "time": "2024-02-09T16:56:22+00:00" + }, + { + "name": "dflydev/dot-access-data", + "version": "v3.0.3", + "source": { + "type": "git", + "url": "https://github.com/dflydev/dflydev-dot-access-data.git", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dflydev/dflydev-dot-access-data/zipball/a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "reference": "a23a2bf4f31d3518f3ecb38660c95715dfead60f", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^0.12.42", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.3", + "scrutinizer/ocular": "1.6.0", + "squizlabs/php_codesniffer": "^3.5", + "vimeo/psalm": "^4.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Dflydev\\DotAccessData\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dragonfly Development Inc.", + "email": "info@dflydev.com", + "homepage": "http://dflydev.com" + }, + { + "name": "Beau Simensen", + "email": "beau@dflydev.com", + "homepage": "http://beausimensen.com" + }, + { + "name": "Carlos Frutos", + "email": "carlos@kiwing.it", + "homepage": "https://github.com/cfrutos" + }, + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com" + } + ], + "description": "Given a deep data structure, access data by dot notation.", + "homepage": "https://github.com/dflydev/dflydev-dot-access-data", + "keywords": [ + "access", + "data", + "dot", + "notation" + ], + "support": { + "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", + "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" + }, + "time": "2024-07-08T12:26:09+00:00" + }, + { + "name": "doctrine/inflector", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "6d6c96277ea252fc1304627204c3d5e6e15faa3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/6d6c96277ea252fc1304627204c3d5e6e15faa3b", + "reference": "6d6c96277ea252fc1304627204c3d5e6e15faa3b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^12.0 || ^13.0", + "phpstan/phpstan": "^1.12 || ^2.0", + "phpstan/phpstan-phpunit": "^1.4 || ^2.0", + "phpstan/phpstan-strict-rules": "^1.6 || ^2.0", + "phpunit/phpunit": "^8.5 || ^12.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Inflector\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.", + "homepage": "https://www.doctrine-project.org/projects/inflector.html", + "keywords": [ + "inflection", + "inflector", + "lowercase", + "manipulation", + "php", + "plural", + "singular", + "strings", + "uppercase", + "words" + ], + "support": { + "issues": "https://github.com/doctrine/inflector/issues", + "source": "https://github.com/doctrine/inflector/tree/2.1.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finflector", + "type": "tidelift" + } + ], + "time": "2025-08-10T19:31:58+00:00" + }, + { + "name": "doctrine/lexer", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "reference": "31ad66abc0fc9e1a1f2d9bc6a42668d2fbbcd6dd", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "doctrine/coding-standard": "^12", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5", + "psalm/plugin-phpunit": "^0.18.3", + "vimeo/psalm": "^5.21" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\Lexer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", + "keywords": [ + "annotations", + "docblock", + "lexer", + "parser", + "php" + ], + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/3.0.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2024-02-05T11:56:58+00:00" + }, + { + "name": "dompdf/dompdf", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496", + "reference": "f11ead23a8a76d0ff9bbc6c7c8fd7e05ca328496", + "shasum": "" + }, + "require": { + "dompdf/php-font-lib": "^1.0.0", + "dompdf/php-svg-lib": "^1.0.0", + "ext-dom": "*", + "ext-mbstring": "*", + "masterminds/html5": "^2.0", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "ext-gd": "*", + "ext-json": "*", + "ext-zip": "*", + "mockery/mockery": "^1.3", + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11", + "squizlabs/php_codesniffer": "^3.5", + "symfony/process": "^4.4 || ^5.4 || ^6.2 || ^7.0" + }, + "suggest": { + "ext-gd": "Needed to process images", + "ext-gmagick": "Improves image processing performance", + "ext-imagick": "Improves image processing performance", + "ext-zlib": "Needed for pdf stream compression" + }, + "type": "library", + "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1" + ], + "authors": [ + { + "name": "The Dompdf Community", + "homepage": "https://github.com/dompdf/dompdf/blob/master/AUTHORS.md" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "support": { + "issues": "https://github.com/dompdf/dompdf/issues", + "source": "https://github.com/dompdf/dompdf/tree/v3.1.5" + }, + "time": "2026-03-03T13:54:37+00:00" + }, + { + "name": "dompdf/php-font-lib", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-font-lib.git", + "reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-font-lib/zipball/a6e9a688a2a80016ac080b97be73d3e10c444c9a", + "reference": "a6e9a688a2a80016ac080b97be73d3e10c444c9a", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11 || ^12" + }, + "type": "library", + "autoload": { + "psr-4": { + "FontLib\\": "src/FontLib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-or-later" + ], + "authors": [ + { + "name": "The FontLib Community", + "homepage": "https://github.com/dompdf/php-font-lib/blob/master/AUTHORS.md" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/dompdf/php-font-lib", + "support": { + "issues": "https://github.com/dompdf/php-font-lib/issues", + "source": "https://github.com/dompdf/php-font-lib/tree/1.0.2" + }, + "time": "2026-01-20T14:10:26+00:00" + }, + { + "name": "dompdf/php-svg-lib", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/dompdf/php-svg-lib.git", + "reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/php-svg-lib/zipball/8259ffb930817e72b1ff1caef5d226501f3dfeb1", + "reference": "8259ffb930817e72b1ff1caef5d226501f3dfeb1", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^7.1 || ^8.0", + "sabberworm/php-css-parser": "^8.4 || ^9.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8 || ^9 || ^10 || ^11" + }, + "type": "library", + "autoload": { + "psr-4": { + "Svg\\": "src/Svg" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "The SvgLib Community", + "homepage": "https://github.com/dompdf/php-svg-lib/blob/master/AUTHORS.md" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/dompdf/php-svg-lib", + "support": { + "issues": "https://github.com/dompdf/php-svg-lib/issues", + "source": "https://github.com/dompdf/php-svg-lib/tree/1.0.2" + }, + "time": "2026-01-02T16:01:13+00:00" + }, + { + "name": "dragonmantank/cron-expression", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/dragonmantank/cron-expression.git", + "reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dragonmantank/cron-expression/zipball/d61a8a9604ec1f8c3d150d09db6ce98b32675013", + "reference": "d61a8a9604ec1f8c3d150d09db6ce98b32675013", + "shasum": "" + }, + "require": { + "php": "^8.2|^8.3|^8.4|^8.5" + }, + "replace": { + "mtdowling/cron-expression": "^1.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.32|^2.1.31", + "phpunit/phpunit": "^8.5.48|^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Cron\\": "src/Cron/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Tankersley", + "email": "chris@ctankersley.com", + "homepage": "https://github.com/dragonmantank" + } + ], + "description": "CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due", + "keywords": [ + "cron", + "schedule" + ], + "support": { + "issues": "https://github.com/dragonmantank/cron-expression/issues", + "source": "https://github.com/dragonmantank/cron-expression/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://github.com/dragonmantank", + "type": "github" + } + ], + "time": "2025-10-31T18:51:33+00:00" + }, + { + "name": "egulias/email-validator", + "version": "4.0.4", + "source": { + "type": "git", + "url": "https://github.com/egulias/EmailValidator.git", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "shasum": "" + }, + "require": { + "doctrine/lexer": "^2.0 || ^3.0", + "php": ">=8.1", + "symfony/polyfill-intl-idn": "^1.26" + }, + "require-dev": { + "phpunit/phpunit": "^10.2", + "vimeo/psalm": "^5.12" + }, + "suggest": { + "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Egulias\\EmailValidator\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eduardo Gulias Davis" + } + ], + "description": "A library for validating emails against several RFCs", + "homepage": "https://github.com/egulias/EmailValidator", + "keywords": [ + "email", + "emailvalidation", + "emailvalidator", + "validation", + "validator" + ], + "support": { + "issues": "https://github.com/egulias/EmailValidator/issues", + "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" + }, + "funding": [ + { + "url": "https://github.com/egulias", + "type": "github" + } + ], + "time": "2025-03-06T22:45:56+00:00" + }, + { + "name": "fruitcake/php-cors", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/fruitcake/php-cors.git", + "reference": "38aaa6c3fd4c157ffe2a4d10aa8b9b16ba8de379" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fruitcake/php-cors/zipball/38aaa6c3fd4c157ffe2a4d10aa8b9b16ba8de379", + "reference": "38aaa6c3fd4c157ffe2a4d10aa8b9b16ba8de379", + "shasum": "" + }, + "require": { + "php": "^8.1", + "symfony/http-foundation": "^5.4|^6.4|^7.3|^8" + }, + "require-dev": { + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^9", + "squizlabs/php_codesniffer": "^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Fruitcake\\Cors\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fruitcake", + "homepage": "https://fruitcake.nl" + }, + { + "name": "Barryvdh", + "email": "barryvdh@gmail.com" + } + ], + "description": "Cross-origin resource sharing library for the Symfony HttpFoundation", + "homepage": "https://github.com/fruitcake/php-cors", + "keywords": [ + "cors", + "laravel", + "symfony" + ], + "support": { + "issues": "https://github.com/fruitcake/php-cors/issues", + "source": "https://github.com/fruitcake/php-cors/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://fruitcake.nl", + "type": "custom" + }, + { + "url": "https://github.com/barryvdh", + "type": "github" + } + ], + "time": "2025-12-03T09:33:47+00:00" + }, + { + "name": "graham-campbell/result-type", + "version": "v1.1.4", + "source": { + "type": "git", + "url": "https://github.com/GrahamCampbell/Result-Type.git", + "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/e01f4a821471308ba86aa202fed6698b6b695e3b", + "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.5" + }, + "require-dev": { + "phpunit/phpunit": "^8.5.41 || ^9.6.22 || ^10.5.45 || ^11.5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "GrahamCampbell\\ResultType\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "An Implementation Of The Result Type", + "keywords": [ + "Graham Campbell", + "GrahamCampbell", + "Result Type", + "Result-Type", + "result" + ], + "support": { + "issues": "https://github.com/GrahamCampbell/Result-Type/issues", + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/graham-campbell/result-type", + "type": "tidelift" + } + ], + "time": "2025-12-27T19:43:20+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.10.4", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "aec528da477062d3af11f51e6b33402be233b21f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/aec528da477062d3af11f51e6b33402be233b21f", + "reference": "aec528da477062d3af11f51e6b33402be233b21f", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "guzzlehttp/test-server": "^0.3.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.52 || ^9.6.34", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.10.4" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2026-05-22T19:00:53+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/09e8a212562fb1fb6a512c4156ed71525969d6c2", + "reference": "09e8a212562fb1fb6a512c4156ed71525969d6c2", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.52 || ^9.6.34" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.4.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2026-05-20T22:57:30+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.10.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "73ab136360b5dfd858006eae9795e8fe43c80361" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/73ab136360b5dfd858006eae9795e8fe43c80361", + "reference": "73ab136360b5dfd858006eae9795e8fe43c80361", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "1.1.0", + "jshttp/mime-db": "1.54.0.1", + "phpunit/phpunit": "^8.5.52 || ^9.6.34" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.10.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2026-05-20T09:27:36+00:00" + }, + { + "name": "guzzlehttp/uri-template", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/guzzle/uri-template.git", + "reference": "eef7f87bab6f204eba3c39224d8075c70c637946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/eef7f87bab6f204eba3c39224d8075c70c637946", + "reference": "eef7f87bab6f204eba3c39224d8075c70c637946", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "symfony/polyfill-php80": "^1.24" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.52 || ^9.6.34", + "uri-template/tests": "1.0.0" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\UriTemplate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + } + ], + "description": "A polyfill class for uri_template of PHP", + "keywords": [ + "guzzlehttp", + "uri-template" + ], + "support": { + "issues": "https://github.com/guzzle/uri-template/issues", + "source": "https://github.com/guzzle/uri-template/tree/v1.0.6" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/uri-template", + "type": "tidelift" + } + ], + "time": "2026-05-23T22:00:21+00:00" + }, + { + "name": "inertiajs/inertia-laravel", + "version": "v2.0.24", + "source": { + "type": "git", + "url": "https://github.com/inertiajs/inertia-laravel.git", + "reference": "ea345adad12f110edbbc4bef03b69c2374a535d4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/ea345adad12f110edbbc4bef03b69c2374a535d4", + "reference": "ea345adad12f110edbbc4bef03b69c2374a535d4", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel/framework": "^10.0|^11.0|^12.0|^13.0", + "php": "^8.1.0", + "symfony/console": "^6.2|^7.0|^8.0" + }, + "conflict": { + "laravel/boost": "<2.2.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^7.2", + "larastan/larastan": "^3.0", + "laravel/pint": "^1.16", + "mockery/mockery": "^1.3.3", + "orchestra/testbench": "^8.0|^9.2|^10.0|^11.0", + "phpunit/phpunit": "^10.4|^11.5|^12.0", + "roave/security-advisories": "dev-master" + }, + "suggest": { + "ext-pcntl": "Recommended when running the Inertia SSR server via the `inertia:start-ssr` artisan command." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Inertia\\ServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "./helpers.php" + ], + "psr-4": { + "Inertia\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Reinink", + "email": "jonathan@reinink.ca", + "homepage": "https://reinink.ca" + } + ], + "description": "The Laravel adapter for Inertia.js.", + "keywords": [ + "inertia", + "laravel" + ], + "support": { + "issues": "https://github.com/inertiajs/inertia-laravel/issues", + "source": "https://github.com/inertiajs/inertia-laravel/tree/v2.0.24" + }, + "time": "2026-04-10T14:36:44+00:00" + }, + { + "name": "laravel/framework", + "version": "v13.11.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/framework.git", + "reference": "4148042bf6ee01edd05408f1f66d91b231f85c25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/framework/zipball/4148042bf6ee01edd05408f1f66d91b231f85c25", + "reference": "4148042bf6ee01edd05408f1f66d91b231f85c25", + "shasum": "" + }, + "require": { + "brick/math": "^0.14.2 || ^0.15 || ^0.16 || ^0.17", + "composer-runtime-api": "^2.2", + "doctrine/inflector": "^2.0.5", + "dragonmantank/cron-expression": "^3.4", + "egulias/email-validator": "^4.0", + "ext-ctype": "*", + "ext-filter": "*", + "ext-hash": "*", + "ext-mbstring": "*", + "ext-openssl": "*", + "ext-session": "*", + "ext-tokenizer": "*", + "fruitcake/php-cors": "^1.3", + "guzzlehttp/guzzle": "^7.8.2", + "guzzlehttp/promises": "^2.0.3", + "guzzlehttp/uri-template": "^1.0", + "laravel/prompts": "^0.3.0", + "laravel/serializable-closure": "^2.0.10", + "league/commonmark": "^2.8.1", + "league/flysystem": "^3.25.1", + "league/flysystem-local": "^3.25.1", + "league/uri": "^7.5.1", + "monolog/monolog": "^3.0", + "nesbot/carbon": "^3.8.4", + "nunomaduro/termwind": "^2.0", + "php": "^8.3", + "psr/container": "^1.1.1 || ^2.0.1", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0", + "ramsey/uuid": "^4.7", + "symfony/console": "^7.4.0 || ^8.0.0", + "symfony/error-handler": "^7.4.0 || ^8.0.0", + "symfony/finder": "^7.4.0 || ^8.0.0", + "symfony/http-foundation": "^7.4.0 || ^8.0.0", + "symfony/http-kernel": "^7.4.0 || ^8.0.0", + "symfony/mailer": "^7.4.0 || ^8.0.0", + "symfony/mime": "^7.4.0 || ^8.0.0", + "symfony/polyfill-php84": "^1.36", + "symfony/polyfill-php85": "^1.36", + "symfony/polyfill-php86": "^1.36", + "symfony/process": "^7.4.5 || ^8.0.5", + "symfony/routing": "^7.4.0 || ^8.0.0", + "symfony/uid": "^7.4.0 || ^8.0.0", + "symfony/var-dumper": "^7.4.0 || ^8.0.0", + "tijsverkoyen/css-to-inline-styles": "^2.2.5", + "vlucas/phpdotenv": "^5.6.1", + "voku/portable-ascii": "^2.0.2" + }, + "conflict": { + "tightenco/collect": "<5.5.33" + }, + "provide": { + "psr/container-implementation": "1.1 || 2.0", + "psr/log-implementation": "1.0 || 2.0 || 3.0", + "psr/simple-cache-implementation": "1.0 || 2.0 || 3.0" + }, + "replace": { + "illuminate/auth": "self.version", + "illuminate/broadcasting": "self.version", + "illuminate/bus": "self.version", + "illuminate/cache": "self.version", + "illuminate/collections": "self.version", + "illuminate/concurrency": "self.version", + "illuminate/conditionable": "self.version", + "illuminate/config": "self.version", + "illuminate/console": "self.version", + "illuminate/container": "self.version", + "illuminate/contracts": "self.version", + "illuminate/cookie": "self.version", + "illuminate/database": "self.version", + "illuminate/encryption": "self.version", + "illuminate/events": "self.version", + "illuminate/filesystem": "self.version", + "illuminate/hashing": "self.version", + "illuminate/http": "self.version", + "illuminate/json-schema": "self.version", + "illuminate/log": "self.version", + "illuminate/macroable": "self.version", + "illuminate/mail": "self.version", + "illuminate/notifications": "self.version", + "illuminate/pagination": "self.version", + "illuminate/pipeline": "self.version", + "illuminate/process": "self.version", + "illuminate/queue": "self.version", + "illuminate/redis": "self.version", + "illuminate/reflection": "self.version", + "illuminate/routing": "self.version", + "illuminate/session": "self.version", + "illuminate/support": "self.version", + "illuminate/testing": "self.version", + "illuminate/translation": "self.version", + "illuminate/validation": "self.version", + "illuminate/view": "self.version", + "spatie/once": "*" + }, + "require-dev": { + "ably/ably-php": "^1.0", + "aws/aws-sdk-php": "^3.322.9", + "ext-gmp": "*", + "fakerphp/faker": "^1.24", + "guzzlehttp/psr7": "^2.9", + "laravel/pint": "^1.18", + "league/flysystem-aws-s3-v3": "^3.25.1", + "league/flysystem-ftp": "^3.25.1", + "league/flysystem-path-prefixing": "^3.25.1", + "league/flysystem-read-only": "^3.25.1", + "league/flysystem-sftp-v3": "^3.25.1", + "mockery/mockery": "^1.6.10", + "opis/json-schema": "^2.4.1", + "orchestra/testbench-core": "^11.0.0", + "pda/pheanstalk": "^7.0.0 || ^8.0.0", + "php-http/discovery": "^1.15", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^11.5.50 || ^12.5.8 || ^13.0.3", + "predis/predis": "^2.3 || ^3.0", + "rector/rector": "^2.3", + "resend/resend-php": "^1.0", + "symfony/cache": "^7.4.0 || ^8.0.0", + "symfony/http-client": "^7.4.0 || ^8.0.0", + "symfony/psr-http-message-bridge": "^7.4.0 || ^8.0.0", + "symfony/translation": "^7.4.0 || ^8.0.0" + }, + "suggest": { + "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", + "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.322.9).", + "brianium/paratest": "Required to run tests in parallel (^7.0 || ^8.0).", + "ext-apcu": "Required to use the APC cache driver.", + "ext-fileinfo": "Required to use the Filesystem class.", + "ext-ftp": "Required to use the Flysystem FTP driver.", + "ext-gd": "Required to use Illuminate\\Http\\Testing\\FileFactory::image().", + "ext-memcached": "Required to use the memcache cache driver.", + "ext-pcntl": "Required to use all features of the queue worker and console signal trapping.", + "ext-pdo": "Required to use all database features.", + "ext-posix": "Required to use all features of the queue worker.", + "ext-redis": "Required to use the Redis cache and queue drivers (^4.0 || ^5.0 || ^6.0).", + "fakerphp/faker": "Required to generate fake data using the fake() helper (^1.23).", + "filp/whoops": "Required for friendly error pages in development (^2.14.3).", + "laravel/tinker": "Required to use the tinker console command (^2.0).", + "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (^3.25.1).", + "league/flysystem-ftp": "Required to use the Flysystem FTP driver (^3.25.1).", + "league/flysystem-path-prefixing": "Required to use the scoped driver (^3.25.1).", + "league/flysystem-read-only": "Required to use read-only disks (^3.25.1)", + "league/flysystem-sftp-v3": "Required to use the Flysystem SFTP driver (^3.25.1).", + "mockery/mockery": "Required to use mocking (^1.6).", + "pda/pheanstalk": "Required to use the beanstalk queue driver (^7.0 || ^8.0).", + "php-http/discovery": "Required to use PSR-7 bridging features (^1.15).", + "phpunit/phpunit": "Required to use assertions and run tests (^11.5.50 || ^12.5.8 || ^13.0.3).", + "predis/predis": "Required to use the predis connector (^2.3 || ^3.0).", + "psr/http-message": "Required to allow Storage::put to accept a StreamInterface (^1.0).", + "pusher/pusher-php-server": "Required to use the Pusher broadcast driver (^6.0 || ^7.0).", + "resend/resend-php": "Required to enable support for the Resend mail transport (^0.10.0 || ^1.0).", + "spatie/fork": "Required to use the 'fork' concurrency driver (^1.2).", + "symfony/cache": "Required to PSR-6 cache bridge (^7.4 || ^8.0).", + "symfony/filesystem": "Required to enable support for relative symbolic links (^7.4 || ^8.0).", + "symfony/http-client": "Required to enable support for the Symfony API mail transports (^7.4 || ^8.0).", + "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^7.4 || ^8.0).", + "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^7.4 || ^8.0).", + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^7.4 || ^8.0)." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "13.0.x-dev" + } + }, + "autoload": { + "files": [ + "src/Illuminate/Collections/functions.php", + "src/Illuminate/Collections/helpers.php", + "src/Illuminate/Events/functions.php", + "src/Illuminate/Filesystem/functions.php", + "src/Illuminate/Foundation/helpers.php", + "src/Illuminate/Log/functions.php", + "src/Illuminate/Reflection/helpers.php", + "src/Illuminate/Support/functions.php", + "src/Illuminate/Support/helpers.php" + ], + "psr-4": { + "Illuminate\\": "src/Illuminate/", + "Illuminate\\Support\\": [ + "src/Illuminate/Macroable/", + "src/Illuminate/Collections/", + "src/Illuminate/Conditionable/", + "src/Illuminate/Reflection/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "The Laravel Framework.", + "homepage": "https://laravel.com", + "keywords": [ + "framework", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2026-05-20T11:46:02+00:00" + }, + { + "name": "laravel/prompts", + "version": "v0.3.18", + "source": { + "type": "git", + "url": "https://github.com/laravel/prompts.git", + "reference": "a19af51bb144bf87f08397921fa619f85c7d4e72" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/prompts/zipball/a19af51bb144bf87f08397921fa619f85c7d4e72", + "reference": "a19af51bb144bf87f08397921fa619f85c7d4e72", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.2", + "ext-mbstring": "*", + "php": "^8.1", + "symfony/console": "^6.2|^7.0|^8.0" + }, + "conflict": { + "illuminate/console": ">=10.17.0 <10.25.0", + "laravel/framework": ">=10.17.0 <10.25.0" + }, + "require-dev": { + "illuminate/collections": "^10.0|^11.0|^12.0|^13.0", + "mockery/mockery": "^1.5", + "pestphp/pest": "^2.3|^3.4|^4.0", + "phpstan/phpstan": "^1.12.28", + "phpstan/phpstan-mockery": "^1.1.3" + }, + "suggest": { + "ext-pcntl": "Required for the spinner to be animated." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.3.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Laravel\\Prompts\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Add beautiful and user-friendly forms to your command-line applications.", + "support": { + "issues": "https://github.com/laravel/prompts/issues", + "source": "https://github.com/laravel/prompts/tree/v0.3.18" + }, + "time": "2026-05-19T00:47:18+00:00" + }, + { + "name": "laravel/sanctum", + "version": "v4.3.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/sanctum.git", + "reference": "2a9bccc18e9907808e0018dd15fa643937886b1e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/sanctum/zipball/2a9bccc18e9907808e0018dd15fa643937886b1e", + "reference": "2a9bccc18e9907808e0018dd15fa643937886b1e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "illuminate/console": "^11.0|^12.0|^13.0", + "illuminate/contracts": "^11.0|^12.0|^13.0", + "illuminate/database": "^11.0|^12.0|^13.0", + "illuminate/support": "^11.0|^12.0|^13.0", + "php": "^8.2", + "symfony/console": "^7.0|^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.6", + "orchestra/testbench": "^9.15|^10.8|^11.0", + "phpstan/phpstan": "^1.10" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Sanctum\\SanctumServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Sanctum\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.", + "keywords": [ + "auth", + "laravel", + "sanctum" + ], + "support": { + "issues": "https://github.com/laravel/sanctum/issues", + "source": "https://github.com/laravel/sanctum" + }, + "time": "2026-04-30T11:46:25+00:00" + }, + { + "name": "laravel/serializable-closure", + "version": "v2.0.13", + "source": { + "type": "git", + "url": "https://github.com/laravel/serializable-closure.git", + "reference": "b566ee0dd251f3c4078bed003a7ce015f5ea6dce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/b566ee0dd251f3c4078bed003a7ce015f5ea6dce", + "reference": "b566ee0dd251f3c4078bed003a7ce015f5ea6dce", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "illuminate/support": "^10.0|^11.0|^12.0|^13.0", + "nesbot/carbon": "^2.67|^3.0", + "pestphp/pest": "^2.36|^3.0|^4.0", + "phpstan/phpstan": "^2.0", + "symfony/var-dumper": "^6.2.0|^7.0.0|^8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\SerializableClosure\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Nuno Maduro", + "email": "nuno@laravel.com" + } + ], + "description": "Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.", + "keywords": [ + "closure", + "laravel", + "serializable" + ], + "support": { + "issues": "https://github.com/laravel/serializable-closure/issues", + "source": "https://github.com/laravel/serializable-closure" + }, + "time": "2026-04-16T14:03:50+00:00" + }, + { + "name": "laravel/tinker", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/tinker.git", + "reference": "4faba77764bd33411735936acdf30446d058c78b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/tinker/zipball/4faba77764bd33411735936acdf30446d058c78b", + "reference": "4faba77764bd33411735936acdf30446d058c78b", + "shasum": "" + }, + "require": { + "illuminate/console": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", + "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0|^13.0", + "php": "^8.1", + "psy/psysh": "^0.12.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0|^8.0" + }, + "require-dev": { + "mockery/mockery": "~1.3.3|^1.4.2", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^10.5|^11.5" + }, + "suggest": { + "illuminate/database": "The Illuminate Database package (^8.0|^9.0|^10.0|^11.0|^12.0|^13.0)." + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Tinker\\TinkerServiceProvider" + ] + }, + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Tinker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Powerful REPL for the Laravel framework.", + "keywords": [ + "REPL", + "Tinker", + "laravel", + "psysh" + ], + "support": { + "issues": "https://github.com/laravel/tinker/issues", + "source": "https://github.com/laravel/tinker/tree/v3.0.2" + }, + "time": "2026-03-17T14:54:13+00:00" + }, + { + "name": "league/commonmark", + "version": "2.8.2", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/commonmark.git", + "reference": "59fb075d2101740c337c7216e3f32b36c204218b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/59fb075d2101740c337c7216e3f32b36c204218b", + "reference": "59fb075d2101740c337c7216e3f32b36c204218b", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "league/config": "^1.1.1", + "php": "^7.4 || ^8.0", + "psr/event-dispatcher": "^1.0", + "symfony/deprecation-contracts": "^2.1 || ^3.0", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "cebe/markdown": "^1.0", + "commonmark/cmark": "0.31.1", + "commonmark/commonmark.js": "0.31.1", + "composer/package-versions-deprecated": "^1.8", + "embed/embed": "^4.4", + "erusev/parsedown": "^1.0", + "ext-json": "*", + "github/gfm": "0.29.0", + "michelf/php-markdown": "^1.4 || ^2.0", + "nyholm/psr7": "^1.5", + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0", + "scrutinizer/ocular": "^1.8.1", + "symfony/finder": "^5.3 | ^6.0 | ^7.0 || ^8.0", + "symfony/process": "^5.4 | ^6.0 | ^7.0 || ^8.0", + "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0 || ^8.0", + "unleashedtech/php-coding-standard": "^3.1.1", + "vimeo/psalm": "^4.24.0 || ^5.0.0 || ^6.0.0" + }, + "suggest": { + "symfony/yaml": "v2.3+ required if using the Front Matter extension" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.9-dev" + } + }, + "autoload": { + "psr-4": { + "League\\CommonMark\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)", + "homepage": "https://commonmark.thephpleague.com", + "keywords": [ + "commonmark", + "flavored", + "gfm", + "github", + "github-flavored", + "markdown", + "md", + "parser" + ], + "support": { + "docs": "https://commonmark.thephpleague.com/", + "forum": "https://github.com/thephpleague/commonmark/discussions", + "issues": "https://github.com/thephpleague/commonmark/issues", + "rss": "https://github.com/thephpleague/commonmark/releases.atom", + "source": "https://github.com/thephpleague/commonmark" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/commonmark", + "type": "tidelift" + } + ], + "time": "2026-03-19T13:16:38+00:00" + }, + { + "name": "league/config", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/config.git", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/config/zipball/754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "reference": "754b3604fb2984c71f4af4a9cbe7b57f346ec1f3", + "shasum": "" + }, + "require": { + "dflydev/dot-access-data": "^3.0.1", + "nette/schema": "^1.2", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.8.2", + "phpunit/phpunit": "^9.5.5", + "scrutinizer/ocular": "^1.8.1", + "unleashedtech/php-coding-standard": "^3.1", + "vimeo/psalm": "^4.7.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.2-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Config\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Colin O'Dell", + "email": "colinodell@gmail.com", + "homepage": "https://www.colinodell.com", + "role": "Lead Developer" + } + ], + "description": "Define configuration arrays with strict schemas and access values with dot notation", + "homepage": "https://config.thephpleague.com", + "keywords": [ + "array", + "config", + "configuration", + "dot", + "dot-access", + "nested", + "schema" + ], + "support": { + "docs": "https://config.thephpleague.com/", + "issues": "https://github.com/thephpleague/config/issues", + "rss": "https://github.com/thephpleague/config/releases.atom", + "source": "https://github.com/thephpleague/config" + }, + "funding": [ + { + "url": "https://www.colinodell.com/sponsor", + "type": "custom" + }, + { + "url": "https://www.paypal.me/colinpodell/10.00", + "type": "custom" + }, + { + "url": "https://github.com/colinodell", + "type": "github" + } + ], + "time": "2022-12-11T20:36:23+00:00" + }, + { + "name": "league/flysystem", + "version": "3.34.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e", + "reference": "2daaac3b0d4c83ea7ed5d8586e786f5d00f3540e", + "shasum": "" + }, + "require": { + "league/flysystem-local": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "conflict": { + "async-aws/core": "<1.19.0", + "async-aws/s3": "<1.14.0", + "aws/aws-sdk-php": "3.209.31 || 3.210.0", + "guzzlehttp/guzzle": "<7.0", + "guzzlehttp/ringphp": "<1.1.1", + "phpseclib/phpseclib": "3.0.15", + "symfony/http-client": "<5.2" + }, + "require-dev": { + "async-aws/s3": "^1.5 || ^2.0", + "async-aws/simple-s3": "^1.1 || ^2.0", + "aws/aws-sdk-php": "^3.295.10", + "composer/semver": "^3.0", + "ext-fileinfo": "*", + "ext-ftp": "*", + "ext-mongodb": "^1.3|^2", + "ext-zip": "*", + "friendsofphp/php-cs-fixer": "^3.5", + "google/cloud-storage": "^1.23", + "guzzlehttp/psr7": "^2.6", + "microsoft/azure-storage-blob": "^1.1", + "mongodb/mongodb": "^1.2|^2", + "phpseclib/phpseclib": "^3.0.36", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.5.11|^10.0", + "sabre/dav": "^4.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "File storage abstraction for PHP", + "keywords": [ + "WebDAV", + "aws", + "cloud", + "file", + "files", + "filesystem", + "filesystems", + "ftp", + "s3", + "sftp", + "storage" + ], + "support": { + "issues": "https://github.com/thephpleague/flysystem/issues", + "source": "https://github.com/thephpleague/flysystem/tree/3.34.0" + }, + "time": "2026-05-14T10:28:08+00:00" + }, + { + "name": "league/flysystem-local", + "version": "3.31.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-local.git", + "reference": "2f669db18a4c20c755c2bb7d3a7b0b2340488079" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-local/zipball/2f669db18a4c20c755c2bb7d3a7b0b2340488079", + "reference": "2f669db18a4c20c755c2bb7d3a7b0b2340488079", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "league/flysystem": "^3.0.0", + "league/mime-type-detection": "^1.0.0", + "php": "^8.0.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\Local\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Local filesystem adapter for Flysystem.", + "keywords": [ + "Flysystem", + "file", + "files", + "filesystem", + "local" + ], + "support": { + "source": "https://github.com/thephpleague/flysystem-local/tree/3.31.0" + }, + "time": "2026-01-23T15:30:45+00:00" + }, + { + "name": "league/mime-type-detection", + "version": "1.16.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/mime-type-detection.git", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/2d6702ff215bf922936ccc1ad31007edc76451b9", + "reference": "2d6702ff215bf922936ccc1ad31007edc76451b9", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "phpstan/phpstan": "^0.12.68", + "phpunit/phpunit": "^8.5.8 || ^9.3 || ^10.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\MimeTypeDetection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frankdejonge.nl" + } + ], + "description": "Mime-type detection for Flysystem", + "support": { + "issues": "https://github.com/thephpleague/mime-type-detection/issues", + "source": "https://github.com/thephpleague/mime-type-detection/tree/1.16.0" + }, + "funding": [ + { + "url": "https://github.com/frankdejonge", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/league/flysystem", + "type": "tidelift" + } + ], + "time": "2024-09-21T08:32:55+00:00" + }, + { + "name": "league/uri", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/08cf38e3924d4f56238125547b5720496fac8fd4", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.8.1", + "php": "^8.1", + "psr/http-factory": "^1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-dom": "to convert the URI into an HTML anchor tag", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "ext-uri": "to use the PHP native URI class", + "jeremykendall/php-domain-parser": "to further parse the URI host and resolve its Public Suffix and Top Level Domain", + "league/uri-components": "to provide additional tools to manipulate URI objects components", + "league/uri-polyfill": "to backport the PHP URI extension for older versions of PHP", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "URN", + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc2141", + "rfc3986", + "rfc3987", + "rfc6570", + "rfc8141", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-15T20:22:25+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/85d5c77c5d6d3af6c54db4a78246364908f3c928", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^8.1", + "psr/http-message": "^1.1 || ^2.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common tools for parsing and resolving RFC3987/RFC3986 URI", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-08T20:05:35+00:00" + }, + { + "name": "masterminds/html5", + "version": "2.10.0", + "source": { + "type": "git", + "url": "https://github.com/Masterminds/html5-php.git", + "reference": "fcf91eb64359852f00d921887b219479b4f21251" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Masterminds/html5-php/zipball/fcf91eb64359852f00d921887b219479b4f21251", + "reference": "fcf91eb64359852f00d921887b219479b4f21251", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7.21 || ^6 || ^7 || ^8 || ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Masterminds\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Butcher", + "email": "technosophos@gmail.com" + }, + { + "name": "Matt Farina", + "email": "matt@mattfarina.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + } + ], + "description": "An HTML5 parser and serializer.", + "homepage": "http://masterminds.github.io/html5-php", + "keywords": [ + "HTML5", + "dom", + "html", + "parser", + "querypath", + "serializer", + "xml" + ], + "support": { + "issues": "https://github.com/Masterminds/html5-php/issues", + "source": "https://github.com/Masterminds/html5-php/tree/2.10.0" + }, + "time": "2025-07-25T09:04:22+00:00" + }, + { + "name": "monolog/monolog", + "version": "3.10.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0", + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/log": "^2.0 || ^3.0" + }, + "provide": { + "psr/log-implementation": "3.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^3.0", + "doctrine/couchdb": "~1.0@dev", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", + "graylog2/gelf-php": "^1.4.2 || ^2.0", + "guzzlehttp/guzzle": "^7.4.5", + "guzzlehttp/psr7": "^2.2", + "mongodb/mongodb": "^1.8 || ^2.0", + "php-amqplib/php-amqplib": "~2.4 || ^3", + "php-console/php-console": "^3.1.8", + "phpstan/phpstan": "^2", + "phpstan/phpstan-deprecation-rules": "^2", + "phpstan/phpstan-strict-rules": "^2", + "phpunit/phpunit": "^10.5.17 || ^11.0.7", + "predis/predis": "^1.1 || ^2", + "rollbar/rollbar": "^4.0", + "ruflin/elastica": "^7 || ^8", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler", + "ext-mbstring": "Allow to work properly with unicode symbols", + "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)", + "ext-openssl": "Required to send log messages using SSL", + "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "https://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "https://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "support": { + "issues": "https://github.com/Seldaek/monolog/issues", + "source": "https://github.com/Seldaek/monolog/tree/3.10.0" + }, + "funding": [ + { + "url": "https://github.com/Seldaek", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/monolog/monolog", + "type": "tidelift" + } + ], + "time": "2026-01-02T08:56:05+00:00" + }, + { + "name": "nesbot/carbon", + "version": "3.11.4", + "source": { + "type": "git", + "url": "https://github.com/CarbonPHP/carbon.git", + "reference": "e890471a3494740f7d9326d72ce6a8c559ffee60" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/e890471a3494740f7d9326d72ce6a8c559ffee60", + "reference": "e890471a3494740f7d9326d72ce6a8c559ffee60", + "shasum": "" + }, + "require": { + "carbonphp/carbon-doctrine-types": "<100.0", + "ext-json": "*", + "php": "^8.1", + "psr/clock": "^1.0", + "symfony/clock": "^6.3.12 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.0", + "symfony/translation": "^4.4.18 || ^5.2.1 || ^6.0 || ^7.0 || ^8.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "require-dev": { + "doctrine/dbal": "^3.6.3 || ^4.0", + "doctrine/orm": "^2.15.2 || ^3.0", + "friendsofphp/php-cs-fixer": "^v3.87.1", + "kylekatarnls/multi-tester": "^2.5.3", + "phpmd/phpmd": "^2.15.0", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^2.1.22", + "phpunit/phpunit": "^10.5.53", + "squizlabs/php_codesniffer": "^3.13.4 || ^4.0.0" + }, + "bin": [ + "bin/carbon" + ], + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev", + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Carbon\\": "src/Carbon/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Nesbitt", + "email": "brian@nesbot.com", + "homepage": "https://markido.com" + }, + { + "name": "kylekatarnls", + "homepage": "https://github.com/kylekatarnls" + } + ], + "description": "An API extension for DateTime that supports 281 different languages.", + "homepage": "https://carbonphp.github.io/carbon/", + "keywords": [ + "date", + "datetime", + "time" + ], + "support": { + "docs": "https://carbonphp.github.io/carbon/guide/getting-started/introduction.html", + "issues": "https://github.com/CarbonPHP/carbon/issues", + "source": "https://github.com/CarbonPHP/carbon" + }, + "funding": [ + { + "url": "https://github.com/sponsors/kylekatarnls", + "type": "github" + }, + { + "url": "https://opencollective.com/Carbon#sponsor", + "type": "opencollective" + }, + { + "url": "https://tidelift.com/subscription/pkg/packagist-nesbot-carbon?utm_source=packagist-nesbot-carbon&utm_medium=referral&utm_campaign=readme", + "type": "tidelift" + } + ], + "time": "2026-04-07T09:57:54+00:00" + }, + { + "name": "nette/schema", + "version": "v1.3.5", + "source": { + "type": "git", + "url": "https://github.com/nette/schema.git", + "reference": "f0ab1a3cda782dbc5da270d28545236aa80c4002" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/schema/zipball/f0ab1a3cda782dbc5da270d28545236aa80c4002", + "reference": "f0ab1a3cda782dbc5da270d28545236aa80c4002", + "shasum": "" + }, + "require": { + "nette/utils": "^4.0", + "php": "8.1 - 8.5" + }, + "require-dev": { + "nette/phpstan-rules": "^1.0", + "nette/tester": "^2.6", + "phpstan/extension-installer": "^1.4@stable", + "phpstan/phpstan": "^2.1.39@stable", + "tracy/tracy": "^2.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Nette\\": "src" + }, + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "📐 Nette Schema: validating data structures against a given Schema.", + "homepage": "https://nette.org", + "keywords": [ + "config", + "nette" + ], + "support": { + "issues": "https://github.com/nette/schema/issues", + "source": "https://github.com/nette/schema/tree/v1.3.5" + }, + "time": "2026-02-23T03:47:12+00:00" + }, + { + "name": "nette/utils", + "version": "v4.1.4", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/7da6c396d7ebe142bc857c20479d5e70a5e1aac7", + "reference": "7da6c396d7ebe142bc857c20479d5e70a5e1aac7", + "shasum": "" + }, + "require": { + "php": "8.2 - 8.5" + }, + "conflict": { + "nette/finder": "<3", + "nette/schema": "<1.2.2" + }, + "require-dev": { + "jetbrains/phpstorm-attributes": "^1.2", + "nette/phpstan-rules": "^1.0", + "nette/tester": "^2.5", + "phpstan/extension-installer": "^1.4@stable", + "phpstan/phpstan": "^2.1@stable", + "tracy/tracy": "^2.9" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()", + "ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Nette\\": "src" + }, + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0-only", + "GPL-3.0-only" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "support": { + "issues": "https://github.com/nette/utils/issues", + "source": "https://github.com/nette/utils/tree/v4.1.4" + }, + "time": "2026-05-11T20:49:54+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.7.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" + }, + "time": "2025-12-06T11:56:16+00:00" + }, + { + "name": "nunomaduro/termwind", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/termwind.git", + "reference": "712a31b768f5daea284c2169a7d227031001b9a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/712a31b768f5daea284c2169a7d227031001b9a8", + "reference": "712a31b768f5daea284c2169a7d227031001b9a8", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.2", + "symfony/console": "^7.4.4 || ^8.0.4" + }, + "require-dev": { + "illuminate/console": "^11.47.0", + "laravel/pint": "^1.27.1", + "mockery/mockery": "^1.6.12", + "pestphp/pest": "^2.36.0 || ^3.8.4 || ^4.3.2", + "phpstan/phpstan": "^1.12.32", + "phpstan/phpstan-strict-rules": "^1.6.2", + "symfony/var-dumper": "^7.3.5 || ^8.0.4", + "thecodingmachine/phpstan-strict-rules": "^1.0.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Termwind\\Laravel\\TermwindServiceProvider" + ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "files": [ + "src/Functions.php" + ], + "psr-4": { + "Termwind\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "It's like Tailwind CSS, but for the console.", + "keywords": [ + "cli", + "console", + "css", + "package", + "php", + "style" + ], + "support": { + "issues": "https://github.com/nunomaduro/termwind/issues", + "source": "https://github.com/nunomaduro/termwind/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://github.com/xiCO2k", + "type": "github" + } + ], + "time": "2026-02-16T23:10:27+00:00" + }, + { + "name": "phpoption/phpoption", + "version": "1.9.5", + "source": { + "type": "git", + "url": "https://github.com/schmittjoh/php-option.git", + "reference": "75365b91986c2405cf5e1e012c5595cd487a98be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/75365b91986c2405cf5e1e012c5595cd487a98be", + "reference": "75365b91986c2405cf5e1e012c5595cd487a98be", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.44 || ^9.6.25 || ^10.5.53 || ^11.5.34" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "PhpOption\\": "src/PhpOption/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Johannes M. Schmitt", + "email": "schmittjoh@gmail.com", + "homepage": "https://github.com/schmittjoh" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + } + ], + "description": "Option Type for PHP", + "keywords": [ + "language", + "option", + "php", + "type" + ], + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.9.5" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2025-12-27T19:41:33+00:00" + }, + { + "name": "psr/clock", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/clock.git", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/clock/zipball/e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "reference": "e41a24703d4560fd0acb709162f73b8adfc3aa0d", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Clock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for reading the clock.", + "homepage": "https://github.com/php-fig/clock", + "keywords": [ + "clock", + "now", + "psr", + "psr-20", + "time" + ], + "support": { + "issues": "https://github.com/php-fig/clock/issues", + "source": "https://github.com/php-fig/clock/tree/1.0.0" + }, + "time": "2022-11-25T14:36:26+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "psr/simple-cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" + }, + "time": "2021-10-29T13:26:27+00:00" + }, + { + "name": "psy/psysh", + "version": "v0.12.23", + "source": { + "type": "git", + "url": "https://github.com/bobthecow/psysh.git", + "reference": "4dcc0f08047d52bbde475eda481146fd8e27e1a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/4dcc0f08047d52bbde475eda481146fd8e27e1a4", + "reference": "4dcc0f08047d52bbde475eda481146fd8e27e1a4", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-tokenizer": "*", + "nikic/php-parser": "^5.0 || ^4.0", + "php": "^8.0 || ^7.4", + "symfony/console": "^8.0 || ^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4", + "symfony/var-dumper": "^8.0 || ^7.0 || ^6.0 || ^5.0 || ^4.0 || ^3.4" + }, + "conflict": { + "symfony/console": "4.4.37 || 5.3.14 || 5.3.15 || 5.4.3 || 5.4.4 || 6.0.3 || 6.0.4" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.2", + "composer/class-map-generator": "^1.6" + }, + "suggest": { + "composer/class-map-generator": "Improved tab completion performance with better class discovery.", + "ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)", + "ext-posix": "If you have PCNTL, you'll want the POSIX extension as well." + }, + "bin": [ + "bin/psysh" + ], + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": false, + "forward-command": false + }, + "branch-alias": { + "dev-main": "0.12.x-dev" + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Psy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Justin Hileman", + "email": "justin@justinhileman.info" + } + ], + "description": "An interactive shell for modern PHP.", + "homepage": "https://psysh.org", + "keywords": [ + "REPL", + "console", + "interactive", + "shell" + ], + "support": { + "issues": "https://github.com/bobthecow/psysh/issues", + "source": "https://github.com/bobthecow/psysh/tree/v0.12.23" + }, + "time": "2026-05-23T13:41:31+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "ramsey/collection", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/ramsey/collection.git", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "captainhook/plugin-composer": "^5.3", + "ergebnis/composer-normalize": "^2.45", + "fakerphp/faker": "^1.24", + "hamcrest/hamcrest-php": "^2.0", + "jangregor/phpstan-prophecy": "^2.1", + "mockery/mockery": "^1.6", + "php-parallel-lint/php-console-highlighter": "^1.0", + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpspec/prophecy-phpunit": "^2.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5", + "ramsey/coding-standard": "^2.3", + "ramsey/conventional-commits": "^1.6", + "roave/security-advisories": "dev-latest" + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + }, + "ramsey/conventional-commits": { + "configFile": "conventional-commits.json" + } + }, + "autoload": { + "psr-4": { + "Ramsey\\Collection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ben Ramsey", + "email": "ben@benramsey.com", + "homepage": "https://benramsey.com" + } + ], + "description": "A PHP library for representing and manipulating collections.", + "keywords": [ + "array", + "collection", + "hash", + "map", + "queue", + "set" + ], + "support": { + "issues": "https://github.com/ramsey/collection/issues", + "source": "https://github.com/ramsey/collection/tree/2.1.1" + }, + "time": "2025-03-22T05:38:12+00:00" + }, + { + "name": "ramsey/uuid", + "version": "4.9.2", + "source": { + "type": "git", + "url": "https://github.com/ramsey/uuid.git", + "reference": "8429c78ca35a09f27565311b98101e2826affde0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/8429c78ca35a09f27565311b98101e2826affde0", + "reference": "8429c78ca35a09f27565311b98101e2826affde0", + "shasum": "" + }, + "require": { + "brick/math": "^0.8.16 || ^0.9 || ^0.10 || ^0.11 || ^0.12 || ^0.13 || ^0.14", + "php": "^8.0", + "ramsey/collection": "^1.2 || ^2.0" + }, + "replace": { + "rhumsaa/uuid": "self.version" + }, + "require-dev": { + "captainhook/captainhook": "^5.25", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "ergebnis/composer-normalize": "^2.47", + "mockery/mockery": "^1.6", + "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.6", + "php-mock/php-mock-mockery": "^1.5", + "php-parallel-lint/php-parallel-lint": "^1.4.0", + "phpbench/phpbench": "^1.2.14", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.6", + "slevomat/coding-standard": "^8.18", + "squizlabs/php_codesniffer": "^3.13" + }, + "suggest": { + "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", + "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", + "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." + }, + "type": "library", + "extra": { + "captainhook": { + "force-install": true + } + }, + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Ramsey\\Uuid\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A PHP library for generating and working with universally unique identifiers (UUIDs).", + "keywords": [ + "guid", + "identifier", + "uuid" + ], + "support": { + "issues": "https://github.com/ramsey/uuid/issues", + "source": "https://github.com/ramsey/uuid/tree/4.9.2" + }, + "time": "2025-12-14T04:43:48+00:00" + }, + { + "name": "sabberworm/php-css-parser", + "version": "v9.3.0", + "source": { + "type": "git", + "url": "https://github.com/MyIntervals/PHP-CSS-Parser.git", + "reference": "88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MyIntervals/PHP-CSS-Parser/zipball/88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949", + "reference": "88dbd0f7f91abbfe4402d0a3071e9ff4d81ed949", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": "^7.2.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "thecodingmachine/safe": "^1.3 || ^2.5 || ^3.4" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "1.4.0", + "phpstan/extension-installer": "1.4.3", + "phpstan/phpstan": "1.12.32 || 2.1.32", + "phpstan/phpstan-phpunit": "1.4.2 || 2.0.8", + "phpstan/phpstan-strict-rules": "1.6.2 || 2.0.7", + "phpunit/phpunit": "8.5.52", + "rawr/phpunit-data-provider": "3.3.1", + "rector/rector": "1.2.10 || 2.2.8", + "rector/type-perfect": "1.0.0 || 2.1.0", + "squizlabs/php_codesniffer": "4.0.1", + "thecodingmachine/phpstan-safe-rule": "1.2.0 || 1.4.1" + }, + "suggest": { + "ext-mbstring": "for parsing UTF-8 CSS" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "9.4.x-dev" + } + }, + "autoload": { + "files": [ + "src/Rule/Rule.php", + "src/RuleSet/RuleContainer.php" + ], + "psr-4": { + "Sabberworm\\CSS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Raphael Schweikert" + }, + { + "name": "Oliver Klee", + "email": "github@oliverklee.de" + }, + { + "name": "Jake Hotson", + "email": "jake.github@qzdesign.co.uk" + } + ], + "description": "Parser for CSS Files written in PHP", + "homepage": "https://www.sabberworm.com/blog/2010/6/10/php-css-parser", + "keywords": [ + "css", + "parser", + "stylesheet" + ], + "support": { + "issues": "https://github.com/MyIntervals/PHP-CSS-Parser/issues", + "source": "https://github.com/MyIntervals/PHP-CSS-Parser/tree/v9.3.0" + }, + "time": "2026-03-03T17:31:43+00:00" + }, + { + "name": "spatie/laravel-package-tools", + "version": "1.93.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-package-tools.git", + "reference": "d5552849801f2642aea710557463234b59ef65eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/d5552849801f2642aea710557463234b59ef65eb", + "reference": "d5552849801f2642aea710557463234b59ef65eb", + "shasum": "" + }, + "require": { + "illuminate/contracts": "^10.0|^11.0|^12.0|^13.0", + "php": "^8.1" + }, + "require-dev": { + "mockery/mockery": "^1.5", + "orchestra/testbench": "^8.0|^9.2|^10.0|^11.0", + "pestphp/pest": "^2.1|^3.1|^4.0", + "phpunit/php-code-coverage": "^10.0|^11.0|^12.0", + "phpunit/phpunit": "^10.5|^11.5|^12.5", + "spatie/pest-plugin-test-time": "^2.2|^3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Spatie\\LaravelPackageTools\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "role": "Developer" + } + ], + "description": "Tools for creating Laravel packages", + "homepage": "https://github.com/spatie/laravel-package-tools", + "keywords": [ + "laravel-package-tools", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-package-tools/issues", + "source": "https://github.com/spatie/laravel-package-tools/tree/1.93.1" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2026-05-19T14:06:37+00:00" + }, + { + "name": "spatie/laravel-permission", + "version": "7.4.1", + "source": { + "type": "git", + "url": "https://github.com/spatie/laravel-permission.git", + "reference": "ef42ecb781e5534d368a3853fa161e420ad51397" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/laravel-permission/zipball/ef42ecb781e5534d368a3853fa161e420ad51397", + "reference": "ef42ecb781e5534d368a3853fa161e420ad51397", + "shasum": "" + }, + "require": { + "illuminate/auth": "^12.0|^13.0", + "illuminate/container": "^12.0|^13.0", + "illuminate/contracts": "^12.0|^13.0", + "illuminate/database": "^12.0|^13.0", + "php": "^8.3", + "spatie/laravel-package-tools": "^1.0" + }, + "require-dev": { + "larastan/larastan": "^3.9", + "laravel/passport": "^13.0", + "laravel/pint": "^1.0", + "orchestra/testbench": "^10.0|^11.0", + "pestphp/pest": "^3.0|^4.0", + "pestphp/pest-plugin-laravel": "^3.0|^4.1", + "phpstan/phpstan": "^2.1" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Spatie\\Permission\\PermissionServiceProvider" + ] + }, + "branch-alias": { + "dev-main": "7.x-dev", + "dev-master": "7.x-dev" + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Spatie\\Permission\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://spatie.be", + "role": "Developer" + } + ], + "description": "Permission handling for Laravel 12 and up", + "homepage": "https://github.com/spatie/laravel-permission", + "keywords": [ + "acl", + "laravel", + "permission", + "permissions", + "rbac", + "roles", + "security", + "spatie" + ], + "support": { + "issues": "https://github.com/spatie/laravel-permission/issues", + "source": "https://github.com/spatie/laravel-permission/tree/7.4.1" + }, + "funding": [ + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2026-04-29T07:59:45+00:00" + }, + { + "name": "symfony/clock", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/clock.git", + "reference": "b55a638b189a6faa875e0ccdb00908fb87af95b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/clock/zipball/b55a638b189a6faa875e0ccdb00908fb87af95b3", + "reference": "b55a638b189a6faa875e0ccdb00908fb87af95b3", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "psr/clock": "^1.0" + }, + "provide": { + "psr/clock-implementation": "1.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/now.php" + ], + "psr-4": { + "Symfony\\Component\\Clock\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Decouples applications from the system clock", + "homepage": "https://symfony.com", + "keywords": [ + "clock", + "psr20", + "time" + ], + "support": { + "source": "https://github.com/symfony/clock/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, + { + "name": "symfony/console", + "version": "v8.0.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "3156577f46a38aa1b9323aad223de7a9cd426782" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/3156577f46a38aa1b9323aad223de7a9cd426782", + "reference": "3156577f46a38aa1b9323aad223de7a9cd426782", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^7.4|^8.0" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v8.0.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-13T12:07:53+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v8.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "3665cfade90565430909b906394c73c8739e57d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/3665cfade90565430909b906394c73c8739e57d0", + "reference": "3665cfade90565430909b906394c73c8739e57d0", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Converts CSS selectors to XPath expressions", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/css-selector/tree/v8.0.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-18T13:51:42+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/50f59d1f3ca46d41ac911f97a78626b6756af35b", + "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-13T15:52:40+00:00" + }, + { + "name": "symfony/error-handler", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/error-handler.git", + "reference": "c1119fe8dcfc3825ec74ec061b96ef0c8f281517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/c1119fe8dcfc3825ec74ec061b96ef0c8f281517", + "reference": "c1119fe8dcfc3825ec74ec061b96ef0c8f281517", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "psr/log": "^1|^2|^3", + "symfony/polyfill-php85": "^1.32", + "symfony/var-dumper": "^7.4|^8.0" + }, + "conflict": { + "symfony/deprecation-contracts": "<2.5" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/webpack-encore-bundle": "^1.0|^2.0" + }, + "bin": [ + "Resources/bin/patch-type-declarations" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\ErrorHandler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to manage errors and ease debugging PHP code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/error-handler/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v8.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "0c3c1a17604c4dbbec4b93fe162c538482096e1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/0c3c1a17604c4dbbec4b93fe162c538482096e1f", + "reference": "0c3c1a17604c4dbbec4b93fe162c538482096e1f", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/security-http": "<7.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/error-handler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/framework-bundle": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v8.0.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-18T13:51:42+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "ccba7060602b7fed0b03c85bf025257f76d9ef32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/ccba7060602b7fed0b03c85bf025257f76d9ef32", + "reference": "ccba7060602b7fed0b03c85bf025257f76d9ef32", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-01-05T13:30:16+00:00" + }, + { + "name": "symfony/finder", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "8da41214757b87d97f181e3d14a4179286151007" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/8da41214757b87d97f181e3d14a4179286151007", + "reference": "8da41214757b87d97f181e3d14a4179286151007", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "require-dev": { + "symfony/filesystem": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "02656f7ebeae5c155d659e946f6b3a33df24051b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/02656f7ebeae5c155d659e946f6b3a33df24051b", + "reference": "02656f7ebeae5c155d659e946f6b3a33df24051b", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.1" + }, + "conflict": { + "doctrine/dbal": "<4.3" + }, + "require-dev": { + "doctrine/dbal": "^4.3", + "predis/predis": "^1.1|^2.0", + "symfony/cache": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Defines an object-oriented layer for the HTTP specification", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-foundation/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-30T15:14:47+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v8.0.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "c00291734c59c05c54c5a3abc2ab18e99b070157" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c00291734c59c05c54c5a3abc2ab18e99b070157", + "reference": "c00291734c59c05c54c5a3abc2ab18e99b070157", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "psr/log": "^1|^2|^3", + "symfony/error-handler": "^7.4|^8.0", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "symfony/flex": "<2.10", + "symfony/http-client-contracts": "<2.5", + "symfony/translation-contracts": "<2.5", + "twig/twig": "<3.21" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/cache": "^1.0|^2.0|^3.0", + "symfony/browser-kit": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/css-selector": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/dom-crawler": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/http-client-contracts": "^2.5|^3", + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/routing": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0", + "symfony/stopwatch": "^7.4|^8.0", + "symfony/translation": "^7.4|^8.0", + "symfony/translation-contracts": "^2.5|^3", + "symfony/uid": "^7.4|^8.0", + "symfony/validator": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0", + "symfony/var-exporter": "^7.4|^8.0", + "twig/twig": "^3.21" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a structured process for converting a Request into a Response", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/http-kernel/tree/v8.0.12" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-20T09:47:36+00:00" + }, + { + "name": "symfony/mailer", + "version": "v8.0.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/mailer.git", + "reference": "5266d594e83593dff3492b5655ff6e8f38d67cfc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mailer/zipball/5266d594e83593dff3492b5655ff6e8f38d67cfc", + "reference": "5266d594e83593dff3492b5655ff6e8f38d67cfc", + "shasum": "" + }, + "require": { + "egulias/email-validator": "^2.1.10|^3|^4", + "php": ">=8.4", + "psr/event-dispatcher": "^1", + "psr/log": "^1|^2|^3", + "symfony/event-dispatcher": "^7.4|^8.0", + "symfony/mime": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/http-client-contracts": "<2.5" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", + "symfony/twig-bridge": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mailer\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Helps sending emails", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/mailer/tree/v8.0.12" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-20T07:22:03+00:00" + }, + { + "name": "symfony/mime", + "version": "v8.0.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/mime.git", + "reference": "7d9a72bbf0a9cb169ed1cbbbbbf709a592207fc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/mime/zipball/7d9a72bbf0a9cb169ed1cbbbbbf709a592207fc1", + "reference": "7d9a72bbf0a9cb169ed1cbbbbbf709a592207fc1", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-intl-idn": "^1.10", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "egulias/email-validator": "~3.0.0", + "phpdocumentor/reflection-docblock": "<5.2|>=7", + "phpdocumentor/type-resolver": "<1.5.1" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3.1|^4", + "league/html-to-markdown": "^5.0", + "phpdocumentor/reflection-docblock": "^5.2|^6.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/property-access": "^7.4|^8.0", + "symfony/property-info": "^7.4|^8.0", + "symfony/serializer": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Mime\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows manipulating MIME messages", + "homepage": "https://symfony.com", + "keywords": [ + "mime", + "mime-type" + ], + "support": { + "source": "https://github.com/symfony/mime/tree/v8.0.12" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-20T07:22:03+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T16:19:22+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/4864388bfbd3001ce88e234fab652acd91fdc57e", + "reference": "4864388bfbd3001ce88e234fab652acd91fdc57e", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-26T13:13:48+00:00" + }, + { + "name": "symfony/polyfill-intl-idn", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-idn.git", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "reference": "9614ac4d8061dc257ecc64cba1b140873dce8ad3", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Idn\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Laurent Bassin", + "email": "laurent@bassin.info" + }, + { + "name": "Trevor Rowbotham", + "email": "trevor.rowbotham@pm.me" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "idn", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-10T14:38:51+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6a21eb99c6973357967f6ce3708cd55a6bec6315", + "reference": "6a21eb99c6973357967f6ce3708cd55a6bec6315", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T17:25:58+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411", + "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T16:19:22+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/88486db2c389b290bf87ff1de7ebc1e13e42bb06", + "reference": "88486db2c389b290bf87ff1de7ebc1e13e42bb06", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T18:47:49+00:00" + }, + { + "name": "symfony/polyfill-php85", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php85.git", + "reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/fcfa4973a9917cef23f2e38774da74a2b7d115ee", + "reference": "fcfa4973a9917cef23f2e38774da74a2b7d115ee", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php85\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php85/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-26T13:10:57+00:00" + }, + { + "name": "symfony/polyfill-php86", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php86.git", + "reference": "33d8fc5a705481e21fe3a81212b26f9b1f61749c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php86/zipball/33d8fc5a705481e21fe3a81212b26f9b1f61749c", + "reference": "33d8fc5a705481e21fe3a81212b26f9b1f61749c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php86\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php86/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-26T13:13:48+00:00" + }, + { + "name": "symfony/polyfill-uuid", + "version": "v1.37.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-uuid.git", + "reference": "26dfec253c4cf3e51b541b52ddf7e42cb0908e94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/26dfec253c4cf3e51b541b52ddf7e42cb0908e94", + "reference": "26dfec253c4cf3e51b541b52ddf7e42cb0908e94", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-uuid": "*" + }, + "suggest": { + "ext-uuid": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Uuid\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for uuid functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/polyfill-uuid/tree/v1.37.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-10T16:19:22+00:00" + }, + { + "name": "symfony/process", + "version": "v8.0.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/26d89e459f037d2873300605d0a07e7a8ef84db0", + "reference": "26d89e459f037d2873300605d0a07e7a8ef84db0", + "shasum": "" + }, + "require": { + "php": ">=8.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v8.0.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-11T16:56:32+00:00" + }, + { + "name": "symfony/routing", + "version": "v8.0.12", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "c7f22a665faa3e5212b8f042e0c5831a6b85492f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/c7f22a665faa3e5212b8f042e0c5831a6b85492f", + "reference": "c7f22a665faa3e5212b8f042e0c5831a6b85492f", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/expression-language": "^7.4|^8.0", + "symfony/http-foundation": "^7.4|^8.0", + "symfony/yaml": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Maps an HTTP request to a set of configuration variables", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "support": { + "source": "https://github.com/symfony/routing/tree/v8.0.12" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-20T07:22:03+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d25d82433a80eba6aa0e6c24b61d7370d99e444a", + "reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-28T09:44:51+00:00" + }, + { + "name": "symfony/string", + "version": "v8.0.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/39be2ad058a3c0bd558edca23e65f009865d75ff", + "reference": "39be2ad058a3c0bd558edca23e65f009865d75ff", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-intl-grapheme": "^1.33", + "symfony/polyfill-intl-normalizer": "^1.0", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v8.0.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-13T12:07:53+00:00" + }, + { + "name": "symfony/translation", + "version": "v8.0.10", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation.git", + "reference": "f63e9342e12646a57c91ef8a366a4f9d8e557b67" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation/zipball/f63e9342e12646a57c91ef8a366a4f9d8e557b67", + "reference": "f63e9342e12646a57c91ef8a366a4f9d8e557b67", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.0", + "symfony/translation-contracts": "^3.6.1" + }, + "conflict": { + "nikic/php-parser": "<5.0", + "symfony/http-client-contracts": "<2.5", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "symfony/translation-implementation": "2.3|3.0" + }, + "require-dev": { + "nikic/php-parser": "^5.0", + "psr/log": "^1|^2|^3", + "symfony/config": "^7.4|^8.0", + "symfony/console": "^7.4|^8.0", + "symfony/dependency-injection": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", + "symfony/http-client-contracts": "^2.5|^3.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/intl": "^7.4|^8.0", + "symfony/polyfill-intl-icu": "^1.21", + "symfony/routing": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/yaml": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools to internationalize your application", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/translation/tree/v8.0.10" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-05-06T11:30:54+00:00" + }, + { + "name": "symfony/translation-contracts", + "version": "v3.7.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "0ab302977a952b42fd51475c4ebac81f8da0a95d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0ab302977a952b42fd51475c4ebac81f8da0a95d", + "reference": "0ab302977a952b42fd51475c4ebac81f8da0a95d", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-01-05T13:30:16+00:00" + }, + { + "name": "symfony/uid", + "version": "v8.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/uid.git", + "reference": "4d9d6510bbe88ebb4608b7200d18606cdf80825c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/uid/zipball/4d9d6510bbe88ebb4608b7200d18606cdf80825c", + "reference": "4d9d6510bbe88ebb4608b7200d18606cdf80825c", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-uuid": "^1.15" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Uid\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Grégoire Pineau", + "email": "lyrixx@lyrixx.info" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to generate and represent UIDs", + "homepage": "https://symfony.com", + "keywords": [ + "UID", + "ulid", + "uuid" + ], + "support": { + "source": "https://github.com/symfony/uid/tree/v8.0.9" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-30T16:10:06+00:00" + }, + { + "name": "symfony/var-dumper", + "version": "v8.0.8", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-dumper.git", + "reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cfb7badd53bf4177f6e9416cfbbccc13c0e773a1", + "reference": "cfb7badd53bf4177f6e9416cfbbccc13c0e773a1", + "shasum": "" + }, + "require": { + "php": ">=8.4", + "symfony/polyfill-mbstring": "^1.0" + }, + "conflict": { + "symfony/console": "<7.4", + "symfony/error-handler": "<7.4" + }, + "require-dev": { + "symfony/console": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/process": "^7.4|^8.0", + "symfony/uid": "^7.4|^8.0", + "twig/twig": "^3.12" + }, + "bin": [ + "Resources/bin/var-dump-server" + ], + "type": "library", + "autoload": { + "files": [ + "Resources/functions/dump.php" + ], + "psr-4": { + "Symfony\\Component\\VarDumper\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides mechanisms for walking through any arbitrary PHP variable", + "homepage": "https://symfony.com", + "keywords": [ + "debug", + "dump" + ], + "support": { + "source": "https://github.com/symfony/var-dumper/tree/v8.0.8" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-03-31T07:15:36+00:00" + }, + { + "name": "thecodingmachine/safe", + "version": "v3.4.0", + "source": { + "type": "git", + "url": "https://github.com/thecodingmachine/safe.git", + "reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/705683a25bacf0d4860c7dea4d7947bfd09eea19", + "reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19", + "shasum": "" + }, + "require": { + "php": "^8.1" + }, + "require-dev": { + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpstan/phpstan": "^2", + "phpunit/phpunit": "^10", + "squizlabs/php_codesniffer": "^3.2" + }, + "type": "library", + "autoload": { + "files": [ + "lib/special_cases.php", + "generated/apache.php", + "generated/apcu.php", + "generated/array.php", + "generated/bzip2.php", + "generated/calendar.php", + "generated/classobj.php", + "generated/com.php", + "generated/cubrid.php", + "generated/curl.php", + "generated/datetime.php", + "generated/dir.php", + "generated/eio.php", + "generated/errorfunc.php", + "generated/exec.php", + "generated/fileinfo.php", + "generated/filesystem.php", + "generated/filter.php", + "generated/fpm.php", + "generated/ftp.php", + "generated/funchand.php", + "generated/gettext.php", + "generated/gmp.php", + "generated/gnupg.php", + "generated/hash.php", + "generated/ibase.php", + "generated/ibmDb2.php", + "generated/iconv.php", + "generated/image.php", + "generated/imap.php", + "generated/info.php", + "generated/inotify.php", + "generated/json.php", + "generated/ldap.php", + "generated/libxml.php", + "generated/lzf.php", + "generated/mailparse.php", + "generated/mbstring.php", + "generated/misc.php", + "generated/mysql.php", + "generated/mysqli.php", + "generated/network.php", + "generated/oci8.php", + "generated/opcache.php", + "generated/openssl.php", + "generated/outcontrol.php", + "generated/pcntl.php", + "generated/pcre.php", + "generated/pgsql.php", + "generated/posix.php", + "generated/ps.php", + "generated/pspell.php", + "generated/readline.php", + "generated/rnp.php", + "generated/rpminfo.php", + "generated/rrd.php", + "generated/sem.php", + "generated/session.php", + "generated/shmop.php", + "generated/sockets.php", + "generated/sodium.php", + "generated/solr.php", + "generated/spl.php", + "generated/sqlsrv.php", + "generated/ssdeep.php", + "generated/ssh2.php", + "generated/stream.php", + "generated/strings.php", + "generated/swoole.php", + "generated/uodbc.php", + "generated/uopz.php", + "generated/url.php", + "generated/var.php", + "generated/xdiff.php", + "generated/xml.php", + "generated/xmlrpc.php", + "generated/yaml.php", + "generated/yaz.php", + "generated/zip.php", + "generated/zlib.php" + ], + "classmap": [ + "lib/DateTime.php", + "lib/DateTimeImmutable.php", + "lib/Exceptions/", + "generated/Exceptions/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHP core functions that throw exceptions instead of returning FALSE on error", + "support": { + "issues": "https://github.com/thecodingmachine/safe/issues", + "source": "https://github.com/thecodingmachine/safe/tree/v3.4.0" + }, + "funding": [ + { + "url": "https://github.com/OskarStark", + "type": "github" + }, + { + "url": "https://github.com/shish", + "type": "github" + }, + { + "url": "https://github.com/silasjoisten", + "type": "github" + }, + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2026-02-04T18:08:13+00:00" + }, + { + "name": "tightenco/ziggy", + "version": "v2.6.2", + "source": { + "type": "git", + "url": "https://github.com/tighten/ziggy.git", + "reference": "8a0b645921623f77dceaf543d61ecd51a391d96e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tighten/ziggy/zipball/8a0b645921623f77dceaf543d61ecd51a391d96e", + "reference": "8a0b645921623f77dceaf543d61ecd51a391d96e", + "shasum": "" + }, + "require": { + "ext-json": "*", + "laravel/framework": ">=9.0", + "php": ">=8.1" + }, + "require-dev": { + "laravel/folio": "^1.1", + "orchestra/testbench": "^8.0 || ^9.0 || ^10.0", + "pestphp/pest": "^2.0 || ^3.0 || ^4.0", + "pestphp/pest-plugin-laravel": "^2.0 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Tighten\\Ziggy\\ZiggyServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Tighten\\Ziggy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Coulbourne", + "email": "daniel@tighten.co" + }, + { + "name": "Jake Bathman", + "email": "jake@tighten.co" + }, + { + "name": "Jacob Baker-Kretzmar", + "email": "jacob@tighten.co" + } + ], + "description": "Use your Laravel named routes in JavaScript.", + "homepage": "https://github.com/tighten/ziggy", + "keywords": [ + "Ziggy", + "javascript", + "laravel", + "routes" + ], + "support": { + "issues": "https://github.com/tighten/ziggy/issues", + "source": "https://github.com/tighten/ziggy/tree/v2.6.2" + }, + "time": "2026-03-05T14:41:19+00:00" + }, + { + "name": "tijsverkoyen/css-to-inline-styles", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/tijsverkoyen/CssToInlineStyles.git", + "reference": "f0292ccf0ec75843d65027214426b6b163b48b41" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/f0292ccf0ec75843d65027214426b6b163b48b41", + "reference": "f0292ccf0ec75843d65027214426b6b163b48b41", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "php": "^7.4 || ^8.0", + "symfony/css-selector": "^5.4 || ^6.0 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^8.5.21 || ^9.5.10" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "TijsVerkoyen\\CssToInlineStyles\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Tijs Verkoyen", + "email": "css_to_inline_styles@verkoyen.eu", + "role": "Developer" + } + ], + "description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.", + "homepage": "https://github.com/tijsverkoyen/CssToInlineStyles", + "support": { + "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", + "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.4.0" + }, + "time": "2025-12-02T11:56:42+00:00" + }, + { + "name": "vlucas/phpdotenv", + "version": "v5.6.3", + "source": { + "type": "git", + "url": "https://github.com/vlucas/phpdotenv.git", + "reference": "955e7815d677a3eaa7075231212f2110983adecc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/955e7815d677a3eaa7075231212f2110983adecc", + "reference": "955e7815d677a3eaa7075231212f2110983adecc", + "shasum": "" + }, + "require": { + "ext-pcre": "*", + "graham-campbell/result-type": "^1.1.4", + "php": "^7.2.5 || ^8.0", + "phpoption/phpoption": "^1.9.5", + "symfony/polyfill-ctype": "^1.26", + "symfony/polyfill-mbstring": "^1.26", + "symfony/polyfill-php80": "^1.26" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-filter": "*", + "phpunit/phpunit": "^8.5.34 || ^9.6.13 || ^10.4.2" + }, + "suggest": { + "ext-filter": "Required to use the boolean validator." + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + }, + "branch-alias": { + "dev-master": "5.6-dev" + } + }, + "autoload": { + "psr-4": { + "Dotenv\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Vance Lucas", + "email": "vance@vancelucas.com", + "homepage": "https://github.com/vlucas" + } + ], + "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", + "keywords": [ + "dotenv", + "env", + "environment" + ], + "support": { + "issues": "https://github.com/vlucas/phpdotenv/issues", + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.3" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/vlucas/phpdotenv", + "type": "tidelift" + } + ], + "time": "2025-12-27T19:49:13+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "8e1051fe39379367aecf014f41744ce7539a856f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/8e1051fe39379367aecf014f41744ce7539a856f", + "reference": "8e1051fe39379367aecf014f41744ce7539a856f", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpunit/phpunit": "~8.5 || ~9.6 || ~10.5 || ~11.5" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "https://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/2.1.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "time": "2026-04-26T05:33:54+00:00" + } + ], + "packages-dev": [ + { + "name": "brianium/paratest", + "version": "v7.20.0", + "source": { + "type": "git", + "url": "https://github.com/paratestphp/paratest.git", + "reference": "81c80677c9ec0ed4ef16b246167f11dec81a6e3d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/81c80677c9ec0ed4ef16b246167f11dec81a6e3d", + "reference": "81c80677c9ec0ed4ef16b246167f11dec81a6e3d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-simplexml": "*", + "fidry/cpu-core-counter": "^1.3.0", + "jean85/pretty-package-versions": "^2.1.1", + "php": "~8.3.0 || ~8.4.0 || ~8.5.0", + "phpunit/php-code-coverage": "^12.5.3 || ^13.0.1", + "phpunit/php-file-iterator": "^6.0.1 || ^7", + "phpunit/php-timer": "^8 || ^9", + "phpunit/phpunit": "^12.5.14 || ^13.0.5", + "sebastian/environment": "^8.0.3 || ^9", + "symfony/console": "^7.4.7 || ^8.0.7", + "symfony/process": "^7.4.5 || ^8.0.5" + }, + "require-dev": { + "doctrine/coding-standard": "^14.0.0", + "ext-pcntl": "*", + "ext-pcov": "*", + "ext-posix": "*", + "phpstan/phpstan": "^2.1.44", + "phpstan/phpstan-deprecation-rules": "^2.0.4", + "phpstan/phpstan-phpunit": "^2.0.16", + "phpstan/phpstan-strict-rules": "^2.0.10", + "symfony/filesystem": "^7.4.6 || ^8.0.6" + }, + "bin": [ + "bin/paratest", + "bin/paratest_for_phpstorm" + ], + "type": "library", + "autoload": { + "psr-4": { + "ParaTest\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Scaturro", + "email": "scaturrob@gmail.com", + "role": "Developer" + }, + { + "name": "Filippo Tessarotto", + "email": "zoeslam@gmail.com", + "role": "Developer" + } + ], + "description": "Parallel testing for PHP", + "homepage": "https://github.com/paratestphp/paratest", + "keywords": [ + "concurrent", + "parallel", + "phpunit", + "testing" + ], + "support": { + "issues": "https://github.com/paratestphp/paratest/issues", + "source": "https://github.com/paratestphp/paratest/tree/v7.20.0" + }, + "funding": [ + { + "url": "https://github.com/sponsors/Slamdunk", + "type": "github" + }, + { + "url": "https://paypal.me/filippotessarotto", + "type": "paypal" + } + ], + "time": "2026-03-29T15:46:14+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.6", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=14" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" + }, + "time": "2026-02-07T07:09:04+00:00" + }, + { + "name": "fakerphp/faker", + "version": "v1.24.1", + "source": { + "type": "git", + "url": "https://github.com/FakerPHP/Faker.git", + "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5", + "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "conflict": { + "fzaninotto/faker": "*" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", + "doctrine/persistence": "^1.3 || ^2.0", + "ext-intl": "*", + "phpunit/phpunit": "^9.5.26", + "symfony/phpunit-bridge": "^5.4.16" + }, + "suggest": { + "doctrine/orm": "Required to use Faker\\ORM\\Doctrine", + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." + }, + "type": "library", + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "support": { + "issues": "https://github.com/FakerPHP/Faker/issues", + "source": "https://github.com/FakerPHP/Faker/tree/v1.24.1" + }, + "time": "2024-11-21T13:46:39+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-08-14T07:29:31+00:00" + }, + { + "name": "filp/whoops", + "version": "2.18.4", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/d2102955e48b9fd9ab24280a7ad12ed552752c4d", + "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "support": { + "issues": "https://github.com/filp/whoops/issues", + "source": "https://github.com/filp/whoops/tree/2.18.4" + }, + "funding": [ + { + "url": "https://github.com/denis-sokolov", + "type": "github" + } + ], + "time": "2025-08-08T12:00:00+00:00" + }, + { + "name": "hamcrest/hamcrest-php", + "version": "v2.1.1", + "source": { + "type": "git", + "url": "https://github.com/hamcrest/hamcrest-php.git", + "reference": "f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/hamcrest/hamcrest-php/zipball/f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487", + "reference": "f8b1c0173b22fa6ec77a81fe63e5b01eba7e6487", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "replace": { + "cordoval/hamcrest-php": "*", + "davedevelopment/hamcrest-php": "*", + "kodova/hamcrest-php": "*" + }, + "require-dev": { + "phpunit/php-file-iterator": "^1.4 || ^2.0 || ^3.0", + "phpunit/phpunit": "^4.8.36 || ^5.7 || ^6.5 || ^7.0 || ^8.0 || ^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "hamcrest" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "This is the PHP port of Hamcrest Matchers", + "keywords": [ + "test" + ], + "support": { + "issues": "https://github.com/hamcrest/hamcrest-php/issues", + "source": "https://github.com/hamcrest/hamcrest-php/tree/v2.1.1" + }, + "time": "2025-04-30T06:54:44+00:00" + }, + { + "name": "jean85/pretty-package-versions", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.1.0", + "php": "^7.4|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "jean85/composer-provided-replaced-stub-package": "^1.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^7.5|^8.5|^9.6", + "rector/rector": "^2.0", + "vimeo/psalm": "^4.3 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A library to get pretty versions strings of installed dependencies", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "support": { + "issues": "https://github.com/Jean85/pretty-package-versions/issues", + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" + }, + "time": "2025-03-19T14:43:43+00:00" + }, + { + "name": "laravel/agent-detector", + "version": "v2.0.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/agent-detector.git", + "reference": "90694b9256099591cf9e55d08c18ba7a00bf099f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/agent-detector/zipball/90694b9256099591cf9e55d08c18ba7a00bf099f", + "reference": "90694b9256099591cf9e55d08c18ba7a00bf099f", + "shasum": "" + }, + "require": { + "php": "^8.2.0" + }, + "require-dev": { + "laravel/pint": "^1.24.0", + "pestphp/pest": "^3.8.5|^4.1.0", + "pestphp/pest-plugin-type-coverage": "^3.0|^4.0.2", + "phpstan/phpstan": "^2.1.26", + "rector/rector": "^2.1.7", + "symfony/var-dumper": "^7.3.3" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Laravel\\AgentDetector\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Detect if code is running in an AI agent or automated development environment", + "homepage": "https://github.com/laravel/agent-detector", + "keywords": [ + "Agent", + "ai", + "automation", + "claude", + "cursor", + "detection", + "devin", + "php" + ], + "support": { + "issues": "https://github.com/laravel/agent-detector/issues", + "source": "https://github.com/laravel/agent-detector" + }, + "time": "2026-04-29T18:32:34+00:00" + }, + { + "name": "laravel/breeze", + "version": "v2.4.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/breeze.git", + "reference": "4f20e7b2cc8d25daa85d8647241a89c8e0930305" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/breeze/zipball/4f20e7b2cc8d25daa85d8647241a89c8e0930305", + "reference": "4f20e7b2cc8d25daa85d8647241a89c8e0930305", + "shasum": "" + }, + "require": { + "illuminate/console": "^11.0|^12.0|^13.0", + "illuminate/filesystem": "^11.0|^12.0|^13.0", + "illuminate/support": "^11.0|^12.0|^13.0", + "illuminate/validation": "^11.0|^12.0|^13.0", + "php": "^8.2.0", + "symfony/console": "^7.0|^8.0" + }, + "require-dev": { + "laravel/framework": "^11.0|^12.0|^13.0", + "orchestra/testbench-core": "^9.0|^10.0|^11.0", + "phpstan/phpstan": "^2.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Breeze\\BreezeServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Laravel\\Breeze\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Minimal Laravel authentication scaffolding with Blade and Tailwind.", + "keywords": [ + "auth", + "laravel" + ], + "support": { + "issues": "https://github.com/laravel/breeze/issues", + "source": "https://github.com/laravel/breeze" + }, + "time": "2026-05-14T16:54:25+00:00" + }, + { + "name": "laravel/pail", + "version": "v1.2.6", + "source": { + "type": "git", + "url": "https://github.com/laravel/pail.git", + "reference": "aa71a01c309e7f66bc2ec4fb1a59291b82eb4abf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pail/zipball/aa71a01c309e7f66bc2ec4fb1a59291b82eb4abf", + "reference": "aa71a01c309e7f66bc2ec4fb1a59291b82eb4abf", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "illuminate/console": "^10.24|^11.0|^12.0|^13.0", + "illuminate/contracts": "^10.24|^11.0|^12.0|^13.0", + "illuminate/log": "^10.24|^11.0|^12.0|^13.0", + "illuminate/process": "^10.24|^11.0|^12.0|^13.0", + "illuminate/support": "^10.24|^11.0|^12.0|^13.0", + "nunomaduro/termwind": "^1.15|^2.0", + "php": "^8.2", + "symfony/console": "^6.0|^7.0|^8.0" + }, + "require-dev": { + "laravel/framework": "^10.24|^11.0|^12.0|^13.0", + "laravel/pint": "^1.13", + "orchestra/testbench-core": "^8.13|^9.17|^10.8|^11.0", + "pestphp/pest": "^2.20|^3.0|^4.0", + "pestphp/pest-plugin-type-coverage": "^2.3|^3.0|^4.0", + "phpstan/phpstan": "^1.12.27", + "symfony/var-dumper": "^6.3|^7.0|^8.0", + "symfony/yaml": "^6.3|^7.0|^8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Laravel\\Pail\\PailServiceProvider" + ] + }, + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Pail\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + }, + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Easily delve into your Laravel application's log files directly from the command line.", + "homepage": "https://github.com/laravel/pail", + "keywords": [ + "dev", + "laravel", + "logs", + "php", + "tail" + ], + "support": { + "issues": "https://github.com/laravel/pail/issues", + "source": "https://github.com/laravel/pail" + }, + "time": "2026-02-09T13:44:54+00:00" + }, + { + "name": "laravel/pao", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/laravel/pao.git", + "reference": "02f62a64c2b60af44a418ee490fee193590d8269" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pao/zipball/02f62a64c2b60af44a418ee490fee193590d8269", + "reference": "02f62a64c2b60af44a418ee490fee193590d8269", + "shasum": "" + }, + "require": { + "laravel/agent-detector": "^2.0.0", + "php": "^8.3" + }, + "conflict": { + "laravel/framework": "<12.0.0", + "nunomaduro/collision": "<8.9.3", + "pestphp/pest": "<4.6.3 || >=6.0.0", + "phpunit/phpunit": "<12.5.23 || >=13.0.0 <13.1.7 || >=14.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.20.0", + "laravel/pint": "^1.29.1", + "orchestra/testbench": "^10.11.0 || ^11.1.0", + "pestphp/pest": "^4.6.3 || ^5.0.0", + "pestphp/pest-plugin-type-coverage": "^4.0.4 || ^5.0.0", + "phpstan/phpstan": "^2.1.51", + "rector/rector": "^2.4.2", + "symfony/process": "^7.4.8 || ^8.1.0", + "symfony/var-dumper": "^7.4.8 || ^8.0.8" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Laravel\\Pao\\Drivers\\Pest\\Plugin" + ] + }, + "laravel": { + "providers": [ + "Laravel\\Pao\\Laravel\\ServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/Autoload.php" + ], + "psr-4": { + "Laravel\\Pao\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Agent-optimized output for PHP testing tools", + "keywords": [ + "Agent", + "PHPStan", + "ai", + "dev", + "paratest", + "pest", + "php", + "phpunit", + "testing" + ], + "support": { + "issues": "https://github.com/laravel/pao/issues", + "source": "https://github.com/laravel/pao" + }, + "time": "2026-04-27T22:37:26+00:00" + }, + { + "name": "laravel/pint", + "version": "v1.29.1", + "source": { + "type": "git", + "url": "https://github.com/laravel/pint.git", + "reference": "0770e9b7fafd50d4586881d456d6eb41c9247a80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/pint/zipball/0770e9b7fafd50d4586881d456d6eb41c9247a80", + "reference": "0770e9b7fafd50d4586881d456d6eb41c9247a80", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-mbstring": "*", + "ext-tokenizer": "*", + "ext-xml": "*", + "php": "^8.2.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.95.1", + "illuminate/view": "^12.56.0", + "larastan/larastan": "^3.9.6", + "laravel-zero/framework": "^12.1.0", + "mockery/mockery": "^1.6.12", + "nunomaduro/termwind": "^2.4.0", + "pestphp/pest": "^3.8.6", + "shipfastlabs/agent-detector": "^1.1.3" + }, + "bin": [ + "builds/pint" + ], + "type": "project", + "autoload": { + "psr-4": { + "App\\": "app/", + "Database\\Seeders\\": "database/seeders/", + "Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "An opinionated code formatter for PHP.", + "homepage": "https://laravel.com", + "keywords": [ + "dev", + "format", + "formatter", + "lint", + "linter", + "php" + ], + "support": { + "issues": "https://github.com/laravel/pint/issues", + "source": "https://github.com/laravel/pint" + }, + "time": "2026-04-20T15:26:14+00:00" + }, + { + "name": "mockery/mockery", + "version": "1.6.12", + "source": { + "type": "git", + "url": "https://github.com/mockery/mockery.git", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "shasum": "" + }, + "require": { + "hamcrest/hamcrest-php": "^2.0.1", + "lib-pcre": ">=7.0", + "php": ">=7.3" + }, + "conflict": { + "phpunit/phpunit": "<8.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" + }, + "type": "library", + "autoload": { + "files": [ + "library/helpers.php", + "library/Mockery.php" + ], + "psr-4": { + "Mockery\\": "library/Mockery" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "https://github.com/padraic", + "role": "Author" + }, + { + "name": "Dave Marshall", + "email": "dave.marshall@atstsolutions.co.uk", + "homepage": "https://davedevelopment.co.uk", + "role": "Developer" + }, + { + "name": "Nathanael Esayeas", + "email": "nathanael.esayeas@protonmail.com", + "homepage": "https://github.com/ghostwriter", + "role": "Lead Developer" + } + ], + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", + "keywords": [ + "BDD", + "TDD", + "library", + "mock", + "mock objects", + "mockery", + "stub", + "test", + "test double", + "testing" + ], + "support": { + "docs": "https://docs.mockery.io/", + "issues": "https://github.com/mockery/mockery/issues", + "rss": "https://github.com/mockery/mockery/releases.atom", + "security": "https://github.com/mockery/mockery/security/advisories", + "source": "https://github.com/mockery/mockery" + }, + "time": "2024-05-16T03:13:13+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.13.4", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2025-08-01T08:46:24+00:00" + }, + { + "name": "nunomaduro/collision", + "version": "v8.9.4", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/collision.git", + "reference": "716af8f95a470e9094cfca09ed897b023be191a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/716af8f95a470e9094cfca09ed897b023be191a5", + "reference": "716af8f95a470e9094cfca09ed897b023be191a5", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.18.4", + "nunomaduro/termwind": "^2.4.0", + "php": "^8.2.0", + "symfony/console": "^7.4.8 || ^8.0.8" + }, + "conflict": { + "laravel/framework": "<11.48.0 || >=14.0.0", + "phpunit/phpunit": "<11.5.50 || >=14.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.8.5", + "larastan/larastan": "^3.9.6", + "laravel/framework": "^11.48.0 || ^12.56.0 || ^13.5.0", + "laravel/pint": "^1.29.1", + "orchestra/testbench-core": "^9.12.0 || ^10.12.1 || ^11.2.1", + "pestphp/pest": "^3.8.5 || ^4.4.3 || ^5.0.0", + "sebastian/environment": "^7.2.1 || ^8.0.4 || ^9.3.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + }, + "branch-alias": { + "dev-8.x": "8.x-dev" + } + }, + "autoload": { + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ], + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "dev", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2026-04-21T14:04:20+00:00" + }, + { + "name": "pestphp/pest", + "version": "v4.7.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest.git", + "reference": "2fc75cfcf03c041c804778fa894282234adc3c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest/zipball/2fc75cfcf03c041c804778fa894282234adc3c66", + "reference": "2fc75cfcf03c041c804778fa894282234adc3c66", + "shasum": "" + }, + "require": { + "brianium/paratest": "^7.20.0", + "composer/xdebug-handler": "^3.0.5", + "nunomaduro/collision": "^8.9.4", + "nunomaduro/termwind": "^2.4.0", + "pestphp/pest-plugin": "^4.0.0", + "pestphp/pest-plugin-arch": "^4.0.2", + "pestphp/pest-plugin-mutate": "^4.0.1", + "pestphp/pest-plugin-profanity": "^4.2.1", + "php": "^8.3.0", + "phpunit/phpunit": "^12.5.24", + "symfony/process": "^7.4.8|^8.0.8" + }, + "conflict": { + "filp/whoops": "<2.18.3", + "phpunit/phpunit": ">12.5.24", + "sebastian/exporter": "<7.0.0", + "webmozart/assert": "<1.11.0" + }, + "require-dev": { + "mrpunyapal/peststan": "^0.2.9", + "pestphp/pest-dev-tools": "^4.1.0", + "pestphp/pest-plugin-browser": "^4.3.1", + "pestphp/pest-plugin-type-coverage": "^4.0.4", + "psy/psysh": "^0.12.22" + }, + "bin": [ + "bin/pest" + ], + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Mutate\\Plugins\\Mutate", + "Pest\\Plugins\\Configuration", + "Pest\\Plugins\\Bail", + "Pest\\Plugins\\Cache", + "Pest\\Plugins\\Coverage", + "Pest\\Plugins\\Init", + "Pest\\Plugins\\Environment", + "Pest\\Plugins\\Help", + "Pest\\Plugins\\Memory", + "Pest\\Plugins\\Only", + "Pest\\Plugins\\Printer", + "Pest\\Plugins\\ProcessIsolation", + "Pest\\Plugins\\Profile", + "Pest\\Plugins\\Retry", + "Pest\\Plugins\\Snapshot", + "Pest\\Plugins\\Verbose", + "Pest\\Plugins\\Version", + "Pest\\Plugins\\Shard", + "Pest\\Plugins\\Tia", + "Pest\\Plugins\\Parallel" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "files": [ + "src/Functions.php", + "src/Pest.php" + ], + "psr-4": { + "Pest\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "The elegant PHP Testing Framework.", + "keywords": [ + "framework", + "pest", + "php", + "test", + "testing", + "unit" + ], + "support": { + "issues": "https://github.com/pestphp/pest/issues", + "source": "https://github.com/pestphp/pest/tree/v4.7.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2026-05-03T16:09:32+00:00" + }, + { + "name": "pestphp/pest-plugin", + "version": "v4.0.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin.git", + "reference": "9d4b93d7f73d3f9c3189bb22c220fef271cdf568" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin/zipball/9d4b93d7f73d3f9c3189bb22c220fef271cdf568", + "reference": "9d4b93d7f73d3f9c3189bb22c220fef271cdf568", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0.0", + "composer-runtime-api": "^2.2.2", + "php": "^8.3" + }, + "conflict": { + "pestphp/pest": "<4.0.0" + }, + "require-dev": { + "composer/composer": "^2.8.10", + "pestphp/pest": "^4.0.0", + "pestphp/pest-dev-tools": "^4.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Pest\\Plugin\\Manager" + }, + "autoload": { + "psr-4": { + "Pest\\Plugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest plugin manager", + "keywords": [ + "framework", + "manager", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin/tree/v4.0.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2025-08-20T12:35:58+00:00" + }, + { + "name": "pestphp/pest-plugin-arch", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-arch.git", + "reference": "3fb0d02a91b9da504b139dc7ab2a31efb7c3215c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/3fb0d02a91b9da504b139dc7ab2a31efb7c3215c", + "reference": "3fb0d02a91b9da504b139dc7ab2a31efb7c3215c", + "shasum": "" + }, + "require": { + "pestphp/pest-plugin": "^4.0.0", + "php": "^8.3", + "ta-tikoma/phpunit-architecture-test": "^0.8.7" + }, + "require-dev": { + "pestphp/pest": "^4.4.6", + "pestphp/pest-dev-tools": "^4.1.0" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Arch\\Plugin" + ] + } + }, + "autoload": { + "files": [ + "src/Autoload.php" + ], + "psr-4": { + "Pest\\Arch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Arch plugin for Pest PHP.", + "keywords": [ + "arch", + "architecture", + "framework", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-arch/tree/v4.0.2" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2026-04-10T17:20:19+00:00" + }, + { + "name": "pestphp/pest-plugin-laravel", + "version": "v4.1.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-laravel.git", + "reference": "3057a36669ff11416cc0dc2b521b3aec58c488d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-laravel/zipball/3057a36669ff11416cc0dc2b521b3aec58c488d0", + "reference": "3057a36669ff11416cc0dc2b521b3aec58c488d0", + "shasum": "" + }, + "require": { + "laravel/framework": "^11.45.2|^12.52.0|^13.0", + "pestphp/pest": "^4.4.1", + "php": "^8.3.0" + }, + "require-dev": { + "laravel/dusk": "^8.3.6", + "orchestra/testbench": "^9.13.0|^10.9.0|^11.0", + "pestphp/pest-dev-tools": "^4.1.0" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Laravel\\Plugin" + ] + }, + "laravel": { + "providers": [ + "Pest\\Laravel\\PestServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/Autoload.php" + ], + "psr-4": { + "Pest\\Laravel\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest Laravel Plugin", + "keywords": [ + "framework", + "laravel", + "pest", + "php", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-laravel/tree/v4.1.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2026-02-21T00:29:45+00:00" + }, + { + "name": "pestphp/pest-plugin-mutate", + "version": "v4.0.1", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-mutate.git", + "reference": "d9b32b60b2385e1688a68cc227594738ec26d96c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-mutate/zipball/d9b32b60b2385e1688a68cc227594738ec26d96c", + "reference": "d9b32b60b2385e1688a68cc227594738ec26d96c", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.6.1", + "pestphp/pest-plugin": "^4.0.0", + "php": "^8.3", + "psr/simple-cache": "^3.0.0" + }, + "require-dev": { + "pestphp/pest": "^4.0.0", + "pestphp/pest-dev-tools": "^4.0.0", + "pestphp/pest-plugin-type-coverage": "^4.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pest\\Mutate\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + }, + { + "name": "Sandro Gehri", + "email": "sandrogehri@gmail.com" + } + ], + "description": "Mutates your code to find untested cases", + "keywords": [ + "framework", + "mutate", + "mutation", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-mutate/tree/v4.0.1" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/gehrisandro", + "type": "github" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2025-08-21T20:19:25+00:00" + }, + { + "name": "pestphp/pest-plugin-profanity", + "version": "v4.2.1", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-profanity.git", + "reference": "343cfa6f3564b7e35df0ebb77b7fa97039f72b27" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-profanity/zipball/343cfa6f3564b7e35df0ebb77b7fa97039f72b27", + "reference": "343cfa6f3564b7e35df0ebb77b7fa97039f72b27", + "shasum": "" + }, + "require": { + "pestphp/pest-plugin": "^4.0.0", + "php": "^8.3" + }, + "require-dev": { + "faissaloux/pest-plugin-inside": "^1.9", + "pestphp/pest": "^4.0.0", + "pestphp/pest-dev-tools": "^4.0.0" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Profanity\\Plugin" + ] + } + }, + "autoload": { + "psr-4": { + "Pest\\Profanity\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest Profanity Plugin", + "keywords": [ + "framework", + "pest", + "php", + "plugin", + "profanity", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-profanity/tree/v4.2.1" + }, + "time": "2025-12-08T00:13:17+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "6.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/7bae67520aa9f5ecc506d646810bd40d9da54582", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.1", + "ext-filter": "*", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^2.0", + "phpstan/phpdoc-parser": "^2.0", + "webmozart/assert": "^1.9.1 || ^2" + }, + "require-dev": { + "mockery/mockery": "~1.3.5 || ~1.6.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^5.26", + "shipmonk/dead-code-detector": "^0.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" + }, + "time": "2026-03-18T20:49:53+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/327a05bbee54120d4786a0dc67aad30226ad4cf9", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.0.0" + }, + "time": "2026-01-06T21:53:42+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "2.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.2" + }, + "time": "2026-01-25T14:56:51+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "12.5.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "876099a072646c7745f673d7aeab5382c4439691" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/876099a072646c7745f673d7aeab5382c4439691", + "reference": "876099a072646c7745f673d7aeab5382c4439691", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^5.7.0", + "php": ">=8.3", + "phpunit/php-text-template": "^5.0", + "sebastian/complexity": "^5.0", + "sebastian/environment": "^8.0.3", + "sebastian/lines-of-code": "^4.0", + "sebastian/version": "^6.0", + "theseer/tokenizer": "^2.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.1" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "12.5.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.6" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" + } + ], + "time": "2026-04-15T08:23:17+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5", + "reference": "3d1cd096ef6bea4bf2762ba586e35dbd317cbfd5", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" + } + ], + "time": "2026-02-02T14:04:18+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "reference": "12b54e689b07a25a9b41e57736dfab6ec9ae5406", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^12.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:58:58+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/e1367a453f0eda562eedb4f659e13aa900d66c53", + "reference": "e1367a453f0eda562eedb4f659e13aa900d66c53", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:59:16+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "8.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "reference": "f258ce36aa457f3aa3339f9ed4c81fc66dc8c2cc", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/8.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:59:38+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "12.5.24", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "d75dd30597caa80e72fad2ef7904601a30ef1046" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d75dd30597caa80e72fad2ef7904601a30ef1046", + "reference": "d75dd30597caa80e72fad2ef7904601a30ef1046", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.3", + "phpunit/php-code-coverage": "^12.5.6", + "phpunit/php-file-iterator": "^6.0.1", + "phpunit/php-invoker": "^6.0.0", + "phpunit/php-text-template": "^5.0.0", + "phpunit/php-timer": "^8.0.0", + "sebastian/cli-parser": "^4.2.0", + "sebastian/comparator": "^7.1.6", + "sebastian/diff": "^7.0.0", + "sebastian/environment": "^8.1.0", + "sebastian/exporter": "^7.0.2", + "sebastian/global-state": "^8.0.2", + "sebastian/object-enumerator": "^7.0.0", + "sebastian/recursion-context": "^7.0.1", + "sebastian/type": "^6.0.3", + "sebastian/version": "^6.0.0", + "staabm/side-effects-detector": "^1.0.5" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "12.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.24" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsoring.html", + "type": "other" + } + ], + "time": "2026-05-01T04:21:04+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "4.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "7d05781b13f7dec9043a629a21d086ed74582a15" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/7d05781b13f7dec9043a629a21d086ed74582a15", + "reference": "7d05781b13f7dec9043a629a21d086ed74582a15", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/4.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/cli-parser", + "type": "tidelift" + } + ], + "time": "2026-05-17T05:29:34+00:00" + }, + { + "name": "sebastian/comparator", + "version": "7.1.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "7c65c1e79836812819705b473a90c12399542485" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/7c65c1e79836812819705b473a90c12399542485", + "reference": "7c65c1e79836812819705b473a90c12399542485", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.3", + "sebastian/diff": "^7.0", + "sebastian/exporter": "^7.0.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/7.1.8" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-05-21T04:45:25+00:00" + }, + { + "name": "sebastian/complexity", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/bad4316aba5303d0221f43f8cee37eb58d384bbb", + "reference": "bad4316aba5303d0221f43f8cee37eb58d384bbb", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:55:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "7.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7ab1ea946c012266ca32390913653d844ecd085f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f", + "reference": "7ab1ea946c012266ca32390913653d844ecd085f", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0", + "symfony/process": "^7.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/7.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:55:46+00:00" + }, + { + "name": "sebastian/environment", + "version": "8.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "334bc42a97ec6fc44c59001dc3467e0d739a20e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/334bc42a97ec6fc44c59001dc3467e0d739a20e9", + "reference": "334bc42a97ec6fc44c59001dc3467e0d739a20e9", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/8.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" + } + ], + "time": "2026-05-21T08:45:32+00:00" + }, + { + "name": "sebastian/exporter", + "version": "7.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "c5e21b5de653ce0a769fb36f5cdfcb5e7a32cf23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c5e21b5de653ce0a769fb36f5cdfcb5e7a32cf23", + "reference": "c5e21b5de653ce0a769fb36f5cdfcb5e7a32cf23", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.3", + "sebastian/recursion-context": "^7.0.1" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/7.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2026-05-20T04:37:17+00:00" + }, + { + "name": "sebastian/global-state", + "version": "8.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "ef1377171613d09edd25b7816f05be8313f9115d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/ef1377171613d09edd25b7816f05be8313f9115d", + "reference": "ef1377171613d09edd25b7816f05be8313f9115d", + "shasum": "" + }, + "require": { + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "8.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/8.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/global-state", + "type": "tidelift" + } + ], + "time": "2025-08-29T11:29:25+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "d543b8ef219dcd8da262cbb958639a96bedba10e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d543b8ef219dcd8da262cbb958639a96bedba10e", + "reference": "d543b8ef219dcd8da262cbb958639a96bedba10e", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.7.0", + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/lines-of-code", + "type": "tidelift" + } + ], + "time": "2026-05-19T16:22:07+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "7.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "reference": "1effe8e9b8e068e9ae228e542d5d11b5d16db894", + "shasum": "" + }, + "require": { + "php": ">=8.3", + "sebastian/object-reflector": "^5.0", + "sebastian/recursion-context": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/7.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:57:48+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "5.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "4bfa827c969c98be1e527abd576533293c634f6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/4bfa827c969c98be1e527abd576533293c634f6a", + "reference": "4bfa827c969c98be1e527abd576533293c634f6a", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/5.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T04:58:17+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "7.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", + "reference": "0b01998a7d5b1f122911a66bebcb8d46f0c82d8c", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/7.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2025-08-13T04:44:59+00:00" + }, + { + "name": "sebastian/type", + "version": "6.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "82ff822c2edc46724be9f7411d3163021f602773" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/82ff822c2edc46724be9f7411d3163021f602773", + "reference": "82ff822c2edc46724be9f7411d3163021f602773", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "require-dev": { + "phpunit/phpunit": "^12.5.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/6.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/type", + "type": "tidelift" + } + ], + "time": "2026-05-20T06:45:45+00:00" + }, + { + "name": "sebastian/version", + "version": "6.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/3e6ccf7657d4f0a59200564b08cead899313b53c", + "reference": "3e6ccf7657d4f0a59200564b08cead899313b53c", + "shasum": "" + }, + "require": { + "php": ">=8.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/6.0.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-02-07T05:00:38+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" + }, + { + "name": "ta-tikoma/phpunit-architecture-test", + "version": "0.8.7", + "source": { + "type": "git", + "url": "https://github.com/ta-tikoma/phpunit-architecture-test.git", + "reference": "1248f3f506ca9641d4f68cebcd538fa489754db8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/1248f3f506ca9641d4f68cebcd538fa489754db8", + "reference": "1248f3f506ca9641d4f68cebcd538fa489754db8", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18.0 || ^5.0.0", + "php": "^8.1.0", + "phpdocumentor/reflection-docblock": "^5.3.0 || ^6.0.0", + "phpunit/phpunit": "^10.5.5 || ^11.0.0 || ^12.0.0 || ^13.0.0", + "symfony/finder": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "require-dev": { + "laravel/pint": "^1.13.7", + "phpstan/phpstan": "^1.10.52" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPUnit\\Architecture\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ni Shi", + "email": "futik0ma011@gmail.com" + }, + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Methods for testing application architecture", + "keywords": [ + "architecture", + "phpunit", + "stucture", + "test", + "testing" + ], + "support": { + "issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues", + "source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.8.7" + }, + "time": "2026-02-17T17:25:14+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/7989e43bf381af0eac72e4f0ca5bcbfa81658be4", + "reference": "7989e43bf381af0eac72e4f0ca5bcbfa81658be4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^8.1" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/2.0.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2025-12-08T11:19:18+00:00" + }, + { + "name": "webmozart/assert", + "version": "2.4.0", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9007ea6f45ecf352a9422b36644e4bfc039b9155", + "reference": "9007ea6f45ecf352a9422b36644e4bfc039b9155", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^8.2" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "psalm": { + "pluginClass": "Webmozart\\Assert\\PsalmPlugin" + }, + "branch-alias": { + "dev-master": "2.0-dev", + "dev-feature/2-0": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/2.4.0" + }, + "time": "2026-05-20T13:07:01+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": true, + "prefer-lowest": false, + "platform": { + "php": "^8.3" + }, + "platform-dev": {}, + "plugin-api-version": "2.6.0" +} diff --git a/erp/config/app.php b/erp/config/app.php new file mode 100644 index 00000000000..423eed59f1d --- /dev/null +++ b/erp/config/app.php @@ -0,0 +1,126 @@ + env('APP_NAME', 'Laravel'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'production'), + + /* + |-------------------------------------------------------------------------- + | Application Debug Mode + |-------------------------------------------------------------------------- + | + | When your application is in debug mode, detailed error messages with + | stack traces will be shown on every error that occurs within your + | application. If disabled, a simple generic error page is shown. + | + */ + + 'debug' => (bool) env('APP_DEBUG', false), + + /* + |-------------------------------------------------------------------------- + | Application URL + |-------------------------------------------------------------------------- + | + | This URL is used by the console to properly generate URLs when using + | the Artisan command line tool. You should set this to the root of + | the application so that it's available within Artisan commands. + | + */ + + 'url' => env('APP_URL', 'http://localhost'), + + /* + |-------------------------------------------------------------------------- + | Application Timezone + |-------------------------------------------------------------------------- + | + | Here you may specify the default timezone for your application, which + | will be used by the PHP date and date-time functions. The timezone + | is set to "UTC" by default as it is suitable for most use cases. + | + */ + + 'timezone' => 'UTC', + + /* + |-------------------------------------------------------------------------- + | Application Locale Configuration + |-------------------------------------------------------------------------- + | + | The application locale determines the default locale that will be used + | by Laravel's translation / localization methods. This option can be + | set to any locale for which you plan to have translation strings. + | + */ + + 'locale' => env('APP_LOCALE', 'en'), + + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), + + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), + + /* + |-------------------------------------------------------------------------- + | Encryption Key + |-------------------------------------------------------------------------- + | + | This key is utilized by Laravel's encryption services and should be set + | to a random, 32 character string to ensure that all encrypted values + | are secure. You should do this prior to deploying the application. + | + */ + + 'cipher' => 'AES-256-CBC', + + 'key' => env('APP_KEY'), + + 'previous_keys' => [ + ...array_filter( + explode(',', (string) env('APP_PREVIOUS_KEYS', '')) + ), + ], + + /* + |-------------------------------------------------------------------------- + | Maintenance Mode Driver + |-------------------------------------------------------------------------- + | + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. + | + | Supported drivers: "file", "cache" + | + */ + + 'maintenance' => [ + 'driver' => env('APP_MAINTENANCE_DRIVER', 'file'), + 'store' => env('APP_MAINTENANCE_STORE', 'database'), + ], + +]; diff --git a/erp/config/auth.php b/erp/config/auth.php new file mode 100644 index 00000000000..d7568ff1942 --- /dev/null +++ b/erp/config/auth.php @@ -0,0 +1,117 @@ + [ + 'guard' => env('AUTH_GUARD', 'web'), + 'passwords' => env('AUTH_PASSWORD_BROKER', 'users'), + ], + + /* + |-------------------------------------------------------------------------- + | Authentication Guards + |-------------------------------------------------------------------------- + | + | Next, you may define every authentication guard for your application. + | Of course, a great default configuration has been defined for you + | which utilizes session storage plus the Eloquent user provider. + | + | All authentication guards have a user provider, which defines how the + | users are actually retrieved out of your database or other storage + | system used by the application. Typically, Eloquent is utilized. + | + | Supported: "session" + | + */ + + 'guards' => [ + 'web' => [ + 'driver' => 'session', + 'provider' => 'users', + ], + ], + + /* + |-------------------------------------------------------------------------- + | User Providers + |-------------------------------------------------------------------------- + | + | All authentication guards have a user provider, which defines how the + | users are actually retrieved out of your database or other storage + | system used by the application. Typically, Eloquent is utilized. + | + | If you have multiple user tables or models you may configure multiple + | providers to represent the model / table. These providers may then + | be assigned to any extra authentication guards you have defined. + | + | Supported: "database", "eloquent" + | + */ + + 'providers' => [ + 'users' => [ + 'driver' => 'eloquent', + 'model' => env('AUTH_MODEL', User::class), + ], + + // 'users' => [ + // 'driver' => 'database', + // 'table' => 'users', + // ], + ], + + /* + |-------------------------------------------------------------------------- + | Resetting Passwords + |-------------------------------------------------------------------------- + | + | These configuration options specify the behavior of Laravel's password + | reset functionality, including the table utilized for token storage + | and the user provider that is invoked to actually retrieve users. + | + | The expiry time is the number of minutes that each reset token will be + | considered valid. This security feature keeps tokens short-lived so + | they have less time to be guessed. You may change this as needed. + | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | + */ + + 'passwords' => [ + 'users' => [ + 'provider' => 'users', + 'table' => env('AUTH_PASSWORD_RESET_TOKEN_TABLE', 'password_reset_tokens'), + 'expire' => 60, + 'throttle' => 60, + ], + ], + + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the number of seconds before a password confirmation + | window expires and users are asked to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ + + 'password_timeout' => env('AUTH_PASSWORD_TIMEOUT', 10800), + +]; diff --git a/erp/config/cache.php b/erp/config/cache.php new file mode 100644 index 00000000000..d7eec61a399 --- /dev/null +++ b/erp/config/cache.php @@ -0,0 +1,136 @@ + env('CACHE_STORE', 'database'), + + /* + |-------------------------------------------------------------------------- + | Cache Stores + |-------------------------------------------------------------------------- + | + | Here you may define all of the cache "stores" for your application as + | well as their drivers. You may even define multiple stores for the + | same cache driver to group types of items stored in your caches. + | + | Supported drivers: "array", "database", "file", "memcached", + | "redis", "dynamodb", "storage", "octane", + | "session", "failover", "null" + | + */ + + 'stores' => [ + + 'array' => [ + 'driver' => 'array', + 'serialize' => false, + ], + + 'database' => [ + 'driver' => 'database', + 'connection' => env('DB_CACHE_CONNECTION'), + 'table' => env('DB_CACHE_TABLE', 'cache'), + 'lock_connection' => env('DB_CACHE_LOCK_CONNECTION'), + 'lock_table' => env('DB_CACHE_LOCK_TABLE'), + ], + + 'file' => [ + 'driver' => 'file', + 'path' => storage_path('framework/cache/data'), + 'lock_path' => storage_path('framework/cache/data'), + ], + + 'storage' => [ + 'driver' => 'storage', + 'disk' => env('CACHE_STORAGE_DISK'), + 'path' => env('CACHE_STORAGE_PATH', 'framework/cache/data'), + ], + + 'memcached' => [ + 'driver' => 'memcached', + 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), + 'sasl' => [ + env('MEMCACHED_USERNAME'), + env('MEMCACHED_PASSWORD'), + ], + 'options' => [ + // Memcached::OPT_CONNECT_TIMEOUT => 2000, + ], + 'servers' => [ + [ + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), + 'weight' => 100, + ], + ], + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => env('REDIS_CACHE_CONNECTION', 'cache'), + 'lock_connection' => env('REDIS_CACHE_LOCK_CONNECTION', 'default'), + ], + + 'dynamodb' => [ + 'driver' => 'dynamodb', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), + ], + + 'octane' => [ + 'driver' => 'octane', + ], + + 'failover' => [ + 'driver' => 'failover', + 'stores' => [ + 'database', + 'array', + ], + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Cache Key Prefix + |-------------------------------------------------------------------------- + | + | When utilizing the APC, database, memcached, Redis, and DynamoDB cache + | stores, there might be other applications using the same cache. For + | that reason, you may prefix every cache key to avoid collisions. + | + */ + + 'prefix' => env('CACHE_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-cache-'), + + /* + |-------------------------------------------------------------------------- + | Serializable Classes + |-------------------------------------------------------------------------- + | + | This value determines the classes that can be unserialized from cache + | storage. By default, no PHP classes will be unserialized from your + | cache to prevent gadget chain attacks if your APP_KEY is leaked. + | + */ + + 'serializable_classes' => false, + +]; diff --git a/erp/config/database.php b/erp/config/database.php new file mode 100644 index 00000000000..abbb88e3724 --- /dev/null +++ b/erp/config/database.php @@ -0,0 +1,184 @@ + env('DB_CONNECTION', 'sqlite'), + + /* + |-------------------------------------------------------------------------- + | Database Connections + |-------------------------------------------------------------------------- + | + | Below are all of the database connections defined for your application. + | An example configuration is provided for each database system which + | is supported by Laravel. You're free to add / remove connections. + | + */ + + 'connections' => [ + + 'sqlite' => [ + 'driver' => 'sqlite', + 'url' => env('DB_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), + 'busy_timeout' => null, + 'journal_mode' => null, + 'synchronous' => null, + 'transaction_mode' => 'DEFERRED', + ], + + 'mysql' => [ + 'driver' => 'mysql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + 'mariadb' => [ + 'driver' => 'mariadb', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => env('DB_CHARSET', 'utf8mb4'), + 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'), + 'prefix' => '', + 'prefix_indexes' => true, + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ + Mysql::ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), + ]) : [], + ], + + 'pgsql' => [ + 'driver' => 'pgsql', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', + 'prefix_indexes' => true, + 'search_path' => 'public', + 'sslmode' => env('DB_SSLMODE', 'prefer'), + ], + + 'sqlsrv' => [ + 'driver' => 'sqlsrv', + 'url' => env('DB_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'laravel'), + 'username' => env('DB_USERNAME', 'root'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => env('DB_CHARSET', 'utf8'), + 'prefix' => '', + 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Migration Repository Table + |-------------------------------------------------------------------------- + | + | This table keeps track of all the migrations that have already run for + | your application. Using this information, we can determine which of + | the migrations on disk haven't actually been run on the database. + | + */ + + 'migrations' => [ + 'table' => 'migrations', + 'update_date_on_publish' => true, + ], + + /* + |-------------------------------------------------------------------------- + | Redis Databases + |-------------------------------------------------------------------------- + | + | Redis is an open source, fast, and advanced key-value store that also + | provides a richer body of commands than a typical key-value system + | such as Memcached. You may define your connection settings here. + | + */ + + 'redis' => [ + + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'), + 'persistent' => env('REDIS_PERSISTENT', false), + ], + + 'default' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), + 'max_retries' => env('REDIS_MAX_RETRIES', 3), + 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), + 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), + 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), + ], + + 'cache' => [ + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_CACHE_DB', '1'), + 'max_retries' => env('REDIS_MAX_RETRIES', 3), + 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'), + 'backoff_base' => env('REDIS_BACKOFF_BASE', 100), + 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000), + ], + + ], + +]; diff --git a/erp/config/filesystems.php b/erp/config/filesystems.php new file mode 100644 index 00000000000..37d8fca4f6f --- /dev/null +++ b/erp/config/filesystems.php @@ -0,0 +1,80 @@ + env('FILESYSTEM_DISK', 'local'), + + /* + |-------------------------------------------------------------------------- + | Filesystem Disks + |-------------------------------------------------------------------------- + | + | Below you may configure as many filesystem disks as necessary, and you + | may even configure multiple disks for the same driver. Examples for + | most supported storage drivers are configured here for reference. + | + | Supported drivers: "local", "ftp", "sftp", "s3" + | + */ + + 'disks' => [ + + 'local' => [ + 'driver' => 'local', + 'root' => storage_path('app/private'), + 'serve' => true, + 'throw' => false, + 'report' => false, + ], + + 'public' => [ + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => rtrim(env('APP_URL', 'http://localhost'), '/').'/storage', + 'visibility' => 'public', + 'throw' => false, + 'report' => false, + ], + + 's3' => [ + 'driver' => 's3', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION'), + 'bucket' => env('AWS_BUCKET'), + 'url' => env('AWS_URL'), + 'endpoint' => env('AWS_ENDPOINT'), + 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), + 'throw' => false, + 'report' => false, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ + + 'links' => [ + public_path('storage') => storage_path('app/public'), + ], + +]; diff --git a/erp/config/logging.php b/erp/config/logging.php new file mode 100644 index 00000000000..b09cb25d956 --- /dev/null +++ b/erp/config/logging.php @@ -0,0 +1,132 @@ + env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Deprecations Log Channel + |-------------------------------------------------------------------------- + | + | This option controls the log channel that should be used to log warnings + | regarding deprecated PHP and library features. This allows you to get + | your application ready for upcoming major versions of dependencies. + | + */ + + 'deprecations' => [ + 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), + 'trace' => env('LOG_DEPRECATIONS_TRACE', false), + ], + + /* + |-------------------------------------------------------------------------- + | Log Channels + |-------------------------------------------------------------------------- + | + | Here you may configure the log channels for your application. Laravel + | utilizes the Monolog PHP logging library, which includes a variety + | of powerful log handlers and formatters that you're free to use. + | + | Available drivers: "single", "daily", "slack", "syslog", + | "errorlog", "monolog", "custom", "stack" + | + */ + + 'channels' => [ + + 'stack' => [ + 'driver' => 'stack', + 'channels' => explode(',', (string) env('LOG_STACK', 'single')), + 'ignore_exceptions' => false, + ], + + 'single' => [ + 'driver' => 'single', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, + ], + + 'daily' => [ + 'driver' => 'daily', + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => env('LOG_DAILY_DAYS', 14), + 'replace_placeholders' => true, + ], + + 'slack' => [ + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'username' => env('LOG_SLACK_USERNAME', env('APP_NAME', 'Laravel')), + 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), + 'level' => env('LOG_LEVEL', 'critical'), + 'replace_placeholders' => true, + ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), + ], + 'processors' => [PsrLogMessageProcessor::class], + ], + + 'stderr' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => StreamHandler::class, + 'handler_with' => [ + 'stream' => 'php://stderr', + ], + 'formatter' => env('LOG_STDERR_FORMATTER'), + 'processors' => [PsrLogMessageProcessor::class], + ], + + 'syslog' => [ + 'driver' => 'syslog', + 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => env('LOG_SYSLOG_FACILITY', LOG_USER), + 'replace_placeholders' => true, + ], + + 'errorlog' => [ + 'driver' => 'errorlog', + 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, + ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), + ], + + ], + +]; diff --git a/erp/config/mail.php b/erp/config/mail.php new file mode 100644 index 00000000000..e32e88da2cc --- /dev/null +++ b/erp/config/mail.php @@ -0,0 +1,118 @@ + env('MAIL_MAILER', 'log'), + + /* + |-------------------------------------------------------------------------- + | Mailer Configurations + |-------------------------------------------------------------------------- + | + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. + | + | Laravel supports a variety of mail "transport" drivers that can be used + | when delivering an email. You may specify which one you're using for + | your mailers below. You may also add additional mailers if needed. + | + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", + | "postmark", "resend", "log", "array", + | "failover", "roundrobin" + | + */ + + 'mailers' => [ + + 'smtp' => [ + 'transport' => 'smtp', + 'scheme' => env('MAIL_SCHEME'), + 'url' => env('MAIL_URL'), + 'host' => env('MAIL_HOST', '127.0.0.1'), + 'port' => env('MAIL_PORT', 2525), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url((string) env('APP_URL', 'http://localhost'), PHP_URL_HOST)), + ], + + 'ses' => [ + 'transport' => 'ses', + ], + + 'postmark' => [ + 'transport' => 'postmark', + // 'message_stream_id' => env('POSTMARK_MESSAGE_STREAM_ID'), + // 'client' => [ + // 'timeout' => 5, + // ], + ], + + 'resend' => [ + 'transport' => 'resend', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + + 'failover' => [ + 'transport' => 'failover', + 'mailers' => [ + 'smtp', + 'log', + ], + 'retry_after' => 60, + ], + + 'roundrobin' => [ + 'transport' => 'roundrobin', + 'mailers' => [ + 'ses', + 'postmark', + ], + 'retry_after' => 60, + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Global "From" Address + |-------------------------------------------------------------------------- + | + | You may wish for all emails sent by your application to be sent from + | the same address. Here you may specify a name and address that is + | used globally for all emails that are sent by your application. + | + */ + + 'from' => [ + 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), + 'name' => env('MAIL_FROM_NAME', env('APP_NAME', 'Laravel')), + ], + +]; diff --git a/erp/config/permission.php b/erp/config/permission.php new file mode 100644 index 00000000000..8f1f452dc1e --- /dev/null +++ b/erp/config/permission.php @@ -0,0 +1,219 @@ + [ + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * Eloquent model should be used to retrieve your permissions. Of course, it + * is often just the "Permission" model but you may use whatever you like. + * + * The model you want to use as a Permission model needs to implement the + * `Spatie\Permission\Contracts\Permission` contract. + */ + + 'permission' => Permission::class, + + /* + * When using the "HasRoles" trait from this package, we need to know which + * Eloquent model should be used to retrieve your roles. Of course, it + * is often just the "Role" model but you may use whatever you like. + * + * The model you want to use as a Role model needs to implement the + * `Spatie\Permission\Contracts\Role` contract. + */ + + 'role' => Role::class, + + /* + * When using the "Teams" feature from this package, we need to know which + * Eloquent model should be used to retrieve your teams. Of course, it + * is often just the "Team" model but you may use whatever you like. + */ + 'team' => null, + + /* + * When using the "HasModels" trait and passing raw IDs to syncModels, + * attachModels, or detachModels, this model class will be used to + * resolve those IDs. If null, defaults to the guard's model. + */ + 'default_model' => null, + ], + + 'table_names' => [ + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your roles. We have chosen a basic + * default value but you may easily change it to any table you like. + */ + + 'roles' => 'roles', + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * table should be used to retrieve your permissions. We have chosen a basic + * default value but you may easily change it to any table you like. + */ + + 'permissions' => 'permissions', + + /* + * When using the "HasPermissions" trait from this package, we need to know which + * table should be used to retrieve your models permissions. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'model_has_permissions' => 'model_has_permissions', + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your models roles. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'model_has_roles' => 'model_has_roles', + + /* + * When using the "HasRoles" trait from this package, we need to know which + * table should be used to retrieve your roles permissions. We have chosen a + * basic default value but you may easily change it to any table you like. + */ + + 'role_has_permissions' => 'role_has_permissions', + ], + + 'column_names' => [ + /* + * Change this if you want to name the related pivots other than defaults + */ + 'role_pivot_key' => null, // default 'role_id', + 'permission_pivot_key' => null, // default 'permission_id', + + /* + * Change this if you want to name the related model primary key other than + * `model_id`. + * + * For example, this would be nice if your primary keys are all UUIDs. In + * that case, name this `model_uuid`. + */ + + 'model_morph_key' => 'model_id', + + /* + * Change this if you want to use the teams feature and your related model's + * foreign key is other than `team_id`. + */ + + 'team_foreign_key' => 'team_id', + ], + + /* + * When set to true, the method for checking permissions will be registered on the gate. + * Set this to false if you want to implement custom logic for checking permissions. + */ + + 'register_permission_check_method' => true, + + /* + * When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered + * this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated + * NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it. + */ + 'register_octane_reset_listener' => false, + + /* + * Events will fire when a role or permission is assigned/unassigned: + * \Spatie\Permission\Events\RoleAttachedEvent + * \Spatie\Permission\Events\RoleDetachedEvent + * \Spatie\Permission\Events\PermissionAttachedEvent + * \Spatie\Permission\Events\PermissionDetachedEvent + * + * To enable, set to true, and then create listeners to watch these events. + */ + 'events_enabled' => false, + + /* + * Teams Feature. + * When set to true the package implements teams using the 'team_foreign_key'. + * If you want the migrations to register the 'team_foreign_key', you must + * set this to true before doing the migration. + * If you already did the migration then you must make a new migration to also + * add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions' + * (view the latest version of this package's migration file) + */ + + 'teams' => false, + + /* + * The class to use to resolve the permissions team id + */ + 'team_resolver' => DefaultTeamResolver::class, + + /* + * Passport Client Credentials Grant + * When set to true the package will use Passports Client to check permissions + */ + + 'use_passport_client_credentials' => false, + + /* + * When set to true, the required permission names are added to exception messages. + * This could be considered an information leak in some contexts, so the default + * setting is false here for optimum safety. + */ + + 'display_permission_in_exception' => false, + + /* + * When set to true, the required role names are added to exception messages. + * This could be considered an information leak in some contexts, so the default + * setting is false here for optimum safety. + */ + + 'display_role_in_exception' => false, + + /* + * By default wildcard permission lookups are disabled. + * See documentation to understand supported syntax. + */ + + 'enable_wildcard_permission' => false, + + /* + * The class to use for interpreting wildcard permissions. + * If you need to modify delimiters, override the class and specify its name here. + */ + // 'wildcard_permission' => Spatie\Permission\WildcardPermission::class, + + /* Cache-specific settings */ + + 'cache' => [ + + /* + * By default all permissions are cached for 24 hours to speed up performance. + * When permissions or roles are updated the cache is flushed automatically. + */ + + 'expiration_time' => DateInterval::createFromDateString('24 hours'), + + /* + * The cache key used to store all permissions. + */ + + 'key' => 'spatie.permission.cache', + + /* + * You may optionally indicate a specific cache driver to use for permission and + * role caching using any of the `store` drivers listed in the cache.php config + * file. Using 'default' here means to use the `default` set in cache.php. + */ + + 'store' => 'default', + ], +]; diff --git a/erp/config/queue.php b/erp/config/queue.php new file mode 100644 index 00000000000..79c2c0a23cd --- /dev/null +++ b/erp/config/queue.php @@ -0,0 +1,129 @@ + env('QUEUE_CONNECTION', 'database'), + + /* + |-------------------------------------------------------------------------- + | Queue Connections + |-------------------------------------------------------------------------- + | + | Here you may configure the connection options for every queue backend + | used by your application. An example configuration is provided for + | each backend supported by Laravel. You're also free to add more. + | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", + | "deferred", "background", "failover", "null" + | + */ + + 'connections' => [ + + 'sync' => [ + 'driver' => 'sync', + ], + + 'database' => [ + 'driver' => 'database', + 'connection' => env('DB_QUEUE_CONNECTION'), + 'table' => env('DB_QUEUE_TABLE', 'jobs'), + 'queue' => env('DB_QUEUE', 'default'), + 'retry_after' => (int) env('DB_QUEUE_RETRY_AFTER', 90), + 'after_commit' => false, + ], + + 'beanstalkd' => [ + 'driver' => 'beanstalkd', + 'host' => env('BEANSTALKD_QUEUE_HOST', 'localhost'), + 'queue' => env('BEANSTALKD_QUEUE', 'default'), + 'retry_after' => (int) env('BEANSTALKD_QUEUE_RETRY_AFTER', 90), + 'block_for' => 0, + 'after_commit' => false, + ], + + 'sqs' => [ + 'driver' => 'sqs', + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), + 'queue' => env('SQS_QUEUE', 'default'), + 'suffix' => env('SQS_SUFFIX'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + 'after_commit' => false, + ], + + 'redis' => [ + 'driver' => 'redis', + 'connection' => env('REDIS_QUEUE_CONNECTION', 'default'), + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => (int) env('REDIS_QUEUE_RETRY_AFTER', 90), + 'block_for' => null, + 'after_commit' => false, + ], + + 'deferred' => [ + 'driver' => 'deferred', + ], + + 'background' => [ + 'driver' => 'background', + ], + + 'failover' => [ + 'driver' => 'failover', + 'connections' => [ + 'database', + 'deferred', + ], + ], + + ], + + /* + |-------------------------------------------------------------------------- + | Job Batching + |-------------------------------------------------------------------------- + | + | The following options configure the database and table that store job + | batching information. These options can be updated to any database + | connection and table which has been defined by your application. + | + */ + + 'batching' => [ + 'database' => env('DB_CONNECTION', 'sqlite'), + 'table' => 'job_batches', + ], + + /* + |-------------------------------------------------------------------------- + | Failed Queue Jobs + |-------------------------------------------------------------------------- + | + | These options configure the behavior of failed queue job logging so you + | can control how and where failed jobs are stored. Laravel ships with + | support for storing failed jobs in a simple file or in a database. + | + | Supported drivers: "database-uuids", "dynamodb", "file", "null" + | + */ + + 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'database' => env('DB_CONNECTION', 'sqlite'), + 'table' => 'failed_jobs', + ], + +]; diff --git a/erp/config/services.php b/erp/config/services.php new file mode 100644 index 00000000000..6a90eb8305b --- /dev/null +++ b/erp/config/services.php @@ -0,0 +1,38 @@ + [ + 'key' => env('POSTMARK_API_KEY'), + ], + + 'resend' => [ + 'key' => env('RESEND_API_KEY'), + ], + + 'ses' => [ + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), + ], + + 'slack' => [ + 'notifications' => [ + 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), + 'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'), + ], + ], + +]; diff --git a/erp/config/session.php b/erp/config/session.php new file mode 100644 index 00000000000..f5744827f90 --- /dev/null +++ b/erp/config/session.php @@ -0,0 +1,233 @@ + env('SESSION_DRIVER', 'database'), + + /* + |-------------------------------------------------------------------------- + | Session Lifetime + |-------------------------------------------------------------------------- + | + | Here you may specify the number of minutes that you wish the session + | to be allowed to remain idle before it expires. If you want them + | to expire immediately when the browser is closed then you may + | indicate that via the expire_on_close configuration option. + | + */ + + 'lifetime' => (int) env('SESSION_LIFETIME', 120), + + 'expire_on_close' => env('SESSION_EXPIRE_ON_CLOSE', false), + + /* + |-------------------------------------------------------------------------- + | Session Encryption + |-------------------------------------------------------------------------- + | + | This option allows you to easily specify that all of your session data + | should be encrypted before it's stored. All encryption is performed + | automatically by Laravel and you may use the session like normal. + | + */ + + 'encrypt' => env('SESSION_ENCRYPT', false), + + /* + |-------------------------------------------------------------------------- + | Session File Location + |-------------------------------------------------------------------------- + | + | When utilizing the "file" session driver, the session files are placed + | on disk. The default storage location is defined here; however, you + | are free to provide another location where they should be stored. + | + */ + + 'files' => storage_path('framework/sessions'), + + /* + |-------------------------------------------------------------------------- + | Session Database Connection + |-------------------------------------------------------------------------- + | + | When using the "database" or "redis" session drivers, you may specify a + | connection that should be used to manage these sessions. This should + | correspond to a connection in your database configuration options. + | + */ + + 'connection' => env('SESSION_CONNECTION'), + + /* + |-------------------------------------------------------------------------- + | Session Database Table + |-------------------------------------------------------------------------- + | + | When using the "database" session driver, you may specify the table to + | be used to store sessions. Of course, a sensible default is defined + | for you; however, you're welcome to change this to another table. + | + */ + + 'table' => env('SESSION_TABLE', 'sessions'), + + /* + |-------------------------------------------------------------------------- + | Session Cache Store + |-------------------------------------------------------------------------- + | + | When using one of the framework's cache driven session backends, you may + | define the cache store which should be used to store the session data + | between requests. This must match one of your defined cache stores. + | + | Affects: "dynamodb", "memcached", "redis" + | + */ + + 'store' => env('SESSION_STORE'), + + /* + |-------------------------------------------------------------------------- + | Session Sweeping Lottery + |-------------------------------------------------------------------------- + | + | Some session drivers must manually sweep their storage location to get + | rid of old sessions from storage. Here are the chances that it will + | happen on a given request. By default, the odds are 2 out of 100. + | + */ + + 'lottery' => [2, 100], + + /* + |-------------------------------------------------------------------------- + | Session Cookie Name + |-------------------------------------------------------------------------- + | + | Here you may change the name of the session cookie that is created by + | the framework. Typically, you should not need to change this value + | since doing so does not grant a meaningful security improvement. + | + */ + + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug((string) env('APP_NAME', 'laravel')).'-session' + ), + + /* + |-------------------------------------------------------------------------- + | Session Cookie Path + |-------------------------------------------------------------------------- + | + | The session cookie path determines the path for which the cookie will + | be regarded as available. Typically, this will be the root path of + | your application, but you're free to change this when necessary. + | + */ + + 'path' => env('SESSION_PATH', '/'), + + /* + |-------------------------------------------------------------------------- + | Session Cookie Domain + |-------------------------------------------------------------------------- + | + | This value determines the domain and subdomains the session cookie is + | available to. By default, the cookie will be available to the root + | domain without subdomains. Typically, this shouldn't be changed. + | + */ + + 'domain' => env('SESSION_DOMAIN'), + + /* + |-------------------------------------------------------------------------- + | HTTPS Only Cookies + |-------------------------------------------------------------------------- + | + | By setting this option to true, session cookies will only be sent back + | to the server if the browser has a HTTPS connection. This will keep + | the cookie from being sent to you when it can't be done securely. + | + */ + + 'secure' => env('SESSION_SECURE_COOKIE'), + + /* + |-------------------------------------------------------------------------- + | HTTP Access Only + |-------------------------------------------------------------------------- + | + | Setting this value to true will prevent JavaScript from accessing the + | value of the cookie and the cookie will only be accessible through + | the HTTP protocol. It's unlikely you should disable this option. + | + */ + + 'http_only' => env('SESSION_HTTP_ONLY', true), + + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | will set this value to "lax" to permit secure cross-site requests. + | + | See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value + | + | Supported: "lax", "strict", "none", null + | + */ + + 'same_site' => env('SESSION_SAME_SITE', 'lax'), + + /* + |-------------------------------------------------------------------------- + | Partitioned Cookies + |-------------------------------------------------------------------------- + | + | Setting this value to true will tie the cookie to the top-level site for + | a cross-site context. Partitioned cookies are accepted by the browser + | when flagged "secure" and the Same-Site attribute is set to "none". + | + */ + + 'partitioned' => env('SESSION_PARTITIONED_COOKIE', false), + + /* + |-------------------------------------------------------------------------- + | Session Serialization + |-------------------------------------------------------------------------- + | + | This value controls the serialization strategy for session data, which + | is JSON by default. Setting this to "php" allows the storage of PHP + | objects in the session but can make an application vulnerable to + | "gadget chain" serialization attacks if the APP_KEY is leaked. + | + | Supported: "json", "php" + | + */ + + 'serialization' => 'json', + +]; diff --git a/erp/database/.gitignore b/erp/database/.gitignore new file mode 100644 index 00000000000..9b19b93c9f1 --- /dev/null +++ b/erp/database/.gitignore @@ -0,0 +1 @@ +*.sqlite* diff --git a/erp/database/factories/UserFactory.php b/erp/database/factories/UserFactory.php new file mode 100644 index 00000000000..c4ceb0745b7 --- /dev/null +++ b/erp/database/factories/UserFactory.php @@ -0,0 +1,45 @@ + + */ +class UserFactory extends Factory +{ + /** + * The current password being used by the factory. + */ + protected static ?string $password; + + /** + * Define the model's default state. + * + * @return array + */ + public function definition(): array + { + return [ + 'name' => fake()->name(), + 'email' => fake()->unique()->safeEmail(), + 'email_verified_at' => now(), + 'password' => static::$password ??= Hash::make('password'), + 'remember_token' => Str::random(10), + ]; + } + + /** + * Indicate that the model's email address should be unverified. + */ + public function unverified(): static + { + return $this->state(fn (array $attributes) => [ + 'email_verified_at' => null, + ]); + } +} diff --git a/erp/database/migrations/0001_01_01_000000_create_users_table.php b/erp/database/migrations/0001_01_01_000000_create_users_table.php new file mode 100644 index 00000000000..05fb5d9ea95 --- /dev/null +++ b/erp/database/migrations/0001_01_01_000000_create_users_table.php @@ -0,0 +1,49 @@ +id(); + $table->string('name'); + $table->string('email')->unique(); + $table->timestamp('email_verified_at')->nullable(); + $table->string('password'); + $table->rememberToken(); + $table->timestamps(); + }); + + Schema::create('password_reset_tokens', function (Blueprint $table) { + $table->string('email')->primary(); + $table->string('token'); + $table->timestamp('created_at')->nullable(); + }); + + Schema::create('sessions', function (Blueprint $table) { + $table->string('id')->primary(); + $table->foreignId('user_id')->nullable()->index(); + $table->string('ip_address', 45)->nullable(); + $table->text('user_agent')->nullable(); + $table->longText('payload'); + $table->integer('last_activity')->index(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('users'); + Schema::dropIfExists('password_reset_tokens'); + Schema::dropIfExists('sessions'); + } +}; diff --git a/erp/database/migrations/0001_01_01_000001_create_cache_table.php b/erp/database/migrations/0001_01_01_000001_create_cache_table.php new file mode 100644 index 00000000000..06dc7a5ee78 --- /dev/null +++ b/erp/database/migrations/0001_01_01_000001_create_cache_table.php @@ -0,0 +1,35 @@ +string('key')->primary(); + $table->mediumText('value'); + $table->bigInteger('expiration')->index(); + }); + + Schema::create('cache_locks', function (Blueprint $table) { + $table->string('key')->primary(); + $table->string('owner'); + $table->bigInteger('expiration')->index(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('cache'); + Schema::dropIfExists('cache_locks'); + } +}; diff --git a/erp/database/migrations/0001_01_01_000002_create_jobs_table.php b/erp/database/migrations/0001_01_01_000002_create_jobs_table.php new file mode 100644 index 00000000000..edac6fee599 --- /dev/null +++ b/erp/database/migrations/0001_01_01_000002_create_jobs_table.php @@ -0,0 +1,59 @@ +id(); + $table->string('queue')->index(); + $table->longText('payload'); + $table->unsignedSmallInteger('attempts'); + $table->unsignedInteger('reserved_at')->nullable(); + $table->unsignedInteger('available_at'); + $table->unsignedInteger('created_at'); + }); + + Schema::create('job_batches', function (Blueprint $table) { + $table->string('id')->primary(); + $table->string('name'); + $table->integer('total_jobs'); + $table->integer('pending_jobs'); + $table->integer('failed_jobs'); + $table->longText('failed_job_ids'); + $table->mediumText('options')->nullable(); + $table->integer('cancelled_at')->nullable(); + $table->integer('created_at'); + $table->integer('finished_at')->nullable(); + }); + + Schema::create('failed_jobs', function (Blueprint $table) { + $table->id(); + $table->string('uuid')->unique(); + $table->string('connection'); + $table->string('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + + $table->index(['connection', 'queue', 'failed_at']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('jobs'); + Schema::dropIfExists('job_batches'); + Schema::dropIfExists('failed_jobs'); + } +}; diff --git a/erp/database/migrations/2026_05_24_000001_create_tenants_table.php b/erp/database/migrations/2026_05_24_000001_create_tenants_table.php new file mode 100644 index 00000000000..a5e4400467d --- /dev/null +++ b/erp/database/migrations/2026_05_24_000001_create_tenants_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('name'); + $table->string('slug')->unique(); + $table->string('domain')->unique()->nullable(); + $table->json('settings')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('tenants'); + } +}; diff --git a/erp/database/migrations/2026_05_24_000002_add_tenant_to_users_table.php b/erp/database/migrations/2026_05_24_000002_add_tenant_to_users_table.php new file mode 100644 index 00000000000..3deabaed80c --- /dev/null +++ b/erp/database/migrations/2026_05_24_000002_add_tenant_to_users_table.php @@ -0,0 +1,29 @@ +foreignId('tenant_id') + ->nullable() + ->after('id') + ->constrained() + ->nullOnDelete(); + $table->string('avatar')->nullable()->after('email'); + $table->timestamp('last_login_at')->nullable()->after('remember_token'); + }); + } + + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropConstrainedForeignId('tenant_id'); + $table->dropColumn(['avatar', 'last_login_at']); + }); + } +}; diff --git a/erp/database/migrations/2026_05_24_000003_create_audit_logs_table.php b/erp/database/migrations/2026_05_24_000003_create_audit_logs_table.php new file mode 100644 index 00000000000..bd425ec15ea --- /dev/null +++ b/erp/database/migrations/2026_05_24_000003_create_audit_logs_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); + $table->foreignId('tenant_id')->nullable()->constrained()->nullOnDelete(); + $table->string('event', 32); + $table->string('auditable_type'); + $table->unsignedBigInteger('auditable_id'); + $table->json('old_values')->nullable(); + $table->json('new_values')->nullable(); + $table->ipAddress('ip_address')->nullable(); + $table->string('user_agent')->nullable(); + $table->timestamp('created_at')->useCurrent(); + + $table->index(['auditable_type', 'auditable_id']); + $table->index(['user_id', 'created_at']); + $table->index('tenant_id'); + }); + } + + public function down(): void + { + Schema::dropIfExists('audit_logs'); + } +}; diff --git a/erp/database/migrations/2026_05_24_120902_create_permission_tables.php b/erp/database/migrations/2026_05_24_120902_create_permission_tables.php new file mode 100644 index 00000000000..89862751975 --- /dev/null +++ b/erp/database/migrations/2026_05_24_120902_create_permission_tables.php @@ -0,0 +1,137 @@ +id(); // permission id + $table->string('name'); + $table->string('guard_name'); + $table->timestamps(); + + $table->unique(['name', 'guard_name']); + }); + + /** + * See `docs/prerequisites.md` for suggested lengths on 'name' and 'guard_name' if "1071 Specified key was too long" errors are encountered. + */ + Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) { + $table->id(); // role id + if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing + $table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable(); + $table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index'); + } + $table->string('name'); + $table->string('guard_name'); + $table->timestamps(); + if ($teams || config('permission.testing')) { + $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); + } else { + $table->unique(['name', 'guard_name']); + } + }); + + Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) { + $table->unsignedBigInteger($pivotPermission); + + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); + + $table->foreign($pivotPermission) + ->references('id') // permission id + ->on($tableNames['permissions']) + ->cascadeOnDelete(); + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } else { + $table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary'); + } + }); + + Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) { + $table->unsignedBigInteger($pivotRole); + + $table->string('model_type'); + $table->unsignedBigInteger($columnNames['model_morph_key']); + $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); + + $table->foreign($pivotRole) + ->references('id') // role id + ->on($tableNames['roles']) + ->cascadeOnDelete(); + if ($teams) { + $table->unsignedBigInteger($columnNames['team_foreign_key']); + $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); + + $table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary'); + } else { + $table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary'); + } + }); + + Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) { + $table->unsignedBigInteger($pivotPermission); + $table->unsignedBigInteger($pivotRole); + + $table->foreign($pivotPermission) + ->references('id') // permission id + ->on($tableNames['permissions']) + ->cascadeOnDelete(); + + $table->foreign($pivotRole) + ->references('id') // role id + ->on($tableNames['roles']) + ->cascadeOnDelete(); + + $table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary'); + }); + + app('cache') + ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) + ->forget(config('permission.cache.key')); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + $tableNames = config('permission.table_names'); + + throw_if(empty($tableNames), 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); + + Schema::dropIfExists($tableNames['role_has_permissions']); + Schema::dropIfExists($tableNames['model_has_roles']); + Schema::dropIfExists($tableNames['model_has_permissions']); + Schema::dropIfExists($tableNames['roles']); + Schema::dropIfExists($tableNames['permissions']); + } +}; diff --git a/erp/database/migrations/2026_05_25_000001_create_categories_table.php b/erp/database/migrations/2026_05_25_000001_create_categories_table.php new file mode 100644 index 00000000000..c85ea316a6b --- /dev/null +++ b/erp/database/migrations/2026_05_25_000001_create_categories_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('parent_id')->nullable()->constrained('categories')->nullOnDelete(); + $table->string('name'); + $table->string('slug'); + $table->text('description')->nullable(); + $table->timestamps(); + + $table->unique(['tenant_id', 'slug']); + }); + } + + public function down(): void { Schema::dropIfExists('categories'); } +}; diff --git a/erp/database/migrations/2026_05_25_000002_create_units_of_measure_table.php b/erp/database/migrations/2026_05_25_000002_create_units_of_measure_table.php new file mode 100644 index 00000000000..d0c3337cf45 --- /dev/null +++ b/erp/database/migrations/2026_05_25_000002_create_units_of_measure_table.php @@ -0,0 +1,23 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('abbreviation', 20); + $table->timestamps(); + + $table->unique(['tenant_id', 'abbreviation']); + }); + } + + public function down(): void { Schema::dropIfExists('units_of_measure'); } +}; diff --git a/erp/database/migrations/2026_05_25_000003_create_suppliers_table.php b/erp/database/migrations/2026_05_25_000003_create_suppliers_table.php new file mode 100644 index 00000000000..174e8e97ea1 --- /dev/null +++ b/erp/database/migrations/2026_05_25_000003_create_suppliers_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('contact_person')->nullable(); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->text('address')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void { Schema::dropIfExists('suppliers'); } +}; diff --git a/erp/database/migrations/2026_05_25_000004_create_warehouses_table.php b/erp/database/migrations/2026_05_25_000004_create_warehouses_table.php new file mode 100644 index 00000000000..cb8a5920e46 --- /dev/null +++ b/erp/database/migrations/2026_05_25_000004_create_warehouses_table.php @@ -0,0 +1,23 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('location')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void { Schema::dropIfExists('warehouses'); } +}; diff --git a/erp/database/migrations/2026_05_25_000005_create_products_table.php b/erp/database/migrations/2026_05_25_000005_create_products_table.php new file mode 100644 index 00000000000..6384b28e093 --- /dev/null +++ b/erp/database/migrations/2026_05_25_000005_create_products_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('sku'); + $table->string('name'); + $table->text('description')->nullable(); + $table->foreignId('category_id')->nullable()->constrained('categories')->nullOnDelete(); + $table->foreignId('uom_id')->nullable()->constrained('units_of_measure')->nullOnDelete(); + $table->decimal('cost_price', 12, 2)->default(0); + $table->decimal('sale_price', 12, 2)->default(0); + $table->integer('reorder_point')->default(0); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'sku']); + }); + } + + public function down(): void { Schema::dropIfExists('products'); } +}; diff --git a/erp/database/migrations/2026_05_25_000006_create_stock_levels_table.php b/erp/database/migrations/2026_05_25_000006_create_stock_levels_table.php new file mode 100644 index 00000000000..d5549def4bb --- /dev/null +++ b/erp/database/migrations/2026_05_25_000006_create_stock_levels_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->foreignId('warehouse_id')->constrained()->cascadeOnDelete(); + $table->decimal('quantity', 12, 2)->default(0); + $table->decimal('reserved_quantity', 12, 2)->default(0); + $table->timestamps(); + + $table->unique(['product_id', 'warehouse_id']); + }); + } + + public function down(): void { Schema::dropIfExists('stock_levels'); } +}; diff --git a/erp/database/migrations/2026_05_25_000007_create_stock_movements_table.php b/erp/database/migrations/2026_05_25_000007_create_stock_movements_table.php new file mode 100644 index 00000000000..77331f9e72d --- /dev/null +++ b/erp/database/migrations/2026_05_25_000007_create_stock_movements_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->foreignId('warehouse_id')->constrained()->cascadeOnDelete(); + $table->enum('type', ['in', 'out', 'transfer', 'adjustment']); + $table->decimal('quantity', 12, 2); + $table->string('reference')->nullable(); + $table->text('notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamp('created_at')->useCurrent(); + + $table->index(['product_id', 'created_at']); + $table->index(['warehouse_id', 'created_at']); + $table->index('tenant_id'); + }); + } + + public function down(): void { Schema::dropIfExists('stock_movements'); } +}; diff --git a/erp/database/migrations/2026_05_25_000008_create_purchase_orders_table.php b/erp/database/migrations/2026_05_25_000008_create_purchase_orders_table.php new file mode 100644 index 00000000000..dab53c6c312 --- /dev/null +++ b/erp/database/migrations/2026_05_25_000008_create_purchase_orders_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('supplier_id')->constrained()->cascadeOnDelete(); + $table->foreignId('warehouse_id')->constrained()->cascadeOnDelete(); + $table->enum('status', ['draft', 'submitted', 'approved', 'received', 'cancelled']) + ->default('draft'); + $table->date('expected_date')->nullable(); + $table->text('notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + + $table->index(['tenant_id', 'status']); + }); + } + + public function down(): void { Schema::dropIfExists('purchase_orders'); } +}; diff --git a/erp/database/migrations/2026_05_25_000009_create_purchase_order_items_table.php b/erp/database/migrations/2026_05_25_000009_create_purchase_order_items_table.php new file mode 100644 index 00000000000..ee3147814ed --- /dev/null +++ b/erp/database/migrations/2026_05_25_000009_create_purchase_order_items_table.php @@ -0,0 +1,23 @@ +id(); + $table->foreignId('purchase_order_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->decimal('quantity', 12, 2); + $table->decimal('unit_cost', 12, 2); + $table->decimal('received_quantity', 12, 2)->default(0); + $table->timestamps(); + }); + } + + public function down(): void { Schema::dropIfExists('purchase_order_items'); } +}; diff --git a/erp/database/migrations/2026_05_26_000001_create_accounts_table.php b/erp/database/migrations/2026_05_26_000001_create_accounts_table.php new file mode 100644 index 00000000000..20005348e8a --- /dev/null +++ b/erp/database/migrations/2026_05_26_000001_create_accounts_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('parent_id')->nullable()->constrained('accounts')->nullOnDelete(); + $table->string('code', 20); + $table->string('name'); + $table->enum('type', ['asset', 'liability', 'equity', 'income', 'expense']); + $table->text('description')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'code']); + }); + } + + public function down(): void + { + Schema::dropIfExists('accounts'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000002_create_journal_entries_table.php b/erp/database/migrations/2026_05_26_000002_create_journal_entries_table.php new file mode 100644 index 00000000000..4d631acdd44 --- /dev/null +++ b/erp/database/migrations/2026_05_26_000002_create_journal_entries_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->date('date'); + $table->string('reference')->nullable(); + $table->string('description'); + $table->enum('status', ['draft', 'posted'])->default('draft'); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('journal_entries'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000003_create_journal_lines_table.php b/erp/database/migrations/2026_05_26_000003_create_journal_lines_table.php new file mode 100644 index 00000000000..a73048e2b7a --- /dev/null +++ b/erp/database/migrations/2026_05_26_000003_create_journal_lines_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('journal_entry_id')->constrained()->cascadeOnDelete(); + $table->foreignId('account_id')->constrained()->restrictOnDelete(); + $table->decimal('debit', 15, 2)->default(0); + $table->decimal('credit', 15, 2)->default(0); + $table->string('description')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('journal_lines'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000004_create_contacts_table.php b/erp/database/migrations/2026_05_26_000004_create_contacts_table.php new file mode 100644 index 00000000000..51e3fb7afed --- /dev/null +++ b/erp/database/migrations/2026_05_26_000004_create_contacts_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->text('address')->nullable(); + $table->enum('type', ['customer', 'vendor', 'both'])->default('customer'); + $table->text('notes')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('contacts'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000005_create_invoices_table.php b/erp/database/migrations/2026_05_26_000005_create_invoices_table.php new file mode 100644 index 00000000000..0465169303d --- /dev/null +++ b/erp/database/migrations/2026_05_26_000005_create_invoices_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete(); + $table->string('number', 50)->nullable(); + $table->date('issue_date'); + $table->date('due_date')->nullable(); + $table->enum('status', ['draft', 'sent', 'paid', 'cancelled'])->default('draft'); + $table->text('notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'number']); + }); + } + + public function down(): void + { + Schema::dropIfExists('invoices'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000006_create_invoice_items_table.php b/erp/database/migrations/2026_05_26_000006_create_invoice_items_table.php new file mode 100644 index 00000000000..6bcd340fdf3 --- /dev/null +++ b/erp/database/migrations/2026_05_26_000006_create_invoice_items_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('invoice_id')->constrained()->cascadeOnDelete(); + $table->string('description'); + $table->decimal('quantity', 12, 2)->default(1); + $table->decimal('unit_price', 15, 2); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('invoice_items'); + } +}; diff --git a/erp/database/migrations/2026_05_26_000007_create_payments_table.php b/erp/database/migrations/2026_05_26_000007_create_payments_table.php new file mode 100644 index 00000000000..947d16d10d5 --- /dev/null +++ b/erp/database/migrations/2026_05_26_000007_create_payments_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('invoice_id')->constrained()->cascadeOnDelete(); + $table->decimal('amount', 15, 2); + $table->date('payment_date'); + $table->enum('method', ['cash', 'bank_transfer', 'cheque', 'card', 'other'])->default('bank_transfer'); + $table->string('reference')->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('payments'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000001_create_departments_table.php b/erp/database/migrations/2026_05_27_000001_create_departments_table.php new file mode 100644 index 00000000000..4fc69100c3b --- /dev/null +++ b/erp/database/migrations/2026_05_27_000001_create_departments_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->text('description')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('departments'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000002_create_employees_table.php b/erp/database/migrations/2026_05_27_000002_create_employees_table.php new file mode 100644 index 00000000000..13712c52173 --- /dev/null +++ b/erp/database/migrations/2026_05_27_000002_create_employees_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); + $table->foreignId('department_id')->nullable()->constrained()->nullOnDelete(); + $table->string('employee_number', 30)->nullable(); + $table->string('first_name'); + $table->string('last_name'); + $table->string('email')->nullable(); + $table->string('phone')->nullable(); + $table->string('position')->nullable(); + $table->enum('employment_type', ['full_time', 'part_time', 'contract'])->default('full_time'); + $table->enum('status', ['active', 'on_leave', 'terminated'])->default('active'); + $table->date('start_date'); + $table->date('end_date')->nullable(); + $table->enum('salary_type', ['hourly', 'monthly'])->default('monthly'); + $table->decimal('salary_amount', 12, 2)->default(0); + $table->timestamps(); + $table->softDeletes(); + + $table->unique(['tenant_id', 'employee_number']); + }); + } + + public function down(): void + { + Schema::dropIfExists('employees'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000003_create_leave_types_table.php b/erp/database/migrations/2026_05_27_000003_create_leave_types_table.php new file mode 100644 index 00000000000..f566df5486c --- /dev/null +++ b/erp/database/migrations/2026_05_27_000003_create_leave_types_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->integer('days_per_year')->default(0); + $table->boolean('is_paid')->default(true); + $table->boolean('is_active')->default(true); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('leave_types'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000004_create_leave_requests_table.php b/erp/database/migrations/2026_05_27_000004_create_leave_requests_table.php new file mode 100644 index 00000000000..32b0b29e3b3 --- /dev/null +++ b/erp/database/migrations/2026_05_27_000004_create_leave_requests_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained()->cascadeOnDelete(); + $table->foreignId('leave_type_id')->constrained()->restrictOnDelete(); + $table->date('start_date'); + $table->date('end_date'); + $table->unsignedSmallInteger('days'); + $table->enum('status', ['pending', 'approved', 'rejected'])->default('pending'); + $table->text('notes')->nullable(); + $table->foreignId('reviewed_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamp('reviewed_at')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('leave_requests'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000005_create_payroll_runs_table.php b/erp/database/migrations/2026_05_27_000005_create_payroll_runs_table.php new file mode 100644 index 00000000000..38ac601204c --- /dev/null +++ b/erp/database/migrations/2026_05_27_000005_create_payroll_runs_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->date('period_start'); + $table->date('period_end'); + $table->enum('status', ['draft', 'processed'])->default('draft'); + $table->text('notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('payroll_runs'); + } +}; diff --git a/erp/database/migrations/2026_05_27_000006_create_payroll_items_table.php b/erp/database/migrations/2026_05_27_000006_create_payroll_items_table.php new file mode 100644 index 00000000000..bf821c6050d --- /dev/null +++ b/erp/database/migrations/2026_05_27_000006_create_payroll_items_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('payroll_run_id')->constrained()->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained()->restrictOnDelete(); + $table->decimal('gross_salary', 12, 2); + $table->decimal('deductions', 12, 2)->default(0); + $table->decimal('net_salary', 12, 2); + $table->text('notes')->nullable(); + $table->timestamps(); + + $table->unique(['payroll_run_id', 'employee_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('payroll_items'); + } +}; diff --git a/erp/database/migrations/2026_05_29_000001_create_notifications_table.php b/erp/database/migrations/2026_05_29_000001_create_notifications_table.php new file mode 100644 index 00000000000..52e3b00595f --- /dev/null +++ b/erp/database/migrations/2026_05_29_000001_create_notifications_table.php @@ -0,0 +1,25 @@ +uuid('id')->primary(); + $table->string('type'); + $table->morphs('notifiable'); + $table->text('data'); + $table->timestamp('read_at')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('notifications'); + } +}; diff --git a/erp/database/migrations/2026_05_29_000002_create_tenant_settings_table.php b/erp/database/migrations/2026_05_29_000002_create_tenant_settings_table.php new file mode 100644 index 00000000000..4d57c8e007f --- /dev/null +++ b/erp/database/migrations/2026_05_29_000002_create_tenant_settings_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('key', 64); + $table->text('value')->nullable(); + $table->timestamps(); + + $table->unique(['tenant_id', 'key']); + }); + } + + public function down(): void + { + Schema::dropIfExists('tenant_settings'); + } +}; diff --git a/erp/database/migrations/2026_05_29_000003_create_bills_table.php b/erp/database/migrations/2026_05_29_000003_create_bills_table.php new file mode 100644 index 00000000000..8c80f68f55f --- /dev/null +++ b/erp/database/migrations/2026_05_29_000003_create_bills_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete(); + $table->string('number', 50)->nullable(); + $table->date('issue_date'); + $table->date('due_date')->nullable(); + $table->enum('status', ['draft', 'received', 'paid', 'cancelled'])->default('draft'); + $table->text('notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + $table->unique(['tenant_id', 'number']); + }); + } + + public function down(): void + { + Schema::dropIfExists('bills'); + } +}; diff --git a/erp/database/migrations/2026_05_29_000004_create_bill_items_table.php b/erp/database/migrations/2026_05_29_000004_create_bill_items_table.php new file mode 100644 index 00000000000..5133d63131c --- /dev/null +++ b/erp/database/migrations/2026_05_29_000004_create_bill_items_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('bill_id')->constrained()->cascadeOnDelete(); + $table->string('description'); + $table->decimal('quantity', 12, 2); + $table->decimal('unit_price', 15, 2); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('bill_items'); + } +}; diff --git a/erp/database/migrations/2026_05_29_000005_create_bill_payments_table.php b/erp/database/migrations/2026_05_29_000005_create_bill_payments_table.php new file mode 100644 index 00000000000..63766de6568 --- /dev/null +++ b/erp/database/migrations/2026_05_29_000005_create_bill_payments_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('bill_id')->constrained()->cascadeOnDelete(); + $table->decimal('amount', 15, 2); + $table->date('payment_date'); + $table->enum('method', ['cash', 'bank_transfer', 'cheque', 'card', 'other']); + $table->string('reference', 100)->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('bill_payments'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000006_create_quotes_table.php b/erp/database/migrations/2026_05_31_000006_create_quotes_table.php new file mode 100644 index 00000000000..91731cad9b5 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000006_create_quotes_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('contact_id')->nullable(); + $table->string('number')->nullable(); + $table->date('issue_date'); + $table->date('expiry_date')->nullable(); + $table->enum('status', ['draft', 'sent', 'accepted', 'declined', 'cancelled'])->default('draft'); + $table->text('notes')->nullable(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('contact_id')->references('id')->on('contacts')->nullOnDelete(); + $table->unique(['tenant_id', 'number']); + }); + } + + public function down(): void + { + Schema::dropIfExists('quotes'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000007_create_quote_items_table.php b/erp/database/migrations/2026_05_31_000007_create_quote_items_table.php new file mode 100644 index 00000000000..cefda213a7c --- /dev/null +++ b/erp/database/migrations/2026_05_31_000007_create_quote_items_table.php @@ -0,0 +1,27 @@ +id(); + $table->unsignedBigInteger('quote_id'); + $table->text('description'); + $table->decimal('quantity', 12, 2)->default(1); + $table->decimal('unit_price', 15, 2); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->timestamps(); + $table->foreign('quote_id')->references('id')->on('quotes')->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('quote_items'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000008_create_credit_notes_table.php b/erp/database/migrations/2026_05_31_000008_create_credit_notes_table.php new file mode 100644 index 00000000000..445ca97f3c4 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000008_create_credit_notes_table.php @@ -0,0 +1,42 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('reference'); + $table->unsignedBigInteger('contact_id')->nullable(); + $table->unsignedBigInteger('original_invoice_id')->nullable(); + $table->unsignedBigInteger('original_bill_id')->nullable(); + $table->enum('type', ['sale', 'purchase'])->default('sale'); + $table->enum('status', ['draft', 'issued', 'applied', 'void'])->default('draft'); + $table->date('issue_date'); + $table->string('currency_code', 3)->default('USD'); + $table->decimal('exchange_rate', 15, 6)->default(1); + $table->decimal('subtotal', 15, 2)->default(0); + $table->decimal('tax_total', 15, 2)->default(0); + $table->decimal('total', 15, 2)->default(0); + $table->decimal('amount_applied', 15, 2)->default(0); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('contact_id')->references('id')->on('contacts')->nullOnDelete(); + $table->foreign('original_invoice_id')->references('id')->on('invoices')->nullOnDelete(); + $table->foreign('original_bill_id')->references('id')->on('bills')->nullOnDelete(); + $table->unique('reference'); + }); + } + + public function down(): void + { + Schema::dropIfExists('credit_notes'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000009_create_credit_note_items_table.php b/erp/database/migrations/2026_05_31_000009_create_credit_note_items_table.php new file mode 100644 index 00000000000..9c4681102f2 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000009_create_credit_note_items_table.php @@ -0,0 +1,28 @@ +id(); + $table->unsignedBigInteger('credit_note_id'); + $table->string('description'); + $table->decimal('quantity', 10, 2)->default(1); + $table->decimal('unit_price', 15, 2)->default(0); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->decimal('line_total', 15, 2)->default(0); + $table->timestamps(); + $table->foreign('credit_note_id')->references('id')->on('credit_notes')->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('credit_note_items'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000010_create_recurring_invoices_table.php b/erp/database/migrations/2026_05_31_000010_create_recurring_invoices_table.php new file mode 100644 index 00000000000..fe301beab6a --- /dev/null +++ b/erp/database/migrations/2026_05_31_000010_create_recurring_invoices_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('contact_id')->nullable(); + $table->enum('frequency', ['weekly', 'monthly', 'quarterly', 'yearly'])->default('monthly'); + $table->date('start_date'); + $table->date('next_run_date'); + $table->date('end_date')->nullable(); + $table->unsignedInteger('due_days')->default(30); + $table->enum('status', ['active', 'paused', 'ended'])->default('active'); + $table->boolean('auto_send')->default(false); + $table->text('notes')->nullable(); + $table->timestamp('last_generated_at')->nullable(); + $table->unsignedInteger('generated_count')->default(0); + $table->unsignedBigInteger('created_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('contact_id')->references('id')->on('contacts')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('recurring_invoices'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000011_create_recurring_invoice_items_table.php b/erp/database/migrations/2026_05_31_000011_create_recurring_invoice_items_table.php new file mode 100644 index 00000000000..b2e76c62ec7 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000011_create_recurring_invoice_items_table.php @@ -0,0 +1,27 @@ +id(); + $table->unsignedBigInteger('recurring_invoice_id'); + $table->text('description'); + $table->decimal('quantity', 12, 2)->default(1); + $table->decimal('unit_price', 15, 2); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->timestamps(); + $table->foreign('recurring_invoice_id')->references('id')->on('recurring_invoices')->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('recurring_invoice_items'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000012_create_sales_orders_table.php b/erp/database/migrations/2026_05_31_000012_create_sales_orders_table.php new file mode 100644 index 00000000000..e7a3e27f29b --- /dev/null +++ b/erp/database/migrations/2026_05_31_000012_create_sales_orders_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('contact_id')->nullable(); + $table->unsignedBigInteger('warehouse_id')->nullable(); + $table->unsignedBigInteger('invoice_id')->nullable(); + $table->string('number')->nullable(); + $table->date('order_date'); + $table->date('expected_date')->nullable(); + $table->enum('status', ['draft', 'confirmed', 'fulfilled', 'cancelled'])->default('draft'); + $table->text('notes')->nullable(); + $table->unsignedBigInteger('created_by')->nullable(); + $table->timestamps(); + $table->softDeletes(); + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('contact_id')->references('id')->on('contacts')->nullOnDelete(); + $table->foreign('warehouse_id')->references('id')->on('warehouses')->nullOnDelete(); + $table->foreign('invoice_id')->references('id')->on('invoices')->nullOnDelete(); + $table->unique(['tenant_id', 'number']); + }); + } + + public function down(): void + { + Schema::dropIfExists('sales_orders'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000013_create_sales_order_items_table.php b/erp/database/migrations/2026_05_31_000013_create_sales_order_items_table.php new file mode 100644 index 00000000000..f17f53aaf00 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000013_create_sales_order_items_table.php @@ -0,0 +1,30 @@ +id(); + $table->unsignedBigInteger('sales_order_id'); + $table->unsignedBigInteger('product_id')->nullable(); + $table->text('description'); + $table->decimal('quantity', 12, 2)->default(1); + $table->decimal('unit_price', 15, 2); + $table->decimal('tax_rate', 5, 2)->default(0); + $table->decimal('quantity_fulfilled', 12, 2)->default(0); + $table->timestamps(); + $table->foreign('sales_order_id')->references('id')->on('sales_orders')->cascadeOnDelete(); + $table->foreign('product_id')->references('id')->on('products')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('sales_order_items'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000014_update_payroll_runs_add_computed_columns.php b/erp/database/migrations/2026_05_31_000014_update_payroll_runs_add_computed_columns.php new file mode 100644 index 00000000000..48977437920 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000014_update_payroll_runs_add_computed_columns.php @@ -0,0 +1,30 @@ +string('period_label')->nullable()->after('tenant_id'); + $table->decimal('total_gross', 14, 2)->default(0)->after('status'); + $table->decimal('total_deductions', 14, 2)->default(0)->after('total_gross'); + $table->decimal('total_net', 14, 2)->default(0)->after('total_deductions'); + $table->integer('employee_count')->default(0)->after('total_net'); + $table->timestamp('processed_at')->nullable()->after('employee_count'); + }); + } + + public function down(): void + { + Schema::table('payroll_runs', function (Blueprint $table) { + $table->dropColumn([ + 'period_label', 'total_gross', 'total_deductions', + 'total_net', 'employee_count', 'processed_at', + ]); + }); + } +}; diff --git a/erp/database/migrations/2026_05_31_000015_create_exchange_rates_table.php b/erp/database/migrations/2026_05_31_000015_create_exchange_rates_table.php new file mode 100644 index 00000000000..3057d119669 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000015_create_exchange_rates_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('currency_code', 3); + $table->decimal('rate', 14, 6); + $table->date('date'); + $table->timestamps(); + $table->unique(['tenant_id', 'currency_code', 'date']); + }); + } + + public function down(): void + { + Schema::dropIfExists('exchange_rates'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000016_add_currency_to_invoices_table.php b/erp/database/migrations/2026_05_31_000016_add_currency_to_invoices_table.php new file mode 100644 index 00000000000..b11f40a71d0 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000016_add_currency_to_invoices_table.php @@ -0,0 +1,23 @@ +string('currency_code', 3)->default('USD')->after('status'); + $table->decimal('exchange_rate', 14, 6)->default(1.000000)->after('currency_code'); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropColumn(['currency_code', 'exchange_rate']); + }); + } +}; diff --git a/erp/database/migrations/2026_05_31_000017_add_currency_to_bills_table.php b/erp/database/migrations/2026_05_31_000017_add_currency_to_bills_table.php new file mode 100644 index 00000000000..f61ee040131 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000017_add_currency_to_bills_table.php @@ -0,0 +1,23 @@ +string('currency_code', 3)->default('USD')->after('status'); + $table->decimal('exchange_rate', 14, 6)->default(1.000000)->after('currency_code'); + }); + } + + public function down(): void + { + Schema::table('bills', function (Blueprint $table) { + $table->dropColumn(['currency_code', 'exchange_rate']); + }); + } +}; diff --git a/erp/database/migrations/2026_05_31_000018_add_currency_to_quotes_table.php b/erp/database/migrations/2026_05_31_000018_add_currency_to_quotes_table.php new file mode 100644 index 00000000000..039f48011d3 --- /dev/null +++ b/erp/database/migrations/2026_05_31_000018_add_currency_to_quotes_table.php @@ -0,0 +1,23 @@ +string('currency_code', 3)->default('USD')->after('status'); + $table->decimal('exchange_rate', 14, 6)->default(1.000000)->after('currency_code'); + }); + } + + public function down(): void + { + Schema::table('quotes', function (Blueprint $table) { + $table->dropColumn(['currency_code', 'exchange_rate']); + }); + } +}; diff --git a/erp/database/migrations/2026_05_31_000019_create_bank_accounts_table.php b/erp/database/migrations/2026_05_31_000019_create_bank_accounts_table.php new file mode 100644 index 00000000000..ce7fdaa60ae --- /dev/null +++ b/erp/database/migrations/2026_05_31_000019_create_bank_accounts_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('account_number')->nullable(); + $table->string('bank_name')->nullable(); + $table->string('currency_code', 3)->default('USD'); + $table->decimal('opening_balance', 14, 2)->default(0); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('bank_accounts'); + } +}; diff --git a/erp/database/migrations/2026_05_31_000020_create_bank_transactions_table.php b/erp/database/migrations/2026_05_31_000020_create_bank_transactions_table.php new file mode 100644 index 00000000000..1ef7b72721c --- /dev/null +++ b/erp/database/migrations/2026_05_31_000020_create_bank_transactions_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('bank_account_id')->constrained()->cascadeOnDelete(); + $table->date('transaction_date'); + $table->string('description')->nullable(); + $table->decimal('amount', 14, 2); + $table->string('reference')->nullable(); + $table->boolean('reconciled')->default(false); + $table->foreignId('payment_id')->nullable()->constrained('payments')->nullOnDelete(); + $table->foreignId('journal_entry_id')->nullable()->constrained('journal_entries')->nullOnDelete(); + $table->timestamp('imported_at')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('bank_transactions'); + } +}; diff --git a/erp/database/migrations/2026_06_01_064257_add_is_active_to_users_table.php b/erp/database/migrations/2026_06_01_064257_add_is_active_to_users_table.php new file mode 100644 index 00000000000..81f9a24b3d5 --- /dev/null +++ b/erp/database/migrations/2026_06_01_064257_add_is_active_to_users_table.php @@ -0,0 +1,28 @@ +boolean('is_active')->default(true)->after('tenant_id'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('is_active'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_01_065114_add_settings_columns_to_tenants_table.php b/erp/database/migrations/2026_06_01_065114_add_settings_columns_to_tenants_table.php new file mode 100644 index 00000000000..f684b07d1a9 --- /dev/null +++ b/erp/database/migrations/2026_06_01_065114_add_settings_columns_to_tenants_table.php @@ -0,0 +1,39 @@ +string('email')->nullable()->after('slug'); + $table->string('phone')->nullable()->after('email'); + $table->text('address')->nullable()->after('phone'); + $table->string('city')->nullable()->after('address'); + $table->string('country')->nullable()->after('city'); + $table->string('currency_code', 3)->default('USD')->after('country'); + $table->string('timezone')->default('UTC')->after('currency_code'); + $table->string('date_format')->default('Y-m-d')->after('timezone'); + $table->string('logo_path')->nullable()->after('date_format'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('tenants', function (Blueprint $table) { + $table->dropColumn([ + 'email', 'phone', 'address', 'city', 'country', + 'currency_code', 'timezone', 'date_format', 'logo_path', + ]); + }); + } +}; diff --git a/erp/database/migrations/2026_06_01_070706_create_warehouse_transfers_table.php b/erp/database/migrations/2026_06_01_070706_create_warehouse_transfers_table.php new file mode 100644 index 00000000000..60028d3a48a --- /dev/null +++ b/erp/database/migrations/2026_06_01_070706_create_warehouse_transfers_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->foreignId('from_warehouse_id')->constrained('warehouses')->cascadeOnDelete(); + $table->foreignId('to_warehouse_id')->constrained('warehouses')->cascadeOnDelete(); + $table->decimal('quantity', 12, 4); + $table->string('reference')->nullable(); + $table->text('notes')->nullable(); + $table->enum('status', ['pending', 'completed', 'cancelled'])->default('completed'); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('warehouse_transfers'); + } +}; diff --git a/erp/database/migrations/2026_06_01_074127_create_budget_lines_table.php b/erp/database/migrations/2026_06_01_074127_create_budget_lines_table.php new file mode 100644 index 00000000000..2650a0dc7bc --- /dev/null +++ b/erp/database/migrations/2026_06_01_074127_create_budget_lines_table.php @@ -0,0 +1,27 @@ +id(); + $table->foreignId('budget_id')->constrained()->cascadeOnDelete(); + $table->foreignId('account_id')->constrained()->cascadeOnDelete(); + $table->integer('period')->default(0); // 0=annual, 1-12=month, 1-4=quarter + $table->decimal('amount', 14, 2)->default(0); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->unique(['budget_id', 'account_id', 'period']); + }); + } + + public function down(): void + { + Schema::dropIfExists('budget_lines'); + } +}; diff --git a/erp/database/migrations/2026_06_01_074127_create_budgets_table.php b/erp/database/migrations/2026_06_01_074127_create_budgets_table.php new file mode 100644 index 00000000000..30c8dea25a3 --- /dev/null +++ b/erp/database/migrations/2026_06_01_074127_create_budgets_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->integer('year'); + $table->enum('period_type', ['annual', 'monthly', 'quarterly'])->default('annual'); + $table->text('notes')->nullable(); + $table->enum('status', ['draft', 'active', 'archived'])->default('draft'); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('budgets'); + } +}; diff --git a/erp/database/migrations/2026_06_01_075041_create_depreciation_entries_table.php b/erp/database/migrations/2026_06_01_075041_create_depreciation_entries_table.php new file mode 100644 index 00000000000..f295405c557 --- /dev/null +++ b/erp/database/migrations/2026_06_01_075041_create_depreciation_entries_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('fixed_asset_id')->constrained()->cascadeOnDelete(); + $table->foreignId('journal_entry_id')->nullable()->constrained()->nullOnDelete(); + $table->date('period_date'); + $table->decimal('amount', 14, 2); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('depreciation_entries'); + } +}; diff --git a/erp/database/migrations/2026_06_01_075041_create_fixed_assets_table.php b/erp/database/migrations/2026_06_01_075041_create_fixed_assets_table.php new file mode 100644 index 00000000000..c576bc37c3b --- /dev/null +++ b/erp/database/migrations/2026_06_01_075041_create_fixed_assets_table.php @@ -0,0 +1,38 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('code')->nullable(); + $table->string('category')->default('equipment'); + $table->text('description')->nullable(); + $table->date('purchase_date'); + $table->decimal('purchase_cost', 14, 2); + $table->decimal('salvage_value', 14, 2)->default(0); + $table->integer('useful_life_years')->default(5); + $table->decimal('accumulated_depreciation', 14, 2)->default(0); + $table->enum('status', ['active', 'disposed', 'fully_depreciated'])->default('active'); + $table->date('disposal_date')->nullable(); + $table->decimal('disposal_proceeds', 14, 2)->nullable(); + $table->foreignId('asset_account_id')->nullable()->constrained('accounts')->nullOnDelete(); + $table->foreignId('depreciation_account_id')->nullable()->constrained('accounts')->nullOnDelete(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('fixed_assets'); + } +}; diff --git a/erp/database/migrations/2026_06_01_080000_create_expense_claims_table.php b/erp/database/migrations/2026_06_01_080000_create_expense_claims_table.php new file mode 100644 index 00000000000..80d9e32d377 --- /dev/null +++ b/erp/database/migrations/2026_06_01_080000_create_expense_claims_table.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained()->cascadeOnDelete(); + $table->foreignId('submitted_by')->nullable()->constrained('users')->nullOnDelete(); + $table->string('title'); + $table->text('description')->nullable(); + $table->date('expense_date'); + $table->decimal('amount', 12, 2); + $table->string('currency_code', 3)->default('USD'); + $table->string('category')->default('other'); + $table->string('receipt_path')->nullable(); + $table->enum('status', ['draft', 'submitted', 'approved', 'rejected', 'reimbursed'])->default('draft'); + $table->foreignId('reviewed_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamp('reviewed_at')->nullable(); + $table->text('review_notes')->nullable(); + $table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('expense_claims'); + } +}; diff --git a/erp/database/migrations/2026_06_01_090001_create_product_categories_table.php b/erp/database/migrations/2026_06_01_090001_create_product_categories_table.php new file mode 100644 index 00000000000..48e25e85514 --- /dev/null +++ b/erp/database/migrations/2026_06_01_090001_create_product_categories_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('slug')->nullable(); + $table->text('description')->nullable(); + $table->string('colour', 7)->default('#6366f1'); + $table->timestamps(); + $table->softDeletes(); + $table->unique(['tenant_id', 'slug']); + }); + } + + public function down(): void + { + Schema::dropIfExists('product_categories'); + } +}; diff --git a/erp/database/migrations/2026_06_01_090002_add_product_category_id_to_products.php b/erp/database/migrations/2026_06_01_090002_add_product_category_id_to_products.php new file mode 100644 index 00000000000..1550f8822b5 --- /dev/null +++ b/erp/database/migrations/2026_06_01_090002_add_product_category_id_to_products.php @@ -0,0 +1,35 @@ +dropForeign(['category_id']); + $table->dropColumn('category_id'); + }); + + Schema::table('products', function (Blueprint $table) { + $table->foreignId('category_id')->nullable()->after('tenant_id') + ->constrained('product_categories')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('products', function (Blueprint $table) { + $table->dropForeign(['category_id']); + $table->dropColumn('category_id'); + }); + + Schema::table('products', function (Blueprint $table) { + $table->foreignId('category_id')->nullable()->after('tenant_id') + ->constrained('categories')->nullOnDelete(); + }); + } +}; diff --git a/erp/database/migrations/2026_06_01_224027_add_reorder_fields_to_products.php b/erp/database/migrations/2026_06_01_224027_add_reorder_fields_to_products.php new file mode 100644 index 00000000000..66dfe0220f5 --- /dev/null +++ b/erp/database/migrations/2026_06_01_224027_add_reorder_fields_to_products.php @@ -0,0 +1,25 @@ +decimal('reorder_quantity', 12, 4)->default(0)->after('reorder_point'); + $table->foreignId('preferred_supplier_id')->nullable()->after('reorder_quantity') + ->constrained('suppliers')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('products', function (Blueprint $table) { + $table->dropForeign(['preferred_supplier_id']); + $table->dropColumn(['reorder_quantity', 'preferred_supplier_id']); + }); + } +}; diff --git a/erp/database/migrations/2026_06_01_225416_create_price_lists_table.php b/erp/database/migrations/2026_06_01_225416_create_price_lists_table.php new file mode 100644 index 00000000000..0665af995a4 --- /dev/null +++ b/erp/database/migrations/2026_06_01_225416_create_price_lists_table.php @@ -0,0 +1,47 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->text('description')->nullable(); + $table->string('currency_code', 3)->default('USD'); + $table->decimal('discount_percent', 5, 2)->default(0); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + + Schema::create('price_list_items', function (Blueprint $table) { + $table->id(); + $table->foreignId('price_list_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->decimal('unit_price', 14, 4); + $table->timestamps(); + $table->unique(['price_list_id', 'product_id']); + }); + + Schema::table('contacts', function (Blueprint $table) { + $table->foreignId('price_list_id')->nullable()->after('type') + ->constrained('price_lists')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('contacts', function (Blueprint $table) { + $table->dropForeign(['price_list_id']); + $table->dropColumn('price_list_id'); + }); + Schema::dropIfExists('price_list_items'); + Schema::dropIfExists('price_lists'); + } +}; diff --git a/erp/database/migrations/2026_06_01_230001_create_projects_table.php b/erp/database/migrations/2026_06_01_230001_create_projects_table.php new file mode 100644 index 00000000000..358ca57456e --- /dev/null +++ b/erp/database/migrations/2026_06_01_230001_create_projects_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->text('description')->nullable(); + $table->enum('status', ['draft', 'active', 'completed', 'cancelled'])->default('active'); + $table->decimal('budget', 14, 2)->nullable(); + $table->foreignId('contact_id')->nullable()->constrained()->nullOnDelete(); + $table->foreignId('invoice_id')->nullable()->constrained()->nullOnDelete(); + $table->date('starts_on')->nullable(); + $table->date('ends_on')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('projects'); + } +}; diff --git a/erp/database/migrations/2026_06_01_230002_create_project_time_entries_table.php b/erp/database/migrations/2026_06_01_230002_create_project_time_entries_table.php new file mode 100644 index 00000000000..ceb0de7f402 --- /dev/null +++ b/erp/database/migrations/2026_06_01_230002_create_project_time_entries_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('project_id')->constrained()->cascadeOnDelete(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->string('description'); + $table->decimal('hours', 6, 2); + $table->boolean('billable')->default(true); + $table->boolean('billed')->default(false); + $table->date('entry_date'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('project_time_entries'); + } +}; diff --git a/erp/database/migrations/2026_06_01_240001_create_attachments_table.php b/erp/database/migrations/2026_06_01_240001_create_attachments_table.php new file mode 100644 index 00000000000..36675aaa54c --- /dev/null +++ b/erp/database/migrations/2026_06_01_240001_create_attachments_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('attachable_type'); + $table->unsignedBigInteger('attachable_id'); + $table->string('filename'); + $table->string('disk')->default('local'); + $table->string('path'); + $table->string('mime_type')->nullable(); + $table->unsignedBigInteger('size')->nullable(); + $table->foreignId('uploaded_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamps(); + + $table->index(['attachable_type', 'attachable_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('attachments'); + } +}; diff --git a/erp/database/migrations/2026_06_02_100001_add_phase34_fields_to_recurring_invoices.php b/erp/database/migrations/2026_06_02_100001_add_phase34_fields_to_recurring_invoices.php new file mode 100644 index 00000000000..d6cb48803c6 --- /dev/null +++ b/erp/database/migrations/2026_06_02_100001_add_phase34_fields_to_recurring_invoices.php @@ -0,0 +1,25 @@ +string('reference_prefix', 50)->default('REC-INV')->after('contact_id'); + $table->tinyInteger('interval')->unsigned()->default(1)->after('frequency'); + $table->string('currency_code', 3)->default('USD')->after('auto_send'); + $table->decimal('exchange_rate', 15, 6)->default(1)->after('currency_code'); + }); + } + + public function down(): void + { + Schema::table('recurring_invoices', function (Blueprint $table) { + $table->dropColumn(['reference_prefix', 'interval', 'currency_code', 'exchange_rate']); + }); + } +}; diff --git a/erp/database/migrations/2026_06_02_100002_add_recurring_invoice_id_to_invoices.php b/erp/database/migrations/2026_06_02_100002_add_recurring_invoice_id_to_invoices.php new file mode 100644 index 00000000000..411013c4dee --- /dev/null +++ b/erp/database/migrations/2026_06_02_100002_add_recurring_invoice_id_to_invoices.php @@ -0,0 +1,27 @@ +foreignId('recurring_invoice_id') + ->nullable() + ->after('tenant_id') + ->constrained('recurring_invoices') + ->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropForeign(['recurring_invoice_id']); + $table->dropColumn('recurring_invoice_id'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_02_200001_create_stock_adjustments_table.php b/erp/database/migrations/2026_06_02_200001_create_stock_adjustments_table.php new file mode 100644 index 00000000000..a6523851e44 --- /dev/null +++ b/erp/database/migrations/2026_06_02_200001_create_stock_adjustments_table.php @@ -0,0 +1,30 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('warehouse_id')->constrained('warehouses')->cascadeOnDelete(); + $table->string('reference')->unique(); + $table->enum('reason', ['count', 'damage', 'theft', 'expiry', 'correction', 'other'])->default('count'); + $table->enum('status', ['draft', 'confirmed', 'cancelled'])->default('draft'); + $table->foreignId('adjusted_by')->nullable()->nullOnDelete()->constrained('users'); + $table->timestamp('confirmed_at')->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('stock_adjustments'); + } +}; diff --git a/erp/database/migrations/2026_06_02_200002_create_stock_adjustment_items_table.php b/erp/database/migrations/2026_06_02_200002_create_stock_adjustment_items_table.php new file mode 100644 index 00000000000..8ac0192bde4 --- /dev/null +++ b/erp/database/migrations/2026_06_02_200002_create_stock_adjustment_items_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('stock_adjustment_id')->constrained('stock_adjustments')->cascadeOnDelete(); + $table->foreignId('product_id')->constrained('products')->cascadeOnDelete(); + $table->decimal('expected_quantity', 10, 2)->default(0); + $table->decimal('actual_quantity', 10, 2)->default(0); + $table->decimal('difference', 10, 2)->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('stock_adjustment_items'); + } +}; diff --git a/erp/database/migrations/2026_06_03_100001_create_purchase_requisitions_table.php b/erp/database/migrations/2026_06_03_100001_create_purchase_requisitions_table.php new file mode 100644 index 00000000000..ae13425ea39 --- /dev/null +++ b/erp/database/migrations/2026_06_03_100001_create_purchase_requisitions_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('reference')->unique(); + $table->foreignId('requested_by')->nullable()->nullOnDelete()->constrained('users'); + $table->foreignId('approved_by')->nullable()->nullOnDelete()->constrained('users'); + $table->enum('status', ['draft', 'submitted', 'approved', 'rejected'])->default('draft'); + $table->date('needed_by')->nullable(); + $table->text('notes')->nullable(); + $table->text('rejection_reason')->nullable(); + $table->timestamp('approved_at')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('purchase_requisitions'); + } +}; diff --git a/erp/database/migrations/2026_06_03_100002_create_purchase_requisition_items_table.php b/erp/database/migrations/2026_06_03_100002_create_purchase_requisition_items_table.php new file mode 100644 index 00000000000..b553d163f74 --- /dev/null +++ b/erp/database/migrations/2026_06_03_100002_create_purchase_requisition_items_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('purchase_requisition_id')->constrained('purchase_requisitions')->cascadeOnDelete(); + $table->foreignId('product_id')->nullable()->nullOnDelete()->constrained('products'); + $table->string('description'); + $table->decimal('quantity', 10, 2)->default(1); + $table->decimal('estimated_unit_cost', 15, 2)->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('purchase_requisition_items'); + } +}; diff --git a/erp/database/migrations/2026_06_03_200001_create_batch_payments_table.php b/erp/database/migrations/2026_06_03_200001_create_batch_payments_table.php new file mode 100644 index 00000000000..2340abf16fc --- /dev/null +++ b/erp/database/migrations/2026_06_03_200001_create_batch_payments_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->string('reference')->unique(); + $table->date('payment_date'); + $table->enum('payment_method', ['bank_transfer', 'cheque', 'cash', 'card', 'other'])->default('bank_transfer'); + $table->enum('type', ['received', 'made'])->default('received'); + $table->decimal('total_amount', 15, 2)->default(0); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('batch_payments'); + } +}; diff --git a/erp/database/migrations/2026_06_03_200002_add_batch_payment_id_to_payments.php b/erp/database/migrations/2026_06_03_200002_add_batch_payment_id_to_payments.php new file mode 100644 index 00000000000..81248453df1 --- /dev/null +++ b/erp/database/migrations/2026_06_03_200002_add_batch_payment_id_to_payments.php @@ -0,0 +1,27 @@ +foreignId('batch_payment_id') + ->nullable() + ->after('notes') + ->constrained('batch_payments') + ->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('payments', function (Blueprint $table) { + $table->dropForeignIdFor(\App\Modules\Finance\Models\BatchPayment::class, 'batch_payment_id'); + $table->dropColumn('batch_payment_id'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_03_200003_add_partial_status_to_invoices_and_bills.php b/erp/database/migrations/2026_06_03_200003_add_partial_status_to_invoices_and_bills.php new file mode 100644 index 00000000000..2566db9bed4 --- /dev/null +++ b/erp/database/migrations/2026_06_03_200003_add_partial_status_to_invoices_and_bills.php @@ -0,0 +1,38 @@ +enum('status', ['draft', 'sent', 'partial', 'paid', 'cancelled']) + ->default('draft') + ->change(); + }); + + Schema::table('bills', function (Blueprint $table) { + $table->enum('status', ['draft', 'received', 'partial', 'paid', 'cancelled']) + ->default('draft') + ->change(); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->enum('status', ['draft', 'sent', 'paid', 'cancelled']) + ->default('draft') + ->change(); + }); + + Schema::table('bills', function (Blueprint $table) { + $table->enum('status', ['draft', 'received', 'paid', 'cancelled']) + ->default('draft') + ->change(); + }); + } +}; diff --git a/erp/database/migrations/2026_06_04_100001_add_phase40_fields_to_sales_orders.php b/erp/database/migrations/2026_06_04_100001_add_phase40_fields_to_sales_orders.php new file mode 100644 index 00000000000..524cce95707 --- /dev/null +++ b/erp/database/migrations/2026_06_04_100001_add_phase40_fields_to_sales_orders.php @@ -0,0 +1,33 @@ +string('reference', 100)->nullable()->unique()->after('contact_id'); + $table->string('currency_code', 3)->default('USD')->after('notes'); + $table->decimal('exchange_rate', 15, 6)->default(1)->after('currency_code'); + }); + + Schema::table('sales_order_items', function (Blueprint $table) { + $table->decimal('line_total', 15, 2)->default(0)->after('tax_rate'); + }); + } + + public function down(): void + { + Schema::table('sales_orders', function (Blueprint $table) { + $table->dropUnique(['reference']); + $table->dropColumn(['reference', 'currency_code', 'exchange_rate']); + }); + + Schema::table('sales_order_items', function (Blueprint $table) { + $table->dropColumn('line_total'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_04_100002_add_sales_order_id_to_invoices.php b/erp/database/migrations/2026_06_04_100002_add_sales_order_id_to_invoices.php new file mode 100644 index 00000000000..91935105272 --- /dev/null +++ b/erp/database/migrations/2026_06_04_100002_add_sales_order_id_to_invoices.php @@ -0,0 +1,24 @@ +unsignedBigInteger('sales_order_id')->nullable()->after('contact_id'); + $table->foreign('sales_order_id')->references('id')->on('sales_orders')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropForeign(['sales_order_id']); + $table->dropColumn('sales_order_id'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_04_100003_add_invoiced_status_to_sales_orders.php b/erp/database/migrations/2026_06_04_100003_add_invoiced_status_to_sales_orders.php new file mode 100644 index 00000000000..fdf375a0ef6 --- /dev/null +++ b/erp/database/migrations/2026_06_04_100003_add_invoiced_status_to_sales_orders.php @@ -0,0 +1,24 @@ +enum('status', ['draft', 'confirmed', 'fulfilled', 'invoiced', 'cancelled']) + ->default('draft')->change(); + }); + } + + public function down(): void + { + Schema::table('sales_orders', function (Blueprint $table) { + $table->enum('status', ['draft', 'confirmed', 'fulfilled', 'cancelled']) + ->default('draft')->change(); + }); + } +}; diff --git a/erp/database/migrations/2026_06_04_200001_create_delivery_notes_table.php b/erp/database/migrations/2026_06_04_200001_create_delivery_notes_table.php new file mode 100644 index 00000000000..375441df0f9 --- /dev/null +++ b/erp/database/migrations/2026_06_04_200001_create_delivery_notes_table.php @@ -0,0 +1,33 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('sales_order_id')->nullable()->constrained('sales_orders')->nullOnDelete(); + $table->foreignId('invoice_id')->nullable()->constrained('invoices')->nullOnDelete(); + $table->foreignId('contact_id')->nullable()->constrained('contacts')->nullOnDelete(); + $table->string('reference')->unique(); + $table->enum('status', ['draft', 'dispatched', 'delivered'])->default('draft'); + $table->date('dispatch_date')->nullable(); + $table->date('delivery_date')->nullable(); + $table->string('carrier')->nullable(); + $table->string('tracking_number')->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('delivery_notes'); + } +}; diff --git a/erp/database/migrations/2026_06_04_200002_create_delivery_note_items_table.php b/erp/database/migrations/2026_06_04_200002_create_delivery_note_items_table.php new file mode 100644 index 00000000000..221899183be --- /dev/null +++ b/erp/database/migrations/2026_06_04_200002_create_delivery_note_items_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('delivery_note_id')->constrained('delivery_notes')->cascadeOnDelete(); + $table->foreignId('product_id')->nullable()->constrained('products')->nullOnDelete(); + $table->string('description'); + $table->decimal('quantity', 10, 2)->default(1); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('delivery_note_items'); + } +}; diff --git a/erp/database/migrations/2026_06_05_100001_create_onboarding_templates_table.php b/erp/database/migrations/2026_06_05_100001_create_onboarding_templates_table.php new file mode 100644 index 00000000000..848b18ae90d --- /dev/null +++ b/erp/database/migrations/2026_06_05_100001_create_onboarding_templates_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('name'); + $table->text('description')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('onboarding_templates'); + } +}; diff --git a/erp/database/migrations/2026_06_05_100002_create_onboarding_template_tasks_table.php b/erp/database/migrations/2026_06_05_100002_create_onboarding_template_tasks_table.php new file mode 100644 index 00000000000..f4313d242cb --- /dev/null +++ b/erp/database/migrations/2026_06_05_100002_create_onboarding_template_tasks_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('onboarding_template_id')->constrained('onboarding_templates')->cascadeOnDelete(); + $table->string('title'); + $table->text('description')->nullable(); + $table->tinyInteger('due_days')->unsigned()->default(0); + $table->tinyInteger('sort_order')->unsigned()->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('onboarding_template_tasks'); + } +}; diff --git a/erp/database/migrations/2026_06_05_100003_create_employee_onboardings_table.php b/erp/database/migrations/2026_06_05_100003_create_employee_onboardings_table.php new file mode 100644 index 00000000000..443c0b53530 --- /dev/null +++ b/erp/database/migrations/2026_06_05_100003_create_employee_onboardings_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete(); + $table->foreignId('template_id')->nullable()->constrained('onboarding_templates')->nullOnDelete(); + $table->string('title'); + $table->enum('status', ['in_progress', 'completed', 'cancelled'])->default('in_progress'); + $table->date('started_at'); + $table->date('completed_at')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('employee_onboardings'); + } +}; diff --git a/erp/database/migrations/2026_06_05_100004_create_employee_onboarding_tasks_table.php b/erp/database/migrations/2026_06_05_100004_create_employee_onboarding_tasks_table.php new file mode 100644 index 00000000000..22a1b694add --- /dev/null +++ b/erp/database/migrations/2026_06_05_100004_create_employee_onboarding_tasks_table.php @@ -0,0 +1,28 @@ +id(); + $table->foreignId('employee_onboarding_id')->constrained('employee_onboardings')->cascadeOnDelete(); + $table->string('title'); + $table->text('description')->nullable(); + $table->date('due_date')->nullable(); + $table->timestamp('completed_at')->nullable(); + $table->foreignId('completed_by')->nullable()->constrained('users')->nullOnDelete(); + $table->tinyInteger('sort_order')->unsigned()->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('employee_onboarding_tasks'); + } +}; diff --git a/erp/database/migrations/2026_06_06_100001_create_performance_reviews_table.php b/erp/database/migrations/2026_06_06_100001_create_performance_reviews_table.php new file mode 100644 index 00000000000..866730e3fd3 --- /dev/null +++ b/erp/database/migrations/2026_06_06_100001_create_performance_reviews_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete(); + $table->foreignId('reviewer_id')->nullable()->constrained('users')->nullOnDelete(); + $table->date('period_start'); + $table->date('period_end'); + $table->enum('status', ['draft', 'in_review', 'completed'])->default('draft'); + $table->tinyInteger('overall_rating')->unsigned()->nullable(); + $table->text('comments')->nullable(); + $table->timestamp('completed_at')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('performance_reviews'); + } +}; diff --git a/erp/database/migrations/2026_06_06_100002_create_performance_review_goals_table.php b/erp/database/migrations/2026_06_06_100002_create_performance_review_goals_table.php new file mode 100644 index 00000000000..448cf58d0e7 --- /dev/null +++ b/erp/database/migrations/2026_06_06_100002_create_performance_review_goals_table.php @@ -0,0 +1,26 @@ +id(); + $table->foreignId('performance_review_id')->constrained('performance_reviews')->cascadeOnDelete(); + $table->string('title'); + $table->text('description')->nullable(); + $table->boolean('achieved')->default(false); + $table->text('achievement_notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('performance_review_goals'); + } +}; diff --git a/erp/database/migrations/2026_06_06_100003_create_performance_review_competencies_table.php b/erp/database/migrations/2026_06_06_100003_create_performance_review_competencies_table.php new file mode 100644 index 00000000000..c2ac5bb800b --- /dev/null +++ b/erp/database/migrations/2026_06_06_100003_create_performance_review_competencies_table.php @@ -0,0 +1,25 @@ +id(); + $table->foreignId('performance_review_id')->constrained('performance_reviews')->cascadeOnDelete(); + $table->string('name'); + $table->tinyInteger('rating')->unsigned()->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('performance_review_competencies'); + } +}; diff --git a/erp/database/migrations/2026_06_07_100001_create_training_courses_table.php b/erp/database/migrations/2026_06_07_100001_create_training_courses_table.php new file mode 100644 index 00000000000..98b21af31a7 --- /dev/null +++ b/erp/database/migrations/2026_06_07_100001_create_training_courses_table.php @@ -0,0 +1,29 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('title'); + $table->string('provider')->nullable(); + $table->enum('type', ['internal', 'external', 'online', 'certification'])->default('internal'); + $table->decimal('duration_hours', 5, 1)->nullable(); + $table->text('description')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('training_courses'); + } +}; diff --git a/erp/database/migrations/2026_06_07_100002_create_employee_training_records_table.php b/erp/database/migrations/2026_06_07_100002_create_employee_training_records_table.php new file mode 100644 index 00000000000..fede497773c --- /dev/null +++ b/erp/database/migrations/2026_06_07_100002_create_employee_training_records_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete(); + $table->foreignId('training_course_id')->nullable()->constrained('training_courses')->nullOnDelete(); + $table->string('course_title'); + $table->date('completed_date'); + $table->date('expiry_date')->nullable(); + $table->decimal('score', 5, 2)->nullable(); + $table->boolean('passed')->default(true); + $table->string('certificate_number')->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + $table->softDeletes(); + }); + } + + public function down(): void + { + Schema::dropIfExists('employee_training_records'); + } +}; diff --git a/erp/database/migrations/2026_06_08_100001_create_job_positions_table.php b/erp/database/migrations/2026_06_08_100001_create_job_positions_table.php new file mode 100644 index 00000000000..67453ce7960 --- /dev/null +++ b/erp/database/migrations/2026_06_08_100001_create_job_positions_table.php @@ -0,0 +1,33 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('title'); + $table->foreignId('department_id')->nullable()->constrained('departments')->nullOnDelete(); + $table->string('location')->nullable(); + $table->enum('employment_type', ['full_time', 'part_time', 'contract', 'internship'])->default('full_time'); + $table->text('description')->nullable(); + $table->text('requirements')->nullable(); + $table->unsignedInteger('openings')->default(1); + $table->enum('status', ['draft', 'open', 'closed', 'on_hold'])->default('draft'); + $table->timestamp('posted_at')->nullable(); + $table->timestamp('closed_at')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('job_positions'); + } +}; diff --git a/erp/database/migrations/2026_06_08_100002_create_job_applications_table.php b/erp/database/migrations/2026_06_08_100002_create_job_applications_table.php new file mode 100644 index 00000000000..811591f15a2 --- /dev/null +++ b/erp/database/migrations/2026_06_08_100002_create_job_applications_table.php @@ -0,0 +1,35 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('job_position_id')->constrained('job_positions')->cascadeOnDelete(); + $table->string('applicant_name'); + $table->string('applicant_email'); + $table->string('applicant_phone')->nullable(); + $table->string('resume_path')->nullable(); + $table->text('cover_letter')->nullable(); + $table->string('source')->nullable(); + $table->enum('stage', ['applied', 'screening', 'interview', 'offer', 'hired', 'rejected'])->default('applied'); + $table->text('notes')->nullable(); + $table->unsignedTinyInteger('rating')->nullable(); + $table->timestamp('rejected_at')->nullable(); + $table->timestamp('hired_at')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('job_applications'); + } +}; diff --git a/erp/database/migrations/2026_06_09_100001_create_attendance_records_table.php b/erp/database/migrations/2026_06_09_100001_create_attendance_records_table.php new file mode 100644 index 00000000000..d3b0ebbdd68 --- /dev/null +++ b/erp/database/migrations/2026_06_09_100001_create_attendance_records_table.php @@ -0,0 +1,32 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete(); + $table->date('work_date'); + $table->time('clock_in')->nullable(); + $table->time('clock_out')->nullable(); + $table->unsignedInteger('break_minutes')->default(0); + $table->enum('status', ['present', 'absent', 'half_day', 'holiday', 'leave'])->default('present'); + $table->text('notes')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->unique(['tenant_id', 'employee_id', 'work_date']); + }); + } + + public function down(): void + { + Schema::dropIfExists('attendance_records'); + } +}; diff --git a/erp/database/migrations/2026_06_09_100002_create_work_schedules_table.php b/erp/database/migrations/2026_06_09_100002_create_work_schedules_table.php new file mode 100644 index 00000000000..1edaf154296 --- /dev/null +++ b/erp/database/migrations/2026_06_09_100002_create_work_schedules_table.php @@ -0,0 +1,39 @@ +id(); + $table->foreignId('tenant_id')->constrained('tenants')->cascadeOnDelete(); + $table->string('name'); + $table->time('monday_start')->nullable(); + $table->time('monday_end')->nullable(); + $table->time('tuesday_start')->nullable(); + $table->time('tuesday_end')->nullable(); + $table->time('wednesday_start')->nullable(); + $table->time('wednesday_end')->nullable(); + $table->time('thursday_start')->nullable(); + $table->time('thursday_end')->nullable(); + $table->time('friday_start')->nullable(); + $table->time('friday_end')->nullable(); + $table->time('saturday_start')->nullable(); + $table->time('saturday_end')->nullable(); + $table->time('sunday_start')->nullable(); + $table->time('sunday_end')->nullable(); + $table->boolean('is_default')->default(false); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('work_schedules'); + } +}; diff --git a/erp/database/migrations/2026_06_10_100001_create_assets_table.php b/erp/database/migrations/2026_06_10_100001_create_assets_table.php new file mode 100644 index 00000000000..8a02368a43b --- /dev/null +++ b/erp/database/migrations/2026_06_10_100001_create_assets_table.php @@ -0,0 +1,38 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('name'); + $table->string('asset_code', 100)->nullable(); + $table->string('category', 100)->nullable(); + $table->string('location')->nullable(); + $table->unsignedBigInteger('assigned_to_employee_id')->nullable(); + $table->date('purchase_date')->nullable(); + $table->decimal('purchase_cost', 12, 2)->nullable(); + $table->decimal('current_value', 12, 2)->nullable(); + $table->enum('status', ['active', 'inactive', 'disposed', 'under_maintenance'])->default('active'); + $table->string('serial_number', 100)->nullable(); + $table->text('notes')->nullable(); + $table->timestamp('disposed_at')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('assigned_to_employee_id')->references('id')->on('employees')->nullOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('assets'); + } +}; diff --git a/erp/database/migrations/2026_06_10_100002_create_asset_maintenances_table.php b/erp/database/migrations/2026_06_10_100002_create_asset_maintenances_table.php new file mode 100644 index 00000000000..1e07e557efc --- /dev/null +++ b/erp/database/migrations/2026_06_10_100002_create_asset_maintenances_table.php @@ -0,0 +1,34 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->unsignedBigInteger('asset_id'); + $table->date('scheduled_date'); + $table->date('completed_date')->nullable(); + $table->enum('type', ['routine', 'repair', 'inspection', 'calibration'])->default('routine'); + $table->text('description')->nullable(); + $table->decimal('cost', 10, 2)->nullable(); + $table->string('performed_by')->nullable(); + $table->enum('status', ['scheduled', 'completed', 'cancelled'])->default('scheduled'); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('tenant_id')->references('id')->on('tenants')->cascadeOnDelete(); + $table->foreign('asset_id')->references('id')->on('assets')->cascadeOnDelete(); + }); + } + + public function down(): void + { + Schema::dropIfExists('asset_maintenances'); + } +}; diff --git a/erp/database/migrations/2026_06_11_100001_create_vendor_profiles_table.php b/erp/database/migrations/2026_06_11_100001_create_vendor_profiles_table.php new file mode 100644 index 00000000000..ee2cc56be78 --- /dev/null +++ b/erp/database/migrations/2026_06_11_100001_create_vendor_profiles_table.php @@ -0,0 +1,30 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('contact_id')->constrained('contacts')->cascadeOnDelete()->unique(); + $table->decimal('credit_limit', 12, 2)->nullable(); + $table->unsignedInteger('payment_terms_days')->default(30); + $table->string('preferred_currency', 3)->nullable(); + $table->string('bank_name')->nullable(); + $table->string('bank_account_number', 100)->nullable(); + $table->string('bank_routing_number', 100)->nullable(); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('vendor_profiles'); + } +}; diff --git a/erp/database/migrations/2026_06_11_100002_create_vendor_evaluations_table.php b/erp/database/migrations/2026_06_11_100002_create_vendor_evaluations_table.php new file mode 100644 index 00000000000..19f5433f441 --- /dev/null +++ b/erp/database/migrations/2026_06_11_100002_create_vendor_evaluations_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('contact_id')->constrained('contacts')->cascadeOnDelete(); + $table->foreignId('evaluated_by')->constrained('users'); + $table->date('evaluation_date'); + $table->unsignedTinyInteger('quality_rating'); + $table->unsignedTinyInteger('delivery_rating'); + $table->unsignedTinyInteger('price_rating'); + $table->unsignedTinyInteger('communication_rating'); + $table->decimal('overall_rating', 3, 2); + $table->text('comments')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('vendor_evaluations'); + } +}; diff --git a/erp/database/migrations/2026_06_12_100001_create_customer_portal_tokens_table.php b/erp/database/migrations/2026_06_12_100001_create_customer_portal_tokens_table.php new file mode 100644 index 00000000000..04d4eda7df1 --- /dev/null +++ b/erp/database/migrations/2026_06_12_100001_create_customer_portal_tokens_table.php @@ -0,0 +1,29 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('contact_id')->constrained('contacts')->cascadeOnDelete(); + $table->string('token', 64)->unique(); + $table->string('email'); + $table->timestamp('expires_at')->nullable(); + $table->timestamp('last_accessed_at')->nullable(); + $table->timestamps(); + + $table->index('tenant_id'); + }); + } + + public function down(): void + { + Schema::dropIfExists('customer_portal_tokens'); + } +}; diff --git a/erp/database/migrations/2026_06_13_100001_update_budgets_table_add_fiscal_year.php b/erp/database/migrations/2026_06_13_100001_update_budgets_table_add_fiscal_year.php new file mode 100644 index 00000000000..8507b9ea3d5 --- /dev/null +++ b/erp/database/migrations/2026_06_13_100001_update_budgets_table_add_fiscal_year.php @@ -0,0 +1,89 @@ +unsignedSmallInteger('fiscal_year')->default(2025)->after('name'); + }); + + // Populate fiscal_year from year + DB::table('budgets')->update(['fiscal_year' => DB::raw('"year"')]); + + Schema::table('budgets', function (Blueprint $table) { + $table->unique(['tenant_id', 'name', 'fiscal_year'], 'budgets_tenant_name_fiscal_year_unique'); + }); + + // Update status column to support 'closed' in addition to 'archived' + // SQLite: drop and recreate the status column with updated check constraint + // Use raw SQL to modify the check constraint + DB::statement(" + CREATE TABLE budgets_new AS SELECT + id, tenant_id, name, fiscal_year, year, period_type, notes, + CASE WHEN status = 'archived' THEN 'closed' ELSE status END as status, + created_by, created_at, updated_at, deleted_at + FROM budgets + "); + DB::statement("DROP TABLE budgets"); + DB::statement(" + CREATE TABLE budgets ( + id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + tenant_id integer NOT NULL, + name varchar(255) NOT NULL, + fiscal_year integer unsigned NOT NULL DEFAULT 2025, + year integer NOT NULL, + period_type varchar(255) CHECK(period_type IN ('annual','monthly','quarterly')) NOT NULL DEFAULT 'annual', + notes text, + status varchar(255) CHECK(status IN ('draft','active','closed')) NOT NULL DEFAULT 'draft', + created_by integer, + created_at datetime, + updated_at datetime, + deleted_at datetime, + FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE, + FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE SET NULL + ) + "); + DB::statement("INSERT INTO budgets SELECT id, tenant_id, name, fiscal_year, year, period_type, notes, status, created_by, created_at, updated_at, deleted_at FROM budgets_new"); + DB::statement("DROP TABLE budgets_new"); + + // Re-create indexes + DB::statement("CREATE UNIQUE INDEX budgets_tenant_name_fiscal_year_unique ON budgets (tenant_id, name, fiscal_year)"); + } + + public function down(): void + { + DB::statement(" + CREATE TABLE budgets_restore AS SELECT + id, tenant_id, name, year, period_type, notes, + CASE WHEN status = 'closed' THEN 'archived' ELSE status END as status, + created_by, created_at, updated_at, deleted_at + FROM budgets + "); + DB::statement("DROP TABLE budgets"); + DB::statement(" + CREATE TABLE budgets ( + id integer NOT NULL PRIMARY KEY AUTOINCREMENT, + tenant_id integer NOT NULL, + name varchar(255) NOT NULL, + year integer NOT NULL, + period_type varchar(255) CHECK(period_type IN ('annual','monthly','quarterly')) NOT NULL DEFAULT 'annual', + notes text, + status varchar(255) CHECK(status IN ('draft','active','archived')) NOT NULL DEFAULT 'draft', + created_by integer, + created_at datetime, + updated_at datetime, + deleted_at datetime, + FOREIGN KEY (tenant_id) REFERENCES tenants(id) ON DELETE CASCADE, + FOREIGN KEY (created_by) REFERENCES users(id) ON DELETE SET NULL + ) + "); + DB::statement("INSERT INTO budgets SELECT id, tenant_id, name, year, period_type, notes, status, created_by, created_at, updated_at, deleted_at FROM budgets_restore"); + DB::statement("DROP TABLE budgets_restore"); + } +}; diff --git a/erp/database/migrations/2026_06_13_100002_update_budget_lines_table_add_tenant.php b/erp/database/migrations/2026_06_13_100002_update_budget_lines_table_add_tenant.php new file mode 100644 index 00000000000..788a2528897 --- /dev/null +++ b/erp/database/migrations/2026_06_13_100002_update_budget_lines_table_add_tenant.php @@ -0,0 +1,42 @@ +unsignedBigInteger('tenant_id')->nullable()->after('id'); + } + if (!Schema::hasColumn('budget_lines', 'deleted_at')) { + $table->softDeletes(); + } + }); + + // Populate tenant_id from related budget (SQLite compatible) + $lines = DB::table('budget_lines')->whereNull('tenant_id')->get(['id', 'budget_id']); + foreach ($lines as $line) { + $budget = DB::table('budgets')->where('id', $line->budget_id)->first(['tenant_id']); + if ($budget) { + DB::table('budget_lines')->where('id', $line->id)->update(['tenant_id' => $budget->tenant_id]); + } + } + } + + public function down(): void + { + Schema::table('budget_lines', function (Blueprint $table) { + if (Schema::hasColumn('budget_lines', 'deleted_at')) { + $table->dropSoftDeletes(); + } + if (Schema::hasColumn('budget_lines', 'tenant_id')) { + $table->dropColumn('tenant_id'); + } + }); + } +}; diff --git a/erp/database/migrations/2026_06_14_100001_create_exchange_rates_table.php b/erp/database/migrations/2026_06_14_100001_create_exchange_rates_table.php new file mode 100644 index 00000000000..fac8b4aa021 --- /dev/null +++ b/erp/database/migrations/2026_06_14_100001_create_exchange_rates_table.php @@ -0,0 +1,41 @@ +dropUnique(['tenant_id', 'currency_code', 'date']); + $table->dropColumn(['currency_code', 'date']); + }); + + Schema::table('exchange_rates', function (Blueprint $table) { + $table->string('base_currency', 3)->after('tenant_id'); + $table->string('quote_currency', 3)->after('base_currency'); + $table->date('effective_date')->after('rate'); + $table->string('source', 100)->nullable()->after('effective_date'); + $table->unique( + ['tenant_id', 'base_currency', 'quote_currency', 'effective_date'], + 'exchange_rates_unique_pair_date' + ); + }); + } + + public function down(): void + { + Schema::table('exchange_rates', function (Blueprint $table) { + $table->dropUnique('exchange_rates_unique_pair_date'); + $table->dropColumn(['base_currency', 'quote_currency', 'effective_date', 'source']); + }); + + Schema::table('exchange_rates', function (Blueprint $table) { + $table->string('currency_code', 3)->after('tenant_id'); + $table->date('date')->after('rate'); + $table->unique(['tenant_id', 'currency_code', 'date']); + }); + } +}; diff --git a/erp/database/migrations/2026_06_15_100001_make_audit_log_auditable_nullable.php b/erp/database/migrations/2026_06_15_100001_make_audit_log_auditable_nullable.php new file mode 100644 index 00000000000..b44eb956e91 --- /dev/null +++ b/erp/database/migrations/2026_06_15_100001_make_audit_log_auditable_nullable.php @@ -0,0 +1,37 @@ +id(); + $table->foreignId('user_id')->nullable()->constrained()->nullOnDelete(); + $table->unsignedBigInteger('tenant_id')->nullable(); + $table->string('event', 64); + $table->string('auditable_type')->nullable(); + $table->unsignedBigInteger('auditable_id')->nullable(); + $table->json('old_values')->nullable(); + $table->json('new_values')->nullable(); + $table->ipAddress('ip_address')->nullable(); + $table->string('user_agent')->nullable(); + $table->timestamp('created_at')->useCurrent(); + + $table->index(['auditable_type', 'auditable_id']); + $table->index(['user_id', 'created_at']); + $table->index('tenant_id'); + }); + } + + public function down(): void + { + // No rollback needed for test env + } +}; diff --git a/erp/database/migrations/2026_06_16_100001_create_notification_rules_table.php b/erp/database/migrations/2026_06_16_100001_create_notification_rules_table.php new file mode 100644 index 00000000000..35c95326781 --- /dev/null +++ b/erp/database/migrations/2026_06_16_100001_create_notification_rules_table.php @@ -0,0 +1,27 @@ +id(); + $table->unsignedBigInteger('tenant_id')->index(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->string('name'); + $table->string('event_type', 100); + $table->json('conditions')->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('notification_rules'); + } +}; diff --git a/erp/database/migrations/2026_06_16_100002_create_notification_inbox_table.php b/erp/database/migrations/2026_06_16_100002_create_notification_inbox_table.php new file mode 100644 index 00000000000..d3a8856d681 --- /dev/null +++ b/erp/database/migrations/2026_06_16_100002_create_notification_inbox_table.php @@ -0,0 +1,29 @@ +id(); + $table->unsignedBigInteger('tenant_id')->index(); + $table->foreignId('user_id')->constrained()->cascadeOnDelete(); + $table->string('title'); + $table->text('body')->nullable(); + $table->string('type'); + $table->string('link')->nullable(); + $table->boolean('is_read')->default(false); + $table->timestamp('read_at')->nullable(); + $table->timestamp('created_at'); + }); + } + + public function down(): void + { + Schema::dropIfExists('notification_inbox'); + } +}; diff --git a/erp/database/migrations/2026_06_17_100001_create_document_templates_table.php b/erp/database/migrations/2026_06_17_100001_create_document_templates_table.php new file mode 100644 index 00000000000..bfd12a33562 --- /dev/null +++ b/erp/database/migrations/2026_06_17_100001_create_document_templates_table.php @@ -0,0 +1,30 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('name'); + $table->enum('type', ['invoice', 'quote', 'letter', 'receipt', 'purchase_order'])->default('invoice'); + $table->string('subject')->nullable(); + $table->longText('body'); + $table->json('variables')->nullable(); + $table->boolean('is_default')->default(false); + $table->boolean('is_active')->default(true); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('document_templates'); + } +}; diff --git a/erp/database/migrations/2026_06_18_100001_create_product_bundle_items_table.php b/erp/database/migrations/2026_06_18_100001_create_product_bundle_items_table.php new file mode 100644 index 00000000000..9786b85779d --- /dev/null +++ b/erp/database/migrations/2026_06_18_100001_create_product_bundle_items_table.php @@ -0,0 +1,27 @@ +id(); + $table->foreignId('tenant_id')->constrained()->cascadeOnDelete(); + $table->foreignId('bundle_product_id')->constrained('products')->cascadeOnDelete(); + $table->foreignId('component_product_id')->constrained('products')->cascadeOnDelete(); + $table->decimal('quantity', 10, 4); + $table->timestamps(); + + $table->unique(['bundle_product_id', 'component_product_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('product_bundle_items'); + } +}; diff --git a/erp/database/migrations/2026_06_18_100002_add_is_bundle_to_products.php b/erp/database/migrations/2026_06_18_100002_add_is_bundle_to_products.php new file mode 100644 index 00000000000..e541c4bf107 --- /dev/null +++ b/erp/database/migrations/2026_06_18_100002_add_is_bundle_to_products.php @@ -0,0 +1,23 @@ +boolean('is_bundle')->default(false)->after('is_active'); + $table->decimal('stock_quantity', 12, 4)->default(0)->after('is_bundle'); + }); + } + + public function down(): void + { + Schema::table('products', function (Blueprint $table) { + $table->dropColumn(['is_bundle', 'stock_quantity']); + }); + } +}; diff --git a/erp/database/migrations/2026_06_18_100003_make_product_sku_nullable.php b/erp/database/migrations/2026_06_18_100003_make_product_sku_nullable.php new file mode 100644 index 00000000000..cff037a8482 --- /dev/null +++ b/erp/database/migrations/2026_06_18_100003_make_product_sku_nullable.php @@ -0,0 +1,22 @@ +string('sku')->nullable()->change(); + }); + } + + public function down(): void + { + Schema::table('products', function (Blueprint $table) { + $table->string('sku')->nullable(false)->change(); + }); + } +}; diff --git a/erp/database/migrations/2026_06_19_100001_create_warehouse_stock_table.php b/erp/database/migrations/2026_06_19_100001_create_warehouse_stock_table.php new file mode 100644 index 00000000000..31738b079f9 --- /dev/null +++ b/erp/database/migrations/2026_06_19_100001_create_warehouse_stock_table.php @@ -0,0 +1,28 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('warehouse_id')->constrained('warehouses')->cascadeOnDelete(); + $table->foreignId('product_id')->constrained('products')->cascadeOnDelete(); + $table->decimal('quantity', 12, 4)->default(0); + $table->decimal('reorder_point', 12, 4)->nullable(); + $table->timestamps(); + + $table->unique(['warehouse_id', 'product_id']); + }); + } + + public function down(): void + { + Schema::dropIfExists('warehouse_stock'); + } +}; diff --git a/erp/database/migrations/2026_06_19_100002_create_stock_transfers_table.php b/erp/database/migrations/2026_06_19_100002_create_stock_transfers_table.php new file mode 100644 index 00000000000..92feab3fe93 --- /dev/null +++ b/erp/database/migrations/2026_06_19_100002_create_stock_transfers_table.php @@ -0,0 +1,29 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('reference')->nullable(); + $table->foreignId('from_warehouse_id')->constrained('warehouses'); + $table->foreignId('to_warehouse_id')->constrained('warehouses'); + $table->enum('status', ['draft', 'in_transit', 'completed', 'cancelled'])->default('draft'); + $table->text('notes')->nullable(); + $table->timestamp('transferred_at')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('stock_transfers'); + } +}; diff --git a/erp/database/migrations/2026_06_19_100003_create_stock_transfer_items_table.php b/erp/database/migrations/2026_06_19_100003_create_stock_transfer_items_table.php new file mode 100644 index 00000000000..1bab9cb76c4 --- /dev/null +++ b/erp/database/migrations/2026_06_19_100003_create_stock_transfer_items_table.php @@ -0,0 +1,25 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('stock_transfer_id')->constrained('stock_transfers')->cascadeOnDelete(); + $table->foreignId('product_id')->constrained('products'); + $table->decimal('quantity', 12, 4); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('stock_transfer_items'); + } +}; diff --git a/erp/database/migrations/2026_06_20_100001_create_subscription_plans_table.php b/erp/database/migrations/2026_06_20_100001_create_subscription_plans_table.php new file mode 100644 index 00000000000..e5d84d95c81 --- /dev/null +++ b/erp/database/migrations/2026_06_20_100001_create_subscription_plans_table.php @@ -0,0 +1,30 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->string('name'); + $table->text('description')->nullable(); + $table->enum('billing_cycle', ['monthly', 'quarterly', 'annually'])->default('monthly'); + $table->decimal('price', 10, 2); + $table->string('currency_code', 3)->default('USD'); + $table->unsignedInteger('trial_days')->default(0); + $table->boolean('is_active')->default(true); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('subscription_plans'); + } +}; diff --git a/erp/database/migrations/2026_06_20_100002_create_subscriptions_table.php b/erp/database/migrations/2026_06_20_100002_create_subscriptions_table.php new file mode 100644 index 00000000000..00f5bb145d4 --- /dev/null +++ b/erp/database/migrations/2026_06_20_100002_create_subscriptions_table.php @@ -0,0 +1,33 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('contact_id')->constrained('contacts')->cascadeOnDelete(); + $table->foreignId('subscription_plan_id')->constrained('subscription_plans')->cascadeOnDelete(); + $table->enum('status', ['trial', 'active', 'paused', 'cancelled', 'expired'])->default('trial'); + $table->date('started_at'); + $table->date('trial_ends_at')->nullable(); + $table->date('current_period_start')->nullable(); + $table->date('current_period_end')->nullable(); + $table->timestamp('cancelled_at')->nullable(); + $table->date('next_invoice_date')->nullable(); + $table->text('notes')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('subscriptions'); + } +}; diff --git a/erp/database/migrations/2026_06_21_100001_create_commission_rules_table.php b/erp/database/migrations/2026_06_21_100001_create_commission_rules_table.php new file mode 100644 index 00000000000..fb7e4a2aec3 --- /dev/null +++ b/erp/database/migrations/2026_06_21_100001_create_commission_rules_table.php @@ -0,0 +1,28 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('user_id')->constrained('users')->cascadeOnDelete(); + $table->string('name'); + $table->decimal('rate', 5, 4)->default(0); + $table->enum('type', ['percentage', 'fixed'])->default('percentage'); + $table->decimal('fixed_amount', 10, 2)->nullable(); + $table->boolean('is_active')->default(true); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('commission_rules'); + } +}; diff --git a/erp/database/migrations/2026_06_21_100002_create_commissions_table.php b/erp/database/migrations/2026_06_21_100002_create_commissions_table.php new file mode 100644 index 00000000000..68188f88439 --- /dev/null +++ b/erp/database/migrations/2026_06_21_100002_create_commissions_table.php @@ -0,0 +1,32 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('commission_rule_id')->constrained('commission_rules')->cascadeOnDelete(); + $table->foreignId('user_id')->constrained('users'); + $table->foreignId('invoice_id')->constrained('invoices')->cascadeOnDelete(); + $table->decimal('invoice_amount', 12, 2); + $table->decimal('commission_amount', 10, 2); + $table->enum('status', ['pending', 'approved', 'paid'])->default('pending'); + $table->timestamp('approved_at')->nullable(); + $table->timestamp('paid_at')->nullable(); + $table->text('notes')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('commissions'); + } +}; diff --git a/erp/database/migrations/2026_06_21_100003_add_assigned_to_user_id_to_invoices.php b/erp/database/migrations/2026_06_21_100003_add_assigned_to_user_id_to_invoices.php new file mode 100644 index 00000000000..55e04bdfa75 --- /dev/null +++ b/erp/database/migrations/2026_06_21_100003_add_assigned_to_user_id_to_invoices.php @@ -0,0 +1,23 @@ +foreignId('assigned_to_user_id')->nullable()->constrained('users')->nullOnDelete()->after('contact_id'); + }); + } + + public function down(): void + { + Schema::table('invoices', function (Blueprint $table) { + $table->dropForeignIdFor(\App\Models\User::class, 'assigned_to_user_id'); + $table->dropColumn('assigned_to_user_id'); + }); + } +}; diff --git a/erp/database/migrations/2026_06_22_100001_create_contracts_table.php b/erp/database/migrations/2026_06_22_100001_create_contracts_table.php new file mode 100644 index 00000000000..e579f3c3eba --- /dev/null +++ b/erp/database/migrations/2026_06_22_100001_create_contracts_table.php @@ -0,0 +1,37 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('contact_id')->nullable()->constrained('contacts')->nullOnDelete(); + $table->string('title'); + $table->string('reference')->nullable(); + $table->enum('type', ['client', 'vendor', 'employment', 'nda', 'other'])->default('client'); + $table->enum('status', ['draft', 'active', 'expired', 'terminated'])->default('draft'); + $table->decimal('value', 14, 2)->nullable(); + $table->string('currency_code', 3)->nullable(); + $table->date('start_date')->nullable(); + $table->date('end_date')->nullable(); + $table->boolean('auto_renew')->default(false); + $table->unsignedInteger('renewal_notice_days')->default(30); + $table->text('description')->nullable(); + $table->text('terms')->nullable(); + $table->date('signed_at')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('contracts'); + } +}; diff --git a/erp/database/migrations/2026_06_23_100001_create_employee_loans_table.php b/erp/database/migrations/2026_06_23_100001_create_employee_loans_table.php new file mode 100644 index 00000000000..94112e8885a --- /dev/null +++ b/erp/database/migrations/2026_06_23_100001_create_employee_loans_table.php @@ -0,0 +1,35 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('employee_id')->constrained('employees')->cascadeOnDelete(); + $table->enum('type', ['loan', 'advance'])->default('loan'); + $table->decimal('amount', 10, 2); + $table->decimal('outstanding_balance', 10, 2); + $table->decimal('interest_rate', 5, 2)->default(0); + $table->enum('status', ['pending', 'active', 'completed', 'cancelled'])->default('pending'); + $table->foreignId('approved_by')->nullable()->constrained('users')->nullOnDelete(); + $table->timestamp('approved_at')->nullable(); + $table->timestamp('disbursed_at')->nullable(); + $table->string('purpose')->nullable(); + $table->text('notes')->nullable(); + $table->date('repayment_start_date')->nullable(); + $table->softDeletes(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('employee_loans'); + } +}; diff --git a/erp/database/migrations/2026_06_23_100002_create_loan_repayments_table.php b/erp/database/migrations/2026_06_23_100002_create_loan_repayments_table.php new file mode 100644 index 00000000000..687b5074ccd --- /dev/null +++ b/erp/database/migrations/2026_06_23_100002_create_loan_repayments_table.php @@ -0,0 +1,26 @@ +id(); + $table->unsignedBigInteger('tenant_id'); + $table->foreignId('employee_loan_id')->constrained('employee_loans')->cascadeOnDelete(); + $table->decimal('amount', 10, 2); + $table->date('payment_date'); + $table->text('notes')->nullable(); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('loan_repayments'); + } +}; diff --git a/erp/database/seeders/DatabaseSeeder.php b/erp/database/seeders/DatabaseSeeder.php new file mode 100644 index 00000000000..29c8d344241 --- /dev/null +++ b/erp/database/seeders/DatabaseSeeder.php @@ -0,0 +1,34 @@ +call(RolePermissionSeeder::class); + + $tenant = Tenant::create([ + 'name' => 'Demo Company', + 'slug' => 'demo', + 'domain' => null, + 'is_active' => true, + ]); + + $admin = User::factory()->create([ + 'name' => 'Admin User', + 'email' => 'admin@example.com', + 'tenant_id' => $tenant->id, + ]); + + $admin->assignRole('super-admin'); + + $this->call(InventorySeeder::class); + $this->call(FinanceSeeder::class); + $this->call(HRSeeder::class); + } +} diff --git a/erp/database/seeders/FinanceSeeder.php b/erp/database/seeders/FinanceSeeder.php new file mode 100644 index 00000000000..44c5ad21f15 --- /dev/null +++ b/erp/database/seeders/FinanceSeeder.php @@ -0,0 +1,77 @@ + '1000', 'name' => 'Assets', 'type' => 'asset'], + ['code' => '1100', 'name' => 'Cash and Bank', 'type' => 'asset', 'parent' => '1000'], + ['code' => '1101', 'name' => 'Main Bank Account', 'type' => 'asset', 'parent' => '1100'], + ['code' => '1102', 'name' => 'Petty Cash', 'type' => 'asset', 'parent' => '1100'], + ['code' => '1200', 'name' => 'Accounts Receivable', 'type' => 'asset', 'parent' => '1000'], + ['code' => '1300', 'name' => 'Inventory', 'type' => 'asset', 'parent' => '1000'], + ['code' => '1400', 'name' => 'Prepaid Expenses', 'type' => 'asset', 'parent' => '1000'], + + // Liabilities + ['code' => '2000', 'name' => 'Liabilities', 'type' => 'liability'], + ['code' => '2100', 'name' => 'Accounts Payable', 'type' => 'liability', 'parent' => '2000'], + ['code' => '2200', 'name' => 'Accrued Liabilities', 'type' => 'liability', 'parent' => '2000'], + ['code' => '2300', 'name' => 'Tax Payable', 'type' => 'liability', 'parent' => '2000'], + + // Equity + ['code' => '3000', 'name' => 'Equity', 'type' => 'equity'], + ['code' => '3100', 'name' => "Owner's Capital", 'type' => 'equity', 'parent' => '3000'], + ['code' => '3200', 'name' => 'Retained Earnings', 'type' => 'equity', 'parent' => '3000'], + + // Income + ['code' => '4000', 'name' => 'Revenue', 'type' => 'income'], + ['code' => '4100', 'name' => 'Sales Revenue', 'type' => 'income', 'parent' => '4000'], + ['code' => '4200', 'name' => 'Service Revenue', 'type' => 'income', 'parent' => '4000'], + ['code' => '4900', 'name' => 'Other Income', 'type' => 'income', 'parent' => '4000'], + + // Expenses + ['code' => '5000', 'name' => 'Expenses', 'type' => 'expense'], + ['code' => '5100', 'name' => 'Cost of Goods Sold', 'type' => 'expense', 'parent' => '5000'], + ['code' => '5200', 'name' => 'Salaries & Wages', 'type' => 'expense', 'parent' => '5000'], + ['code' => '5300', 'name' => 'Rent & Occupancy', 'type' => 'expense', 'parent' => '5000'], + ['code' => '5400', 'name' => 'Utilities', 'type' => 'expense', 'parent' => '5000'], + ['code' => '5500', 'name' => 'Marketing & Advertising', 'type' => 'expense', 'parent' => '5000'], + ['code' => '5900', 'name' => 'Miscellaneous Expenses', 'type' => 'expense', 'parent' => '5000'], + ]; + + $created = []; + foreach ($accounts as $data) { + $parentId = isset($data['parent']) ? ($created[$data['parent']] ?? null) : null; + $account = Account::create([ + 'tenant_id' => $tenant->id, + 'code' => $data['code'], + 'name' => $data['name'], + 'type' => $data['type'], + 'parent_id' => $parentId, + ]); + $created[$data['code']] = $account->id; + } + + // Sample contacts + Contact::create(['tenant_id' => $tenant->id, 'name' => 'Acme Corp', 'email' => 'billing@acme.example', 'type' => 'customer']); + Contact::create(['tenant_id' => $tenant->id, 'name' => 'Globex LLC', 'email' => 'accounts@globex.example', 'type' => 'customer']); + Contact::create(['tenant_id' => $tenant->id, 'name' => 'Office Supplies Co', 'email' => 'ap@officesup.example','type' => 'vendor']); + Contact::create(['tenant_id' => $tenant->id, 'name' => 'Cloud Services Ltd', 'email' => 'invoices@cloud.example','type' => 'both']); + } +} diff --git a/erp/database/seeders/HRSeeder.php b/erp/database/seeders/HRSeeder.php new file mode 100644 index 00000000000..c877d95c36d --- /dev/null +++ b/erp/database/seeders/HRSeeder.php @@ -0,0 +1,67 @@ + $tenant->id, 'name' => 'Engineering', 'description' => 'Software and hardware development']); + $operations = Department::create(['tenant_id' => $tenant->id, 'name' => 'Operations', 'description' => 'Business operations and logistics']); + $finance = Department::create(['tenant_id' => $tenant->id, 'name' => 'Finance', 'description' => 'Financial management and accounting']); + $hr = Department::create(['tenant_id' => $tenant->id, 'name' => 'Human Resources', 'description' => 'People operations']); + $sales = Department::create(['tenant_id' => $tenant->id, 'name' => 'Sales & Marketing', 'description' => 'Revenue and growth']); + + // Leave Types + $annual = LeaveType::create(['tenant_id' => $tenant->id, 'name' => 'Annual Leave', 'days_per_year' => 20, 'is_paid' => true]); + $sick = LeaveType::create(['tenant_id' => $tenant->id, 'name' => 'Sick Leave', 'days_per_year' => 10, 'is_paid' => true]); + $unpaid = LeaveType::create(['tenant_id' => $tenant->id, 'name' => 'Unpaid Leave', 'days_per_year' => 0, 'is_paid' => false]); + + // Employees + $employees = [ + ['first_name' => 'Alice', 'last_name' => 'Johnson', 'employee_number' => 'EMP-001', 'position' => 'Engineering Manager', 'department_id' => $engineering->id, 'salary_amount' => 9500], + ['first_name' => 'Bob', 'last_name' => 'Williams', 'employee_number' => 'EMP-002', 'position' => 'Senior Developer', 'department_id' => $engineering->id, 'salary_amount' => 7500], + ['first_name' => 'Carol', 'last_name' => 'Davis', 'employee_number' => 'EMP-003', 'position' => 'Financial Controller', 'department_id' => $finance->id, 'salary_amount' => 8000], + ['first_name' => 'David', 'last_name' => 'Brown', 'employee_number' => 'EMP-004', 'position' => 'Operations Coordinator', 'department_id' => $operations->id, 'salary_amount' => 5500], + ['first_name' => 'Emma', 'last_name' => 'Wilson', 'employee_number' => 'EMP-005', 'position' => 'HR Specialist', 'department_id' => $hr->id, 'salary_amount' => 5000], + ['first_name' => 'Frank', 'last_name' => 'Moore', 'employee_number' => 'EMP-006', 'position' => 'Sales Representative', 'department_id' => $sales->id, 'salary_amount' => 4500], + ['first_name' => 'Grace', 'last_name' => 'Taylor', 'employee_number' => 'EMP-007', 'position' => 'Junior Developer', 'department_id' => $engineering->id, 'salary_amount' => 5500], + ]; + + $created = []; + foreach ($employees as $data) { + $created[] = Employee::create([ + 'tenant_id' => $tenant->id, + 'start_date' => now()->subYears(rand(1, 3))->toDateString(), + 'employment_type' => 'full_time', + 'salary_type' => 'monthly', + ...$data, + ]); + } + + // A sample leave request + LeaveRequest::create([ + 'tenant_id' => $tenant->id, + 'employee_id' => $created[1]->id, + 'leave_type_id' => $annual->id, + 'start_date' => now()->addDays(7)->toDateString(), + 'end_date' => now()->addDays(11)->toDateString(), + 'days' => 5, + 'notes' => 'Family vacation', + ]); + } +} diff --git a/erp/database/seeders/InventorySeeder.php b/erp/database/seeders/InventorySeeder.php new file mode 100644 index 00000000000..e26c2197549 --- /dev/null +++ b/erp/database/seeders/InventorySeeder.php @@ -0,0 +1,68 @@ + $tenant->id, 'name' => 'Main Warehouse', 'location' => 'Building A, Floor 1']); + $secondary = Warehouse::create(['tenant_id' => $tenant->id, 'name' => 'Secondary Store', 'location' => 'Building B']); + $returns = Warehouse::create(['tenant_id' => $tenant->id, 'name' => 'Returns Depot', 'location' => 'Dock C', 'is_active' => false]); + + // Units of Measure + $pcs = UnitOfMeasure::create(['tenant_id' => $tenant->id, 'name' => 'Pieces', 'abbreviation' => 'pcs']); + $kg = UnitOfMeasure::create(['tenant_id' => $tenant->id, 'name' => 'Kilograms', 'abbreviation' => 'kg']); + $ltr = UnitOfMeasure::create(['tenant_id' => $tenant->id, 'name' => 'Litres', 'abbreviation' => 'ltr']); + + // Categories + $electronics = Category::create(['tenant_id' => $tenant->id, 'name' => 'Electronics', 'slug' => 'electronics']); + $computers = Category::create(['tenant_id' => $tenant->id, 'name' => 'Computers', 'slug' => 'computers', 'parent_id' => $electronics->id]); + $peripherals = Category::create(['tenant_id' => $tenant->id, 'name' => 'Peripherals', 'slug' => 'peripherals', 'parent_id' => $electronics->id]); + $office = Category::create(['tenant_id' => $tenant->id, 'name' => 'Office Supplies', 'slug' => 'office-supplies']); + $consumables = Category::create(['tenant_id' => $tenant->id, 'name' => 'Consumables', 'slug' => 'consumables']); + + // Suppliers + $supplier1 = Supplier::create(['tenant_id' => $tenant->id, 'name' => 'TechWorld Distributors', 'contact_person' => 'Alice Nguyen', 'email' => 'alice@techworld.example', 'phone' => '+1-555-0100']); + $supplier2 = Supplier::create(['tenant_id' => $tenant->id, 'name' => 'Office Direct', 'contact_person' => 'Bob Martinez', 'email' => 'bob@officedirect.example','phone' => '+1-555-0200']); + + // Products & Stock + $products = [ + ['sku' => 'LAP-001', 'name' => 'Laptop Pro 15"', 'category_id' => $computers->id, 'uom_id' => $pcs->id, 'cost_price' => 850.00, 'sale_price' => 1299.99, 'reorder_point' => 5], + ['sku' => 'LAP-002', 'name' => 'Laptop Air 13"', 'category_id' => $computers->id, 'uom_id' => $pcs->id, 'cost_price' => 650.00, 'sale_price' => 999.99, 'reorder_point' => 5], + ['sku' => 'MON-001', 'name' => '27" Monitor 4K', 'category_id' => $peripherals->id, 'uom_id' => $pcs->id, 'cost_price' => 280.00, 'sale_price' => 449.99, 'reorder_point' => 3], + ['sku' => 'KBD-001', 'name' => 'Mechanical Keyboard','category_id' => $peripherals->id,'uom_id' => $pcs->id, 'cost_price' => 60.00, 'sale_price' => 119.99, 'reorder_point' => 10], + ['sku' => 'MSE-001', 'name' => 'Wireless Mouse', 'category_id' => $peripherals->id, 'uom_id' => $pcs->id, 'cost_price' => 25.00, 'sale_price' => 49.99, 'reorder_point' => 10], + ['sku' => 'PPR-A4', 'name' => 'A4 Paper Ream', 'category_id' => $office->id, 'uom_id' => $pcs->id, 'cost_price' => 4.50, 'sale_price' => 8.99, 'reorder_point' => 50], + ['sku' => 'PEN-BLK', 'name' => 'Ballpoint Pen Box', 'category_id' => $office->id, 'uom_id' => $pcs->id, 'cost_price' => 3.00, 'sale_price' => 6.50, 'reorder_point' => 20], + ]; + + foreach ($products as $data) { + $product = Product::create([...$data, 'tenant_id' => $tenant->id]); + + StockLevel::create([ + 'tenant_id' => $tenant->id, + 'product_id' => $product->id, + 'warehouse_id' => $main->id, + 'quantity' => rand(10, 100), + ]); + } + } +} diff --git a/erp/database/seeders/RolePermissionSeeder.php b/erp/database/seeders/RolePermissionSeeder.php new file mode 100644 index 00000000000..d3bbe7bd589 --- /dev/null +++ b/erp/database/seeders/RolePermissionSeeder.php @@ -0,0 +1,57 @@ + */ + private array $permissions = [ + // Core + 'users.view' => ['super-admin', 'admin'], + 'users.create' => ['super-admin', 'admin'], + 'users.update' => ['super-admin', 'admin'], + 'users.delete' => ['super-admin'], + 'roles.manage' => ['super-admin'], + 'tenants.manage' => ['super-admin'], + 'audit.view' => ['super-admin'], + + // Inventory + 'inventory.view' => ['super-admin', 'admin', 'manager', 'staff'], + 'inventory.create' => ['super-admin', 'admin', 'manager'], + 'inventory.update' => ['super-admin', 'admin', 'manager'], + 'inventory.delete' => ['super-admin', 'admin'], + + // Finance + 'finance.view' => ['super-admin', 'admin', 'manager'], + 'finance.create' => ['super-admin', 'admin'], + 'finance.update' => ['super-admin', 'admin'], + 'finance.delete' => ['super-admin'], + + // HR + 'hr.view' => ['super-admin', 'admin', 'manager', 'staff'], + 'hr.create' => ['super-admin', 'admin', 'manager'], + 'hr.update' => ['super-admin', 'admin', 'manager'], + 'hr.delete' => ['super-admin', 'admin'], + ]; + + public function run(): void + { + $roles = ['super-admin', 'admin', 'manager', 'staff']; + + foreach ($roles as $roleName) { + Role::firstOrCreate(['name' => $roleName, 'guard_name' => 'web']); + } + + foreach ($this->permissions as $permName => $assignedRoles) { + $permission = Permission::firstOrCreate(['name' => $permName, 'guard_name' => 'web']); + + foreach ($assignedRoles as $roleName) { + Role::findByName($roleName, 'web')->givePermissionTo($permission); + } + } + } +} diff --git a/erp/package-lock.json b/erp/package-lock.json new file mode 100644 index 00000000000..0a837674704 --- /dev/null +++ b/erp/package-lock.json @@ -0,0 +1,4309 @@ +{ + "name": "erp", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "dependencies": { + "recharts": "^3.8.1" + }, + "devDependencies": { + "@headlessui/react": "^2.0.0", + "@inertiajs/react": "^2.0.0", + "@tailwindcss/forms": "^0.5.3", + "@types/node": "^22.0.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.2.0", + "autoprefixer": "^10.4.12", + "axios": "^1.6.4", + "concurrently": "^9.0.1", + "laravel-vite-plugin": "^1.0", + "postcss": "^8.4.31", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "tailwindcss": "^3.2.1", + "typescript": "^5.0.2", + "vite": "^6.0.0", + "ziggy-js": "^2.3.0" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", + "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.3", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.3.tgz", + "integrity": "sha512-LIVqM46zQWZhj17qA8wb4nW/ixr2y1Nw+r1etiAWgRM6U1IqP+LNhL1yg440jYZR72jCWcWbLWzIosH+uP1fqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.0.tgz", + "integrity": "sha512-CGOfOJqWjg2qW/Mb6zNsDm+u5vFQ8DxXfbM09z69p5Z6+mE1ikP2jUXw+j42Pf1XTYED2Rni5f95npYeuwMDQA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-compilation-targets": "^7.28.6", + "@babel/helper-module-transforms": "^7.28.6", + "@babel/helpers": "^7.28.6", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/traverse": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.1", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.1.tgz", + "integrity": "sha512-qsaF+9Qcm2Qv8SRIMMscAvG4O3lJ0F1GuMo5HR/Bp02LopNgnZBC/EkbevHFeGs4ls/oPz9v+Bsmzbkbe+0dUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.0", + "@babel/types": "^7.29.0", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.28.6.tgz", + "integrity": "sha512-JYtls3hqi15fcx5GaSNL7SCTJ2MNmjrkHXg4FSpOA/grxK8KwyZ5bubHsCq8FXCkua6xhuaaBit+3b7+VZRfcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.28.6", + "@babel/helper-validator-option": "^7.27.1", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.28.0.tgz", + "integrity": "sha512-+W6cISkXFa1jXsDEdYA8HeevQT/FULhxzR99pxphltZcVaugps53THCeiWA8SguxxpSp3gKPiuYfSWopkLQ4hw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.28.6.tgz", + "integrity": "sha512-l5XkZK7r7wa9LucGw9LwZyyCUscb4x37JWTPz7swwFE/0FMQAGpiWUZn8u9DzkSBWEcK25jmvubfpw2dnAMdbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.28.6.tgz", + "integrity": "sha512-67oXFAYr2cDLDVGLXTEABjdBJZ6drElUSI7WKp70NrpyISso3plG9SAGEF6y7zbha/wOzUByWWTJvEDVNIUGcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.28.6", + "@babel/helper-validator-identifier": "^7.28.5", + "@babel/traverse": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.28.6.tgz", + "integrity": "sha512-S9gzZ/bz83GRysI7gAD4wPT/AI3uCnY+9xn+Mx/KPs2JwHJIz1W8PZkg2cqyt3RNOBM8ejcXhV6y8Og7ly/Dug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.27.1.tgz", + "integrity": "sha512-YvjJow9FxbhFFKDSuFnVCe2WxXk1zWc22fFePVNEaWJEu8IrZVlda6N0uHwzZrUM1il7NC9Mlp4MaJYbYd9JSg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.2.tgz", + "integrity": "sha512-HoGuUs4sCZNezVEKdVcwqmZN8GoHirLUcLaYVNBK2J0DadGtdcqgr3BCbvH8+XUo4NGjNl3VOtSjEKNzqfFgKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.3", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.3.tgz", + "integrity": "sha512-b3ctpQwp+PROvU/cttc4OYl4MzfJUWy6FZg+PMXfzmt/+39iHVF0sDfqay8TQM3JA2EUOyKcFZt75jWriQijsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.27.1.tgz", + "integrity": "sha512-6UzkCs+ejGdZ5mFFC/OCUrv028ab2fp1znZmCZjAOBKiBK2jXD1O+BPSfX8X2qjJ75fZBMSnQn3Rq2mrBJK2mw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.27.1.tgz", + "integrity": "sha512-zbwoTsBruTeKB9hSq73ha66iFeJHuaFkUbwvqElnygoNbj/jHRsSeokowZFN3CZ64IvEqcmmkVe89OPXc7ldAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.28.6", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.28.6.tgz", + "integrity": "sha512-YA6Ma2KsCdGb+WC6UpBVFJGXL58MDA6oyONbjyF/+5sBgxY/dwkhLogbMT2GXXyU84/IhRw/2D1Os1B/giz+BQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.28.6", + "@babel/parser": "^7.28.6", + "@babel/types": "^7.28.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.0.tgz", + "integrity": "sha512-4HPiQr0X7+waHfyXPZpWPfWL/J7dcN1mx9gL6WdQVMbPnF3+ZhSMs8tCxN7oHddJE9fhNE7+lxdnlyemKfJRuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.0", + "@babel/generator": "^7.29.0", + "@babel/helper-globals": "^7.28.0", + "@babel/parser": "^7.29.0", + "@babel/template": "^7.28.6", + "@babel/types": "^7.29.0", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz", + "integrity": "sha512-LwdZHpScM4Qz8Xw2iKSzS+cfglZzJGvofQICy7W7v4caru4EaAmyUuO6BGrbyQ2mYV11W0U8j5mBhd14dd3B0A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.28.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@floating-ui/core": { + "version": "1.7.5", + "resolved": "https://registry.npmjs.org/@floating-ui/core/-/core-1.7.5.tgz", + "integrity": "sha512-1Ih4WTWyw0+lKyFMcBHGbb5U5FtuHJuujoyyr5zTaWS5EYMeT6Jb2AuDeftsCsEuchO+mM2ij5+q9crhydzLhQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/utils": "^0.2.11" + } + }, + "node_modules/@floating-ui/dom": { + "version": "1.7.6", + "resolved": "https://registry.npmjs.org/@floating-ui/dom/-/dom-1.7.6.tgz", + "integrity": "sha512-9gZSAI5XM36880PPMm//9dfiEngYoC6Am2izES1FF406YFsjvyBMmeJ2g4SAju3xWwtuynNRFL2s9hgxpLI5SQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/core": "^1.7.5", + "@floating-ui/utils": "^0.2.11" + } + }, + "node_modules/@floating-ui/react": { + "version": "0.26.28", + "resolved": "https://registry.npmjs.org/@floating-ui/react/-/react-0.26.28.tgz", + "integrity": "sha512-yORQuuAtVpiRjpMhdc0wJj06b9JFjrYF4qp96j++v2NBpbi6SEGF7donUJ3TMieerQ6qVkAv1tgr7L4r5roTqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/react-dom": "^2.1.2", + "@floating-ui/utils": "^0.2.8", + "tabbable": "^6.0.0" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/react-dom": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@floating-ui/react-dom/-/react-dom-2.1.8.tgz", + "integrity": "sha512-cC52bHwM/n/CxS87FH0yWdngEZrjdtLW/qVruo68qg+prK7ZQ4YGdut2GyDVpoGeAYe/h899rVeOVm6Oi40k2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.7.6" + }, + "peerDependencies": { + "react": ">=16.8.0", + "react-dom": ">=16.8.0" + } + }, + "node_modules/@floating-ui/utils": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/@floating-ui/utils/-/utils-0.2.11.tgz", + "integrity": "sha512-RiB/yIh78pcIxl6lLMG0CgBXAZ2Y0eVHqMPYugu+9U0AeT6YBeiJpf7lbdJNIugFP5SIjwNRgo4DhR1Qxi26Gg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@headlessui/react": { + "version": "2.2.10", + "resolved": "https://registry.npmjs.org/@headlessui/react/-/react-2.2.10.tgz", + "integrity": "sha512-5pVLNK9wlpxTUTy9GpgbX/SdcRh+HBnPktjM2wbiLTH4p+2EPHBO1aoSryUCuKUIItdDWO9ITlhUL8UnUN/oIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@floating-ui/react": "^0.26.16", + "@react-aria/focus": "^3.20.2", + "@react-aria/interactions": "^3.25.0", + "@tanstack/react-virtual": "^3.13.9", + "use-sync-external-store": "^1.5.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": "^18 || ^19 || ^19.0.0-rc", + "react-dom": "^18 || ^19 || ^19.0.0-rc" + } + }, + "node_modules/@inertiajs/core": { + "version": "2.3.24", + "resolved": "https://registry.npmjs.org/@inertiajs/core/-/core-2.3.24.tgz", + "integrity": "sha512-xAlUl5+RKtdbutEgsmdWa6HmnvjIGcWTrvfLj/3Icy3/7bSH3aiI+kuYPs17LBq/SMaXnqBZXXo094rEXUv2aA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash-es": "^4.17.12", + "axios": "^1.13.5", + "laravel-precognition": "^1.0.2", + "lodash-es": "^4.18.1", + "qs": "^6.15.0" + } + }, + "node_modules/@inertiajs/react": { + "version": "2.3.24", + "resolved": "https://registry.npmjs.org/@inertiajs/react/-/react-2.3.24.tgz", + "integrity": "sha512-PtzuoL66QlxpLgV8j8l9a7SIkVtFVFetrIHQjfemNk8Ey9C7IhacE7b4PKgx5cI77ftJBwEfNrj2+AhOvFpgpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@inertiajs/core": "2.3.24", + "@types/lodash-es": "^4.17.12", + "laravel-precognition": "^1.0.2", + "lodash-es": "^4.18.1" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@internationalized/date": { + "version": "3.12.1", + "resolved": "https://registry.npmjs.org/@internationalized/date/-/date-3.12.1.tgz", + "integrity": "sha512-6IedsVWXyq4P9Tj+TxuU8WGWM70hYLl12nbYU8jkikVpa6WXapFazPUcHUMDMoWftIDE2ILDkFFte6W2nFCkRQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@internationalized/number": { + "version": "3.6.6", + "resolved": "https://registry.npmjs.org/@internationalized/number/-/number-3.6.6.tgz", + "integrity": "sha512-iFgmQaXHE0vytNfpLZWOC2mEJCBRzcUxt53Xf/yCXG93lRvqas237i3r7X4RKMwO3txiyZD4mQjKAByFv6UGSQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@internationalized/string": { + "version": "3.2.8", + "resolved": "https://registry.npmjs.org/@internationalized/string/-/string-3.2.8.tgz", + "integrity": "sha512-NdbMQUSfXLYIQol5VyMtinm9pZDciiMfN7RtmSuSB78io1hqwJ0naYfxyW6vgxWBkzWymQa/3uLDlbfmshtCaA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.5", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", + "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@react-aria/focus": { + "version": "3.22.0", + "resolved": "https://registry.npmjs.org/@react-aria/focus/-/focus-3.22.0.tgz", + "integrity": "sha512-ZfDOVuVhqDsM9mkNji3QUZ/d40JhlVgXrDkrfXylM1035QCrcTHN7m2DpbE95sU2A8EQb4wikvt5jM6K/73BPg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-aria/interactions": { + "version": "3.28.0", + "resolved": "https://registry.npmjs.org/@react-aria/interactions/-/interactions-3.28.0.tgz", + "integrity": "sha512-OXwdU1EWFdMxmr/K1CXNGJzmNlCClByb+PuCaqUyzBymHPCGVhawirLIon/CrIN5psh3AiWpHSh4H0WeJdVpng==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "react-aria": "3.48.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@react-types/shared": { + "version": "3.34.0", + "resolved": "https://registry.npmjs.org/@react-types/shared/-/shared-3.34.0.tgz", + "integrity": "sha512-gp6xo/s2lX54AlTjOiqwDnxA7UW79BNvI9dB9pr3LZTzRKCd1ZA+ZbgKw/ReIiWuvvVw/8QFJpnqeeFyLocMcQ==", + "dev": true, + "license": "Apache-2.0", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@reduxjs/toolkit": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.12.0.tgz", + "integrity": "sha512-KiT+RzZbp6mQET+Mg+h2c97+9j1sNflUxQkIHI7Yuzf6Peu+OYpmkn6nbHWmLLWj+1ZODUJFwGZ7gx3L9R9EOw==", + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "@standard-schema/utils": "^0.3.0", + "immer": "^11.0.0", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "11.1.8", + "resolved": "https://registry.npmjs.org/immer/-/immer-11.1.8.tgz", + "integrity": "sha512-/tbkHMW7y10Lx6i1crLjD4/OhNkRG+Fo7byZHtah0547nIeXYcpIXaUh0IAQY6gO5459qpGGYapcEOHtFXkIuA==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.4.tgz", + "integrity": "sha512-F5QXMSiFebS9hKZj02XhWLLnRpJ3B3AROP0tWbFBSj+6kCbg5m9j5JoHKd4mmSVy5mS/IMQloYgYxCuJC0fxEQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.4.tgz", + "integrity": "sha512-GxxTKApUpzRhof7poWvCJHRF51C67u1R7D6DiluBE8wKU1u5GWE8t+v81JvJYtbawoBFX1hLv5Ei4eVjkWokaw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.4.tgz", + "integrity": "sha512-tua0TaJxMOB1R0V0RS1jFZ/RpURFDJIOR2A6jWwQeawuFyS4gBW+rntLRaQd0EQ4bd6Vp44Z2rXW+YYDBsj6IA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.4.tgz", + "integrity": "sha512-CSKq7MsP+5PFIcydhAiR1K0UhEI1A2jWXVKHPCBZ151yOutENwvnPocgVHkivu2kviURtCEB6zUQw0vs8RrhMg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.4.tgz", + "integrity": "sha512-+O8OkVdyvXMtJEciu2wS/pzm1IxntEEQx3z5TAVy4l32G0etZn+RsA48ARRrFm6Ri8fvqPQfgrvNxSjKAbnd3g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.4.tgz", + "integrity": "sha512-Iw3oMskH3AfNuhU0MSN7vNbdi4me/NiYo2azqPz/Le16zHSa+3RRmliCMWWQmh4lcndccU40xcJuTYJZxNo/lw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.4.tgz", + "integrity": "sha512-EIPRXTVQpHyF8WOo219AD2yEltPehLTcTMz2fn6JsatLYSzQf00hj3rulF+yauOlF9/FtM2WpkT/hJh/KJFGhA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.4.tgz", + "integrity": "sha512-J3Yh9PzzF1Ovah2At+lHiGQdsYgArxBbXv/zHfSyaiFQEqvNv7DcW98pCrmdjCZBrqBiKrKKe2V+aaSGWuBe/w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.4.tgz", + "integrity": "sha512-BFDEZMYfUvLn37ONE1yMBojPxnMlTFsdyNoqncT0qFq1mAfllL+ATMMJd8TeuVMiX84s1KbcxcZbXInmcO2mRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.4.tgz", + "integrity": "sha512-pc9EYOSlOgdQ2uPl1o9PF6/kLSgaUosia7gOuS8mB69IxJvlclko1MECXysjs5ryez1/5zjYqx3+xYU0TU6R1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.4.tgz", + "integrity": "sha512-NxnomyxYerDh5n4iLrNa+sH+Z+U4BMEE46V2PgQ/hoB909i8gV1M5wPojWg9fk1jWpO3IQnOs20K4wyZuFLEFQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.4.tgz", + "integrity": "sha512-nbJnQ8a3z1mtmrwImCYhc6BGpThAyYVRQxw9uKSKG4wR6aAYno9sVjJ0zaZcW9BPJX1GbrDPf+SvdWjgTuDmnw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.4.tgz", + "integrity": "sha512-2EU6acNrQLd8tYvo/LXW535wupT3m6fo7HKo6lr7ktQoItxTyOL1ZCR/GfGCuXl2vR+zmfI6eRXkSemafv+iVg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.4.tgz", + "integrity": "sha512-WeBtoMuaMxiiIrO2IYP3xs6GMWkJP2C0EoT8beTLkUPmzV1i/UcOSVw1d5r9KBODtHKilG5yFxsGRnBbK3wJ4A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.4.tgz", + "integrity": "sha512-FJHFfqpKUI3A10WrWKiFbBZ7yVbGT4q4B5o1qKFFojqpaYoh9LrQgqWCmmcxQzVSXYtyB5bzkXrYzlHTs21MYA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.4.tgz", + "integrity": "sha512-mcEl6CUT5IAUmQf1m9FYSmVqCJlpQ8r8eyftFUHG8i9OhY7BkBXSUdnLH5DOf0wCOjcP9v/QO93zpmF1SptCCw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.4.tgz", + "integrity": "sha512-ynt3JxVd2w2buzoKDWIyiV1pJW93xlQic1THVLXilz429oijRpSHivZAgp65KBu+cMcgf1eVVjdnTLvPxgCuoQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.4.tgz", + "integrity": "sha512-Boiz5+MsaROEWDf+GGEwF8VMHGhlUoQMtIPjOgA5fv4osupqTVnJteQNKJwUcnUog2G55jYXH7KZFFiJe0TEzQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.4.tgz", + "integrity": "sha512-+qfSY27qIrFfI/Hom04KYFw3GKZSGU4lXus51wsb5EuySfFlWRwjkKWoE9emgRw/ukoT4Udsj4W/+xxG8VbPKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.4.tgz", + "integrity": "sha512-VpTfOPHgVXEBeeR8hZ2O0F3aSso+JDWqTWmTmzcQKted54IAdUVbxE+j/MVxUsKa8L20HJhv3vUezVPoquqWjA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.4.tgz", + "integrity": "sha512-IPOsh5aRYuLv/nkU51X10Bf75Bsf6+gZdx1X+QP5QM6lIJFHHqbHLG0uJn/hWthzo13UAc2umiUorqZy3axoZg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.4.tgz", + "integrity": "sha512-4QzE9E81OohJ/HKzHhsqU+zcYYojVOXlFMs1DdyMT6qXl/niOH7AVElmmEdUNHHS/oRkc++d5k6Vy85zFs0DEw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.4.tgz", + "integrity": "sha512-zTPgT1YuHHcd+Tmx7h8aml0FWFVelV5N54oHow9SLj+GfoDy/huQ+UV396N/C7KpMDMiPspRktzM1/0r1usYEA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.4.tgz", + "integrity": "sha512-DRS4G7mi9lJxqEDezIkKCaUIKCrLUUDCUaCsTPCi/rtqaC6D/jjwslMQyiDU50Ka0JKpeXeRBFBAXwArY52vBw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.4.tgz", + "integrity": "sha512-QVTUovf40zgTqlFVrKA1uXMVvU2QWEFWfAH8Wdc48IxLvrJMQVMBRjuQyUpzZCDkakImib9eVazbWlC6ksWtJw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@standard-schema/spec": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", + "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", + "license": "MIT" + }, + "node_modules/@standard-schema/utils": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@standard-schema/utils/-/utils-0.3.0.tgz", + "integrity": "sha512-e7Mew686owMaPJVNNLs55PUvgz371nKgwsc4vxE49zsODpJEnxgxRo2y/OKrqueavXgZNMDVj3DdHFlaSAeU8g==", + "license": "MIT" + }, + "node_modules/@swc/helpers": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.21.tgz", + "integrity": "sha512-jI/VAmtdjB/RnI8GTnokyX7Ug8c+g+ffD6QRLa6XQewtnGyukKkKSk3wLTM3b5cjt1jNh9x0jfVlagdN2gDKQg==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.8.0" + } + }, + "node_modules/@tailwindcss/forms": { + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/@tailwindcss/forms/-/forms-0.5.11.tgz", + "integrity": "sha512-h9wegbZDPurxG22xZSoWtdzc41/OlNEUQERNqI/0fOwa2aVlWGu7C35E/x6LDyD3lgtztFSSjKZyuVM0hxhbgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mini-svg-data-uri": "^1.2.3" + }, + "peerDependencies": { + "tailwindcss": ">=3.0.0 || >= 3.0.0-alpha.1 || >= 4.0.0-alpha.20 || >= 4.0.0-beta.1" + } + }, + "node_modules/@tanstack/react-virtual": { + "version": "3.13.25", + "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.13.25.tgz", + "integrity": "sha512-bmNoqMu6gcAW9JGrKVB0Q1tN1i5RONZF8r1fW0bbE4Oyf3DwEGnzzQJ2OW+Ozg1P4s8PyugkHg2ULZoFQN+cqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@tanstack/virtual-core": "3.15.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/@tanstack/virtual-core": { + "version": "3.15.0", + "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.15.0.tgz", + "integrity": "sha512-0AwPGx0I8QxPYjAxShT/+z+ZOe9u8mW5rsXvivCTjRfRmz9a43+3mRyi4wwlyoUqOC56q/jatKa0Bh9M99BEHQ==", + "dev": true, + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/tannerlinsley" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.2.tgz", + "integrity": "sha512-hOLWVbm7uRza0BYXpIIW5pxfrKe0W+D5lrFiAEYR+pb6w3N2SwSMaJbXdUfSEv+dT4MfHBLtn5js0LAWaO6otw==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-shape": { + "version": "3.1.8", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.8.tgz", + "integrity": "sha512-lae0iWfcDeR7qt7rA88BNiqdvPS5pFVPpo5OfjElwNaT2yyekbM0C9vK+yqBqEmHr6lDkRnYNoTBYlAgJa7a4w==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/lodash": { + "version": "4.17.24", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.24.tgz", + "integrity": "sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, + "node_modules/@types/node": { + "version": "22.19.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.19.tgz", + "integrity": "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.15", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.15.tgz", + "integrity": "sha512-eRwcGNHve+E8qtEQSSRl6urh+rFop4v8gm6O8rGv25CodbvFdLjA1vVQ1KkiFE0w0UPOnb8tDiFKL5lp0rtY5Q==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==", + "license": "MIT" + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/anymatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true, + "license": "MIT" + }, + "node_modules/aria-hidden": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/aria-hidden/-/aria-hidden-1.2.6.tgz", + "integrity": "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tslib": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/autoprefixer": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.0.tgz", + "integrity": "sha512-FMhOoZV4+qR6aTUALKX2rEqGG+oyATvwBt9IIzVR5rMa2HRWPkxf+P+PAJLD1I/H5/II+HuZcBJYEFBpq39ong==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "browserslist": "^4.28.2", + "caniuse-lite": "^1.0.30001787", + "fraction.js": "^5.3.4", + "picocolors": "^1.1.1", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/axios": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.16.1.tgz", + "integrity": "sha512-caYkukvroVPO8KrzuJEb50Hm07KwfBZPEC3VeFHTsqWHvKTsy54hjJz9BS/cdaypROE2rH6xvm9mHX4fgWkr3A==", + "dev": true, + "license": "MIT", + "dependencies": { + "follow-redirects": "^1.16.0", + "form-data": "^4.0.5", + "https-proxy-agent": "^5.0.1", + "proxy-from-env": "^2.1.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.10.32", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.32.tgz", + "integrity": "sha512-wbPvpyjJPC0zdfdKXxqEL3Ea+bOMD/87X4lftiJkkaBiuG6ALQy1SLmEd7BSmVCuwCQsBrCamgBoLyfFDD1EPg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.28.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", + "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.10.12", + "caniuse-lite": "^1.0.30001782", + "electron-to-chromium": "^1.5.328", + "node-releases": "^2.0.36", + "update-browserslist-db": "^1.2.3" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001793", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz", + "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/clsx": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz", + "integrity": "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/concurrently": { + "version": "9.2.1", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz", + "integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "4.1.2", + "rxjs": "7.8.2", + "shell-quote": "1.8.3", + "supports-color": "8.1.1", + "tree-kill": "1.2.2", + "yargs": "17.7.2" + }, + "bin": { + "conc": "dist/bin/concurrently.js", + "concurrently": "dist/bin/concurrently.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.2.tgz", + "integrity": "sha512-AJDdYOdnyRDV5b6ArilzCPPwc1ejkHcoyFarqlPqT7zRYjhavcT3uSrqcMvsgh2CgoPbK3RCwyHaVyxYcP2Arg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decimal.js-light": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/decimal.js-light/-/decimal.js-light-2.5.1.tgz", + "integrity": "sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg==", + "license": "MIT" + }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.361", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.361.tgz", + "integrity": "sha512-Q6Hts7N9FnJc5LeGRINFvLhCI9xZmNtTDe5ZbcVezQz7cU4a8Aua3GH1b8J2XY8Al9PF+OCwYqhgsOOheMdvkA==", + "dev": true, + "license": "ISC" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-toolkit": { + "version": "1.47.0", + "resolved": "https://registry.npmjs.org/es-toolkit/-/es-toolkit-1.47.0.tgz", + "integrity": "sha512-n1GuoD0WEQZMBk5tttoZSqwgyLx01oqa5XsBmCHwPyNe1S9jPBEmtR2pSgp2kJuWE3ciFZ6yRHmY4pM4C3OOkw==", + "license": "MIT", + "workspaces": [ + "docs", + "benchmarks" + ] + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventemitter3": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz", + "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==", + "license": "MIT" + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fastq": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/follow-redirects": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", + "integrity": "sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "license": "MIT", + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/form-data": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "dev": true, + "license": "MIT", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fraction.js": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", + "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "dev": true, + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.3.tgz", + "integrity": "sha512-ej4AhfhfL2Q2zpMmLo7U1Uv9+PyhIZpgQLGT1F9miIGmiCJIoCgSmczFdrc97mWT4kVY72KA+WnnhJ5pghSvSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/immer": { + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.2.0.tgz", + "integrity": "sha512-d/+XTN3zfODyjr89gM3mPq1WNX2B8pYsu7eORitdwyA2sBubnTl3laYlBk4sXY5FUa5qTZGBDPJICVbvqzjlbw==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz", + "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/laravel-precognition": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/laravel-precognition/-/laravel-precognition-1.0.2.tgz", + "integrity": "sha512-0H08JDdMWONrL/N314fvsO3FATJwGGlFKGkMF3nNmizVFJaWs17816iM+sX7Rp8d5hUjYCx6WLfsehSKfaTxjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "axios": "^1.4.0", + "lodash-es": "^4.17.21" + } + }, + "node_modules/laravel-vite-plugin": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/laravel-vite-plugin/-/laravel-vite-plugin-1.3.0.tgz", + "integrity": "sha512-P5qyG56YbYxM8OuYmK2OkhcKe0AksNVJUjq9LUZ5tOekU9fBn9LujYyctI4t9XoLjuMvHJXXpCoPntY1oKltuA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.0.0", + "vite-plugin-full-reload": "^1.1.0" + }, + "bin": { + "clean-orphaned-assets": "bin/clean.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "peerDependencies": { + "vite": "^5.0.0 || ^6.0.0" + } + }, + "node_modules/lilconfig": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", + "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash-es": { + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.18.1.tgz", + "integrity": "sha512-J8xewKD/Gk22OZbhpOVSwcs60zhd95ESDwezOFuA3/099925PdHJ7OFHNTGtajL3AlZkykD32HykiMo+BIBI8A==", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dev": true, + "license": "MIT", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mini-svg-data-uri": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.4.4.tgz", + "integrity": "sha512-r9deDe9p5FJUPZAk3A59wGH7Ii9YrjjWw0jmw/liSbHl2CHiyXj6FcDXDu2K3TjVAXqiJdaw3xxwlZZr9E6nHg==", + "dev": true, + "license": "MIT", + "bin": { + "mini-svg-data-uri": "cli.js" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.12", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz", + "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.46", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.46.tgz", + "integrity": "sha512-GYVXHE2KnrzAfsAjl4uP++evGFCrAU1jta4ubEjIG7YWt/64Gqv66a30yKwWczVjA6j3bM4nBwH7Pk1JmDHaxQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz", + "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.5.15", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz", + "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", + "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", + "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.1" + }, + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz", + "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/proxy-from-env": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz", + "integrity": "sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/qs": { + "version": "6.15.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.2.tgz", + "integrity": "sha512-Rzq0KEyX/w/tEybncDgdkZrJgVUsUMk3xjh3t5bv3S1HTAtg+uOYt72+ZfwiQwKdysThkTBdL/rTi6HDmX9Ddw==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/qs-esm": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/qs-esm/-/qs-esm-7.0.3.tgz", + "integrity": "sha512-8jbjCR0PPbqoQcv83C2K/zvVeytRPwPpt3WPDbq51qyLAxcWGtXVRjSe6GHtLCoVbg9+NEFkv7GyUxqjcDIJzw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react": { + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.6.tgz", + "integrity": "sha512-sfWGGfavi0xr8Pg0sVsyHMAOziVYKgPLNrS7ig+ivMNb3wbCBw3KxtflsGBAwD3gYQlE/AEZsTLgToRrSCjb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-aria": { + "version": "3.48.0", + "resolved": "https://registry.npmjs.org/react-aria/-/react-aria-3.48.0.tgz", + "integrity": "sha512-jQjd4rBEIMqecBaAKYJbVGK6EqIHLa5znVQ7jwFyK5vCyljoj6KhgtiahmcIPsG5vG5vEDLw+ba+bEWn6A2P4w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@internationalized/number": "^3.6.6", + "@internationalized/string": "^3.2.8", + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "aria-hidden": "^1.2.3", + "clsx": "^2.0.0", + "react-stately": "3.46.0", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1", + "react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/react-dom": { + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.6.tgz", + "integrity": "sha512-0prMI+hvBbPjsWnxDLxlCGyM8PN6UuWjEUCYmZhO67xIV9Xasa/r/vDnq+Xyq4Lo27g8QSbO5YzARu0D1Sps3g==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.6" + } + }, + "node_modules/react-is": { + "version": "19.2.6", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.6.tgz", + "integrity": "sha512-XjBR15BhXuylgWGuslhDKqlSayuqvqBX91BP8pauG8kd1zY8kotkNWbXksTCNRarse4kuGbe2kIY05ARtwNIvw==", + "license": "MIT", + "peer": true + }, + "node_modules/react-redux": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.3.0.tgz", + "integrity": "sha512-KQopgqFo/p/fgmAs5qz6p5RWaNAzq40WAu7fJIXnQpYxFPbJYtsJPWvGeF2rOBaY/kEuV77AVsX8TsQzKm+A/g==", + "license": "MIT", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-stately": { + "version": "3.46.0", + "resolved": "https://registry.npmjs.org/react-stately/-/react-stately-3.46.0.tgz", + "integrity": "sha512-OdxhWvHgs2L4OJGIs7hnuTr5WjjMM6enhNEAMRqiekhF8+ITvA2LRwNftOZwcogaoCslGYq5S2VQTQwnm0GbCA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@internationalized/date": "^3.12.1", + "@internationalized/number": "^3.6.6", + "@internationalized/string": "^3.2.8", + "@react-types/shared": "^3.34.0", + "@swc/helpers": "^0.5.0", + "use-sync-external-store": "^1.6.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/read-cache": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", + "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "pify": "^2.3.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/readdirp/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/recharts": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-3.8.1.tgz", + "integrity": "sha512-mwzmO1s9sFL0TduUpwndxCUNoXsBw3u3E/0+A+cLcrSfQitSG62L32N69GhqUrrT5qKcAE3pCGVINC6pqkBBQg==", + "license": "MIT", + "workspaces": [ + "www" + ], + "dependencies": { + "@reduxjs/toolkit": "^1.9.0 || 2.x.x", + "clsx": "^2.1.1", + "decimal.js-light": "^2.5.1", + "es-toolkit": "^1.39.3", + "eventemitter3": "^5.0.1", + "immer": "^10.1.1", + "react-redux": "8.x.x || 9.x.x", + "reselect": "5.1.1", + "tiny-invariant": "^1.3.3", + "use-sync-external-store": "^1.2.2", + "victory-vendor": "^37.0.2" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", + "license": "MIT" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "license": "MIT", + "peerDependencies": { + "redux": "^5.0.0" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==", + "license": "MIT" + }, + "node_modules/resolve": { + "version": "1.22.12", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz", + "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.16.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.60.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.4.tgz", + "integrity": "sha512-WHeFSbZYsPu3+bLoNRUuAO+wavNlocOPf3wSHTP7hcFKVnJeWsYlCDbr3mTS14FCizf9ccIxXA8sGL8zKeQN3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.60.4", + "@rollup/rollup-android-arm64": "4.60.4", + "@rollup/rollup-darwin-arm64": "4.60.4", + "@rollup/rollup-darwin-x64": "4.60.4", + "@rollup/rollup-freebsd-arm64": "4.60.4", + "@rollup/rollup-freebsd-x64": "4.60.4", + "@rollup/rollup-linux-arm-gnueabihf": "4.60.4", + "@rollup/rollup-linux-arm-musleabihf": "4.60.4", + "@rollup/rollup-linux-arm64-gnu": "4.60.4", + "@rollup/rollup-linux-arm64-musl": "4.60.4", + "@rollup/rollup-linux-loong64-gnu": "4.60.4", + "@rollup/rollup-linux-loong64-musl": "4.60.4", + "@rollup/rollup-linux-ppc64-gnu": "4.60.4", + "@rollup/rollup-linux-ppc64-musl": "4.60.4", + "@rollup/rollup-linux-riscv64-gnu": "4.60.4", + "@rollup/rollup-linux-riscv64-musl": "4.60.4", + "@rollup/rollup-linux-s390x-gnu": "4.60.4", + "@rollup/rollup-linux-x64-gnu": "4.60.4", + "@rollup/rollup-linux-x64-musl": "4.60.4", + "@rollup/rollup-openbsd-x64": "4.60.4", + "@rollup/rollup-openharmony-arm64": "4.60.4", + "@rollup/rollup-win32-arm64-msvc": "4.60.4", + "@rollup/rollup-win32-ia32-msvc": "4.60.4", + "@rollup/rollup-win32-x64-gnu": "4.60.4", + "@rollup/rollup-win32-x64-msvc": "4.60.4", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/shell-quote": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.3.tgz", + "integrity": "sha512-ObmnIF4hXNg1BqhnHmgbDETF8dLPCggZWBjkQfhZpbszZnYur5DUljTcCHii5LC3J5E0yeO/1LIMyH+UvHQgyw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tabbable": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/tabbable/-/tabbable-6.4.0.tgz", + "integrity": "sha512-05PUHKSNE8ou2dwIxTngl4EzcnsCDZGJ/iCLtDflR/SHB/ny14rXc+qU5P4mG9JkusiV7EivzY9Mhm55AzAvCg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tailwindcss": { + "version": "3.4.19", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", + "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.6.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.21.7", + "lilconfig": "^3.1.3", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tiny-invariant": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", + "integrity": "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.16", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.16.tgz", + "integrity": "sha512-pn99VhoACYR8nFHhxqix+uvsbXineAasWm5ojXoN8xEwK5Kd3/TrhNn1wByuD52UxWRLy8pu+kRMniEi6Eq9Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/use-sync-external-store": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz", + "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==", + "license": "MIT", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/victory-vendor": { + "version": "37.3.6", + "resolved": "https://registry.npmjs.org/victory-vendor/-/victory-vendor-37.3.6.tgz", + "integrity": "sha512-SbPDPdDBYp+5MJHhBCAyI7wKM3d5ivekigc2Dk2s7pgbZ9wIgIBYGVw4zGHBml/qTFbexrofXW6Gu4noGxrOwQ==", + "license": "MIT AND ISC", + "dependencies": { + "@types/d3-array": "^3.0.3", + "@types/d3-ease": "^3.0.0", + "@types/d3-interpolate": "^3.0.1", + "@types/d3-scale": "^4.0.2", + "@types/d3-shape": "^3.1.0", + "@types/d3-time": "^3.0.0", + "@types/d3-timer": "^3.0.0", + "d3-array": "^3.1.6", + "d3-ease": "^3.0.1", + "d3-interpolate": "^3.0.1", + "d3-scale": "^4.0.2", + "d3-shape": "^3.1.0", + "d3-time": "^3.0.0", + "d3-timer": "^3.0.1" + } + }, + "node_modules/vite": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.2.tgz", + "integrity": "sha512-2N/55r4JDJ4gdrCvGgINMy+HH3iRpNIz8K6SFwVsA+JbQScLiC+clmAxBgwiSPgcG9U15QmvqCGWzMbqda5zGQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-plugin-full-reload": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/vite-plugin-full-reload/-/vite-plugin-full-reload-1.2.0.tgz", + "integrity": "sha512-kz18NW79x0IHbxRSHm0jttP4zoO9P9gXh+n6UTwlNKnviTTEpOlum6oS9SmecrTtSr+muHEn5TUuC75UovQzcA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picocolors": "^1.0.0", + "picomatch": "^2.3.1" + } + }, + "node_modules/vite-plugin-full-reload/node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/ziggy-js": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/ziggy-js/-/ziggy-js-2.6.2.tgz", + "integrity": "sha512-41xc9wRvv5Olh8pZjKSaL5vDAjw4BfTDMFoeLwRpDGc2B+uqcdwIKd81EHs6uwpqahdRrU7uMab0xWj0hBSDjg==", + "dev": true, + "license": "MIT", + "dependencies": { + "qs-esm": "^7.0.3" + } + } + } +} diff --git a/erp/package.json b/erp/package.json new file mode 100644 index 00000000000..0be9500c772 --- /dev/null +++ b/erp/package.json @@ -0,0 +1,32 @@ +{ + "$schema": "https://www.schemastore.org/package.json", + "private": true, + "type": "module", + "scripts": { + "build": "tsc && vite build", + "dev": "vite" + }, + "devDependencies": { + "@headlessui/react": "^2.0.0", + "@inertiajs/react": "^2.0.0", + "@tailwindcss/forms": "^0.5.3", + "@types/node": "^22.0.0", + "@types/react": "^19.0.0", + "@types/react-dom": "^19.0.0", + "@vitejs/plugin-react": "^4.2.0", + "autoprefixer": "^10.4.12", + "axios": "^1.6.4", + "concurrently": "^9.0.1", + "laravel-vite-plugin": "^1.0", + "postcss": "^8.4.31", + "react": "^19.0.0", + "react-dom": "^19.0.0", + "tailwindcss": "^3.2.1", + "typescript": "^5.0.2", + "vite": "^6.0.0", + "ziggy-js": "^2.3.0" + }, + "dependencies": { + "recharts": "^3.8.1" + } +} diff --git a/erp/phpunit.xml b/erp/phpunit.xml new file mode 100644 index 00000000000..e7f0a48df61 --- /dev/null +++ b/erp/phpunit.xml @@ -0,0 +1,36 @@ + + + + + tests/Unit + + + tests/Feature + + + + + app + + + + + + + + + + + + + + + + + + + diff --git a/erp/postcss.config.js b/erp/postcss.config.js new file mode 100644 index 00000000000..49c0612d5c2 --- /dev/null +++ b/erp/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/erp/public/.htaccess b/erp/public/.htaccess new file mode 100644 index 00000000000..b574a597daf --- /dev/null +++ b/erp/public/.htaccess @@ -0,0 +1,25 @@ + + + Options -MultiViews -Indexes + + + RewriteEngine On + + # Handle Authorization Header + RewriteCond %{HTTP:Authorization} . + RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + + # Handle X-XSRF-Token Header + RewriteCond %{HTTP:x-xsrf-token} . + RewriteRule .* - [E=HTTP_X_XSRF_TOKEN:%{HTTP:X-XSRF-Token}] + + # Redirect Trailing Slashes If Not A Folder... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_URI} (.+)/$ + RewriteRule ^ %1 [L,R=301] + + # Send Requests To Front Controller... + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.php [L] + diff --git a/erp/public/favicon.ico b/erp/public/favicon.ico new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erp/public/index.php b/erp/public/index.php new file mode 100644 index 00000000000..ee8f07e9938 --- /dev/null +++ b/erp/public/index.php @@ -0,0 +1,20 @@ +handleRequest(Request::capture()); diff --git a/erp/public/robots.txt b/erp/public/robots.txt new file mode 100644 index 00000000000..eb0536286f3 --- /dev/null +++ b/erp/public/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: diff --git a/erp/resources/css/app.css b/erp/resources/css/app.css new file mode 100644 index 00000000000..b5c61c95671 --- /dev/null +++ b/erp/resources/css/app.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/erp/resources/js/Components/ApplicationLogo.tsx b/erp/resources/js/Components/ApplicationLogo.tsx new file mode 100644 index 00000000000..ccd928517bc --- /dev/null +++ b/erp/resources/js/Components/ApplicationLogo.tsx @@ -0,0 +1,13 @@ +import { SVGAttributes } from 'react'; + +export default function ApplicationLogo(props: SVGAttributes) { + return ( + + + + ); +} diff --git a/erp/resources/js/Components/Charts/BarChart.tsx b/erp/resources/js/Components/Charts/BarChart.tsx new file mode 100644 index 00000000000..8b20ee291fa --- /dev/null +++ b/erp/resources/js/Components/Charts/BarChart.tsx @@ -0,0 +1,60 @@ +interface DataPoint { + label: string; + value: number; +} + +interface BarChartProps { + data: DataPoint[]; + valueFormatter?: (n: number) => string; + color?: string; + horizontal?: boolean; +} + +export function BarChart({ data, valueFormatter, color = 'bg-indigo-500', horizontal = false }: BarChartProps) { + const max = Math.max(...data.map((d) => d.value), 1); + const fmt = valueFormatter ?? ((n) => String(n)); + + if (horizontal) { + return ( +
+ {data.map((d) => ( +
+ {d.label} +
+
+
+ + {fmt(d.value)} + +
+ ))} + {data.length === 0 && ( +

No data

+ )} +
+ ); + } + + return ( +
+ {data.map((d) => ( +
+ + {d.value > 0 ? fmt(d.value) : ''} + +
+ {d.label} +
+ ))} + {data.length === 0 && ( +

No data

+ )} +
+ ); +} diff --git a/erp/resources/js/Components/Charts/LineChart.tsx b/erp/resources/js/Components/Charts/LineChart.tsx new file mode 100644 index 00000000000..e38d134b093 --- /dev/null +++ b/erp/resources/js/Components/Charts/LineChart.tsx @@ -0,0 +1,72 @@ +interface DataPoint { + label: string; + value: number; +} + +interface LineChartProps { + data: DataPoint[]; + valueFormatter?: (n: number) => string; +} + +export function LineChart({ data, valueFormatter }: LineChartProps) { + if (data.length < 2) { + return

Not enough data

; + } + + const W = 600; + const H = 140; + const padX = 10; + const padY = 12; + const plotW = W - padX * 2; + const plotH = H - padY * 2; + + const max = Math.max(...data.map((d) => d.value), 1); + + const pts = data.map((d, i) => ({ + x: padX + (i / (data.length - 1)) * plotW, + y: H - padY - (d.value / max) * plotH, + ...d, + })); + + const polyline = pts.map((p) => `${p.x},${p.y}`).join(' '); + const areaPath = `M${padX},${H - padY} ${pts.map((p) => `L${p.x},${p.y}`).join(' ')} L${W - padX},${H - padY} Z`; + + return ( +
+ + {/* Grid lines */} + {[0, 0.25, 0.5, 0.75, 1].map((t) => ( + + ))} + {/* Area fill */} + + {/* Line */} + + {/* Dots */} + {pts.map((p) => ( + + ))} + + {/* Labels */} +
+ {data.map((d, i) => ( + i === 0 || i === data.length - 1 || i % Math.ceil(data.length / 6) === 0 + ? {d.label} + : + ))} +
+
+ ); +} diff --git a/erp/resources/js/Components/Checkbox.tsx b/erp/resources/js/Components/Checkbox.tsx new file mode 100644 index 00000000000..a65ffce7a94 --- /dev/null +++ b/erp/resources/js/Components/Checkbox.tsx @@ -0,0 +1,17 @@ +import { InputHTMLAttributes } from 'react'; + +export default function Checkbox({ + className = '', + ...props +}: InputHTMLAttributes) { + return ( + + ); +} diff --git a/erp/resources/js/Components/Common/Badge.tsx b/erp/resources/js/Components/Common/Badge.tsx new file mode 100644 index 00000000000..7403fa7a3b0 --- /dev/null +++ b/erp/resources/js/Components/Common/Badge.tsx @@ -0,0 +1,42 @@ +import { ReactNode } from 'react'; + +type BadgeColor = + | 'gray' + | 'red' + | 'yellow' + | 'green' + | 'blue' + | 'indigo' + | 'purple' + | 'pink'; + +interface BadgeProps { + color?: BadgeColor; + children: ReactNode; + className?: string; +} + +const colorClasses: Record = { + gray: 'bg-slate-100 text-slate-700', + red: 'bg-red-100 text-red-700', + yellow: 'bg-yellow-100 text-yellow-800', + green: 'bg-green-100 text-green-700', + blue: 'bg-blue-100 text-blue-700', + indigo: 'bg-indigo-100 text-indigo-700', + purple: 'bg-purple-100 text-purple-700', + pink: 'bg-pink-100 text-pink-700', +}; + +export function Badge({ color = 'gray', children, className = '' }: BadgeProps) { + return ( + + {children} + + ); +} diff --git a/erp/resources/js/Components/Common/Button.tsx b/erp/resources/js/Components/Common/Button.tsx new file mode 100644 index 00000000000..46e16189e8f --- /dev/null +++ b/erp/resources/js/Components/Common/Button.tsx @@ -0,0 +1,77 @@ +import { ButtonHTMLAttributes, ReactNode } from 'react'; + +type Variant = 'primary' | 'secondary' | 'danger' | 'ghost'; +type Size = 'sm' | 'md' | 'lg'; + +interface ButtonProps extends ButtonHTMLAttributes { + variant?: Variant; + size?: Size; + loading?: boolean; + children: ReactNode; +} + +const variantClasses: Record = { + primary: + 'bg-indigo-600 text-white hover:bg-indigo-700 focus:ring-indigo-500 disabled:bg-indigo-400', + secondary: + 'bg-white text-slate-700 border border-slate-300 hover:bg-slate-50 focus:ring-indigo-500', + danger: + 'bg-red-600 text-white hover:bg-red-700 focus:ring-red-500 disabled:bg-red-400', + ghost: + 'bg-transparent text-slate-600 hover:bg-slate-100 focus:ring-slate-400', +}; + +const sizeClasses: Record = { + sm: 'px-3 py-1.5 text-sm', + md: 'px-4 py-2 text-sm', + lg: 'px-6 py-3 text-base', +}; + +export function Button({ + variant = 'primary', + size = 'md', + loading = false, + disabled, + children, + className = '', + ...props +}: ButtonProps) { + return ( + + ); +} diff --git a/erp/resources/js/Components/Common/Input.tsx b/erp/resources/js/Components/Common/Input.tsx new file mode 100644 index 00000000000..e0e9da9c3e7 --- /dev/null +++ b/erp/resources/js/Components/Common/Input.tsx @@ -0,0 +1,63 @@ +import { InputHTMLAttributes, ReactNode, useId } from 'react'; + +interface InputProps extends InputHTMLAttributes { + label?: string; + error?: string; + helper?: string; + leadingIcon?: ReactNode; +} + +export function Input({ + label, + error, + helper, + leadingIcon, + className = '', + id: providedId, + ...props +}: InputProps) { + const generatedId = useId(); + const id = providedId ?? generatedId; + + return ( +
+ {label && ( + + )} +
+ {leadingIcon && ( +
+ {leadingIcon} +
+ )} + +
+ {error && ( +

{error}

+ )} + {!error && helper && ( +

{helper}

+ )} +
+ ); +} diff --git a/erp/resources/js/Components/Common/Modal.tsx b/erp/resources/js/Components/Common/Modal.tsx new file mode 100644 index 00000000000..0b588b32f6f --- /dev/null +++ b/erp/resources/js/Components/Common/Modal.tsx @@ -0,0 +1,91 @@ +import { + ReactNode, + useEffect, + useRef, + KeyboardEvent, + MouseEvent, +} from 'react'; +import { createPortal } from 'react-dom'; + +interface ModalProps { + open: boolean; + onClose: () => void; + title?: string; + children: ReactNode; + size?: 'sm' | 'md' | 'lg' | 'xl'; +} + +const sizeClasses = { + sm: 'max-w-sm', + md: 'max-w-md', + lg: 'max-w-lg', + xl: 'max-w-2xl', +}; + +export function Modal({ open, onClose, title, children, size = 'md' }: ModalProps) { + const dialogRef = useRef(null); + + useEffect(() => { + if (open) { + dialogRef.current?.focus(); + document.body.style.overflow = 'hidden'; + } else { + document.body.style.overflow = ''; + } + return () => { + document.body.style.overflow = ''; + }; + }, [open]); + + const handleKeyDown = (e: KeyboardEvent) => { + if (e.key === 'Escape') onClose(); + }; + + const handleBackdropClick = (e: MouseEvent) => { + if (e.target === e.currentTarget) onClose(); + }; + + if (!open) return null; + + return createPortal( +
+
+ {title && ( +
+ + +
+ )} +
{children}
+
+
, + document.body, + ); +} diff --git a/erp/resources/js/Components/Common/Table.tsx b/erp/resources/js/Components/Common/Table.tsx new file mode 100644 index 00000000000..d36cf07cb0f --- /dev/null +++ b/erp/resources/js/Components/Common/Table.tsx @@ -0,0 +1,96 @@ +import { ReactNode } from 'react'; + +export interface Column { + key: string; + header: string; + render?: (row: T) => ReactNode; + sortable?: boolean; + className?: string; +} + +interface TableProps { + columns: Column[]; + data: T[]; + emptyMessage?: string; + onSort?: (key: string) => void; + sortKey?: string; + sortDir?: 'asc' | 'desc'; +} + +export function Table({ + columns, + data, + emptyMessage = 'No records found.', + onSort, + sortKey, + sortDir, +}: TableProps) { + return ( +
+ + + + {columns.map((col) => ( + + ))} + + + + {data.length === 0 ? ( + + + + ) : ( + data.map((row) => ( + + {columns.map((col) => ( + + ))} + + )) + )} + +
onSort?.(col.key) : undefined} + > + + {col.header} + {col.sortable && sortKey === col.key && ( + + + + )} + +
+ {emptyMessage} +
+ {col.render + ? col.render(row) + : String((row as Record)[col.key] ?? '')} +
+
+ ); +} diff --git a/erp/resources/js/Components/DangerButton.tsx b/erp/resources/js/Components/DangerButton.tsx new file mode 100644 index 00000000000..07954b4c87c --- /dev/null +++ b/erp/resources/js/Components/DangerButton.tsx @@ -0,0 +1,22 @@ +import { ButtonHTMLAttributes } from 'react'; + +export default function DangerButton({ + className = '', + disabled, + children, + ...props +}: ButtonHTMLAttributes) { + return ( + + ); +} diff --git a/erp/resources/js/Components/Dropdown.tsx b/erp/resources/js/Components/Dropdown.tsx new file mode 100644 index 00000000000..1e6ccb30087 --- /dev/null +++ b/erp/resources/js/Components/Dropdown.tsx @@ -0,0 +1,130 @@ +import { Transition } from '@headlessui/react'; +import { InertiaLinkProps, Link } from '@inertiajs/react'; +import { + createContext, + Dispatch, + PropsWithChildren, + SetStateAction, + useContext, + useState, +} from 'react'; + +const DropDownContext = createContext<{ + open: boolean; + setOpen: Dispatch>; + toggleOpen: () => void; +}>({ + open: false, + setOpen: () => {}, + toggleOpen: () => {}, +}); + +const Dropdown = ({ children }: PropsWithChildren) => { + const [open, setOpen] = useState(false); + + const toggleOpen = () => { + setOpen((previousState) => !previousState); + }; + + return ( + +
{children}
+
+ ); +}; + +const Trigger = ({ children }: PropsWithChildren) => { + const { open, setOpen, toggleOpen } = useContext(DropDownContext); + + return ( + <> +
{children}
+ + {open && ( +
setOpen(false)} + >
+ )} + + ); +}; + +const Content = ({ + align = 'right', + width = '48', + contentClasses = 'py-1 bg-white', + children, +}: PropsWithChildren<{ + align?: 'left' | 'right'; + width?: '48'; + contentClasses?: string; +}>) => { + const { open, setOpen } = useContext(DropDownContext); + + let alignmentClasses = 'origin-top'; + + if (align === 'left') { + alignmentClasses = 'ltr:origin-top-left rtl:origin-top-right start-0'; + } else if (align === 'right') { + alignmentClasses = 'ltr:origin-top-right rtl:origin-top-left end-0'; + } + + let widthClasses = ''; + + if (width === '48') { + widthClasses = 'w-48'; + } + + return ( + <> + +
setOpen(false)} + > +
+ {children} +
+
+
+ + ); +}; + +const DropdownLink = ({ + className = '', + children, + ...props +}: InertiaLinkProps) => { + return ( + + {children} + + ); +}; + +Dropdown.Trigger = Trigger; +Dropdown.Content = Content; +Dropdown.Link = DropdownLink; + +export default Dropdown; diff --git a/erp/resources/js/Components/Finance/AssetStatusBadge.tsx b/erp/resources/js/Components/Finance/AssetStatusBadge.tsx new file mode 100644 index 00000000000..eb5844fc74f --- /dev/null +++ b/erp/resources/js/Components/Finance/AssetStatusBadge.tsx @@ -0,0 +1,18 @@ +interface Props { + status: 'active' | 'disposed' | 'fully_depreciated'; +} + +const config: Record = { + active: { label: 'Active', classes: 'bg-green-100 text-green-800' }, + disposed: { label: 'Disposed', classes: 'bg-slate-100 text-slate-700' }, + fully_depreciated: { label: 'Fully Depreciated', classes: 'bg-amber-100 text-amber-800' }, +}; + +export function AssetStatusBadge({ status }: Props) { + const { label, classes } = config[status] ?? { label: status, classes: 'bg-gray-100 text-gray-700' }; + return ( + + {label} + + ); +} diff --git a/erp/resources/js/Components/Finance/AttachmentPanel.tsx b/erp/resources/js/Components/Finance/AttachmentPanel.tsx new file mode 100644 index 00000000000..c522dbb8372 --- /dev/null +++ b/erp/resources/js/Components/Finance/AttachmentPanel.tsx @@ -0,0 +1,78 @@ +import { useForm } from '@inertiajs/react'; +import { Button } from '@/Components/Common/Button'; +import type { Attachment } from '@/types/finance'; + +interface Props { + attachments: Attachment[]; + modelType: string; + modelId: number; + canDelete?: boolean; +} + +export default function AttachmentPanel({ attachments, modelType, modelId, canDelete = true }: Props) { + const { data, setData, post, processing, reset } = useForm<{ file: File | null }>({ file: null }); + + function handleSubmit(e: React.FormEvent) { + e.preventDefault(); + if (!data.file) return; + post(`/finance/attachments/${modelType}/${modelId}`, { + forceFormData: true, + onSuccess: () => reset(), + }); + } + + function formatSize(bytes: number | null): string { + if (!bytes) return ''; + return bytes < 1024 ? `${bytes} B` : `${Math.round(bytes / 1024)} KB`; + } + + return ( +
+

Attachments

+ + {attachments.length === 0 && ( +

No attachments yet.

+ )} + +
    + {attachments.map((a) => ( +
  • +
    + {a.filename} + {a.size && {formatSize(a.size)}} +
    +
    + + Download + + {canDelete && ( +
    { + e.preventDefault(); + if (confirm('Delete attachment?')) (e.target as HTMLFormElement).submit(); + }}> + + +
    + )} +
    +
  • + ))} +
+ +
+ setData('file', e.target.files?.[0] ?? null)} + className="text-sm text-slate-600 file:mr-3 file:rounded file:border-0 file:bg-indigo-50 file:px-3 file:py-1 file:text-xs file:font-medium file:text-indigo-700 hover:file:bg-indigo-100" + /> + +
+
+ ); +} diff --git a/erp/resources/js/Components/Finance/BillStatusBadge.tsx b/erp/resources/js/Components/Finance/BillStatusBadge.tsx new file mode 100644 index 00000000000..1f49b4c1bcb --- /dev/null +++ b/erp/resources/js/Components/Finance/BillStatusBadge.tsx @@ -0,0 +1,16 @@ +import type { BillStatus } from '@/types/finance'; + +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + received: 'bg-blue-100 text-blue-700', + paid: 'bg-green-100 text-green-700', + cancelled: 'bg-red-100 text-red-600', +}; + +export function BillStatusBadge({ status }: { status: BillStatus }) { + return ( + + {status.charAt(0).toUpperCase() + status.slice(1)} + + ); +} diff --git a/erp/resources/js/Components/Finance/BudgetStatusBadge.tsx b/erp/resources/js/Components/Finance/BudgetStatusBadge.tsx new file mode 100644 index 00000000000..c4abd4e8b9d --- /dev/null +++ b/erp/resources/js/Components/Finance/BudgetStatusBadge.tsx @@ -0,0 +1,16 @@ +type BudgetStatus = 'draft' | 'active' | 'closed' | 'archived'; + +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + active: 'bg-green-100 text-green-700', + closed: 'bg-red-100 text-red-700', + archived: 'bg-slate-100 text-slate-500', +}; + +export function BudgetStatusBadge({ status }: { status: BudgetStatus }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/Finance/CreditNoteStatusBadge.tsx b/erp/resources/js/Components/Finance/CreditNoteStatusBadge.tsx new file mode 100644 index 00000000000..46219cae8e5 --- /dev/null +++ b/erp/resources/js/Components/Finance/CreditNoteStatusBadge.tsx @@ -0,0 +1,16 @@ +import type { CreditNoteStatus } from '@/types/finance'; + +const COLORS: Record = { + draft: 'bg-slate-100 text-slate-600', + issued: 'bg-blue-100 text-blue-700', + applied: 'bg-green-100 text-green-700', + void: 'bg-red-100 text-red-700', +}; + +export function CreditNoteStatusBadge({ status }: { status: CreditNoteStatus }) { + return ( + + {status.charAt(0).toUpperCase() + status.slice(1)} + + ); +} diff --git a/erp/resources/js/Components/Finance/InvoiceStatusBadge.tsx b/erp/resources/js/Components/Finance/InvoiceStatusBadge.tsx new file mode 100644 index 00000000000..19337fade5d --- /dev/null +++ b/erp/resources/js/Components/Finance/InvoiceStatusBadge.tsx @@ -0,0 +1,16 @@ +import type { InvoiceStatus } from '@/types/finance'; + +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + sent: 'bg-blue-100 text-blue-700', + paid: 'bg-green-100 text-green-700', + cancelled: 'bg-red-100 text-red-600', +}; + +export function InvoiceStatusBadge({ status }: { status: InvoiceStatus }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/Finance/JournalEntryStatusBadge.tsx b/erp/resources/js/Components/Finance/JournalEntryStatusBadge.tsx new file mode 100644 index 00000000000..511121b3553 --- /dev/null +++ b/erp/resources/js/Components/Finance/JournalEntryStatusBadge.tsx @@ -0,0 +1,12 @@ +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + posted: 'bg-green-100 text-green-700', +}; + +export function JournalEntryStatusBadge({ status }: { status: string }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/Finance/QuoteStatusBadge.tsx b/erp/resources/js/Components/Finance/QuoteStatusBadge.tsx new file mode 100644 index 00000000000..37dff9b4a53 --- /dev/null +++ b/erp/resources/js/Components/Finance/QuoteStatusBadge.tsx @@ -0,0 +1,17 @@ +import type { QuoteStatus } from '@/types/finance'; + +const COLORS: Record = { + draft: 'bg-slate-100 text-slate-600', + sent: 'bg-blue-100 text-blue-700', + accepted: 'bg-green-100 text-green-700', + declined: 'bg-red-100 text-red-700', + cancelled: 'bg-red-100 text-red-600', +}; + +export function QuoteStatusBadge({ status }: { status: QuoteStatus }) { + return ( + + {status.charAt(0).toUpperCase() + status.slice(1)} + + ); +} diff --git a/erp/resources/js/Components/Finance/RecurringStatusBadge.tsx b/erp/resources/js/Components/Finance/RecurringStatusBadge.tsx new file mode 100644 index 00000000000..3a388046bfc --- /dev/null +++ b/erp/resources/js/Components/Finance/RecurringStatusBadge.tsx @@ -0,0 +1,15 @@ +import type { RecurringStatus } from '@/types/finance'; + +const COLORS: Record = { + active: 'bg-green-100 text-green-700', + paused: 'bg-amber-100 text-amber-700', + ended: 'bg-slate-100 text-slate-600', +}; + +export function RecurringStatusBadge({ status }: { status: RecurringStatus }) { + return ( + + {status.charAt(0).toUpperCase() + status.slice(1)} + + ); +} diff --git a/erp/resources/js/Components/Finance/SalesOrderStatusBadge.tsx b/erp/resources/js/Components/Finance/SalesOrderStatusBadge.tsx new file mode 100644 index 00000000000..2255cb87c2c --- /dev/null +++ b/erp/resources/js/Components/Finance/SalesOrderStatusBadge.tsx @@ -0,0 +1,16 @@ +import type { SalesOrderStatus } from '@/types/finance'; + +const COLORS: Record = { + draft: 'bg-slate-100 text-slate-600', + confirmed: 'bg-blue-100 text-blue-700', + fulfilled: 'bg-green-100 text-green-700', + cancelled: 'bg-red-100 text-red-600', +}; + +export function SalesOrderStatusBadge({ status }: { status: SalesOrderStatus }) { + return ( + + {status.charAt(0).toUpperCase() + status.slice(1)} + + ); +} diff --git a/erp/resources/js/Components/HR/EmployeeStatusBadge.tsx b/erp/resources/js/Components/HR/EmployeeStatusBadge.tsx new file mode 100644 index 00000000000..bea5d78af25 --- /dev/null +++ b/erp/resources/js/Components/HR/EmployeeStatusBadge.tsx @@ -0,0 +1,15 @@ +import type { EmployeeStatus } from '@/types/hr'; + +const map: Record = { + active: 'bg-green-100 text-green-700', + on_leave: 'bg-yellow-100 text-yellow-700', + terminated: 'bg-red-100 text-red-600', +}; + +export function EmployeeStatusBadge({ status }: { status: EmployeeStatus }) { + return ( + + {status.replace('_', ' ')} + + ); +} diff --git a/erp/resources/js/Components/HR/ExpenseStatusBadge.tsx b/erp/resources/js/Components/HR/ExpenseStatusBadge.tsx new file mode 100644 index 00000000000..58a502acc84 --- /dev/null +++ b/erp/resources/js/Components/HR/ExpenseStatusBadge.tsx @@ -0,0 +1,17 @@ +export type ExpenseStatus = 'draft' | 'submitted' | 'approved' | 'rejected' | 'reimbursed'; + +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + submitted: 'bg-blue-100 text-blue-700', + approved: 'bg-green-100 text-green-700', + rejected: 'bg-red-100 text-red-600', + reimbursed: 'bg-purple-100 text-purple-700', +}; + +export function ExpenseStatusBadge({ status }: { status: ExpenseStatus }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/HR/LeaveStatusBadge.tsx b/erp/resources/js/Components/HR/LeaveStatusBadge.tsx new file mode 100644 index 00000000000..d603fcea8e0 --- /dev/null +++ b/erp/resources/js/Components/HR/LeaveStatusBadge.tsx @@ -0,0 +1,16 @@ +import type { LeaveStatus } from '@/types/hr'; + +const map: Record = { + pending: 'bg-yellow-100 text-yellow-700', + approved: 'bg-green-100 text-green-700', + rejected: 'bg-red-100 text-red-600', + cancelled: 'bg-slate-100 text-slate-600', +}; + +export function LeaveStatusBadge({ status }: { status: LeaveStatus }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/HR/PayrollStatusBadge.tsx b/erp/resources/js/Components/HR/PayrollStatusBadge.tsx new file mode 100644 index 00000000000..20648ef206f --- /dev/null +++ b/erp/resources/js/Components/HR/PayrollStatusBadge.tsx @@ -0,0 +1,15 @@ +import type { PayrollStatus } from '@/types/hr'; + +const map: Record = { + draft: 'bg-slate-100 text-slate-600', + processed: 'bg-blue-100 text-blue-700', + paid: 'bg-green-100 text-green-700', +}; + +export function PayrollStatusBadge({ status }: { status: PayrollStatus }) { + return ( + + {status} + + ); +} diff --git a/erp/resources/js/Components/InputError.tsx b/erp/resources/js/Components/InputError.tsx new file mode 100644 index 00000000000..e20474fc944 --- /dev/null +++ b/erp/resources/js/Components/InputError.tsx @@ -0,0 +1,16 @@ +import { HTMLAttributes } from 'react'; + +export default function InputError({ + message, + className = '', + ...props +}: HTMLAttributes & { message?: string }) { + return message ? ( +

+ {message} +

+ ) : null; +} diff --git a/erp/resources/js/Components/InputLabel.tsx b/erp/resources/js/Components/InputLabel.tsx new file mode 100644 index 00000000000..61e6c364133 --- /dev/null +++ b/erp/resources/js/Components/InputLabel.tsx @@ -0,0 +1,20 @@ +import { LabelHTMLAttributes } from 'react'; + +export default function InputLabel({ + value, + className = '', + children, + ...props +}: LabelHTMLAttributes & { value?: string }) { + return ( + + ); +} diff --git a/erp/resources/js/Components/Inventory/Pagination.tsx b/erp/resources/js/Components/Inventory/Pagination.tsx new file mode 100644 index 00000000000..f23a78f47ab --- /dev/null +++ b/erp/resources/js/Components/Inventory/Pagination.tsx @@ -0,0 +1,53 @@ +import { Link } from '@inertiajs/react'; +import type { Paginator } from '@/types/inventory'; + +interface Props { + paginator: Paginator; + preserveScroll?: boolean; +} + +export function Pagination({ paginator, preserveScroll = true }: Props) { + const { current_page, last_page, from, to, total, prev_page_url, next_page_url } = paginator; + + if (last_page <= 1) return null; + + return ( +
+

+ Showing {from}{to} of{' '} + {total} results +

+
+ {prev_page_url ? ( + + Previous + + ) : ( + + Previous + + )} + + {current_page} / {last_page} + + {next_page_url ? ( + + Next + + ) : ( + + Next + + )} +
+
+ ); +} diff --git a/erp/resources/js/Components/Inventory/ProductForm.tsx b/erp/resources/js/Components/Inventory/ProductForm.tsx new file mode 100644 index 00000000000..b757c6b6673 --- /dev/null +++ b/erp/resources/js/Components/Inventory/ProductForm.tsx @@ -0,0 +1,171 @@ +import { useForm } from '@inertiajs/react'; +import { Button } from '@/Components/Common/Button'; +import { Input } from '@/Components/Common/Input'; +import type { ProductCategory, UnitOfMeasure } from '@/types/inventory'; + +interface ProductFormData { + sku: string; + name: string; + description: string; + category_id: string; + uom_id: string; + cost_price: string; + sale_price: string; + reorder_point: string; + is_active: boolean; + [key: string]: string | boolean; +} + +interface Props { + categories: Pick[]; + uoms: UnitOfMeasure[]; + defaults?: Partial; + action: string; + method?: 'post' | 'put' | 'patch'; + submitLabel?: string; + cancelHref?: string; +} + +export function ProductForm({ categories, uoms, defaults = {}, action, method = 'post', submitLabel = 'Save', cancelHref }: Props) { + const { data, setData, submit, processing, errors } = useForm({ + sku: defaults.sku ?? '', + name: defaults.name ?? '', + description: defaults.description ?? '', + category_id: defaults.category_id ?? '', + uom_id: defaults.uom_id ?? '', + cost_price: defaults.cost_price ?? '', + sale_price: defaults.sale_price ?? '', + reorder_point: defaults.reorder_point ?? '0', + is_active: defaults.is_active ?? true, + }); + + function handleSubmit(e: React.FormEvent) { + e.preventDefault(); + submit(method, action); + } + + return ( +
+
+
+ + setData('sku', e.target.value)} + placeholder="e.g. LAP-001" + required + /> + {errors.sku &&

{errors.sku}

} +
+
+ + setData('name', e.target.value)} + placeholder="Product name" + required + /> + {errors.name &&

{errors.name}

} +
+
+ +