From ab086466547bd5100255077d3ba809210fd89436 Mon Sep 17 00:00:00 2001 From: antoine Date: Tue, 20 May 2025 12:50:34 +0200 Subject: [PATCH 1/2] Add command form error alert --- .../commands/components/CommandFormModal.vue | 48 ++++++++++++------- resources/js/form/Form.ts | 4 ++ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/resources/js/commands/components/CommandFormModal.vue b/resources/js/commands/components/CommandFormModal.vue index 11967321e..c0f94a0fe 100644 --- a/resources/js/commands/components/CommandFormModal.vue +++ b/resources/js/commands/components/CommandFormModal.vue @@ -14,6 +14,8 @@ import { Button } from "@/components/ui/button"; import { __ } from "@/utils/i18n"; import { CommandFormExtraData } from "@/commands/types"; + import { Alert, AlertDescription } from "@/components/ui/alert"; + import { OctagonAlert } from "lucide-vue-next"; const props = defineProps<{ commands: CommandManager, @@ -55,24 +57,36 @@ ref="form" /> - - - - - diff --git a/resources/js/form/Form.ts b/resources/js/form/Form.ts index 512c80870..8de717404 100644 --- a/resources/js/form/Form.ts +++ b/resources/js/form/Form.ts @@ -73,6 +73,10 @@ export class Form implements FormData, CommandFormData, EventTarget { set errors(errors) { this.state.errors = errors; } + get hasErrors() + { + return Object.keys(this.errors).length > 0; + } get meta() { return this.state.meta; From 07e9b4d252b082e690b01c45088576a1abfa206c Mon Sep 17 00:00:00 2001 From: antoine Date: Wed, 21 May 2025 12:13:40 +0200 Subject: [PATCH 2/2] Update alert UI --- .../commands/components/CommandFormModal.vue | 66 +++++++++---------- .../ui/dialog/DialogScrollContent.vue | 45 +++++++------ resources/js/form/Form.ts | 3 +- resources/js/form/components/Form.vue | 11 +++- 4 files changed, 68 insertions(+), 57 deletions(-) diff --git a/resources/js/commands/components/CommandFormModal.vue b/resources/js/commands/components/CommandFormModal.vue index c0f94a0fe..b7f60e7a5 100644 --- a/resources/js/commands/components/CommandFormModal.vue +++ b/resources/js/commands/components/CommandFormModal.vue @@ -1,6 +1,6 @@