settings updates, fixed

This commit is contained in:
Mark Gregory
2026-08-25 22:30:59 +01:00
parent 1cad54ce42
commit d359ac29b6
13 changed files with 61 additions and 815 deletions
@@ -4,7 +4,6 @@
class="bg-zinc-50 text-left text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:bg-zinc-800 dark:text-zinc-300">
<tr>
<th class="px-3 py-2.5">Project</th>
<th class="px-3 py-2.5">Company</th>
<th class="px-3 py-2.5">Team</th>
<th class="px-3 py-2.5">Colour</th>
<th class="px-3 py-2.5">Default</th>
@@ -16,7 +15,6 @@
@forelse ($items as $item)
<tr>
<td class="px-3 py-2.5 font-medium text-zinc-900 dark:text-zinc-100">{{ $item->title }}</td>
<td class="px-3 py-2.5 text-zinc-500">{{ $item->company?->name ?? 'Global' }}</td>
<td class="px-3 py-2.5 text-zinc-500">{{ $item->team?->name ?? 'No team' }}</td>
<td class="px-3 py-2.5">
<span class="inline-flex items-center gap-2 rounded-full border border-zinc-200 bg-white px-2.5 py-1 text-xs font-semibold text-zinc-700 shadow-sm dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-200">
@@ -4,7 +4,6 @@
class="bg-zinc-50 text-left text-xs font-semibold uppercase tracking-wide text-zinc-500 dark:bg-zinc-800 dark:text-zinc-300">
<tr>
<th class="px-3 py-2.5">Team</th>
<th class="px-3 py-2.5">Company</th>
<th class="px-3 py-2.5">Colour</th>
<th class="px-3 py-2.5">Default</th>
<th class="px-3 py-2.5">Tickets</th>
@@ -15,7 +14,6 @@
@forelse ($items as $item)
<tr>
<td class="px-3 py-2.5 font-medium text-zinc-900 dark:text-zinc-100">{{ $item->name }}</td>
<td class="px-3 py-2.5 text-zinc-500">{{ $item->company?->name ?? 'Global' }}</td>
<td class="px-3 py-2.5">
<span class="inline-flex items-center gap-2 rounded-full border border-zinc-200 bg-white px-2.5 py-1 text-xs font-semibold text-zinc-700 shadow-sm dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-200">
<span class="h-3 w-3 rounded-full" style="background-color: {{ \Modules\Helpdesk\Support\Color::css($item->color) }}"></span>
@@ -6,19 +6,11 @@
<body class="min-h-screen bg-white dark:bg-zinc-800">
@php
/*
* Match the Core WMS support navigation strategy:
* detect routes rather than hiding navigation behind role checks.
*/
$helpdeskEnabled = Route::has('helpdesk.index') || Route::has('helpdesk.tickets.index');
$helpdeskSettingsRoute = Route::has('helpdesk.settings')
? 'helpdesk.settings'
: (Route::has('helpdesk.settings.index')
? 'helpdesk.settings.index'
: null);
$helpdeskActive = request()->routeIs('helpdesk.*');
@endphp
<flux:sidebar
@@ -48,63 +40,40 @@
</flux:sidebar.item>
</flux:sidebar.group>
@if ($helpdeskEnabled)
<div class="hd-support-group">
{{-- Core WMS uses Support as the selected parent group. --}}
@if (Route::has('helpdesk.index'))
<flux:sidebar.item
icon="lifebuoy"
:href="route('helpdesk.index')"
class="hd-support-parent {{ $helpdeskActive ? 'is-section-active' : '' }}"
wire:navigate
>
{{ __('Support') }}
</flux:sidebar.item>
@else
<div class="hd-support-parent is-section-active">
<span class="hd-support-parent-label">{{ __('Support') }}</span>
</div>
@endif
<flux:sidebar.group :heading="__('Helpdesk')" class="grid">
@if (Route::has('helpdesk.tickets.index'))
<flux:sidebar.item
icon="inbox"
:href="route('helpdesk.tickets.index')"
:current="request()->routeIs('helpdesk.tickets.*')"
wire:navigate
>
{{ __('Tickets') }}
</flux:sidebar.item>
@endif
<div class="hd-support-children">
@if (Route::has('helpdesk.tickets.index'))
<flux:sidebar.item
icon="inbox"
:href="route('helpdesk.tickets.index')"
:current="request()->routeIs('helpdesk.tickets.*')"
class="hd-support-child"
wire:navigate
>
{{ __('Tickets') }}
</flux:sidebar.item>
@endif
@if (Route::has('helpdesk.kanban'))
<flux:sidebar.item
icon="squares-2x2"
:href="route('helpdesk.kanban')"
:current="request()->routeIs('helpdesk.kanban')"
wire:navigate
>
{{ __('Kanban') }}
</flux:sidebar.item>
@endif
@if (Route::has('helpdesk.kanban'))
<flux:sidebar.item
icon="squares-2x2"
:href="route('helpdesk.kanban')"
:current="request()->routeIs('helpdesk.kanban')"
class="hd-support-child"
wire:navigate
>
{{ __('Kanban') }}
</flux:sidebar.item>
@endif
@if ($helpdeskSettingsRoute)
<flux:sidebar.item
icon="cog"
:href="route($helpdeskSettingsRoute)"
:current="request()->routeIs('helpdesk.settings') || request()->routeIs('helpdesk.settings.index')"
class="hd-support-child"
wire:navigate
>
{{ __('Settings') }}
</flux:sidebar.item>
@endif
</div>
</div>
@endif
@if ($helpdeskSettingsRoute)
<flux:sidebar.item
icon="cog"
:href="route($helpdeskSettingsRoute)"
:current="request()->routeIs('helpdesk.settings') || request()->routeIs('helpdesk.settings.index')"
wire:navigate
>
{{ __('Settings') }}
</flux:sidebar.item>
@endif
</flux:sidebar.group>
</flux:sidebar.nav>
<flux:spacer />
@@ -156,16 +125,6 @@
<flux:menu.separator />
<flux:menu.radio.group>
@if (Route::has('helpdesk.index'))
<flux:menu.item
:href="route('helpdesk.index')"
icon="lifebuoy"
wire:navigate
>
{{ __('Support') }}
</flux:menu.item>
@endif
@if ($helpdeskSettingsRoute)
<flux:menu.item
:href="route($helpdeskSettingsRoute)"
@@ -173,16 +173,10 @@
@if ($section === 'categories')
<x-helpdesk.settings-section title="Categories"
description="Group tickets by support area, optionally per company.">
description="Group tickets by support area.">
<x-slot:form>
<form wire:submit.prevent="saveCategory" class="grid gap-3 xl:grid-cols-12">
<div class="xl:col-span-3">
<flux:select wire:model="categoryForm.company_id" label="Company">
<option value="">Global</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</flux:select>
</div>
<div class="xl:col-span-3">
<flux:input wire:model="categoryForm.name" label="Name" />
@@ -215,16 +209,10 @@
@if ($section === 'teams')
<x-helpdesk.settings-section title="Teams"
description="Create support teams under each company and assign projects to them.">
description="Create support teams and assign projects to them.">
<x-slot:form>
<form wire:submit.prevent="saveTeam" class="grid gap-3 xl:grid-cols-12">
<div class="xl:col-span-3">
<flux:select wire:model="teamForm.company_id" label="Company">
<option value="">Global</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</flux:select>
</div>
<div class="xl:col-span-3">
<flux:input wire:model="teamForm.name" label="Name" />
@@ -257,16 +245,10 @@
@if ($section === 'projects')
<x-helpdesk.settings-section title="Projects"
description="Create company projects and optionally assign them to support teams.">
description="Create projects and optionally assign them to support teams.">
<x-slot:form>
<form wire:submit.prevent="saveProject" class="grid gap-3 xl:grid-cols-12">
<div class="xl:col-span-2">
<flux:select wire:model="projectForm.company_id" label="Company">
<option value="">Global</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</flux:select>
</div>
<div class="xl:col-span-2">
<flux:select wire:model="projectForm.team_id" label="Team">
@@ -420,12 +402,6 @@
description="Configure repositories that can be linked to projects and tickets. Commits can then be stored against tickets for traceability.">
<x-slot:form>
<form wire:submit.prevent="saveRepository" class="grid gap-3 md:grid-cols-6">
<flux:select wire:model="repositoryForm.company_id" label="Company">
<option value="">Global</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}">{{ $company->name }}</option>
@endforeach
</flux:select>
<flux:select wire:model="repositoryForm.project_id" label="Project">
<option value="">No project</option>
@foreach ($projects as $project)
@@ -439,7 +415,7 @@
<flux:input wire:model="repositoryForm.webhook_secret" label="Webhook secret" />
<div class="md:col-span-full">
<flux:input wire:model="repositoryForm.remote_url" label="Remote URL"
placeholder="git@github.com:company/repo.git" />
placeholder="git@github.com:organisation/repo.git" />
</div>
<div class="md:col-span-full flex gap-2">
<flux:button size="sm" type="submit" variant="primary"
@@ -73,30 +73,6 @@
@enderror
</div>
@if ($companies->isNotEmpty())
<div class="xl:col-span-2">
<label class="block text-sm font-semibold text-zinc-200" for="company_id">
Company <span class="helpdesk-required-star">*</span>
</label>
<div class="mt-2" wire:ignore>
<select id="company_id" dusk="ticket-company" data-helpdesk-select2 wire:model.defer="company_id" name="company_id"
data-placeholder="Select option" data-wire-model="company_id"
class="block w-full rounded-xl border-zinc-700 bg-zinc-950 text-zinc-100 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="">Select company</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}" @selected((string) $company_id === (string) $company->id)>
{{ $company->name }}</option>
@endforeach
</select>
</div>
@error('company_id')
<p class="mt-2 text-sm text-red-500">{{ $message }}</p>
@enderror
</div>
@endif
<div class="xl:col-span-2">
<label class="block text-sm font-semibold text-zinc-200" for="board_id">
Board <span class="helpdesk-required-star">*</span>
@@ -59,30 +59,6 @@
@enderror
</div>
@if ($companies->isNotEmpty())
<div class="xl:col-span-2">
<label class="block text-sm font-semibold text-zinc-200" for="company_id">
Company <span class="helpdesk-required-star">*</span>
</label>
<div class="mt-2" wire:ignore>
<select id="company_id" data-helpdesk-select2 data-placeholder="Select option"
data-wire-model="company_id"
class="block w-full rounded-xl border-zinc-700 bg-zinc-950 text-zinc-100 shadow-sm focus:border-blue-500 focus:ring-blue-500">
<option value="">Select company</option>
@foreach ($companies as $company)
<option value="{{ $company->id }}" @selected((string) $company_id === (string) $company->id)>
{{ $company->name }}</option>
@endforeach
</select>
</div>
@error('company_id')
<p class="mt-2 text-sm text-red-500">{{ $message }}</p>
@enderror
</div>
@endif
<div class="xl:col-span-2">
<label class="block text-sm font-semibold text-zinc-200" for="board_id">Board</label>
@@ -7,7 +7,7 @@
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Ticket management</p>
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Active tickets</h1>
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Search, triage and manage support requests across
companies, projects, teams, priorities and statuses.</p>
projects, teams, priorities and statuses.</p>
</div>
<div class="flex flex-wrap gap-2">
<a href="{{ route('helpdesk.index') }}" wire:navigate class="hd-btn hd-btn-blue">
@@ -9,11 +9,11 @@
use Illuminate\Support\Str;
use Modules\Helpdesk\Models\TicketTimeLog;
$currentUser = auth()->user();
$currentCompany = $currentUser?->company;
$canSeeInternalNotes =
(bool) ($currentCompany?->is_system_company ?? false) ||
Str::lower((string) ($currentCompany?->slug ?? '')) === 'mpba-limited' ||
Str::contains(Str::lower((string) ($currentCompany?->name ?? '')), 'mpba');
(bool) ($currentUser?->helpdesk_admin ?? false) ||
(bool) ($currentUser?->helpdesk_agent ?? false) ||
(method_exists($currentUser, 'isHelpdeskAdmin') && $currentUser->isHelpdeskAdmin()) ||
(method_exists($currentUser, 'isHelpdeskAgent') && $currentUser->isHelpdeskAgent());
$visibleCommentCount = $ticket->comments->count();
$ticketTimeLogs = TicketTimeLog::query()
->with('user')
@@ -1285,10 +1285,6 @@
<dt class="text-zinc-500">Email</dt>
<dd class="truncate">{{ $ticket->owner?->email ?? 'None' }}</dd>
</div>
<div class="flex justify-between gap-3">
<dt class="text-zinc-500">Company</dt>
<dd>{{ $ticket->owner?->company?->name ?? 'Current company' }}</dd>
</div>
</dl>
@if ($ticket->tags->isNotEmpty())