diff --git a/Company/Database/Migrations/2026_07_07_093000_add_country_id_to_companies_table.php b/Company/Database/Migrations/2026_07_07_093000_add_country_id_to_companies_table.php
deleted file mode 100644
index 0d0a61f0..00000000
--- a/Company/Database/Migrations/2026_07_07_093000_add_country_id_to_companies_table.php
+++ /dev/null
@@ -1,26 +0,0 @@
-foreignId('country_id')
- ->nullable()
- ->after('billing_email')
- ->constrained('countries')
- ->nullOnDelete();
- });
- }
-
- public function down(): void
- {
- Schema::table('companies', function (Blueprint $table): void {
- $table->dropConstrainedForeignId('country_id');
- });
- }
-};
diff --git a/Company/Http/Controllers/CompanyController.php b/Company/Http/Controllers/CompanyController.php
deleted file mode 100644
index 0880b292..00000000
--- a/Company/Http/Controllers/CompanyController.php
+++ /dev/null
@@ -1,141 +0,0 @@
- Company::query()
- ->with(['address.country', 'country'])
- ->withCount(['users', 'warehouses', 'licenseKeys', 'divisions'])
- ->latest('id')
- ->paginate(20),
- 'countries' => $this->countries(),
- ]);
- }
-
- /**
- * Show the create company screen.
- */
- public function create()
- {
- return view('company::create', [
- 'company' => new Company([
- 'status' => 'active',
- 'timezone' => 'Europe/London',
- ]),
- 'countries' => $this->countries(),
- ]);
- }
-
- /**
- * Store a company tenant.
- */
- public function store(Request $request)
- {
- $company = Company::create($this->validated($request));
-
- return redirect()
- ->route('platform.companies.index')
- ->with('status', 'Company created.');
- }
-
- /**
- * Display a company workbench.
- */
- public function show(Company $company)
- {
- $company->load([
- 'address.country',
- 'divisions.address.country',
- 'divisions.warehouses',
- 'divisions.users',
- 'warehouses.address.country',
- 'warehouses.division',
- 'directorAssignments.user',
- 'directorAssignments.division',
- ])->loadCount(['users', 'warehouses', 'licenseKeys', 'payments', 'divisions']);
-
- return view('company::show', [
- 'company' => $company,
- 'recentUsers' => $company->users()->latest('id')->limit(5)->get(),
- 'recentWarehouses' => $company->warehouses()->latest('id')->limit(5)->get(),
- 'recentLicenseKeys' => $company->licenseKeys()->latest('id')->limit(5)->get(),
- 'countries' => Country::query()->active()->orderBy('sort_order')->orderBy('name')->get(['id', 'alpha2', 'name', 'display_name', 'common_name']),
- 'companyUsers' => $company->users()->orderBy('name')->get(['id', 'name', 'email', 'company_id']),
- 'unassignedWarehouses' => $company->warehouses()->whereNull('division_id')->orderBy('name')->get(),
- ]);
- }
-
- /**
- * Show the edit company screen.
- */
- public function edit(Company $company)
- {
- return view('company::edit', [
- 'company' => $company->loadMissing(['address.country', 'country']),
- 'countries' => $this->countries(),
- ]);
- }
-
- /**
- * Update a company tenant.
- */
- public function update(Request $request, Company $company)
- {
- $company->update($this->validated($request, $company));
-
- return redirect()
- ->route('platform.companies.show', $company)
- ->with('status', 'Company updated.');
- }
-
- /**
- * Delete a company tenant.
- */
- public function destroy(Company $company)
- {
- abort_if($company->is_system_company, 403, 'The system company cannot be deleted.');
-
- $company->delete();
-
- return redirect()
- ->route('platform.companies.index')
- ->with('status', 'Company deleted.');
- }
-
- private function validated(Request $request, ?Company $company = null): array
- {
- $data = $request->validate([
- 'name' => ['required', 'string', 'max:255'],
- 'billing_email' => ['nullable', 'email', 'max:255'],
- 'status' => ['required', Rule::in(['active', 'suspended', 'inactive'])],
- 'country_id' => ['nullable', Rule::exists('countries', 'id')->where('is_active', true)],
- ]);
-
- $data['slug'] = Str::slug($data['name']);
- $data['timezone'] = $company?->timezone ?: 'Europe/London';
-
- return $data;
- }
-
- private function countries()
- {
- return Country::query()
- ->active()
- ->ordered()
- ->get(['id', 'alpha2', 'name', 'display_name', 'common_name', 'sort_order']);
- }
-}
diff --git a/Company/Models/Company.php b/Company/Models/Company.php
deleted file mode 100644
index e3dd2a77..00000000
--- a/Company/Models/Company.php
+++ /dev/null
@@ -1,100 +0,0 @@
- 'array',
- 'is_system_company' => 'boolean',
- ];
-
- protected static function booted(): void
- {
- static::creating(function (Company $company): void {
- $company->uuid ??= (string) Str::uuid();
- $company->slug ??= Str::slug($company->name);
- $company->status ??= 'active';
- $company->timezone ??= 'Europe/London';
- });
- }
-
-
-
- public function country(): BelongsTo
- {
- return $this->belongsTo(Country::class);
- }
-
- public function address(): MorphOne
- {
- return $this->morphOne(CompanyAddress::class, 'addressable');
- }
-
- public function divisions(): HasMany
- {
- return $this->hasMany(CompanyDivision::class);
- }
-
- public function directorAssignments(): HasMany
- {
- return $this->hasMany(CompanyDirectorAssignment::class);
- }
-
- public function users(): HasMany
- {
- return $this->hasMany(User::class);
- }
-
- public function licenseKeys(): HasMany
- {
- return $this->hasMany(LicenseKey::class);
- }
-
- public function payments(): HasMany
- {
- return $this->hasMany(Payment::class);
- }
-
- public function warehouses(): HasMany
- {
- return $this->hasMany(Warehouse::class);
- }
-
- public function hasActiveLicense(): bool
- {
- if ($this->is_system_company) {
- return true;
- }
-
- return $this->licenseKeys()
- ->where('is_active', true)
- ->where(function ($query): void {
- $query->whereNull('starts_at')->orWhere('starts_at', '<=', now());
- })
- ->where(function ($query): void {
- $query->whereNull('expires_at')->orWhere('expires_at', '>=', now());
- })
- ->whereNull('revoked_at')
- ->exists();
- }
-}
diff --git a/Company/Resources/views/_form.blade.php b/Company/Resources/views/_form.blade.php
deleted file mode 100644
index e044d2d7..00000000
--- a/Company/Resources/views/_form.blade.php
+++ /dev/null
@@ -1,83 +0,0 @@
-@csrf
-
-
-
-
-
- @error('name')
-
{{ $message }}
- @enderror
-
-
-
-
-
- @error('billing_email')
-
{{ $message }}
- @enderror
-
-
-
-
-
- @error('status')
-
{{ $message }}
- @enderror
-
-
-
-
-
- @error('country_id')
-
{{ $message }}
- @enderror
-
-
-
-
diff --git a/Company/Resources/views/index.blade.php b/Company/Resources/views/index.blade.php
deleted file mode 100644
index b4515449..00000000
--- a/Company/Resources/views/index.blade.php
+++ /dev/null
@@ -1,174 +0,0 @@
-
-
-
-
-
-
- @if (session('status'))
-
- {{ session('status') }}
-
- @endif
-
-
-
-
-
Create company
-
Add a new tenant without leaving the administration index.
-
-
-
- Open full form
-
-
-
-
-
-
-
-
-
- | Name |
- Users |
- Divisions |
- Warehouses |
- Licences |
- Status |
- Actions |
-
-
-
-
- @forelse ($companies as $company)
-
- |
- {{ $company->name }}
- |
-
-
- {{ $company->users_count }}
- |
-
-
- {{ $company->divisions_count }}
- |
-
-
- {{ $company->warehouses_count }}
- |
-
-
- {{ $company->license_keys_count }}
- |
-
-
-
- {{ $company->is_system_company ? 'System' : ucfirst($company->status) }}
-
- |
-
-
-
-
- View
-
-
-
- Edit
-
-
- @unless ($company->is_system_company)
-
- @endunless
-
- |
-
- @empty
-
- |
- No companies found.
- |
-
- @endforelse
-
-
-
-
- {{ $companies->links() }}
-
-
diff --git a/Modules/Company/Config/.gitkeep b/Modules/Company/Config/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Config/config.php b/Modules/Company/Config/config.php
deleted file mode 100644
index 2f8ac5ec..00000000
--- a/Modules/Company/Config/config.php
+++ /dev/null
@@ -1,8 +0,0 @@
- 'Company',
- 'features' =>
- [
- ],
-];
diff --git a/Modules/Company/Console/.gitkeep b/Modules/Company/Console/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Database/Migrations/.gitkeep b/Modules/Company/Database/Migrations/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Database/Migrations/2026_07_02_120000_create_company_addresses_table.php b/Modules/Company/Database/Migrations/2026_07_02_120000_create_company_addresses_table.php
deleted file mode 100644
index 627f7f17..00000000
--- a/Modules/Company/Database/Migrations/2026_07_02_120000_create_company_addresses_table.php
+++ /dev/null
@@ -1,40 +0,0 @@
-id();
- $table->morphs('addressable');
- $table->string('label', 80)->default('Registered office');
- $table->string('attention')->nullable();
- $table->string('line_1');
- $table->string('line_2')->nullable();
- $table->string('line_3')->nullable();
- $table->string('locality')->comment('City, town or locality.');
- $table->string('administrative_area')->nullable()->comment('County, state, province or region.');
- $table->string('postal_code', 32)->nullable();
- $table->foreignId('country_id')->constrained('countries')->restrictOnDelete();
- $table->foreignId('country_subdivision_id')->nullable()->constrained('country_subdivisions')->nullOnDelete();
- $table->decimal('latitude', 10, 7)->nullable();
- $table->decimal('longitude', 10, 7)->nullable();
- $table->boolean('is_primary')->default(true);
- $table->json('metadata')->nullable();
- $table->timestamps();
-
- $table->unique(['addressable_type', 'addressable_id'], 'company_addresses_one_per_owner_unique');
- $table->index(['country_id', 'locality']);
- $table->index(['postal_code']);
- });
- }
-
- public function down(): void
- {
- Schema::dropIfExists('company_addresses');
- }
-};
diff --git a/Modules/Company/Database/Migrations/2026_07_02_121000_create_company_divisions_table.php b/Modules/Company/Database/Migrations/2026_07_02_121000_create_company_divisions_table.php
deleted file mode 100644
index 44cad595..00000000
--- a/Modules/Company/Database/Migrations/2026_07_02_121000_create_company_divisions_table.php
+++ /dev/null
@@ -1,34 +0,0 @@
-id();
- $table->foreignId('company_id')->constrained('companies')->cascadeOnDelete();
- $table->uuid('uuid')->unique();
- $table->string('name');
- $table->string('code', 40)->nullable();
- $table->string('slug');
- $table->string('status', 32)->default('active')->index();
- $table->text('description')->nullable();
- $table->json('metadata')->nullable();
- $table->timestamps();
- $table->softDeletes();
-
- $table->unique(['company_id', 'slug']);
- $table->unique(['company_id', 'code']);
- $table->index(['company_id', 'status', 'name']);
- });
- }
-
- public function down(): void
- {
- Schema::dropIfExists('company_divisions');
- }
-};
diff --git a/Modules/Company/Database/Migrations/2026_07_02_122000_create_company_division_user_table.php b/Modules/Company/Database/Migrations/2026_07_02_122000_create_company_division_user_table.php
deleted file mode 100644
index 16fed17b..00000000
--- a/Modules/Company/Database/Migrations/2026_07_02_122000_create_company_division_user_table.php
+++ /dev/null
@@ -1,30 +0,0 @@
-id();
- $table->foreignId('company_id')->constrained('companies')->cascadeOnDelete();
- $table->foreignId('company_division_id')->constrained('company_divisions')->cascadeOnDelete();
- $table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
- $table->string('role', 80)->default('member')->index();
- $table->boolean('is_director')->default(false)->index();
- $table->timestamps();
-
- $table->unique(['company_division_id', 'user_id']);
- $table->index(['company_id', 'user_id']);
- $table->index(['company_id', 'is_director']);
- });
- }
-
- public function down(): void
- {
- Schema::dropIfExists('company_division_user');
- }
-};
diff --git a/Modules/Company/Database/Migrations/2026_07_02_123000_create_company_director_assignments_table.php b/Modules/Company/Database/Migrations/2026_07_02_123000_create_company_director_assignments_table.php
deleted file mode 100644
index c539c515..00000000
--- a/Modules/Company/Database/Migrations/2026_07_02_123000_create_company_director_assignments_table.php
+++ /dev/null
@@ -1,32 +0,0 @@
-id();
- $table->foreignId('company_id')->constrained('companies')->cascadeOnDelete();
- $table->foreignId('company_division_id')->nullable()->constrained('company_divisions')->cascadeOnDelete();
- $table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
- $table->string('coverage_type', 32)->default('company')->index();
- $table->date('starts_at')->nullable();
- $table->date('ends_at')->nullable();
- $table->text('notes')->nullable();
- $table->timestamps();
-
- $table->unique(['company_id', 'company_division_id', 'user_id'], 'company_director_coverage_unique');
- $table->index(['company_id', 'coverage_type']);
- $table->index(['user_id', 'coverage_type']);
- });
- }
-
- public function down(): void
- {
- Schema::dropIfExists('company_director_assignments');
- }
-};
diff --git a/Modules/Company/Database/Migrations/2026_07_02_124000_add_division_id_to_warehouses_table.php b/Modules/Company/Database/Migrations/2026_07_02_124000_add_division_id_to_warehouses_table.php
deleted file mode 100644
index b7c52b09..00000000
--- a/Modules/Company/Database/Migrations/2026_07_02_124000_add_division_id_to_warehouses_table.php
+++ /dev/null
@@ -1,27 +0,0 @@
-foreignId('division_id')->nullable()->after('company_id')->constrained('company_divisions')->nullOnDelete();
- $table->index(['company_id', 'division_id']);
- }
- });
- }
-
- public function down(): void
- {
- Schema::table('warehouses', function (Blueprint $table): void {
- if (Schema::hasColumn('warehouses', 'division_id')) {
- $table->dropConstrainedForeignId('division_id');
- }
- });
- }
-};
diff --git a/Modules/Company/Database/Seeders/.gitkeep b/Modules/Company/Database/Seeders/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Database/Seeders/CompanyDatabaseSeeder.php b/Modules/Company/Database/Seeders/CompanyDatabaseSeeder.php
deleted file mode 100644
index 49302c7a..00000000
--- a/Modules/Company/Database/Seeders/CompanyDatabaseSeeder.php
+++ /dev/null
@@ -1,21 +0,0 @@
-call("OthersTableSeeder");
- }
-}
diff --git a/Modules/Company/Database/factories/.gitkeep b/Modules/Company/Database/factories/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Helpers/.gitkeep b/Modules/Company/Helpers/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Helpers/Helper.php b/Modules/Company/Helpers/Helper.php
deleted file mode 100644
index 7693b057..00000000
--- a/Modules/Company/Helpers/Helper.php
+++ /dev/null
@@ -1,12 +0,0 @@
-upsertAddress($request, $company);
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Company address updated.');
- }
-
- public function updateDivision(Request $request, Company $company, CompanyDivision $division)
- {
- abort_unless($division->company_id === $company->id, 404);
-
- $this->upsertAddress($request, $division, 'Operating address');
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Division address updated.');
- }
-
- public function updateWarehouse(Request $request, Company $company, Warehouse $warehouse)
- {
- abort_unless($warehouse->company_id === $company->id, 404);
-
- $this->upsertAddress($request, $warehouse, 'Warehouse address');
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Warehouse address updated.');
- }
-
- private function upsertAddress(Request $request, object $owner, string $defaultLabel = 'Registered office'): void
- {
- $data = $request->validate([
- 'label' => ['nullable', 'string', 'max:80'],
- 'attention' => ['nullable', 'string', 'max:255'],
- 'line_1' => ['required', 'string', 'max:255'],
- 'line_2' => ['nullable', 'string', 'max:255'],
- 'line_3' => ['nullable', 'string', 'max:255'],
- 'locality' => ['required', 'string', 'max:255'],
- 'administrative_area' => ['nullable', 'string', 'max:255'],
- 'postal_code' => ['nullable', 'string', 'max:32'],
- 'country_id' => ['required', Rule::exists('countries', 'id')->where('is_active', true)],
- 'country_subdivision_id' => ['nullable', 'exists:country_subdivisions,id'],
- 'latitude' => ['nullable', 'numeric', 'between:-90,90'],
- 'longitude' => ['nullable', 'numeric', 'between:-180,180'],
- ]);
-
- $data['label'] = $data['label'] ?: $defaultLabel;
- $data['is_primary'] = true;
-
- $owner->address()->updateOrCreate([], $data);
- }
-}
diff --git a/Modules/Company/Http/Controllers/CompanyController.php b/Modules/Company/Http/Controllers/CompanyController.php
index 10a583c1..0880b292 100644
--- a/Modules/Company/Http/Controllers/CompanyController.php
+++ b/Modules/Company/Http/Controllers/CompanyController.php
@@ -18,11 +18,11 @@ class CompanyController extends Controller
{
return view('company::index', [
'companies' => Company::query()
- ->with(['address.country'])
+ ->with(['address.country', 'country'])
->withCount(['users', 'warehouses', 'licenseKeys', 'divisions'])
->latest('id')
->paginate(20),
- 'countries' => $this->countriesForSelect(),
+ 'countries' => $this->countries(),
]);
}
@@ -36,7 +36,7 @@ class CompanyController extends Controller
'status' => 'active',
'timezone' => 'Europe/London',
]),
- 'countries' => $this->countriesForSelect(),
+ 'countries' => $this->countries(),
]);
}
@@ -45,10 +45,7 @@ class CompanyController extends Controller
*/
public function store(Request $request)
{
- $validated = $this->validated($request);
-
- $company = Company::create($validated['company']);
- $this->syncAddressCountry($company, $validated['country_id']);
+ $company = Company::create($this->validated($request));
return redirect()
->route('platform.companies.index')
@@ -76,7 +73,7 @@ class CompanyController extends Controller
'recentUsers' => $company->users()->latest('id')->limit(5)->get(),
'recentWarehouses' => $company->warehouses()->latest('id')->limit(5)->get(),
'recentLicenseKeys' => $company->licenseKeys()->latest('id')->limit(5)->get(),
- 'countries' => $this->countriesForSelect(),
+ 'countries' => Country::query()->active()->orderBy('sort_order')->orderBy('name')->get(['id', 'alpha2', 'name', 'display_name', 'common_name']),
'companyUsers' => $company->users()->orderBy('name')->get(['id', 'name', 'email', 'company_id']),
'unassignedWarehouses' => $company->warehouses()->whereNull('division_id')->orderBy('name')->get(),
]);
@@ -88,8 +85,8 @@ class CompanyController extends Controller
public function edit(Company $company)
{
return view('company::edit', [
- 'company' => $company->loadMissing('address.country'),
- 'countries' => $this->countriesForSelect(),
+ 'company' => $company->loadMissing(['address.country', 'country']),
+ 'countries' => $this->countries(),
]);
}
@@ -98,10 +95,7 @@ class CompanyController extends Controller
*/
public function update(Request $request, Company $company)
{
- $validated = $this->validated($request, $company);
-
- $company->update($validated['company']);
- $this->syncAddressCountry($company, $validated['country_id']);
+ $company->update($this->validated($request, $company));
return redirect()
->route('platform.companies.show', $company)
@@ -128,44 +122,20 @@ class CompanyController extends Controller
'name' => ['required', 'string', 'max:255'],
'billing_email' => ['nullable', 'email', 'max:255'],
'status' => ['required', Rule::in(['active', 'suspended', 'inactive'])],
- 'country_id' => ['nullable', 'integer', Rule::exists('countries', 'id')],
+ 'country_id' => ['nullable', Rule::exists('countries', 'id')->where('is_active', true)],
]);
- return [
- 'company' => [
- 'name' => $data['name'],
- 'billing_email' => $data['billing_email'] ?? null,
- 'status' => $data['status'],
- 'slug' => Str::slug($data['name']),
- 'timezone' => $company?->timezone ?: 'Europe/London',
- ],
- 'country_id' => $data['country_id'] ?? null,
- ];
+ $data['slug'] = Str::slug($data['name']);
+ $data['timezone'] = $company?->timezone ?: 'Europe/London';
+
+ return $data;
}
- private function countriesForSelect()
+ private function countries()
{
return Country::query()
->active()
- ->orderByRaw("LOWER(COALESCE(NULLIF(display_name, ''), NULLIF(common_name, ''), name)) ASC")
- ->get(['id', 'alpha2', 'name', 'display_name', 'common_name']);
- }
-
- private function syncAddressCountry(Company $company, ?int $countryId): void
- {
- if ($countryId === null) {
- $company->address()?->delete();
-
- return;
- }
-
- $company->address()->updateOrCreate(
- [],
- [
- 'country_id' => $countryId,
- 'label' => 'Registered address',
- 'is_primary' => true,
- ]
- );
+ ->ordered()
+ ->get(['id', 'alpha2', 'name', 'display_name', 'common_name', 'sort_order']);
}
}
diff --git a/Modules/Company/Http/Controllers/CompanyDivisionController.php b/Modules/Company/Http/Controllers/CompanyDivisionController.php
deleted file mode 100644
index baf3b8ed..00000000
--- a/Modules/Company/Http/Controllers/CompanyDivisionController.php
+++ /dev/null
@@ -1,54 +0,0 @@
-divisions()->create($this->validated($request, $company));
-
- return redirect()->route('platform.companies.show', $company)->with('status', "Division {$division->name} created.");
- }
-
- public function update(Request $request, Company $company, CompanyDivision $division)
- {
- abort_unless($division->company_id === $company->id, 404);
-
- $division->update($this->validated($request, $company, $division));
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Division updated.');
- }
-
- public function destroy(Company $company, CompanyDivision $division)
- {
- abort_unless($division->company_id === $company->id, 404);
-
- abort_if($division->warehouses()->exists(), 422, 'Move warehouses before deleting this division.');
-
- $division->delete();
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Division deleted.');
- }
-
- private function validated(Request $request, Company $company, ?CompanyDivision $division = null): array
- {
- $data = $request->validate([
- 'name' => ['required', 'string', 'max:255'],
- 'code' => ['nullable', 'string', 'max:40', Rule::unique('company_divisions', 'code')->where('company_id', $company->id)->ignore($division?->id)],
- 'status' => ['required', Rule::in(['active', 'suspended', 'inactive'])],
- 'description' => ['nullable', 'string', 'max:2000'],
- ]);
-
- $data['slug'] = Str::slug($data['name']);
-
- return $data;
- }
-}
diff --git a/Modules/Company/Http/Controllers/CompanyMembershipController.php b/Modules/Company/Http/Controllers/CompanyMembershipController.php
deleted file mode 100644
index 7ce6d23c..00000000
--- a/Modules/Company/Http/Controllers/CompanyMembershipController.php
+++ /dev/null
@@ -1,83 +0,0 @@
-validate([
- 'user_id' => ['required', Rule::exists('users', 'id')->where('company_id', $company->id)],
- 'company_division_id' => ['required', Rule::exists('company_divisions', 'id')->where('company_id', $company->id)],
- 'role' => ['nullable', 'string', 'max:80'],
- 'is_director' => ['nullable', 'boolean'],
- ]);
-
- $division = CompanyDivision::where('company_id', $company->id)->findOrFail($data['company_division_id']);
- $division->users()->syncWithoutDetaching([
- $data['user_id'] => [
- 'company_id' => $company->id,
- 'role' => $data['role'] ?? 'member',
- 'is_director' => (bool) ($data['is_director'] ?? false),
- ],
- ]);
-
- if ((bool) ($data['is_director'] ?? false)) {
- CompanyDirectorAssignment::updateOrCreate([
- 'company_id' => $company->id,
- 'company_division_id' => $division->id,
- 'user_id' => $data['user_id'],
- ], ['coverage_type' => 'division']);
- }
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Division membership updated.');
- }
-
- public function assignDirector(Request $request, Company $company)
- {
- $data = $request->validate([
- 'user_id' => ['required', Rule::exists('users', 'id')->where('company_id', $company->id)],
- 'coverage_type' => ['required', Rule::in(['company', 'division'])],
- 'company_division_id' => ['nullable', Rule::exists('company_divisions', 'id')->where('company_id', $company->id)],
- 'starts_at' => ['nullable', 'date'],
- 'ends_at' => ['nullable', 'date', 'after_or_equal:starts_at'],
- 'notes' => ['nullable', 'string', 'max:2000'],
- ]);
-
- if ($data['coverage_type'] === 'company') {
- $data['company_division_id'] = null;
- } else {
- abort_if(empty($data['company_division_id']), 422, 'Division coverage requires a division.');
- }
-
- CompanyDirectorAssignment::updateOrCreate([
- 'company_id' => $company->id,
- 'company_division_id' => $data['company_division_id'],
- 'user_id' => $data['user_id'],
- ], [
- 'coverage_type' => $data['coverage_type'],
- 'starts_at' => $data['starts_at'] ?? null,
- 'ends_at' => $data['ends_at'] ?? null,
- 'notes' => $data['notes'] ?? null,
- ]);
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Director coverage updated.');
- }
-
- public function removeDirector(Company $company, CompanyDirectorAssignment $assignment)
- {
- abort_unless($assignment->company_id === $company->id, 404);
-
- $assignment->delete();
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Director coverage removed.');
- }
-}
diff --git a/Modules/Company/Http/Controllers/CompanyWarehouseAssignmentController.php b/Modules/Company/Http/Controllers/CompanyWarehouseAssignmentController.php
deleted file mode 100644
index 194be483..00000000
--- a/Modules/Company/Http/Controllers/CompanyWarehouseAssignmentController.php
+++ /dev/null
@@ -1,25 +0,0 @@
-company_id === $company->id, 404);
-
- $data = $request->validate([
- 'division_id' => ['nullable', Rule::exists('company_divisions', 'id')->where('company_id', $company->id)],
- ]);
-
- $warehouse->update(['division_id' => $data['division_id'] ?? null]);
-
- return redirect()->route('platform.companies.show', $company)->with('status', 'Warehouse division assignment updated.');
- }
-}
diff --git a/Modules/Company/Http/Middleware/.gitkeep b/Modules/Company/Http/Middleware/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Http/Requests/.gitkeep b/Modules/Company/Http/Requests/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Models/.gitkeep b/Modules/Company/Models/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Models/CompanyAddress.php b/Modules/Company/Models/CompanyAddress.php
deleted file mode 100644
index 1345e8fe..00000000
--- a/Modules/Company/Models/CompanyAddress.php
+++ /dev/null
@@ -1,54 +0,0 @@
- 'boolean',
- 'metadata' => 'array',
- 'latitude' => 'decimal:7',
- 'longitude' => 'decimal:7',
- ];
-
- public function addressable(): MorphTo
- {
- return $this->morphTo();
- }
-
- public function country(): BelongsTo
- {
- return $this->belongsTo(Country::class);
- }
-
- public function subdivision(): BelongsTo
- {
- return $this->belongsTo(CountrySubdivision::class, 'country_subdivision_id');
- }
-
- public function getFormattedAttribute(): string
- {
- return collect([
- $this->attention,
- $this->line_1,
- $this->line_2,
- $this->line_3,
- $this->locality,
- $this->administrative_area,
- $this->postal_code,
- $this->country?->effective_name ?? $this->country?->name,
- ])->filter()->implode(', ');
- }
-}
diff --git a/Modules/Company/Models/CompanyDirectorAssignment.php b/Modules/Company/Models/CompanyDirectorAssignment.php
deleted file mode 100644
index 9c2923ea..00000000
--- a/Modules/Company/Models/CompanyDirectorAssignment.php
+++ /dev/null
@@ -1,34 +0,0 @@
- 'date',
- 'ends_at' => 'date',
- ];
-
- public function company(): BelongsTo
- {
- return $this->belongsTo(Company::class);
- }
-
- public function division(): BelongsTo
- {
- return $this->belongsTo(CompanyDivision::class, 'company_division_id');
- }
-
- public function user(): BelongsTo
- {
- return $this->belongsTo(User::class);
- }
-}
diff --git a/Modules/Company/Models/CompanyDivision.php b/Modules/Company/Models/CompanyDivision.php
deleted file mode 100644
index 20ea2f29..00000000
--- a/Modules/Company/Models/CompanyDivision.php
+++ /dev/null
@@ -1,62 +0,0 @@
- 'array',
- ];
-
- protected static function booted(): void
- {
- static::creating(function (CompanyDivision $division): void {
- $division->uuid ??= (string) Str::uuid();
- $division->slug ??= Str::slug($division->name);
- $division->status ??= 'active';
- });
- }
-
- public function company(): BelongsTo
- {
- return $this->belongsTo(Company::class);
- }
-
- public function address(): MorphOne
- {
- return $this->morphOne(CompanyAddress::class, 'addressable');
- }
-
- public function users(): BelongsToMany
- {
- return $this->belongsToMany(User::class, 'company_division_user')
- ->withPivot(['company_id', 'role', 'is_director'])
- ->withTimestamps();
- }
-
- public function warehouses(): HasMany
- {
- return $this->hasMany(Warehouse::class, 'division_id');
- }
-
- public function directorAssignments(): HasMany
- {
- return $this->hasMany(CompanyDirectorAssignment::class, 'company_division_id');
- }
-}
diff --git a/Modules/Company/Providers/.gitkeep b/Modules/Company/Providers/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Providers/CompanyServiceProvider.php b/Modules/Company/Providers/CompanyServiceProvider.php
deleted file mode 100644
index 49f68ce4..00000000
--- a/Modules/Company/Providers/CompanyServiceProvider.php
+++ /dev/null
@@ -1,155 +0,0 @@
-registerTranslations();
- $this->registerConfig();
- $this->registerViews();
- $this->registerHelpers();
- $this->registerCommands();
- $this->loadMigrationsFrom(module_path(ModuleInfo::name(), 'Database/Migrations'));
- }
-
- /**
- * Register the service provider.
- *
- * @return void
- */
- public function register(): void
- {
- $this->app->register(RouteServiceProvider::class);
- }
-
- /**
- * Register the helpers.
- *
- * @return void
- */
- protected function registerHelpers(): void
- {
- foreach (glob(__DIR__.'/../Helpers/*.php') as $filename) {
- require_once $filename;
- }
- }
-
- /**
- * Dynamically Register Commands.
- *
- * @return void
- */
- public function registerCommands(): void
- {
- if (!$this->app->runningInConsole()) {
- return;
- }
- $commandPath = __DIR__ . '/../Console';
- $commands = collect(File::allFiles($commandPath))
- ->map(function ($file) {
- $class = 'Modules\\' . $this->moduleName . '\\Console\\' . $file->getFilenameWithoutExtension();
- return $class;
- })
- ->filter(function ($class) {
- return class_exists($class);
- })
- ->values()
- ->all();
- $this->commands($commands);
- }
-
- /**
- * Register config.
- *
- * @return void
- */
- protected function registerConfig(): void
- {
- $this->publishes([
- module_path(ModuleInfo::name(), 'Config/config.php') => config_path( ModuleInfo::nameLower(). '.php'),
- ], 'config');
- $this->mergeConfigFrom(
- module_path(ModuleInfo::name(), 'Config/config.php'), ModuleInfo::nameLower()
- );
- }
-
- /**
- * Register views.
- *
- * @return void
- */
- public function registerViews(): void
- {
- $viewPath = resource_path('views/modules/' . ModuleInfo::nameLower());
- $sourcePath = module_path(ModuleInfo::name(), 'Resources/views');
- $this->publishes([
- $sourcePath => $viewPath
- ], ['views', ModuleInfo::nameLower() . '-module-views']);
- $this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), ModuleInfo::nameLower());
- }
-
- /**
- * Register translations.
- *
- * @return void
- */
- public function registerTranslations(): void
- {
- $langPath = resource_path('lang/modules/' . ModuleInfo::nameLower());
-
- if (is_dir($langPath)) {
- $this->loadTranslationsFrom($langPath, ModuleInfo::nameLower());
- } else {
- $this->loadTranslationsFrom(module_path(ModuleInfo::name(), 'Resources/lang'), ModuleInfo::nameLower());
- }
- }
-
- /**
- * Regsiter View Paths
- * @return array
- */
- private function getPublishableViewPaths(): array
- {
- $paths = [];
- foreach (Config::get('view.paths') as $path) {
- if (is_dir($path . '/modules/' . ModuleInfo::nameLower())) {
- $paths[] = $path . '/modules/' . ModuleInfo::nameLower();
- }
- }
- return $paths;
- }
-}
diff --git a/Modules/Company/Providers/RouteServiceProvider.php b/Modules/Company/Providers/RouteServiceProvider.php
deleted file mode 100644
index 8d38c074..00000000
--- a/Modules/Company/Providers/RouteServiceProvider.php
+++ /dev/null
@@ -1,70 +0,0 @@
-mapApiRoutes();
-
- $this->mapWebRoutes();
- }
-
- /**
- * Define the "web" routes for the application.
- *
- * These routes all receive session state, CSRF protection, etc.
- *
- * @return void
- */
- protected function mapWebRoutes()
- {
- Route::middleware('web')
- ->namespace($this->moduleNamespace)
- ->group(module_path('Company', '/Routes/web.php'));
- }
-
- /**
- * Define the "api" routes for the application.
- *
- * These routes are typically stateless.
- *
- * @return void
- */
- protected function mapApiRoutes()
- {
- Route::prefix('api')
- ->middleware('api')
- ->namespace($this->moduleNamespace)
- ->group(module_path('Company', '/Routes/api.php'));
- }
-}
diff --git a/Modules/Company/Resources/assets/.gitkeep b/Modules/Company/Resources/assets/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Resources/assets/js/app.js b/Modules/Company/Resources/assets/js/app.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Resources/assets/sass/app.scss b/Modules/Company/Resources/assets/sass/app.scss
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Resources/lang/.gitkeep b/Modules/Company/Resources/lang/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Resources/views/.gitkeep b/Modules/Company/Resources/views/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Modules/Company/Resources/views/_form.blade.php b/Modules/Company/Resources/views/_form.blade.php
index 340639fe..e044d2d7 100644
--- a/Modules/Company/Resources/views/_form.blade.php
+++ b/Modules/Company/Resources/views/_form.blade.php
@@ -1,13 +1,13 @@
@csrf
-
+
@error('name')
@@ -23,7 +23,7 @@
name="billing_email"
value="{{ old('billing_email', $company->billing_email) }}"
placeholder="billing@example.com"
- class="mt-2 h-12 w-full rounded-xl border-zinc-300 bg-white px-4 text-sm text-zinc-900 shadow-sm outline-none transition focus:border-blue-500 focus:ring-2 focus:ring-blue-500/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white"
+ class="mt-2 w-full rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white"
>
@error('billing_email')
{{ $message }}
@@ -35,7 +35,7 @@
-
+
@@ -73,189 +69,15 @@
-
-
-