feat: add companies as top-level container for projects with departments

- Company → Project → (Locations + Departments) hierarchy
- Company CRUD (add, edit, delete) with AJAX
- Projects are created under a company via inline strip
- Two-column project body: Locations | Departments
- Stats show companies, projects, locations, departments, active projects
- Dynamic stat counters update on add/delete without page reload

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
ghassanandClaude Sonnet 4.6 committed 2026-05-26 18:05:04 +03:00
1 parent 60d57af630
commit a425e12349
6 files changed
+518 -264

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
<?php
namespace App\Models\Settings;
use Illuminate\Database\Eloquent\Model;
class Company extends Model
{
protected $table = 'settings_companies';
protected $fillable = ['name', 'is_active'];
protected $casts = ['is_active' => 'boolean'];
public function projects(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(ProjectSetting::class, 'company_id');
}
}
+6 -1
View File
@@ -8,7 +8,7 @@ class ProjectSetting extends Model
{
protected $table = 'settings_projects';
protected $fillable = ['name', 'is_active'];
protected $fillable = ['name', 'is_active', 'company_id'];
protected $casts = ['is_active' => 'boolean'];
@@ -17,6 +17,11 @@ class ProjectSetting extends Model
return $query->where('is_active', true);
}
public function company(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Company::class, 'company_id');
}
public function locations(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(\App\Models\Settings\Location::class, 'project_id');