From 64023f3930d7dee077248497d444d503e75930e9 Mon Sep 17 00:00:00 2001 From: Gregor Vostrak Date: Fri, 12 Apr 2024 03:19:58 +0200 Subject: [PATCH] added success and error notifications --- .../Common/Notification/Notification.vue | 62 +++++++++ .../js/Components/Common/Tag/TagDropdown.vue | 4 +- .../js/Components/NotificationContainer.vue | 22 ++++ resources/js/Layouts/AppLayout.vue | 6 +- resources/js/Pages/Time.vue | 2 +- resources/js/utils/notification.ts | 83 ++++++++++++ resources/js/utils/useClients.ts | 52 +++++--- resources/js/utils/useCurrentTimeEntry.ts | 124 ++++++++++-------- resources/js/utils/useMembers.ts | 16 ++- resources/js/utils/useProjectMembers.ts | 54 +++++--- resources/js/utils/useProjects.ts | 52 +++++--- resources/js/utils/useTags.ts | 67 ++++++---- resources/js/utils/useTasks.ts | 68 ++++++---- resources/js/utils/useTimeEntries.ts | 104 +++++++++------ 14 files changed, 508 insertions(+), 208 deletions(-) create mode 100644 resources/js/Components/Common/Notification/Notification.vue create mode 100644 resources/js/Components/NotificationContainer.vue create mode 100644 resources/js/utils/notification.ts diff --git a/resources/js/Components/Common/Notification/Notification.vue b/resources/js/Components/Common/Notification/Notification.vue new file mode 100644 index 00000000..65eb7f33 --- /dev/null +++ b/resources/js/Components/Common/Notification/Notification.vue @@ -0,0 +1,62 @@ + + + diff --git a/resources/js/Components/Common/Tag/TagDropdown.vue b/resources/js/Components/Common/Tag/TagDropdown.vue index 39939ef9..1de5a08b 100644 --- a/resources/js/Components/Common/Tag/TagDropdown.vue +++ b/resources/js/Components/Common/Tag/TagDropdown.vue @@ -61,7 +61,9 @@ const filteredTags = computed(() => { async function addTagIfNoneExists() { if (searchValue.value.length > 0 && filteredTags.value.length === 0) { const newTag = await tagsStore.createTag(searchValue.value); - addOrRemoveTagFromSelection(newTag.id); + if (newTag) { + addOrRemoveTagFromSelection(newTag.id); + } searchValue.value = ''; } else { if (highlightedItemId.value) { diff --git a/resources/js/Components/NotificationContainer.vue b/resources/js/Components/NotificationContainer.vue new file mode 100644 index 00000000..ddead6a2 --- /dev/null +++ b/resources/js/Components/NotificationContainer.vue @@ -0,0 +1,22 @@ + + + diff --git a/resources/js/Layouts/AppLayout.vue b/resources/js/Layouts/AppLayout.vue index be357608..d136c19e 100644 --- a/resources/js/Layouts/AppLayout.vue +++ b/resources/js/Layouts/AppLayout.vue @@ -23,6 +23,7 @@ import { useTasksStore } from '@/utils/useTasks'; import { useCurrentTimeEntryStore } from '@/utils/useCurrentTimeEntry'; import { useClientsStore } from '@/utils/useClients'; import { useMembersStore } from '@/utils/useMembers'; +import NotificationContainer from '@/Components/NotificationContainer.vue'; defineProps({ title: String, @@ -39,7 +40,9 @@ onMounted(async () => { diff --git a/resources/js/Pages/Time.vue b/resources/js/Pages/Time.vue index 037b519c..df3f10d8 100644 --- a/resources/js/Pages/Time.vue +++ b/resources/js/Pages/Time.vue @@ -47,7 +47,7 @@ const groupedTimeEntries = computed(() => {