From 96d4ee7356eeeeccb5e179e4e02078ae7c51b170 Mon Sep 17 00:00:00 2001 From: flfeders Date: Thu, 22 Feb 2024 22:23:15 +0100 Subject: [PATCH] Rebuild General Layout to Nuxt UI PRO Dashboard --- spaces/app.vue | 52 +-- spaces/components/HelpSlideover.vue | 107 +++++ spaces/components/NotificationsSlideover.vue | 29 ++ spaces/components/TeamsDropdown.vue | 46 +++ spaces/components/UserDropdown.vue | 84 ++++ spaces/composables/useDashboard.ts | 29 ++ spaces/layouts/default.vue | 390 +++++++++++-------- spaces/pages/calendar/[mode].vue | 29 +- spaces/pages/index.vue | 69 +++- spaces/pages/planningBoard.vue | 33 +- spaces/pages/tasks/[mode]/[[id]].vue | 178 ++++++++- spaces/pages/tasks/index.vue | 97 +++-- spaces/pages/test.vue | 11 + spaces/stores/data.js | 2 +- 14 files changed, 897 insertions(+), 259 deletions(-) create mode 100644 spaces/components/HelpSlideover.vue create mode 100644 spaces/components/NotificationsSlideover.vue create mode 100644 spaces/components/TeamsDropdown.vue create mode 100644 spaces/components/UserDropdown.vue create mode 100644 spaces/composables/useDashboard.ts create mode 100644 spaces/pages/test.vue diff --git a/spaces/app.vue b/spaces/app.vue index 584089a..ccc5db0 100644 --- a/spaces/app.vue +++ b/spaces/app.vue @@ -3,9 +3,7 @@ const supabase = useSupabaseClient() const user = useSupabaseUser() const route = useRoute() const tenants = (await supabase.from("tenants").select()).data - const dataStore = useDataStore() - const viewport = useViewport() /*watch(viewport.breakpoint, (newBreakpoint, oldBreakpoint) => { @@ -13,6 +11,10 @@ const viewport = useViewport() })*/ + + + + useHead({ meta: [ { name: 'viewport', content: 'width=device-width, initial-scale=1' } @@ -45,6 +47,28 @@ useSeoMeta({ \ No newline at end of file diff --git a/spaces/components/HelpSlideover.vue b/spaces/components/HelpSlideover.vue new file mode 100644 index 0000000..8625835 --- /dev/null +++ b/spaces/components/HelpSlideover.vue @@ -0,0 +1,107 @@ + + + \ No newline at end of file diff --git a/spaces/components/NotificationsSlideover.vue b/spaces/components/NotificationsSlideover.vue new file mode 100644 index 0000000..09b566e --- /dev/null +++ b/spaces/components/NotificationsSlideover.vue @@ -0,0 +1,29 @@ + + + diff --git a/spaces/components/TeamsDropdown.vue b/spaces/components/TeamsDropdown.vue new file mode 100644 index 0000000..0ee32c0 --- /dev/null +++ b/spaces/components/TeamsDropdown.vue @@ -0,0 +1,46 @@ + + + \ No newline at end of file diff --git a/spaces/components/UserDropdown.vue b/spaces/components/UserDropdown.vue new file mode 100644 index 0000000..441d715 --- /dev/null +++ b/spaces/components/UserDropdown.vue @@ -0,0 +1,84 @@ + + + \ No newline at end of file diff --git a/spaces/composables/useDashboard.ts b/spaces/composables/useDashboard.ts new file mode 100644 index 0000000..4d7708e --- /dev/null +++ b/spaces/composables/useDashboard.ts @@ -0,0 +1,29 @@ +import { createSharedComposable } from '@vueuse/core' + +const _useDashboard = () => { + const route = useRoute() + const router = useRouter() + const isHelpSlideoverOpen = ref(false) + const isNotificationsSlideoverOpen = ref(false) + + defineShortcuts({ + 'g-h': () => router.push('/'), + 'g-i': () => router.push('/inbox'), + 'g-u': () => router.push('/users'), + 'g-s': () => router.push('/settings'), + '?': () => isHelpSlideoverOpen.value = true, + n: () => isNotificationsSlideoverOpen.value = true + }) + + watch(() => route.fullPath, () => { + isHelpSlideoverOpen.value = false + isNotificationsSlideoverOpen.value = false + }) + + return { + isHelpSlideoverOpen, + isNotificationsSlideoverOpen + } +} + +export const useDashboard = createSharedComposable(_useDashboard) \ No newline at end of file diff --git a/spaces/layouts/default.vue b/spaces/layouts/default.vue index a09e62d..1932c71 100644 --- a/spaces/layouts/default.vue +++ b/spaces/layouts/default.vue @@ -2,7 +2,7 @@ const dataStore = useDataStore() const colorMode = useColorMode() - +const { isHelpSlideoverOpen } = useDashboard() const userProfile = dataStore.getOwnProfile const supabase = useSupabaseClient() const router = useRouter() @@ -10,6 +10,7 @@ const route = useRoute() dataStore.initializeData((await supabase.auth.getUser()).data.user.id) + const isLight = computed({ get() { return colorMode.value !== 'dark' @@ -196,21 +197,16 @@ const userMenuItems = ref([ } ]) -const links = [[{ - label: 'Profil', - avatar: { - alt: userProfile ? userProfile.fullName : "XY" - } -},{ +const linksold = [[{ label: "Dashboard", to: "/", icon: "i-heroicons-home" -}], [{ +}], + [{ label: "Aufgaben", to: "/tasks", icon: "i-heroicons-rectangle-stack" -}, - { +}, { label: "Plantafel", to: "/calendar/timeline", icon: "i-heroicons-calendar-days" @@ -314,147 +310,227 @@ const links = [[{ }] ] +let links = [ + { + id: 'dashboard', + label: "Dashboard", + to: "/", + icon: "i-heroicons-home" + }, + { + label: "Organisation", + icon: "i-heroicons-rectangle-stack", + defaultOpen: false, + children: [ + { + label: "Aufgaben", + to: "/tasks", + icon: "i-heroicons-rectangle-stack" + }, + { + label: "Plantafel", + to: "/calendar/timeline", + icon: "i-heroicons-calendar-days" + }, + { + label: "Kalender", + to: "/calendar/grid", + icon: "i-heroicons-calendar-days" + }, + { + label: "Dokumente", + to: "/documents", + icon: "i-heroicons-document" + }, + ] + }, + { + label: "E-Mail", + to: "/email", + icon: "i-heroicons-envelope" + }, + { + label: "Kontakte", + defaultOpen: false, + icon: "i-heroicons-user-group", + children: [ + { + label: "Kunden", + to: "/customers", + icon: "i-heroicons-user-group" + }, + { + label: "Lieferanten", + to: "/vendors", + icon: "i-heroicons-truck" + }, + { + label: "Ansprechpartner", + to: "/contacts", + icon: "i-heroicons-user-group" + }, + ] + }, + { + label: "Mitarbeiter", + defaultOpen:false, + icon: "i-heroicons-user-group", + children: [ + { + label: "Zeiterfassung", + to: "/employees/timetracking", + icon: "i-heroicons-clock" + }, + { + label: "Anwesenheiten", + to: "/workingtimes", + icon: "i-heroicons-clock" + }, + { + label: "Abwesenheiten", + to: "/absenceRequests", + icon: "i-heroicons-document-text" + }, + ] + }, + { + label: "Lager", + icon: "i-heroicons-puzzle-piece", + defaultOpen: false, + children: [ + { + label: "Steuerung", + to: "/inventory", + icon: "i-heroicons-square-3-stack-3d" + }, + { + label: "Lagerplätze", + to: "/spaces", + icon: "i-heroicons-square-3-stack-3d" + }, + { + label: "Inventar", + to: "/inventoryitems", + icon: "i-heroicons-puzzle-piece" + }, + ] + }, + { + label: "Stammdaten", + defaultOpen: false, + icon: "i-heroicons-clipboard-document", + children: [ + { + label: "Artikelstamm", + to: "/products", + icon: "i-heroicons-puzzle-piece" + },{ + label: "Leistungsstamm", + to: "/services", + icon: "i-heroicons-puzzle-piece" + },{ + label: "Fahrzeuge", + to: "/vehicles", + icon: "i-heroicons-truck" + }, + ] + }, + { + label: "Belege", + to: "/receipts", + icon: "i-heroicons-document-text" + },{ + label: "Projekte", + to: "/projects", + icon: "i-heroicons-clipboard-document-check" + }, + { + label: "Verträge", + to: "/contracts", + icon: "i-heroicons-clipboard-document" + }, + { + label: "Objekte", + to: "/plants", + icon: "i-heroicons-clipboard-document" + }, + ] + +const groups = [{ + key: 'links', + label: 'Go to', + commands: links.map(link => ({ ...link, shortcuts: link.tooltip?.shortcuts })) +}, { + key: 'code', + label: 'Code', + commands: [{ + id: 'source', + label: 'View page source', + icon: 'i-simple-icons-github', + click: () => { + window.open(`https://github.com/nuxt-ui-pro/dashboard/blob/main/pages${route.path === '/' ? '/index' : route.path}.vue`, '_blank') + } + }] +}] +const footerLinks = [/*{ + label: 'Invite people', + icon: 'i-heroicons-plus', + to: '/settings/members' +}, */{ + label: 'Hilfe & Support', + icon: 'i-heroicons-question-mark-circle', + click: () => isHelpSlideoverOpen.value = true +}] + + \ No newline at end of file diff --git a/spaces/pages/planningBoard.vue b/spaces/pages/planningBoard.vue index 74e5b1c..3d014a1 100644 --- a/spaces/pages/planningBoard.vue +++ b/spaces/pages/planningBoard.vue @@ -122,6 +122,28 @@ const calendarOptionsTimeline = reactive({ - + --> \ No newline at end of file diff --git a/spaces/stores/data.js b/spaces/stores/data.js index 27f1650..d8ced1d 100644 --- a/spaces/stores/data.js +++ b/spaces/stores/data.js @@ -795,7 +795,7 @@ export const useDataStore = defineStore('data', () => { const getResources = computed(() => { return [ - ...profiles.value.map(profile => { + ...profiles.value.filter(i => i.tenant === currentTenant.value).map(profile => { return { type: 'Mitarbeiter', title: profile.fullName,