interim fix for drop downs, BROKEN FIX, interinm fix

This commit is contained in:
Mark Gregory
2026-07-07 12:20:27 +01:00
parent d2c1f744c3
commit a12372963a
6 changed files with 132 additions and 50 deletions
@@ -20,7 +20,7 @@ class CompanyController extends Controller
'companies' => Company::query() 'companies' => Company::query()
->with(['address.country', 'country']) ->with(['address.country', 'country'])
->withCount(['users', 'warehouses', 'licenseKeys', 'divisions']) ->withCount(['users', 'warehouses', 'licenseKeys', 'divisions'])
->latest('id') ->orderBy('name')
->paginate(20), ->paginate(20),
'countries' => $this->countries(), 'countries' => $this->countries(),
]); ]);
@@ -73,7 +73,7 @@ class CompanyController extends Controller
'recentUsers' => $company->users()->latest('id')->limit(5)->get(), 'recentUsers' => $company->users()->latest('id')->limit(5)->get(),
'recentWarehouses' => $company->warehouses()->latest('id')->limit(5)->get(), 'recentWarehouses' => $company->warehouses()->latest('id')->limit(5)->get(),
'recentLicenseKeys' => $company->licenseKeys()->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']), 'countries' => $this->countries(),
'companyUsers' => $company->users()->orderBy('name')->get(['id', 'name', 'email', 'company_id']), 'companyUsers' => $company->users()->orderBy('name')->get(['id', 'name', 'email', 'company_id']),
'unassignedWarehouses' => $company->warehouses()->whereNull('division_id')->orderBy('name')->get(), 'unassignedWarehouses' => $company->warehouses()->whereNull('division_id')->orderBy('name')->get(),
]); ]);
@@ -135,7 +135,7 @@ class CompanyController extends Controller
{ {
return Country::query() return Country::query()
->active() ->active()
->ordered() ->orderByRaw("LOWER(COALESCE(NULLIF(display_name, ''), NULLIF(common_name, ''), name)) ASC")
->get(['id', 'alpha2', 'name', 'display_name', 'common_name', 'sort_order']); ->get(['id', 'alpha2', 'name', 'display_name', 'common_name']);
} }
} }
@@ -0,0 +1,15 @@
<?php
namespace Modules\Company\Providers;
use Illuminate\Support\ServiceProvider;
class CompanyServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->loadRoutesFrom(__DIR__ . '/../Routes/web.php');
$this->loadViewsFrom(__DIR__ . '/../Resources/views', 'company');
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
}
}
+82 -46
View File
@@ -7,8 +7,6 @@
icon="fa-solid fa-building" icon="fa-solid fa-building"
/> />
@if (session('status')) @if (session('status'))
<div class="rounded-2xl bg-green-50 p-4 text-sm font-semibold text-green-700 ring-1 ring-green-200 dark:bg-green-950 dark:text-green-300 dark:ring-green-900"> <div class="rounded-2xl bg-green-50 p-4 text-sm font-semibold text-green-700 ring-1 ring-green-200 dark:bg-green-950 dark:text-green-300 dark:ring-green-900">
{{ session('status') }} {{ session('status') }}
@@ -30,47 +28,85 @@
</a> </a>
</div> </div>
<form method="POST" action="{{ route('platform.companies.store') }}" class="mt-5 grid gap-4 md:grid-cols-5"> <form method="POST" action="{{ route('platform.companies.store') }}" class="mt-6">
@csrf @csrf
<input <div class="grid gap-5 xl:grid-cols-[minmax(0,1.15fr)_minmax(0,1.15fr)_minmax(12rem,.75fr)_minmax(18rem,1.15fr)_auto] xl:items-end">
name="name" <div>
value="{{ old('name') }}" <label for="quick_company_name" class="block text-xs font-bold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">Company</label>
placeholder="Company name" <input
class="rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white" id="quick_company_name"
required name="name"
> value="{{ old('name') }}"
placeholder="Company name"
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"
required
>
@error('name')
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
<input <div>
name="billing_email" <label for="quick_billing_email" class="block text-xs font-bold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">Billing email</label>
value="{{ old('billing_email') }}" <input
placeholder="billing@example.com" id="quick_billing_email"
type="email" name="billing_email"
class="rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white" value="{{ old('billing_email') }}"
> placeholder="billing@example.com"
type="email"
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"
>
@error('billing_email')
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
<select name="status" class="rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white" required> <div>
<option value="active" @selected(old('status', 'active') === 'active')>Active</option> <label for="quick_status" class="block text-xs font-bold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">Status</label>
<option value="suspended" @selected(old('status') === 'suspended')>Suspended</option> <select
<option value="inactive" @selected(old('status') === 'inactive')>Inactive</option> id="quick_status"
</select> name="status"
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"
required
>
<option value="active" @selected(old('status', 'active') === 'active')>Active</option>
<option value="suspended" @selected(old('status') === 'suspended')>Suspended</option>
<option value="inactive" @selected(old('status') === 'inactive')>Inactive</option>
</select>
@error('status')
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
<div class="wms-select2-field"> <div class="wms-select2-field">
<select name="country_id" data-wms-select2 data-placeholder="Search country" class="rounded-xl border-zinc-300 dark:border-zinc-700 dark:bg-zinc-950 dark:text-white"> <label for="quick_country_id" class="block text-xs font-bold uppercase tracking-wide text-zinc-500 dark:text-zinc-400">Country</label>
<option value="">Search country</option> <select
@foreach ($countries as $country) id="quick_country_id"
<option value="{{ $country->id }}" @selected((int) old('country_id') === $country->id)> name="country_id"
{{ $country->effective_name ?? $country->name }} data-wms-select2
</option> data-placeholder="Search and select country"
@endforeach class="mt-2 w-full"
</select> >
<option value="">Search and select country</option>
@foreach ($countries as $country)
<option value="{{ $country->id }}" @selected((int) old('country_id') === $country->id)>
{{ $country->display_name ?: $country->common_name ?: $country->name }}
</option>
@endforeach
</select>
@error('country_id')
<p class="mt-1 text-sm text-red-600 dark:text-red-400">{{ $message }}</p>
@enderror
</div>
<button class="h-12 rounded-xl bg-green-600 px-6 text-sm font-bold text-white shadow-sm shadow-green-950/20 transition hover:bg-green-500 focus:outline-none focus:ring-2 focus:ring-green-500/40">
Create
</button>
</div> </div>
<button class="rounded-xl bg-zinc-900 px-4 py-2 font-semibold text-white dark:bg-white dark:text-zinc-900">
Create
</button>
</form> </form>
</div> </div>
<div class="overflow-x-auto rounded-2xl bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-900 dark:ring-zinc-800"> <div class="overflow-x-auto rounded-2xl bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-900 dark:ring-zinc-800">
<table class="min-w-full text-sm"> <table class="min-w-full text-sm">
<thead> <thead>
@@ -109,17 +145,17 @@
</td> </td>
<td class="p-4"> <td class="p-4">
<span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold <span class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold
@if ($company->is_system_company) @if ($company->is_system_company)
bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300 bg-blue-100 text-blue-700 dark:bg-blue-950 dark:text-blue-300
@elseif ($company->status === 'active') @elseif ($company->status === 'active')
bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-300 bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-300
@else @else
bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300 bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300
@endif @endif
"> ">
{{ $company->is_system_company ? 'System' : ucfirst($company->status) }} {{ $company->is_system_company ? 'System' : ucfirst($company->status) }}
</span> </span>
</td> </td>
<td class="p-4"> <td class="p-4">
+13
View File
@@ -0,0 +1,13 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Company\Http\Controllers\CompanyController;
if (! Route::has('platform.companies.index')) {
Route::middleware(['web', 'auth', 'verified', 'tenant.assigned', 'platform.admin'])
->prefix('admin')
->name('platform.')
->group(function (): void {
Route::resource('/companies', CompanyController::class);
});
}
+14
View File
@@ -0,0 +1,14 @@
{
"name": "Company",
"alias": "company",
"version": "1.0.1",
"description": "Tenant company administration module.",
"keywords": ["company", "tenant", "platform-administration"],
"priority": 0,
"providers": [
"Modules\\Company\\Providers\\CompanyServiceProvider"
],
"aliases": {},
"files": [],
"requires": []
}
+4
View File
@@ -6,6 +6,7 @@ use Modules\Platform\app\Http\Controllers\PaymentController;
use Modules\Platform\app\Http\Controllers\PlatformDashboardController; use Modules\Platform\app\Http\Controllers\PlatformDashboardController;
use Modules\Platform\app\Http\Controllers\PlatformPriceController; use Modules\Platform\app\Http\Controllers\PlatformPriceController;
use Modules\Platform\app\Http\Controllers\StripeWebhookController; use Modules\Platform\app\Http\Controllers\StripeWebhookController;
use Modules\Company\Http\Controllers\CompanyController;
Route::middleware(['auth', 'verified', 'tenant.assigned']) Route::middleware(['auth', 'verified', 'tenant.assigned'])
->prefix('platform') ->prefix('platform')
@@ -23,6 +24,9 @@ Route::middleware(['auth', 'verified', 'tenant.assigned', 'platform.admin'])
Route::post('/licenses', [LicenseKeyController::class, 'store'])->name('licenses.store'); Route::post('/licenses', [LicenseKeyController::class, 'store'])->name('licenses.store');
Route::get('/payments', [PaymentController::class, 'index'])->name('payments.index'); Route::get('/payments', [PaymentController::class, 'index'])->name('payments.index');
Route::post('/payments', [PaymentController::class, 'store'])->name('payments.store'); Route::post('/payments', [PaymentController::class, 'store'])->name('payments.store');
if (! Route::has('platform.companies.index')) {
Route::resource('/companies', CompanyController::class);
}
Route::resource('/prices', PlatformPriceController::class)->except(['show']); Route::resource('/prices', PlatformPriceController::class)->except(['show']);
}); });