FIXING TICKET SAVE
This commit is contained in:
@@ -58,6 +58,8 @@ final class TicketCreate extends Component
|
||||
*/
|
||||
public function save(TicketService $tickets): mixed
|
||||
{
|
||||
$this->validate();
|
||||
|
||||
$this->validate([
|
||||
'attachments.*' => 'file|max:' . config('helpdesk.max_upload_kb') . '|mimes:' . implode(',', config('helpdesk.allowed_mimes')),
|
||||
]);
|
||||
@@ -75,9 +77,7 @@ final class TicketCreate extends Component
|
||||
|
||||
session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.');
|
||||
|
||||
return redirect()->route('helpdesk.tickets.show', [
|
||||
'ticket' => $ticket,
|
||||
]);
|
||||
return redirect()->route('helpdesk.tickets.index');
|
||||
}
|
||||
|
||||
/** @return View */
|
||||
|
||||
@@ -8,6 +8,7 @@ use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Helpdesk\Livewire\HelpdeskDashboardWidget;
|
||||
@@ -67,6 +68,13 @@ final class HelpdeskServiceProvider extends ServiceProvider
|
||||
$this->registerPolicies();
|
||||
|
||||
$this->loadMigrationsFrom(module_path(ModuleInfo::name(), 'Database/Migrations'));
|
||||
Livewire::setUpdateRoute(function ($handle) {
|
||||
|
||||
return Route::post('/livewire-cfc83872/update', $handle)
|
||||
|
||||
->middleware('web');
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<div class="space-y-6">
|
||||
@include('helpdesk::partials.page-header', [
|
||||
'eyebrow' => 'Helpdesk',
|
||||
'title' => 'Create Ticket',
|
||||
'subtitle' => 'Raise a new support request with priority, project, category and full details.',
|
||||
])
|
||||
'eyebrow' => 'Helpdesk',
|
||||
'title' => 'Create Ticket',
|
||||
'subtitle' => 'Raise a new support request with priority, project, category, team and full details.',
|
||||
])
|
||||
|
||||
<form wire:submit.prevent="save" class="space-y-6">
|
||||
<div class="rounded-2xl border border-zinc-200 bg-white shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
@@ -95,7 +95,7 @@
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 border-t border-zinc-200 px-6 py-4 dark:border-zinc-700">
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="rounded-xl border border-zinc-300 px-4 py-2 text-sm font-semibold text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800">Cancel</a>
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" class="rounded-xl border border-zinc-300 px-4 py-2 text-sm font-semibold text-zinc-700 hover:bg-zinc-50 dark:border-zinc-700 dark:text-zinc-200 dark:hover:bg-zinc-800">Cancel</a>
|
||||
<button type="submit" class="rounded-xl bg-blue-600 px-5 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-700" data-dusk="ticket-create-submit">Create Ticket</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,27 @@
|
||||
<div class="mb-8 overflow-hidden rounded-3xl border border-slate-800 bg-slate-950 shadow-sm">
|
||||
<div class="px-6 py-8 text-white">
|
||||
<p class="text-sm font-semibold uppercase tracking-[0.3em] text-blue-300">
|
||||
{{ $eyebrow ?? 'Helpdesk' }}
|
||||
</p>
|
||||
<div class="flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between">
|
||||
<div>
|
||||
<p class="text-sm font-semibold uppercase tracking-[0.3em] text-blue-300">
|
||||
{{ $eyebrow ?? 'Helpdesk' }}
|
||||
</p>
|
||||
|
||||
<h1 class="mt-3 text-3xl font-bold tracking-tight">
|
||||
{{ $title ?? 'Helpdesk' }}
|
||||
</h1>
|
||||
<h1 class="mt-3 text-3xl font-bold tracking-tight">
|
||||
{{ $title ?? 'Helpdesk' }}
|
||||
</h1>
|
||||
|
||||
@if(! empty($subtitle))
|
||||
<p class="mt-2 max-w-3xl text-sm text-slate-300">
|
||||
{{ $subtitle }}
|
||||
</p>
|
||||
@endif
|
||||
@if(! empty($subtitle))
|
||||
<p class="mt-2 max-w-3xl text-sm text-slate-300">
|
||||
{{ $subtitle }}
|
||||
</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@isset($actions)
|
||||
<div class="flex flex-wrap items-center gap-3">
|
||||
{{ $actions }}
|
||||
</div>
|
||||
@endisset
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
@php
|
||||
$helpdeskEnabled = Route::has('helpdesk.index');
|
||||
|
||||
if (class_exists(\Nwidart\Modules\Facades\Module::class)) {
|
||||
$helpdeskModule = \Nwidart\Modules\Facades\Module::find('Helpdesk');
|
||||
$helpdeskEnabled = $helpdeskModule !== null && $helpdeskModule->isEnabled() && Route::has('helpdesk.index');
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if($helpdeskEnabled)
|
||||
<div class="wms-sidebar-group">
|
||||
<div class="wms-sidebar-heading" data-wms-sidebar-label>{{ __('Support') }}</div>
|
||||
|
||||
<a href="{{ route('helpdesk.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('helpdesk.index')) is-active @endif" title="{{ __('Helpdesk') }}">
|
||||
<i class="fa-solid fa-headset wms-sidebar-icon" aria-hidden="true"></i>
|
||||
<span data-wms-sidebar-label>{{ __('Helpdesk') }}</span>
|
||||
</a>
|
||||
|
||||
@if(Route::has('helpdesk.tickets.index'))
|
||||
<a href="{{ route('helpdesk.tickets.index') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('helpdesk.tickets.*')) is-active @endif" title="{{ __('Tickets') }}">
|
||||
<i class="fa-solid fa-ticket wms-sidebar-icon" aria-hidden="true"></i>
|
||||
<span data-wms-sidebar-label>{{ __('Tickets') }}</span>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if(Route::has('helpdesk.kanban'))
|
||||
<a href="{{ route('helpdesk.kanban') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('helpdesk.kanban')) is-active @endif" title="{{ __('Kanban') }}">
|
||||
<i class="fa-solid fa-table-columns wms-sidebar-icon" aria-hidden="true"></i>
|
||||
<span data-wms-sidebar-label>{{ __('Kanban') }}</span>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
@if(Route::has('helpdesk.settings'))
|
||||
<a href="{{ route('helpdesk.settings') }}" wire:navigate class="wms-sidebar-link @if(request()->routeIs('helpdesk.settings')) is-active @endif" title="{{ __('Support Settings') }}">
|
||||
<i class="fa-solid fa-gears wms-sidebar-icon" aria-hidden="true"></i>
|
||||
<span data-wms-sidebar-label>{{ __('Support Settings') }}</span>
|
||||
</a>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
@@ -21,3 +21,10 @@ versions:
|
||||
- Rebuilt the ticket create page to use the correct subject/body Livewire properties.
|
||||
- Stabilised the rich HTML editor so typing no longer clears the field or accidentally submits the ticket form.
|
||||
- Added root layout support-menu integration instructions for enabled Helpdesk modules.
|
||||
|
||||
"1.0.4":
|
||||
changed:
|
||||
- Fixed the Helpdesk page header so dark WMS pages do not render a blank white hero.
|
||||
- Changed ticket create save to validate all fields and return to the tickets index after creation to avoid route-model redirect issues.
|
||||
- Added a root layout replacement containing the Support sidebar menu and Livewire update endpoint configuration.
|
||||
- Kept module.json version in sync with changelog.yaml.
|
||||
|
||||
@@ -13,5 +13,5 @@
|
||||
"Modules\\Helpdesk\\Providers\\HelpdeskServiceProvider"
|
||||
],
|
||||
"files": [],
|
||||
"version": "1.0.3"
|
||||
"version": "1.0.4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user