added countries support expanded for ISO 3166 standard merged in new support

This commit is contained in:
Mark Gregory
2026-06-15 11:00:14 +01:00
parent 4099be7770
commit 96e0d60355
10 changed files with 187 additions and 65 deletions
@@ -1,9 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use Modules\Countries\Http\Controllers\Api\CountryLookupController;
if (class_exists(CountryLookupController::class)) {
Route::get('/countries', [CountryLookupController::class, 'index'])->name('api.countries.index');
Route::get('/countries/{country:alpha2}', [CountryLookupController::class, 'show'])->name('api.countries.show');
}
+6 -5
View File
@@ -59,6 +59,7 @@ final class TicketIndex extends Component
private function tickets(): LengthAwarePaginator
{
$user = Auth::user();
$search = trim($this->search);
return Ticket::query()
->with(['owner', 'agent', 'status', 'priority', 'category', 'project', 'team'])
@@ -67,11 +68,11 @@ final class TicketIndex extends Component
->when($this->scope === 'closed', static fn (Builder $query): Builder => $query->whereNotNull('completed_at'))
->when($this->status !== '', fn (Builder $query): Builder => $query->where('status_id', (int) $this->status))
->when($this->priority !== '', fn (Builder $query): Builder => $query->where('priority_id', (int) $this->priority))
->when($this->search !== '', function (Builder $query): Builder {
return $query->where(static function (Builder $subQuery): void {
$subQuery->where('reference', 'like', '%'.$this->search.'%')
->orWhere('subject', 'like', '%'.$this->search.'%')
->orWhere('body', 'like', '%'.$this->search.'%');
->when($search !== '', static function (Builder $query) use ($search): Builder {
return $query->where(static function (Builder $subQuery) use ($search): void {
$subQuery->where('reference', 'like', '%'.$search.'%')
->orWhere('subject', 'like', '%'.$search.'%')
->orWhere('body', 'like', '%'.$search.'%');
});
})
->latest('last_activity_at')
+1 -2
View File
@@ -29,8 +29,7 @@ final class TicketPolicy
public function update(User $user, Ticket $ticket): bool
{
return $this->isPrivileged($user)
|| (int) $ticket->agent_id === (int) $user->id
|| (int) $ticket->user_id === (int) $user->id;
|| ((bool) ($user->helpdesk_agent ?? false) && (int) $ticket->agent_id === (int) $user->id);
}
public function comment(User $user, Ticket $ticket): bool
@@ -25,7 +25,7 @@
@include('helpdesk::partials.page-header', [
'eyebrow' => 'Helpdesk',
'title' => 'Create Ticket',
'title' => 'Create ticket',
'subtitle' => 'Raise a new support request with priority, project, category, team and full details.',
])
@@ -17,6 +17,7 @@ final class AgentAssignmentService
public function selectAgentId(?int $categoryId): ?int
{
$query = User::query()
->select('users.*')
->where(static function (Builder $query): void {
$query->where('helpdesk_agent', true)->orWhere('helpdesk_admin', true);
})