settings updates
This commit is contained in:
@@ -81,12 +81,12 @@ final class KanbanBoard extends Component
|
||||
Auth::user(),
|
||||
);
|
||||
|
||||
$message = 'Ticket '.$freshTicket->reference.' moved from '.$oldStatusName.' to '.$status->name.'.';
|
||||
$message = 'Ticket ' . $freshTicket->reference . ' moved from ' . $oldStatusName . ' to ' . $status->name . '.';
|
||||
session()->flash('success', $message);
|
||||
|
||||
$this->refreshBoard();
|
||||
$this->dispatch('helpdesk-kanban-moved', ticketId: (int) $freshTicket->id, statusId: (int) $freshTicket->status_id);
|
||||
$this->dispatch('thredary:toast', type: 'success', title: 'Ticket moved', message: $message);
|
||||
$this->dispatch('helpdesk:toast', type: 'success', title: 'Ticket moved', message: $message);
|
||||
} finally {
|
||||
$this->isMovingTicket = false;
|
||||
}
|
||||
@@ -124,12 +124,12 @@ final class KanbanBoard extends Component
|
||||
$fresh = $ticket->fresh(['status', 'priority', 'category', 'project', 'team', 'board']) ?? $ticket;
|
||||
$workflow->dispatch($fresh, 'ticket.updated', Auth::user());
|
||||
|
||||
$message = 'Ticket '.$fresh->reference.' moved from '.$oldBoardName.' to '.$board->name.'.';
|
||||
$message = 'Ticket ' . $fresh->reference . ' moved from ' . $oldBoardName . ' to ' . $board->name . '.';
|
||||
session()->flash('success', $message);
|
||||
|
||||
$this->refreshBoard();
|
||||
$this->dispatch('helpdesk-kanban-moved', ticketId: (int) $fresh->id, statusId: (int) $fresh->status_id);
|
||||
$this->dispatch('thredary:toast', type: 'success', title: 'Board changed', message: $message);
|
||||
$this->dispatch('helpdesk:toast', type: 'success', title: 'Board changed', message: $message);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,7 +234,7 @@ final class KanbanBoard extends Component
|
||||
/**
|
||||
* Resolve the selected board from an already-loaded board collection.
|
||||
*
|
||||
* @param Collection<int, KanbanBoardModel> $boards
|
||||
* @param Collection<int, KanbanBoardModel> $boards
|
||||
*/
|
||||
private function resolveSelectedBoard(Collection $boards): ?KanbanBoardModel
|
||||
{
|
||||
|
||||
@@ -16,9 +16,16 @@ final class TicketPolicy
|
||||
|
||||
public function view(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return $this->isPrivileged($user)
|
||||
|| ($user->isHelpdeskAgent() && ((int) $ticket->agent_id === (int) $user->id || (int) $ticket->user_id === (int) $user->id))
|
||||
|| (int) $ticket->user_id === (int) $user->id;
|
||||
if ($this->isHelpdeskAdmin($user)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->isHelpdeskAgent($user)) {
|
||||
return (int) $ticket->agent_id === (int) $user->id
|
||||
|| (int) $ticket->user_id === (int) $user->id;
|
||||
}
|
||||
|
||||
return (int) $ticket->user_id === (int) $user->id;
|
||||
}
|
||||
|
||||
public function create(User $user): bool
|
||||
@@ -26,10 +33,29 @@ final class TicketPolicy
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helpdesk workflow updates.
|
||||
*
|
||||
* Admins can update every Helpdesk ticket.
|
||||
*
|
||||
* Agents can update any ticket that is visible to them under the Helpdesk
|
||||
* visibility rules. This is important for Kanban drag/drop: a card must
|
||||
* never be displayed as movable and then fail authorization on drop.
|
||||
*
|
||||
* Normal requesters cannot change workflow/status/assignment data.
|
||||
*/
|
||||
public function update(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return $this->isPrivileged($user)
|
||||
|| ($user->isHelpdeskAgent() && (int) $ticket->agent_id === (int) $user->id);
|
||||
if ($this->isHelpdeskAdmin($user)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (! $this->isHelpdeskAgent($user)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (int) $ticket->agent_id === (int) $user->id
|
||||
|| (int) $ticket->user_id === (int) $user->id;
|
||||
}
|
||||
|
||||
public function comment(User $user, Ticket $ticket): bool
|
||||
@@ -39,11 +65,36 @@ final class TicketPolicy
|
||||
|
||||
public function delete(User $user, Ticket $ticket): bool
|
||||
{
|
||||
return $this->isPrivileged($user);
|
||||
return $this->isHelpdeskAdmin($user);
|
||||
}
|
||||
|
||||
private function isPrivileged(User $user): bool
|
||||
private function isHelpdeskAdmin(User $user): bool
|
||||
{
|
||||
return $user->isHelpdeskAdmin();
|
||||
if (method_exists($user, 'isHelpdeskAdmin')) {
|
||||
return $user->isHelpdeskAdmin();
|
||||
}
|
||||
|
||||
if ((bool) ($user->helpdesk_admin ?? false)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (method_exists($user, 'isAdmin')) {
|
||||
return $user->isAdmin();
|
||||
}
|
||||
|
||||
if (method_exists($user, 'isMpbaPlatformAdmin')) {
|
||||
return $user->isMpbaPlatformAdmin();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isHelpdeskAgent(User $user): bool
|
||||
{
|
||||
if (method_exists($user, 'isHelpdeskAgent')) {
|
||||
return $user->isHelpdeskAgent();
|
||||
}
|
||||
|
||||
return (bool) ($user->helpdesk_agent ?? false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,31 +13,6 @@
|
||||
@theme {
|
||||
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif,
|
||||
'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
||||
|
||||
--color-zinc-50: #fafafa;
|
||||
--color-zinc-100: #f5f5f5;
|
||||
--color-zinc-200: #e5e5e5;
|
||||
--color-zinc-300: #d4d4d4;
|
||||
--color-zinc-400: #a3a3a3;
|
||||
--color-zinc-500: #737373;
|
||||
--color-zinc-600: #525252;
|
||||
--color-zinc-700: #404040;
|
||||
--color-zinc-800: #262626;
|
||||
--color-zinc-900: #171717;
|
||||
--color-zinc-950: #0a0a0a;
|
||||
|
||||
/* Keep Flux controls on the same Helpdesk/Core blue accent. */
|
||||
--color-accent: #2563eb;
|
||||
--color-accent-content: #1d4ed8;
|
||||
--color-accent-foreground: #ffffff;
|
||||
}
|
||||
|
||||
@layer theme {
|
||||
.dark {
|
||||
--color-accent: #60a5fa;
|
||||
--color-accent-content: #93c5fd;
|
||||
--color-accent-foreground: #172554;
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -49,17 +24,3 @@
|
||||
border-color: var(--color-gray-200, currentColor);
|
||||
}
|
||||
}
|
||||
|
||||
[data-flux-field]:not(ui-radio, ui-checkbox) {
|
||||
@apply grid gap-2;
|
||||
}
|
||||
|
||||
[data-flux-label] {
|
||||
@apply !mb-0 !leading-tight;
|
||||
}
|
||||
|
||||
input:focus[data-flux-control],
|
||||
textarea:focus[data-flux-control],
|
||||
select:focus[data-flux-control] {
|
||||
@apply outline-hidden ring-2 ring-accent ring-offset-2 ring-offset-accent-foreground;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,184 +1,223 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="dark">
|
||||
<head>
|
||||
@include('partials.head')
|
||||
</head>
|
||||
<head>
|
||||
@include('partials.head')
|
||||
</head>
|
||||
|
||||
<body class="min-h-screen bg-white dark:bg-zinc-800">
|
||||
<flux:sidebar
|
||||
sticky
|
||||
collapsible="mobile"
|
||||
class="hd-sidebar border-e border-zinc-200 bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900"
|
||||
>
|
||||
<flux:sidebar.header>
|
||||
<x-app-logo
|
||||
:sidebar="true"
|
||||
href="{{ route('dashboard') }}"
|
||||
wire:navigate
|
||||
/>
|
||||
<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');
|
||||
|
||||
<flux:sidebar.collapse class="lg:hidden" />
|
||||
</flux:sidebar.header>
|
||||
$helpdeskSettingsRoute = Route::has('helpdesk.settings')
|
||||
? 'helpdesk.settings'
|
||||
: (Route::has('helpdesk.settings.index')
|
||||
? 'helpdesk.settings.index'
|
||||
: null);
|
||||
|
||||
<flux:sidebar.nav>
|
||||
<flux:sidebar.group :heading="__('Platform')" class="grid">
|
||||
<flux:sidebar.item
|
||||
icon="home"
|
||||
:href="route('dashboard')"
|
||||
:current="request()->routeIs('dashboard')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Dashboard') }}
|
||||
</flux:sidebar.item>
|
||||
</flux:sidebar.group>
|
||||
$helpdeskActive = request()->routeIs('helpdesk.*');
|
||||
@endphp
|
||||
|
||||
<flux:sidebar.group :heading="__('Helpdesk')" class="grid">
|
||||
<flux:sidebar.item
|
||||
icon="inbox"
|
||||
:href="route('helpdesk.tickets.index')"
|
||||
:current="request()->routeIs('helpdesk.tickets.*')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Tickets') }}
|
||||
</flux:sidebar.item>
|
||||
|
||||
<flux:sidebar.item
|
||||
icon="squares-2x2"
|
||||
:href="route('helpdesk.kanban')"
|
||||
:current="request()->routeIs('helpdesk.kanban')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Kanban') }}
|
||||
</flux:sidebar.item>
|
||||
|
||||
<flux:sidebar.item
|
||||
icon="lifebuoy"
|
||||
:href="route('helpdesk.index')"
|
||||
:current="request()->routeIs('helpdesk.index')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Support') }}
|
||||
</flux:sidebar.item>
|
||||
|
||||
@if (auth()->user()->isHelpdeskAdmin())
|
||||
<flux:sidebar.item
|
||||
icon="cog"
|
||||
:href="route('helpdesk.settings')"
|
||||
:current="request()->routeIs('helpdesk.settings')"
|
||||
<flux:sidebar
|
||||
sticky
|
||||
collapsible="mobile"
|
||||
class="hd-sidebar border-e border-zinc-200 bg-zinc-50 dark:border-zinc-700 dark:bg-zinc-900"
|
||||
>
|
||||
<flux:sidebar.header>
|
||||
<x-app-logo
|
||||
:sidebar="true"
|
||||
href="{{ route('dashboard') }}"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Settings') }}
|
||||
</flux:sidebar.item>
|
||||
@endif
|
||||
</flux:sidebar.group>
|
||||
</flux:sidebar.nav>
|
||||
/>
|
||||
|
||||
<flux:spacer />
|
||||
<flux:sidebar.collapse class="lg:hidden" />
|
||||
</flux:sidebar.header>
|
||||
|
||||
<x-desktop-user-menu
|
||||
class="hidden lg:block"
|
||||
:name="auth()->user()->name"
|
||||
/>
|
||||
</flux:sidebar>
|
||||
|
||||
<flux:header class="lg:hidden">
|
||||
<flux:sidebar.toggle
|
||||
class="lg:hidden"
|
||||
icon="bars-2"
|
||||
inset="left"
|
||||
/>
|
||||
|
||||
<flux:spacer />
|
||||
|
||||
<flux:dropdown position="top" align="end">
|
||||
<flux:profile
|
||||
:initials="auth()->user()->initials()"
|
||||
icon-trailing="chevron-down"
|
||||
/>
|
||||
|
||||
<flux:menu>
|
||||
<flux:menu.radio.group>
|
||||
<div class="p-0 text-sm font-normal">
|
||||
<div class="flex items-center gap-2 px-1 py-1.5 text-start text-sm">
|
||||
<flux:avatar
|
||||
:name="auth()->user()->name"
|
||||
:initials="auth()->user()->initials()"
|
||||
/>
|
||||
|
||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||
<flux:heading class="truncate">
|
||||
{{ auth()->user()->name }}
|
||||
</flux:heading>
|
||||
|
||||
<flux:text class="truncate">
|
||||
{{ auth()->user()->email }}
|
||||
</flux:text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</flux:menu.radio.group>
|
||||
|
||||
<flux:menu.separator />
|
||||
|
||||
<flux:menu.radio.group>
|
||||
<flux:menu.item
|
||||
:href="route('helpdesk.index')"
|
||||
icon="lifebuoy"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Support') }}
|
||||
</flux:menu.item>
|
||||
|
||||
@if (auth()->user()->isHelpdeskAdmin())
|
||||
<flux:menu.item
|
||||
:href="route('helpdesk.settings')"
|
||||
icon="cog"
|
||||
<flux:sidebar.nav>
|
||||
<flux:sidebar.group :heading="__('Platform')" class="grid">
|
||||
<flux:sidebar.item
|
||||
icon="home"
|
||||
:href="route('dashboard')"
|
||||
:current="request()->routeIs('dashboard')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Helpdesk Settings') }}
|
||||
</flux:menu.item>
|
||||
{{ __('Dashboard') }}
|
||||
</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
|
||||
|
||||
<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')"
|
||||
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
|
||||
</flux:sidebar.nav>
|
||||
|
||||
<flux:menu.item
|
||||
:href="route('profile.edit')"
|
||||
icon="user-circle"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Profile Settings') }}
|
||||
</flux:menu.item>
|
||||
</flux:menu.radio.group>
|
||||
<flux:spacer />
|
||||
|
||||
<flux:menu.separator />
|
||||
<x-desktop-user-menu
|
||||
class="hidden lg:block"
|
||||
:name="auth()->user()->name"
|
||||
/>
|
||||
</flux:sidebar>
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('logout') }}"
|
||||
class="w-full"
|
||||
>
|
||||
@csrf
|
||||
<!-- Mobile User Menu -->
|
||||
<flux:header class="lg:hidden">
|
||||
<flux:sidebar.toggle
|
||||
class="lg:hidden"
|
||||
icon="bars-2"
|
||||
inset="left"
|
||||
/>
|
||||
|
||||
<flux:menu.item
|
||||
as="button"
|
||||
type="submit"
|
||||
icon="arrow-right-start-on-rectangle"
|
||||
class="w-full cursor-pointer"
|
||||
data-test="logout-button"
|
||||
>
|
||||
{{ __('Log out') }}
|
||||
</flux:menu.item>
|
||||
</form>
|
||||
</flux:menu>
|
||||
</flux:dropdown>
|
||||
</flux:header>
|
||||
<flux:spacer />
|
||||
|
||||
{{ $slot }}
|
||||
<flux:dropdown position="top" align="end">
|
||||
<flux:profile
|
||||
:initials="auth()->user()->initials()"
|
||||
icon-trailing="chevron-down"
|
||||
/>
|
||||
|
||||
@persist('toast')
|
||||
<flux:toast.group>
|
||||
<flux:toast />
|
||||
</flux:toast.group>
|
||||
@endpersist
|
||||
<flux:menu>
|
||||
<flux:menu.radio.group>
|
||||
<div class="p-0 text-sm font-normal">
|
||||
<div class="flex items-center gap-2 px-1 py-1.5 text-start text-sm">
|
||||
<flux:avatar
|
||||
:name="auth()->user()->name"
|
||||
:initials="auth()->user()->initials()"
|
||||
/>
|
||||
|
||||
@fluxScripts
|
||||
</body>
|
||||
<div class="grid flex-1 text-start text-sm leading-tight">
|
||||
<flux:heading class="truncate">
|
||||
{{ auth()->user()->name }}
|
||||
</flux:heading>
|
||||
|
||||
<flux:text class="truncate">
|
||||
{{ auth()->user()->email }}
|
||||
</flux:text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</flux:menu.radio.group>
|
||||
|
||||
<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)"
|
||||
icon="cog"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Helpdesk Settings') }}
|
||||
</flux:menu.item>
|
||||
@endif
|
||||
|
||||
@if (Route::has('profile.edit'))
|
||||
<flux:menu.item
|
||||
:href="route('profile.edit')"
|
||||
icon="user-circle"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Profile') }}
|
||||
</flux:menu.item>
|
||||
@endif
|
||||
</flux:menu.radio.group>
|
||||
|
||||
<flux:menu.separator />
|
||||
|
||||
<form
|
||||
method="POST"
|
||||
action="{{ route('logout') }}"
|
||||
class="w-full"
|
||||
>
|
||||
@csrf
|
||||
|
||||
<flux:menu.item
|
||||
as="button"
|
||||
type="submit"
|
||||
icon="arrow-right-start-on-rectangle"
|
||||
class="w-full cursor-pointer"
|
||||
data-test="logout-button"
|
||||
>
|
||||
{{ __('Log out') }}
|
||||
</flux:menu.item>
|
||||
</form>
|
||||
</flux:menu>
|
||||
</flux:dropdown>
|
||||
</flux:header>
|
||||
|
||||
{{ $slot }}
|
||||
|
||||
@persist('toast')
|
||||
<flux:toast.group>
|
||||
<flux:toast />
|
||||
</flux:toast.group>
|
||||
@endpersist
|
||||
|
||||
@fluxScripts
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,172 +1,347 @@
|
||||
<div class="hd-helpdesk-surface space-y-6" wire:key="helpdesk-kanban-{{ $refreshNonce }}">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-end lg:justify-between">
|
||||
<div>
|
||||
<flux:heading size="xl">{{ __('Helpdesk Kanban') }}</flux:heading>
|
||||
<flux:text class="mt-1">
|
||||
{{ __('Move tickets through the workflow for the selected board.') }}
|
||||
</flux:text>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-end gap-3">
|
||||
@if ($boards->isNotEmpty())
|
||||
<div class="min-w-64">
|
||||
<flux:select
|
||||
wire:model.live="board_id"
|
||||
:label="__('Board')"
|
||||
>
|
||||
@foreach ($boards as $boardOption)
|
||||
<option value="{{ $boardOption->id }}">
|
||||
{{ $boardOption->name }}
|
||||
@if ($boardOption->is_default)
|
||||
— {{ __('Default') }}
|
||||
@endif
|
||||
</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
<div class="hd-helpdesk-surface mx-auto max-w-[1800px] space-y-6" dusk="helpdesk-kanban-board"
|
||||
wire:poll.visible.5s="refreshBoard" wire:key="helpdesk-kanban-root">
|
||||
<div
|
||||
class="overflow-hidden rounded-3xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="bg-gradient-to-br from-slate-950 via-slate-900 to-blue-950 px-6 py-7 text-white">
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<p class="text-xs font-semibold uppercase tracking-[0.28em] text-blue-200">Helpdesk workflow</p>
|
||||
<h1 class="mt-2 text-3xl font-semibold tracking-tight">Kanban board</h1>
|
||||
<p class="mt-2 max-w-3xl text-sm text-blue-100/90">Drag tickets between board columns. Boards and
|
||||
columns are configured in Helpdesk Settings.</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<flux:button
|
||||
:href="route('helpdesk.tickets.index')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Ticket list') }}
|
||||
</flux:button>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<a href="{{ route('helpdesk.index') }}" wire:navigate class="hd-btn hd-btn-blue">
|
||||
<i class="fa-solid fa-gauge-high" aria-hidden="true"></i>
|
||||
<span>Dashboard</span>
|
||||
</a>
|
||||
|
||||
<flux:button
|
||||
variant="primary"
|
||||
:href="route('helpdesk.tickets.create')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('New ticket') }}
|
||||
</flux:button>
|
||||
<a href="{{ route('helpdesk.tickets.create') }}" wire:navigate class="hd-btn hd-btn-green">
|
||||
<i class="fa-solid fa-plus" aria-hidden="true"></i>
|
||||
<span>New Ticket</span>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('helpdesk.settings') }}" wire:navigate class="hd-btn hd-btn-amber">
|
||||
<i class="fa-solid fa-gear" aria-hidden="true"></i>
|
||||
<span>Configure boards</span>
|
||||
</a>
|
||||
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="hd-btn hd-btn-blue">
|
||||
<i class="fa-solid fa-list" aria-hidden="true"></i>
|
||||
<span>List view</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (session('success'))
|
||||
<div class="rounded-xl border border-emerald-300 bg-emerald-50 px-4 py-3 text-sm font-medium text-emerald-800 dark:border-emerald-800 dark:bg-emerald-950/40 dark:text-emerald-200">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($board === null)
|
||||
<div class="rounded-2xl border border-dashed border-zinc-300 bg-white p-10 text-center dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<flux:heading size="lg">{{ __('No Kanban board configured') }}</flux:heading>
|
||||
<flux:text class="mt-2">
|
||||
{{ __('Create a board in Helpdesk settings before using Kanban.') }}
|
||||
</flux:text>
|
||||
|
||||
<flux:button
|
||||
class="mt-5"
|
||||
variant="primary"
|
||||
:href="route('helpdesk.settings')"
|
||||
wire:navigate
|
||||
>
|
||||
{{ __('Open settings') }}
|
||||
</flux:button>
|
||||
@if ($boards->isEmpty())
|
||||
<div
|
||||
class="rounded-2xl border border-amber-300 bg-amber-50 px-5 py-4 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-100">
|
||||
No Kanban boards exist yet. Open Helpdesk Settings and create a board with at least one status column.
|
||||
</div>
|
||||
@else
|
||||
<div class="flex gap-4 overflow-x-auto pb-4">
|
||||
@foreach ($statuses as $status)
|
||||
@php
|
||||
$statusTickets = collect($ticketsByStatus[$status->id] ?? []);
|
||||
@endphp
|
||||
<div
|
||||
class="flex flex-col gap-4 rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm dark:border-zinc-700 dark:bg-zinc-900 md:flex-row md:items-center md:justify-between">
|
||||
<div class="min-w-0">
|
||||
<h2 class="text-sm font-semibold text-zinc-900 dark:text-zinc-100">Active board: {{ $board?->name ?? 'None' }}</h2>
|
||||
<p class="text-xs text-zinc-500 dark:text-zinc-400">
|
||||
{{ $board?->description ?: 'Use settings to configure which statuses appear as draggable columns.' }}
|
||||
</p>
|
||||
@if ($board?->owner)
|
||||
<p class="mt-1 text-xs font-semibold text-emerald-600 dark:text-emerald-300">Owner:
|
||||
{{ $board->owner->name }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<section
|
||||
class="w-[22rem] min-w-[22rem] rounded-2xl border border-zinc-200 bg-zinc-100/70 p-3 dark:border-zinc-700 dark:bg-zinc-900"
|
||||
wire:key="kanban-status-{{ $status->id }}-{{ $refreshNonce }}"
|
||||
<div class="hd-select-wrap shrink-0 md:w-72">
|
||||
<select
|
||||
class="hd-select"
|
||||
aria-label="Select Kanban board"
|
||||
onchange="window.location.href = '{{ route('helpdesk.kanban') }}?board_id=' + encodeURIComponent(this.value)"
|
||||
>
|
||||
<header class="mb-3 flex items-center justify-between gap-3 px-1">
|
||||
<div class="min-w-0">
|
||||
<flux:heading size="sm" class="truncate">
|
||||
{{ $status->name }}
|
||||
</flux:heading>
|
||||
</div>
|
||||
|
||||
<span class="inline-flex min-w-7 items-center justify-center rounded-full bg-white px-2 py-1 text-xs font-semibold text-zinc-600 shadow-sm dark:bg-zinc-800 dark:text-zinc-300">
|
||||
{{ $statusTickets->count() }}
|
||||
</span>
|
||||
</header>
|
||||
|
||||
<div class="space-y-3">
|
||||
@forelse ($statusTickets as $ticket)
|
||||
<article
|
||||
class="rounded-xl border border-zinc-200 bg-white p-4 shadow-sm transition hover:shadow-md dark:border-zinc-700 dark:bg-zinc-800"
|
||||
wire:key="kanban-ticket-{{ $ticket->id }}-{{ $ticket->status_id }}"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<a
|
||||
href="{{ route('helpdesk.tickets.show', $ticket) }}"
|
||||
wire:navigate
|
||||
class="text-xs font-semibold text-blue-600 hover:underline dark:text-blue-400"
|
||||
>
|
||||
{{ $ticket->reference }}
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="{{ route('helpdesk.tickets.show', $ticket) }}"
|
||||
wire:navigate
|
||||
class="mt-1 block font-semibold leading-snug text-zinc-900 hover:underline dark:text-zinc-100"
|
||||
>
|
||||
{{ $ticket->subject }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@if ($ticket->priority)
|
||||
<span class="shrink-0 rounded-full bg-zinc-100 px-2 py-1 text-[11px] font-semibold text-zinc-600 dark:bg-zinc-700 dark:text-zinc-200">
|
||||
{{ $ticket->priority->name }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3 space-y-1 text-xs text-zinc-500 dark:text-zinc-400">
|
||||
@if ($ticket->agent)
|
||||
<div>{{ __('Agent') }}: {{ $ticket->agent->name }}</div>
|
||||
@endif
|
||||
|
||||
@if ($ticket->category)
|
||||
<div>{{ __('Category') }}: {{ $ticket->category->name }}</div>
|
||||
@endif
|
||||
|
||||
@if ($ticket->project)
|
||||
<div>{{ __('Project') }}: {{ $ticket->project->name ?? $ticket->project->title ?? '—' }}</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@can('update', $ticket)
|
||||
<div class="mt-4">
|
||||
<label class="mb-1 block text-xs font-semibold text-zinc-500 dark:text-zinc-400">
|
||||
{{ __('Move to') }}
|
||||
</label>
|
||||
|
||||
<select
|
||||
class="hd-select !min-h-0 !rounded-lg !px-3 !py-2 text-sm"
|
||||
wire:change="moveTicket({{ $ticket->id }}, $event.target.value)"
|
||||
wire:loading.attr="disabled"
|
||||
wire:target="moveTicket"
|
||||
>
|
||||
<option value="{{ $status->id }}">{{ $status->name }}</option>
|
||||
|
||||
@foreach ($statuses as $targetStatus)
|
||||
@if ($targetStatus->id !== $status->id)
|
||||
<option value="{{ $targetStatus->id }}">
|
||||
{{ $targetStatus->name }}
|
||||
</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endcan
|
||||
</article>
|
||||
@empty
|
||||
<div class="rounded-xl border border-dashed border-zinc-300 bg-white/70 px-4 py-8 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-800/40 dark:text-zinc-400">
|
||||
{{ __('No tickets') }}
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
@endforeach
|
||||
@foreach ($boards as $availableBoard)
|
||||
<option value="{{ $availableBoard->id }}" @selected((int) $board_id === (int) $availableBoard->id)>
|
||||
{{ $availableBoard->name }}{{ $availableBoard->owner ? ' · ' . $availableBoard->owner->name : '' }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if ($statuses->isEmpty())
|
||||
<div
|
||||
class="rounded-2xl border border-amber-500/40 bg-amber-950/70 px-5 py-4 text-sm font-semibold text-amber-100">
|
||||
This board is being initialised with the default workflow statuses. Refresh the page if the columns do
|
||||
not appear immediately.
|
||||
</div>
|
||||
@else
|
||||
<div class="flex gap-4 overflow-x-auto pb-4" data-helpdesk-kanban-board
|
||||
wire:key="helpdesk-kanban-columns-{{ $board?->id ?? 0 }}-{{ $refreshNonce }}">
|
||||
@foreach ($statuses as $status)
|
||||
@php($tickets = $ticketsByStatus[$status->id] ?? collect())
|
||||
|
||||
<section
|
||||
class="flex min-h-[640px] w-[330px] shrink-0 flex-col overflow-hidden rounded-2xl border border-zinc-200 bg-zinc-100 shadow-sm dark:border-zinc-700 dark:bg-zinc-950"
|
||||
dusk="kanban-column-{{ $status->slug }}"
|
||||
wire:key="kanban-column-{{ $board?->id ?? 0 }}-{{ $status->id }}-{{ $refreshNonce }}">
|
||||
<header
|
||||
class="border-b border-zinc-200 bg-white px-4 py-4 dark:border-zinc-800 dark:bg-zinc-900">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div>
|
||||
<h2
|
||||
class="text-sm font-bold uppercase tracking-wide text-zinc-900 dark:text-zinc-100">
|
||||
{{ $status->name }}</h2>
|
||||
<p class="mt-1 text-xs text-zinc-500"><span data-helpdesk-kanban-count
|
||||
data-status-id="{{ $status->id }}">{{ $tickets->count() }}</span>
|
||||
tickets</p>
|
||||
</div>
|
||||
<span class="inline-flex h-4 w-4 rounded-full ring-4 ring-zinc-100 dark:ring-zinc-800"
|
||||
style="background-color: {{ \Modules\Helpdesk\Support\Color::css($status->color) }}"></span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="helpdesk-kanban-column-{{ $status->id }}"
|
||||
class="helpdesk-kanban-column min-h-[560px] flex-1 space-y-3 p-3 transition data-[drag-over=true]:bg-blue-50 dark:data-[drag-over=true]:bg-blue-950/30"
|
||||
data-helpdesk-kanban-column data-status-id="{{ $status->id }}"
|
||||
wire:key="kanban-dropzone-{{ $board?->id ?? 0 }}-{{ $status->id }}-{{ $refreshNonce }}">
|
||||
@forelse ($tickets as $ticket)
|
||||
<article
|
||||
class="group cursor-grab rounded-2xl border border-zinc-200 bg-white p-4 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md active:cursor-grabbing dark:border-zinc-800 dark:bg-zinc-900"
|
||||
draggable="true" data-helpdesk-kanban-ticket data-ticket-id="{{ $ticket->id }}"
|
||||
wire:key="kanban-ticket-{{ $ticket->id }}-{{ $ticket->status_id }}-{{ $ticket->board_id }}-{{ optional($ticket->updated_at)->timestamp }}"
|
||||
dusk="kanban-ticket-{{ $ticket->id }}">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<div
|
||||
class="font-mono text-xs font-semibold text-blue-700 dark:text-blue-300">
|
||||
{{ $ticket->reference }}</div>
|
||||
<h3
|
||||
class="mt-1 line-clamp-3 text-sm font-semibold leading-5 text-zinc-900 dark:text-zinc-100">
|
||||
{{ $ticket->subject }}</h3>
|
||||
</div>
|
||||
|
||||
@if ($ticket->priority)
|
||||
<span class="shrink-0 rounded-full px-2 py-1 text-xs font-bold text-white"
|
||||
style="background-color: {{ \Modules\Helpdesk\Support\Color::css($ticket->priority->color) }}">
|
||||
{{ $ticket->priority->name }}
|
||||
</span>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="mt-3 space-y-1.5 text-xs text-zinc-500 dark:text-zinc-400">
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-user w-3"
|
||||
aria-hidden="true"></i> {{ $ticket->owner?->name ?? 'Unknown' }}</div>
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-user-gear w-3"
|
||||
aria-hidden="true"></i> {{ $ticket->agent?->name ?? 'Unassigned' }}
|
||||
</div>
|
||||
@if ($ticket->project)
|
||||
<div class="flex items-center gap-2"><i
|
||||
class="fa-solid fa-diagram-project w-3" aria-hidden="true"></i>
|
||||
{{ $ticket->project->title }}</div>
|
||||
@endif
|
||||
@if ($ticket->team)
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-users w-3"
|
||||
aria-hidden="true"></i> {{ $ticket->team->name }}</div>
|
||||
@endif
|
||||
@if ($ticket->product)
|
||||
<div class="flex items-center gap-2"><i class="fa-solid fa-box w-3"
|
||||
aria-hidden="true"></i> {{ $ticket->product->name }}</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
||||
<form method="POST" action="{{ route('helpdesk.tickets.board.update', $ticket) }}"
|
||||
class="mt-3 rounded-xl border border-emerald-500/20 bg-emerald-950/20 p-2"
|
||||
onclick="event.stopPropagation()"
|
||||
onmousedown="event.stopPropagation()"
|
||||
ondragstart="event.preventDefault(); event.stopPropagation();">
|
||||
@csrf
|
||||
<input type="hidden" name="return_to_board_id" value="{{ $board?->id }}">
|
||||
<label
|
||||
class="mb-1 block text-[11px] font-bold uppercase tracking-wide text-emerald-200/80">Board</label>
|
||||
<div class="hd-ticket-board-select-wrap">
|
||||
<select name="board_id"
|
||||
class="hd-ticket-board-select"
|
||||
draggable="false"
|
||||
onchange="this.form.requestSubmit ? this.form.requestSubmit() : this.form.submit()"
|
||||
onclick="event.stopPropagation()"
|
||||
onmousedown="event.stopPropagation()"
|
||||
aria-label="Move {{ $ticket->reference }} to another board">
|
||||
@foreach ($boards as $ticketBoard)
|
||||
<option value="{{ $ticketBoard->id }}"
|
||||
@selected((int) $ticket->board_id === (int) $ticketBoard->id)>{{ $ticketBoard->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
@if ($ticket->tags->isNotEmpty())
|
||||
<div class="mt-3 flex flex-wrap gap-1">
|
||||
@foreach ($ticket->tags as $tag)
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 text-[11px] font-semibold text-white"
|
||||
style="background-color: {{ \Modules\Helpdesk\Support\Color::css($tag->color) }}">{{ $tag->name }}</span>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if ($ticket->checklistItems->isNotEmpty())
|
||||
@php($done = $ticket->checklistItems->where('is_completed', true)->count())
|
||||
<div class="mt-3 text-xs text-zinc-500">Checklist
|
||||
{{ $done }}/{{ $ticket->checklistItems->count() }}</div>
|
||||
@endif
|
||||
|
||||
@if ($ticket->sla_first_response_breached || $ticket->sla_resolution_breached)
|
||||
<div
|
||||
class="mt-3 rounded-lg border border-red-300 bg-red-50 px-3 py-2 text-xs font-semibold text-red-800 dark:border-red-900 dark:bg-red-950 dark:text-red-100">
|
||||
SLA breach</div>
|
||||
@endif
|
||||
|
||||
<div
|
||||
class="mt-4 flex items-center justify-between gap-2 border-t border-zinc-100 pt-3 dark:border-zinc-800">
|
||||
<a href="{{ route('helpdesk.tickets.show', $ticket) }}" wire:navigate
|
||||
class="rounded-lg bg-blue-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-blue-700">Open</a>
|
||||
@can('update', $ticket)
|
||||
<a href="{{ route('helpdesk.tickets.edit', $ticket) }}" wire:navigate
|
||||
class="rounded-lg bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-700">Edit</a>
|
||||
@endcan
|
||||
</div>
|
||||
</article>
|
||||
@empty
|
||||
<div
|
||||
class="rounded-2xl border border-dashed border-zinc-300 bg-white p-6 text-center text-sm text-zinc-500 dark:border-zinc-700 dark:bg-zinc-900">
|
||||
Drop tickets here for {{ $status->name }}.
|
||||
</div>
|
||||
@endforelse
|
||||
</div>
|
||||
</section>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
|
||||
@script
|
||||
<script>
|
||||
const initialiseHelpdeskKanban = function() {
|
||||
let draggedTicketId = null;
|
||||
let draggedCard = null;
|
||||
|
||||
const updateColumnCounts = function() {
|
||||
document.querySelectorAll('[data-helpdesk-kanban-count]').forEach(function(counter) {
|
||||
const statusId = counter.dataset.statusId;
|
||||
const column = document.querySelector('[data-helpdesk-kanban-column][data-status-id="' +
|
||||
statusId + '"]');
|
||||
|
||||
if (!column) {
|
||||
return;
|
||||
}
|
||||
|
||||
counter.textContent = column.querySelectorAll('[data-helpdesk-kanban-ticket]').length
|
||||
.toString();
|
||||
});
|
||||
};
|
||||
|
||||
const forceLivewireRefresh = function() {
|
||||
if (typeof $wire !== 'undefined' && typeof $wire.$refresh === 'function') {
|
||||
return Promise.resolve($wire.$refresh());
|
||||
}
|
||||
|
||||
if (typeof Livewire !== 'undefined' && typeof Livewire.find === 'function') {
|
||||
const root = document.querySelector('[wire\\:id]');
|
||||
const component = root ? Livewire.find(root.getAttribute('wire:id')) : null;
|
||||
|
||||
if (component && typeof component.$refresh === 'function') {
|
||||
return Promise.resolve(component.$refresh());
|
||||
}
|
||||
}
|
||||
|
||||
window.location.reload();
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
document.querySelectorAll('[data-helpdesk-kanban-ticket]').forEach(function(card) {
|
||||
if (card.dataset.nativeDragReady === '1') return;
|
||||
card.dataset.nativeDragReady = '1';
|
||||
|
||||
card.addEventListener('dragstart', function(event) {
|
||||
draggedTicketId = card.dataset.ticketId;
|
||||
draggedCard = card;
|
||||
event.dataTransfer.effectAllowed = 'move';
|
||||
event.dataTransfer.setData('text/plain', draggedTicketId);
|
||||
event.dataTransfer.setData('application/x-helpdesk-ticket-id', draggedTicketId);
|
||||
card.classList.add('opacity-60');
|
||||
});
|
||||
|
||||
card.addEventListener('dragend', function() {
|
||||
card.classList.remove('opacity-60');
|
||||
document.querySelectorAll('[data-helpdesk-kanban-column]').forEach(function(
|
||||
column) {
|
||||
column.dataset.dragOver = 'false';
|
||||
column.dataset.refreshing = 'false';
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelectorAll('[data-helpdesk-kanban-column]').forEach(function(column) {
|
||||
if (column.dataset.nativeDropReady === '1') return;
|
||||
column.dataset.nativeDropReady = '1';
|
||||
|
||||
column.addEventListener('dragover', function(event) {
|
||||
event.preventDefault();
|
||||
event.dataTransfer.dropEffect = 'move';
|
||||
column.dataset.dragOver = 'true';
|
||||
});
|
||||
|
||||
column.addEventListener('dragleave', function(event) {
|
||||
if (!column.contains(event.relatedTarget)) {
|
||||
column.dataset.dragOver = 'false';
|
||||
}
|
||||
});
|
||||
|
||||
column.addEventListener('drop', function(event) {
|
||||
event.preventDefault();
|
||||
column.dataset.dragOver = 'false';
|
||||
|
||||
const ticketId = event.dataTransfer.getData('application/x-helpdesk-ticket-id') ||
|
||||
event.dataTransfer.getData('text/plain') || draggedTicketId;
|
||||
const statusId = column.dataset.statusId;
|
||||
const card = draggedCard || document.querySelector(
|
||||
'[data-helpdesk-kanban-ticket][data-ticket-id="' + ticketId + '"]');
|
||||
|
||||
if (!ticketId || !statusId || !card) return;
|
||||
|
||||
column.dataset.refreshing = 'true';
|
||||
column.appendChild(card);
|
||||
updateColumnCounts();
|
||||
|
||||
Promise.resolve($wire.moveTicket(ticketId, statusId))
|
||||
.then(forceLivewireRefresh)
|
||||
.finally(function() {
|
||||
column.dataset.refreshing = 'false';
|
||||
draggedTicketId = null;
|
||||
draggedCard = null;
|
||||
updateColumnCounts();
|
||||
setTimeout(initialiseHelpdeskKanban, 50);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
updateColumnCounts();
|
||||
};
|
||||
|
||||
initialiseHelpdeskKanban();
|
||||
document.addEventListener('livewire:navigated', initialiseHelpdeskKanban);
|
||||
document.addEventListener('livewire:updated', initialiseHelpdeskKanban);
|
||||
document.addEventListener('helpdesk-kanban-moved', function() {
|
||||
setTimeout(function() {
|
||||
initialiseHelpdeskKanban();
|
||||
|
||||
if (typeof $wire !== 'undefined' && typeof $wire.$refresh === 'function') {
|
||||
$wire.$refresh();
|
||||
}
|
||||
}, 50);
|
||||
});
|
||||
</script>
|
||||
@endscript
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user