standard colours

This commit is contained in:
Mark Gregory
2026-06-23 15:32:05 +01:00
parent 3be4ff590f
commit a8cbb8e2ac
19 changed files with 330 additions and 56 deletions
@@ -0,0 +1,10 @@
@props([
'color' => 'gray',
])
<span
{{ $attributes->class('inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold text-white shadow-sm ring-1 ring-white/20') }}
style="background-color: {{ \Modules\Helpdesk\Support\Color::css($color) }};"
>
{{ $slot }}
</span>
@@ -0,0 +1,34 @@
@props([
'label' => 'Badge colour',
'model',
'options' => [],
])
<div {{ $attributes->class('space-y-2') }}>
<label class="block text-sm font-semibold text-zinc-700 dark:text-zinc-200">
{{ $label }}
</label>
<select
wire:model="{{ $model }}"
class="block h-10 w-full rounded-xl border border-zinc-300 bg-white px-3 text-sm font-semibold text-zinc-900 shadow-sm outline-none transition-colors duration-150 focus:border-blue-500 focus:ring-2 focus:ring-blue-500/30 dark:border-zinc-700 dark:bg-zinc-950 dark:text-zinc-100"
>
@foreach ($options as $key => $option)
<option value="{{ $key }}" style="color: {{ $option['hex'] }};">
● {{ $option['name'] }} — {{ $option['hex'] }}
</option>
@endforeach
</select>
<div class="flex flex-wrap gap-1.5" aria-label="Available Helpdesk colours">
@foreach ($options as $key => $option)
<span
title="{{ $option['name'] }} {{ $option['hex'] }}"
class="inline-flex h-5 min-w-5 items-center justify-center rounded-full border border-white/70 shadow-sm ring-1 ring-zinc-900/10"
style="background-color: {{ $option['hex'] }}"
>
<span class="sr-only">{{ $option['name'] }}</span>
</span>
@endforeach
</div>
</div>
@@ -17,7 +17,10 @@
<td class="px-4 py-3 font-medium text-zinc-900 dark:text-zinc-100">{{ $item->name }}</td>
<td class="px-4 py-3 font-mono text-xs text-zinc-500">{{ $item->slug }}</td>
<td class="px-4 py-3">
<flux:badge color="{{ $item->color }}">{{ $item->color }}</flux:badge>
<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>
{{ \Illuminate\Support\Str::of(\Modules\Helpdesk\Support\Color::normalise($item->color))->headline() }}
</span>
</td>
<td class="px-4 py-3">
<flux:badge color="{{ $item->is_default ?? false ? 'emerald' : 'zinc' }}">
@@ -6,6 +6,7 @@
<th class="px-4 py-3">Project</th>
<th class="px-4 py-3">Company</th>
<th class="px-4 py-3">Team</th>
<th class="px-4 py-3">Colour</th>
<th class="px-4 py-3">Default</th>
<th class="px-4 py-3">Tickets</th>
<th class="px-4 py-3 text-right">Actions</th>
@@ -17,6 +18,12 @@
<td class="px-4 py-3 font-medium text-zinc-900 dark:text-zinc-100">{{ $item->title }}</td>
<td class="px-4 py-3 text-zinc-500">{{ $item->company?->name ?? 'Global' }}</td>
<td class="px-4 py-3 text-zinc-500">{{ $item->team?->name ?? 'No team' }}</td>
<td class="px-4 py-3">
<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>
{{ \Illuminate\Support\Str::of(\Modules\Helpdesk\Support\Color::normalise($item->color))->headline() }}
</span>
</td>
<td class="px-4 py-3">
<flux:badge color="{{ $item->is_default ?? false ? 'emerald' : 'zinc' }}">
{{ $item->is_default ?? false ? 'Default' : 'No' }}</flux:badge>
@@ -32,7 +39,7 @@
</tr>
@empty
<tr>
<td colspan="6" class="px-4 py-10 text-center text-zinc-500">No projects yet.</td>
<td colspan="7" class="px-4 py-10 text-center text-zinc-500">No projects yet.</td>
</tr>
@endforelse
</tbody>
@@ -5,6 +5,7 @@
<tr>
<th class="px-4 py-3">Team</th>
<th class="px-4 py-3">Company</th>
<th class="px-4 py-3">Colour</th>
<th class="px-4 py-3">Default</th>
<th class="px-4 py-3">Tickets</th>
<th class="px-4 py-3 text-right">Actions</th>
@@ -15,6 +16,12 @@
<tr>
<td class="px-4 py-3 font-medium text-zinc-900 dark:text-zinc-100">{{ $item->name }}</td>
<td class="px-4 py-3 text-zinc-500">{{ $item->company?->name ?? 'Global' }}</td>
<td class="px-4 py-3">
<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>
{{ \Illuminate\Support\Str::of(\Modules\Helpdesk\Support\Color::normalise($item->color))->headline() }}
</span>
</td>
<td class="px-4 py-3">
<flux:badge color="{{ $item->is_default ?? false ? 'emerald' : 'zinc' }}">
{{ $item->is_default ?? false ? 'Default' : 'No' }}</flux:badge>
@@ -30,7 +37,7 @@
</tr>
@empty
<tr>
<td colspan="5" class="px-4 py-10 text-center text-zinc-500">No teams yet.</td>
<td colspan="6" class="px-4 py-10 text-center text-zinc-500">No teams yet.</td>
</tr>
@endforelse
</tbody>
@@ -95,8 +95,9 @@
<div class="flex items-center justify-between gap-3">
<span
class="truncate text-sm font-medium text-zinc-900 dark:text-zinc-100">{{ $ticket->subject }}</span>
<flux:badge color="{{ $ticket->priority->color }}" size="sm">
{{ $ticket->priority->name }}</flux:badge>
<x-helpdesk::colour-badge :color="$ticket->priority->color">
{{ $ticket->priority->name }}
</x-helpdesk::colour-badge>
</div>
<div class="mt-1 text-xs text-zinc-500">{{ $ticket->reference }} · {{ $ticket->status->name }}
</div>
@@ -143,7 +143,7 @@
<form wire:submit.prevent="saveStatus" class="grid gap-4 md:grid-cols-5">
<flux:input wire:model="statusForm.name" label="Name" />
<flux:input wire:model="statusForm.slug" label="Slug" placeholder="auto-generated" />
<flux:input wire:model="statusForm.color" label="Badge colour" />
<x-helpdesk::colour-select model="statusForm.color" label="Badge colour" :options="$colourOptions" />
<flux:input wire:model="statusForm.sort_order" label="Sort" type="number" min="0" />
<label class="flex items-end gap-2 pb-2 text-sm text-zinc-700 dark:text-zinc-200"><input
type="checkbox" wire:model="statusForm.is_closed" class="rounded border-zinc-300"> Closed
@@ -174,7 +174,7 @@
<form wire:submit.prevent="savePriority" class="grid gap-4 md:grid-cols-4">
<flux:input wire:model="priorityForm.name" label="Name" />
<flux:input wire:model="priorityForm.slug" label="Slug" placeholder="auto-generated" />
<flux:input wire:model="priorityForm.color" label="Badge colour" />
<x-helpdesk::colour-select model="priorityForm.color" label="Badge colour" :options="$colourOptions" />
<flux:input wire:model="priorityForm.sort_order" label="Sort" type="number" min="0" />
<label class="flex items-end gap-2 pb-2 text-sm font-semibold text-zinc-700 dark:text-zinc-200">
<input type="checkbox" wire:model="priorityForm.is_default"
@@ -208,7 +208,7 @@
</flux:select>
<flux:input wire:model="categoryForm.name" label="Name" />
<flux:input wire:model="categoryForm.slug" label="Slug" placeholder="auto-generated" />
<flux:input wire:model="categoryForm.color" label="Badge colour" />
<x-helpdesk::colour-select model="categoryForm.color" label="Badge colour" :options="$colourOptions" />
<div class="md:col-span-4">
<flux:textarea wire:model="categoryForm.description" label="Description" rows="3" />
</div>
@@ -245,7 +245,7 @@
</flux:select>
<flux:input wire:model="teamForm.name" label="Name" />
<flux:input wire:model="teamForm.slug" label="Slug" placeholder="auto-generated" />
<flux:input wire:model="teamForm.color" label="Badge colour" />
<x-helpdesk::colour-select model="teamForm.color" label="Badge colour" :options="$colourOptions" />
<div class="md:col-span-4">
<flux:textarea wire:model="teamForm.description" label="Description" rows="3" />
</div>
@@ -288,7 +288,7 @@
</flux:select>
<flux:input wire:model="projectForm.title" label="Title" />
<flux:input wire:model="projectForm.slug" label="Slug" placeholder="auto-generated" />
<flux:input wire:model="projectForm.color" label="Badge colour" />
<x-helpdesk::colour-select model="projectForm.color" label="Badge colour" :options="$colourOptions" />
<div class="md:col-span-5">
<flux:textarea wire:model="projectForm.description" label="Description" rows="3" />
</div>
@@ -868,7 +868,7 @@
<form wire:submit.prevent="saveTag" class="grid gap-4 md:grid-cols-5">
<flux:input wire:model="tagForm.name" label="Name" />
<flux:input wire:model="tagForm.slug" label="Slug" />
<flux:input wire:model="tagForm.color" label="Colour" />
<x-helpdesk::colour-select model="tagForm.color" label="Colour" :options="$colourOptions" />
<div class="md:col-span-5 flex gap-2">
<flux:button type="submit" variant="primary"
class="!bg-green-600 !text-white hover:!bg-green-700 focus:!ring-green-400/60">Save tag
@@ -92,12 +92,10 @@
</div>
</td>
<td class="px-4 py-3">
<flux:badge color="{{ $ticket->status->color }}">{{ $ticket->status->name }}
</flux:badge>
<x-helpdesk::colour-badge :color="$ticket->status->color">{{ $ticket->status->name }}</x-helpdesk::colour-badge>
</td>
<td class="px-4 py-3">
<flux:badge color="{{ $ticket->priority->color }}">{{ $ticket->priority->name }}
</flux:badge>
<x-helpdesk::colour-badge :color="$ticket->priority->color">{{ $ticket->priority->name }}</x-helpdesk::colour-badge>
</td>
<td class="px-4 py-3 text-zinc-600 dark:text-zinc-300">
{{ $ticket->agent?->name ?? 'Unassigned' }}</td>
@@ -23,8 +23,8 @@
<div class="min-w-0">
<div class="mb-2 flex flex-wrap items-center gap-2">
<span class="font-mono text-xs text-blue-100">{{ $ticket->reference }}</span>
<flux:badge color="{{ $ticket->status->color }}">{{ $ticket->status->name }}</flux:badge>
<flux:badge color="{{ $ticket->priority->color }}">{{ $ticket->priority->name }}</flux:badge>
<x-helpdesk::colour-badge :color="$ticket->status->color">{{ $ticket->status->name }}</x-helpdesk::colour-badge>
<x-helpdesk::colour-badge :color="$ticket->priority->color">{{ $ticket->priority->name }}</x-helpdesk::colour-badge>
</div>
<h1 class="truncate text-2xl font-semibold tracking-tight">{{ $ticket->subject }}</h1>