new helpdesk module
This commit is contained in:
@@ -1,70 +1,176 @@
|
||||
<div class="mx-auto max-w-5xl space-y-6" dusk="helpdesk-ticket-create">
|
||||
<div>
|
||||
<h1 class="text-2xl font-semibold tracking-tight text-zinc-900 dark:text-white">Create ticket</h1>
|
||||
<p class="text-sm text-zinc-500 dark:text-zinc-400">Raise a support request with optional attachments.</p>
|
||||
</div>
|
||||
<div>
|
||||
@include('helpdesk::partials.page-header', [
|
||||
'title' => 'Create Ticket',
|
||||
'subtitle' => 'Raise a new support request with priority, project, category and full details.',
|
||||
])
|
||||
|
||||
<form wire:submit="save" class="rounded-2xl border border-zinc-200 bg-white p-6 shadow-sm dark:border-zinc-700 dark:bg-zinc-900">
|
||||
<div class="grid gap-6 md:grid-cols-3">
|
||||
<div class="space-y-6 md:col-span-2">
|
||||
<flux:input wire:model="subject" label="Subject" placeholder="Short summary" required />
|
||||
<flux:textarea wire:model="body" label="Details" rows="10" placeholder="What happened? What did you expect? Include steps to reproduce where useful." required />
|
||||
<form wire:submit.prevent="save" class="space-y-6">
|
||||
<div class="rounded-2xl border border-slate-200 bg-white shadow-sm">
|
||||
<div class="border-b border-slate-200 px-6 py-4">
|
||||
<h2 class="text-lg font-semibold text-slate-900">Ticket details</h2>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-6 p-6 lg:grid-cols-2">
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-slate-700" for="title">
|
||||
Title
|
||||
</label>
|
||||
|
||||
<input
|
||||
id="title"
|
||||
type="text"
|
||||
wire:model.defer="title"
|
||||
class="mt-2 block w-full rounded-xl border-slate-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
|
||||
@error('title')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="space-y-6">
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-slate-700" for="priority_id">
|
||||
Priority
|
||||
</label>
|
||||
|
||||
<flux:select wire:model="company_id" label="Company">
|
||||
<option value="">Default company</option>
|
||||
@foreach ($companies as $company)
|
||||
<option value="{{ $company->id }}">{{ $company->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
|
||||
<flux:select wire:model="team_id" label="Team">
|
||||
<option value="">No team</option>
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
|
||||
<flux:select wire:model="priority_id" label="Priority" required>
|
||||
<select
|
||||
id="priority_id"
|
||||
wire:model.defer="priority_id"
|
||||
class="mt-2 block w-full rounded-xl border-slate-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Select priority</option>
|
||||
|
||||
@foreach ($priorities as $priority)
|
||||
<option value="{{ $priority->id }}">{{ $priority->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</select>
|
||||
|
||||
<flux:select wire:model="category_id" label="Category">
|
||||
@error('priority_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-slate-700" for="category_id">
|
||||
Category
|
||||
</label>
|
||||
|
||||
<select
|
||||
id="category_id"
|
||||
wire:model.defer="category_id"
|
||||
class="mt-2 block w-full rounded-xl border-slate-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Select category</option>
|
||||
|
||||
@foreach ($categories as $category)
|
||||
<option value="{{ $category->id }}">{{ $category->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</select>
|
||||
|
||||
@error('category_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-slate-700" for="project_id">
|
||||
Project
|
||||
</label>
|
||||
|
||||
<select
|
||||
id="project_id"
|
||||
wire:model.defer="project_id"
|
||||
class="mt-2 block w-full rounded-xl border-slate-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Select project</option>
|
||||
|
||||
<flux:select wire:model="project_id" label="Project">
|
||||
<option value="">No project</option>
|
||||
@foreach ($projects as $project)
|
||||
<option value="{{ $project->id }}">{{ $project->title }}</option>
|
||||
<option value="{{ $project->id }}">{{ $project->name }}</option>
|
||||
@endforeach
|
||||
</flux:select>
|
||||
</select>
|
||||
|
||||
<flux:input wire:model="due_at" type="date" label="Due date" />
|
||||
@error('project_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="mb-2 block text-sm font-medium text-zinc-700 dark:text-zinc-200">Attachments</label>
|
||||
<input wire:model="attachments" type="file" multiple class="block w-full rounded-lg border border-zinc-300 bg-white p-2 text-sm dark:border-zinc-700 dark:bg-zinc-950" />
|
||||
<div class="mt-2 text-xs text-zinc-500">Allowed: {{ implode(', ', config('helpdesk.allowed_mimes')) }}. Max {{ config('helpdesk.max_upload_kb') }}KB each.</div>
|
||||
@error('attachments.*') <div class="mt-2 text-sm text-red-600">{{ $message }}</div> @enderror
|
||||
<div>
|
||||
<label class="block text-sm font-semibold text-slate-700" for="team_id">
|
||||
Team
|
||||
</label>
|
||||
|
||||
<select
|
||||
id="team_id"
|
||||
wire:model.defer="team_id"
|
||||
class="mt-2 block w-full rounded-xl border-slate-300 shadow-sm focus:border-blue-500 focus:ring-blue-500"
|
||||
>
|
||||
<option value="">Select team</option>
|
||||
|
||||
@foreach ($teams as $team)
|
||||
<option value="{{ $team->id }}">{{ $team->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@error('team_id')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
<div class="lg:col-span-2">
|
||||
<label class="block text-sm font-semibold text-slate-700" for="details_editor">
|
||||
Details
|
||||
</label>
|
||||
|
||||
<div wire:ignore class="mt-2">
|
||||
<textarea id="details_editor">{{ $details }}</textarea>
|
||||
</div>
|
||||
|
||||
@error('details')
|
||||
<p class="mt-2 text-sm text-red-600">{{ $message }}</p>
|
||||
@enderror
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex items-center justify-end gap-3 border-t border-zinc-200 pt-6 dark:border-zinc-700">
|
||||
<flux:button :href="route('helpdesk.tickets.index')" wire:navigate variant="ghost">Cancel</flux:button>
|
||||
<flux:button type="submit" variant="primary" icon="paper-airplane" wire:loading.attr="disabled">
|
||||
<span wire:loading.remove>Create ticket</span>
|
||||
<span wire:loading>Creating...</span>
|
||||
</flux:button>
|
||||
<div class="flex items-center justify-end gap-3 border-t border-slate-200 px-6 py-4">
|
||||
<a
|
||||
href="{{ route('helpdesk.tickets.index') }}"
|
||||
class="rounded-xl border border-slate-300 px-4 py-2 text-sm font-semibold text-slate-700 hover:bg-slate-50"
|
||||
>
|
||||
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"
|
||||
>
|
||||
Create Ticket
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@push('scripts')
|
||||
<script>
|
||||
document.addEventListener('livewire:init', function () {
|
||||
const textarea = document.getElementById('details_editor');
|
||||
|
||||
if (!textarea || textarea.dataset.initialised === '1') {
|
||||
return;
|
||||
}
|
||||
|
||||
textarea.dataset.initialised = '1';
|
||||
|
||||
const editor = new EasyMDE({
|
||||
element: textarea,
|
||||
spellChecker: false,
|
||||
status: false,
|
||||
forceSync: true
|
||||
});
|
||||
|
||||
editor.codemirror.on('change', function () {
|
||||
@this.set('details', editor.value(), false);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
Reference in New Issue
Block a user