diff --git a/Modules/Helpdesk/Livewire/TicketCreate.php b/Modules/Helpdesk/Livewire/TicketCreate.php index b2ddd5b3..a6467145 100644 --- a/Modules/Helpdesk/Livewire/TicketCreate.php +++ b/Modules/Helpdesk/Livewire/TicketCreate.php @@ -86,54 +86,10 @@ final class TicketCreate extends Component $this->applyDefaults(); } - public function save(TicketService $tickets) - { - logger()->info('SAVE START'); - - try { - - logger()->info('VALIDATING'); - - $this->validate(); - - logger()->info('VALIDATED'); - - logger()->info([ - 'attachments' => count($this->attachments), - 'body' => $this->body, - ]); - - $ticket = $tickets->create(Auth::user(), [ - 'company_id' => $this->company_id, - 'subject' => $this->subject, - 'body' => $this->body, - 'board_id' => $this->board_id, - 'priority_id' => $this->priority_id, - 'category_id' => $this->category_id, - 'project_id' => $this->project_id, - 'product_id' => $this->product_id, - 'team_id' => $this->team_id, - 'due_at' => $this->due_at, - 'tag_ids' => $this->tag_ids, - ], $this->attachments); - session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.'); - - logger()->info('CREATED '.$ticket->id); - - return redirect()->route('helpdesk.tickets.index'); - - } catch (\Throwable $e) { - - logger()->error($e); - - throw $e; - } - } - /** * Store a new helpdesk ticket. */ - public function save_old(TicketService $tickets) + public function save(TicketService $tickets) { if ($this->isSaving) { return null; @@ -159,7 +115,9 @@ final class TicketCreate extends Component 'due_at' => $this->due_at, 'tag_ids' => $this->tag_ids, ], $this->attachments); + session()->flash('success', 'Ticket ' . $ticket->reference . ' has been created.'); + return redirect()->to(route('helpdesk.tickets.index')); } finally { $this->isSaving = false; diff --git a/Modules/Helpdesk/Resources/views/components/html-editor.blade.php b/Modules/Helpdesk/Resources/views/components/html-editor.blade.php index d4f42200..d1d6f764 100644 --- a/Modules/Helpdesk/Resources/views/components/html-editor.blade.php +++ b/Modules/Helpdesk/Resources/views/components/html-editor.blade.php @@ -31,15 +31,13 @@ this.$refs.editor.textContent = nextValue; }, syncToLivewire(live = true) { - const value = this.$refs.editor?.innerText || ''; - - this.value = value; + this.value = this.$refs.editor?.innerText || ''; if (this.$refs.input) { - this.$refs.input.value = value; + this.$refs.input.value = this.value; } - this.$wire.set(this.model, value, live); + this.$wire.set(this.model, this.value, live); }, resetEditor() { this.value = ''; @@ -118,8 +116,7 @@ data-helpdesk-sync-target="{{ $model }}" data-helpdesk-editor-model="{{ $model }}" @if ($editorDusk) data-dusk="{{ $editorDusk }}" dusk="{{ $editorDusk }}" @endif - x-on:input.debounce.350ms="syncToLivewire(true)" - x-on:paste.debounce.350ms="syncToLivewire(true)" + x-on:paste="syncToLivewire(false)" x-on:blur="syncToLivewire(true)" class="helpdesk-rich-editor block min-h-[14rem] w-full overflow-y-auto whitespace-pre-wrap break-words border-0 bg-zinc-950 px-5 py-4 text-base leading-7 text-zinc-100 outline-none transition placeholder:text-zinc-500 empty:before:pointer-events-none empty:before:text-zinc-500 empty:before:content-[attr(data-placeholder)] focus:ring-2 focus:ring-blue-500" > @@ -141,6 +138,6 @@

- Browser spellcheck stays active in the native editable area. Formatting is synchronised before uploads and submit so Livewire does not lose unsaved editor text during attachment refreshes. + Browser spellcheck stays active in the native editable area. Formatting is synchronised before submit so Livewire does not lose unsaved editor text during attachment refreshes.

diff --git a/Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php b/Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php index 16b31af4..bf4894a3 100644 --- a/Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php +++ b/Modules/Helpdesk/Resources/views/livewire/ticket-create.blade.php @@ -5,7 +5,7 @@ ->unique() ->implode(','); @endphp -
+
@include('helpdesk::partials.page-header', [ 'eyebrow' => 'Helpdesk', 'title' => 'Create ticket', @@ -16,16 +16,26 @@
@@ -259,12 +269,12 @@
@@ -315,7 +325,7 @@
@endif -
Uploading attachments... @@ -355,7 +365,7 @@