From 69e4e3ccca89fdddb063a1331b0fd5a04b16b4ed Mon Sep 17 00:00:00 2001 From: Mark Gregory Date: Wed, 24 Jun 2026 12:29:48 +0100 Subject: [PATCH] now with git support --- Modules/Helpdesk/Livewire/TicketCreate.php | 23 +++++- Modules/Helpdesk/Livewire/TicketEdit.php | 43 +++++++---- .../views/components/html-editor.blade.php | 12 +-- .../views/livewire/ticket-create.blade.php | 72 ++++++++++++------ .../views/livewire/ticket-edit.blade.php | 74 +++++++++++++++---- Modules/Helpdesk/changelog.yaml | 12 +++ Modules/Helpdesk/module.json | 2 +- .../Git/GiteaWebhookController.php | 25 +++++++ bootstrap/app.php | 1 + config/services.php | 5 +- routes/api.php | 6 ++ 11 files changed, 214 insertions(+), 61 deletions(-) create mode 100644 app/Http/Controllers/Git/GiteaWebhookController.php create mode 100644 routes/api.php diff --git a/Modules/Helpdesk/Livewire/TicketCreate.php b/Modules/Helpdesk/Livewire/TicketCreate.php index 3cbb635e..5f6859c6 100644 --- a/Modules/Helpdesk/Livewire/TicketCreate.php +++ b/Modules/Helpdesk/Livewire/TicketCreate.php @@ -134,10 +134,31 @@ final class TicketCreate extends Component $this->subject = ''; $this->body = ''; + $this->due_at = null; $this->tag_ids = []; $this->attachments = []; - $this->dispatch('helpdesk-form-cleared'); + $this->company_id = null; + $this->board_id = null; + $this->priority_id = null; + $this->category_id = null; + $this->project_id = null; + $this->product_id = null; + $this->team_id = null; + + $this->applyDefaults(); + + $this->dispatch('helpdesk-form-cleared', values: [ + 'company_id' => $this->company_id, + '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->dispatch('helpdesk-editor-reset', model: 'body'); } diff --git a/Modules/Helpdesk/Livewire/TicketEdit.php b/Modules/Helpdesk/Livewire/TicketEdit.php index 8b0f7c58..6c789ec5 100644 --- a/Modules/Helpdesk/Livewire/TicketEdit.php +++ b/Modules/Helpdesk/Livewire/TicketEdit.php @@ -173,23 +173,36 @@ final class TicketEdit extends Component $this->resetErrorBag(); $this->resetValidation(); - $this->subject = ''; - $this->body = ''; - $this->company_id = null; - $this->status_id = null; - $this->board_id = null; - $this->priority_id = null; - $this->category_id = null; - $this->project_id = null; - $this->product_id = null; - $this->team_id = null; - $this->agent_id = null; - $this->due_at = null; - $this->tag_ids = []; + $this->ticket = $this->freshTicket($this->ticket); + $this->company_id = $this->ticket->company_id; + $this->subject = $this->ticket->subject; + $this->body = $this->ticket->body; + $this->status_id = $this->ticket->status_id; + $this->board_id = $this->ticket->board_id; + $this->priority_id = $this->ticket->priority_id; + $this->category_id = $this->ticket->category_id; + $this->project_id = $this->ticket->project_id; + $this->product_id = $this->ticket->product_id; + $this->team_id = $this->ticket->team_id; + $this->agent_id = $this->ticket->agent_id; + $this->due_at = $this->ticket->due_at?->format('Y-m-d'); + $this->tag_ids = $this->ticket->tags->pluck('id')->map(fn ($id): int => (int) $id)->all(); $this->attachments = []; - $this->dispatch('helpdesk-form-cleared'); - $this->dispatch('helpdesk-editor-reset', model: 'body'); + $this->dispatch('helpdesk-form-cleared', values: [ + 'company_id' => $this->company_id, + 'status_id' => $this->status_id, + '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, + 'agent_id' => $this->agent_id, + 'due_at' => $this->due_at, + 'tag_ids' => $this->tag_ids, + ]); + $this->dispatch('helpdesk-editor-reset', model: 'body', value: $this->body); } public function render(): View diff --git a/Modules/Helpdesk/Resources/views/components/html-editor.blade.php b/Modules/Helpdesk/Resources/views/components/html-editor.blade.php index 66cbd03b..dc0cd89b 100644 --- a/Modules/Helpdesk/Resources/views/components/html-editor.blade.php +++ b/Modules/Helpdesk/Resources/views/components/html-editor.blade.php @@ -13,7 +13,7 @@
whereDoesntStartWith('wire:model')->merge(['class' => 'space-y-2']) }} @if ($model) data-helpdesk-editor-model="{{ $model }}" @endif - x-on:helpdesk-editor-reset.window="if ($event.detail.model === model) clear()" + x-on:helpdesk-editor-reset.window="if ($event.detail.model === model) clear($event.detail.value || '')" x-on:helpdesk-editor-sync.window="if ($event.detail.model === model) syncToLivewire()" x-data="{ model: @js($model), @@ -54,12 +54,12 @@ this.$nextTick(() => this.syncToHiddenInput()); }, - clear() { - this.value = ''; - this.$refs.editor.innerHTML = ''; + clear(value = '') { + this.value = value || ''; + this.$refs.editor.innerHTML = this.value; if (this.model) { - this.$wire.set(this.model, '', false); + this.$wire.set(this.model, this.value, false); } }, init() { @@ -103,7 +103,7 @@ class="rounded-lg px-2 py-1 text-sm hover:bg-zinc-200 dark:hover:bg-zinc-800">Clear
-
-
- +
- - Cancel - +
+
+ + + Cancel + - + + + +
@@ -392,11 +397,36 @@ }; }; - const resetTicketCreateFiles = () => { + const resetTicketCreateFiles = (event) => { document.querySelectorAll('.helpdesk-ticket-form #attachments').forEach((input) => { input.value = ''; input.dispatchEvent(new Event('change', { bubbles: true })); }); + + const values = event?.detail?.values || event?.values || {}; + + document.querySelectorAll('.helpdesk-ticket-form [data-helpdesk-select2][data-wire-model]').forEach((select) => { + const model = select.dataset.wireModel; + const value = values[model] ?? ''; + + select.value = value === null ? '' : String(value); + select.dispatchEvent(new Event('change', { bubbles: true })); + + if (window.jQuery && window.jQuery.fn?.select2) { + window.jQuery(select).val(select.value || null).trigger('change.select2'); + } + }); + + document.querySelectorAll('.helpdesk-ticket-form [data-helpdesk-flatpickr]').forEach((input) => { + const model = input.getAttribute('wire:model') || input.dataset.wireModel || input.id; + const value = values[model] ?? ''; + input.value = value || ''; + input.dispatchEvent(new Event('change', { bubbles: true })); + + if (input._flatpickr) { + input._flatpickr.setDate(value || null, false); + } + }); }; const appendPastedFiles = (event) => { diff --git a/Modules/Helpdesk/Resources/views/livewire/ticket-edit.blade.php b/Modules/Helpdesk/Resources/views/livewire/ticket-edit.blade.php index e74fb070..ba059ad7 100644 --- a/Modules/Helpdesk/Resources/views/livewire/ticket-edit.blade.php +++ b/Modules/Helpdesk/Resources/views/livewire/ticket-edit.blade.php @@ -400,25 +400,67 @@ -
- +
+
+ + + Cancel + - - Cancel - + - + +
+ + diff --git a/Modules/Helpdesk/changelog.yaml b/Modules/Helpdesk/changelog.yaml index 964e1e3e..2b6a48ef 100644 --- a/Modules/Helpdesk/changelog.yaml +++ b/Modules/Helpdesk/changelog.yaml @@ -387,3 +387,15 @@ - Replaced the broken artwork area with inline Helpdesk workflow artwork using Blade and Tailwind only. - Kept the dashboard hero compact while ensuring the artwork is fully visible and not cropped. - Preserved append-only changelog history. + +- version: 1.10.12 + date: 2026-06-24 + type: bugfix + summary: Fix Helpdesk ticket create and edit form actions and reset behaviour. + changes: + - Restored the missing grid closing wrapper so create form actions render in the footer rather than inside the form grid. + - Repositioned Cancel, Reset and Create/Save actions to the right-hand footer on create and edit screens. + - Changed create reset to clear user-entered values and then reapply configured default dropdown values. + - Changed edit reset to restore the saved ticket values rather than blanking the ticket. + - Kept rich editor spellcheck enabled and preserved submit-time Livewire synchronisation without keypress syncing. + - Preserved append-only changelog history. diff --git a/Modules/Helpdesk/module.json b/Modules/Helpdesk/module.json index 4d2628a8..93fb45a4 100644 --- a/Modules/Helpdesk/module.json +++ b/Modules/Helpdesk/module.json @@ -22,5 +22,5 @@ "Modules\\Helpdesk\\Providers\\HelpdeskServiceProvider" ], "files": [], - "version": "1.10.10" + "version": "1.10.12" } diff --git a/app/Http/Controllers/Git/GiteaWebhookController.php b/app/Http/Controllers/Git/GiteaWebhookController.php new file mode 100644 index 00000000..e8276464 --- /dev/null +++ b/app/Http/Controllers/Git/GiteaWebhookController.php @@ -0,0 +1,25 @@ +json([ + 'message' => 'Gitea webhook received.', + 'event' => $request->header('X-Gitea-Event'), + 'delivery' => $request->header('X-Gitea-Delivery'), + 'payload' => $request->json()->all(), + ]); + } +} diff --git a/bootstrap/app.php b/bootstrap/app.php index c1908a1d..a9a5a0df 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -9,6 +9,7 @@ use Modules\Platform\app\Http\Middleware\EnsureLicensedTenant; return Application::configure(basePath: dirname(__DIR__)) ->withRouting( web: __DIR__ . '/../routes/web.php', + api: __DIR__ . '/../routes/api.php', commands: __DIR__ . '/../routes/console.php', health: '/up', ) diff --git a/config/services.php b/config/services.php index 6a90eb83..1d3a8f42 100644 --- a/config/services.php +++ b/config/services.php @@ -27,7 +27,10 @@ return [ 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], - + 'gitea' => [ + 'webhook_secret' => env('GITEA_WEBHOOK_SECRET'), + 'webhook_authorization' => env('GITEA_WEBHOOK_AUTHORIZATION'), + ], 'slack' => [ 'notifications' => [ 'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'), diff --git a/routes/api.php b/routes/api.php new file mode 100644 index 00000000..54dc47ed --- /dev/null +++ b/routes/api.php @@ -0,0 +1,6 @@ +name('git.gitea.webhook');