diff --git a/app/_components/users/UsersForm.vue b/app/_components/users/UsersForm.vue deleted file mode 100644 index bf37dd0..0000000 --- a/app/_components/users/UsersForm.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/app/_pages/inbox.vue b/app/_pages/inbox.vue deleted file mode 100644 index cfe3451..0000000 --- a/app/_pages/inbox.vue +++ /dev/null @@ -1,190 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/_pages/index.vue b/app/_pages/index.vue deleted file mode 100644 index daedef2..0000000 --- a/app/_pages/index.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/_pages/users.vue b/app/_pages/users.vue deleted file mode 100644 index db0753a..0000000 --- a/app/_pages/users.vue +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - Display - - - - - - - - - - - - - - - - {{ row.name }} - - - - - - - - - - diff --git a/app/components/customers/AddModal.vue b/app/components/customers/AddModal.vue new file mode 100644 index 0000000..fa6c942 --- /dev/null +++ b/app/components/customers/AddModal.vue @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/components/customers/DeleteModal.vue b/app/components/customers/DeleteModal.vue new file mode 100644 index 0000000..daea54a --- /dev/null +++ b/app/components/customers/DeleteModal.vue @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + diff --git a/app/pages/customers.vue b/app/pages/customers.vue index 1ef01dd..e64d21b 100644 --- a/app/pages/customers.vue +++ b/app/pages/customers.vue @@ -1,3 +1,200 @@ + + @@ -5,7 +202,118 @@ + + + + + + + + + + + + + + + {{ table?.tableApi?.getFilteredSelectedRowModel().rows.length }} + + + + + + + + + + + + + + + + + {{ table?.tableApi?.getFilteredSelectedRowModel().rows.length || 0 }} of + {{ table?.tableApi?.getFilteredRowModel().rows.length || 0 }} row(s) selected. + + + + table?.tableApi?.setPageIndex(p - 1)" + /> + + + diff --git a/app/pages/index.vue b/app/pages/index.vue index b4db713..e3010ba 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -51,7 +51,7 @@ const period = ref('daily') - + diff --git a/package.json b/package.json index 4a7af58..3c9478b 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,13 @@ "dependencies": { "@iconify-json/lucide": "^1.2.26", "@iconify-json/simple-icons": "^1.2.24", - "@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@429d8fd", + "@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@17d88f7", "@unovis/ts": "^1.5.0", "@unovis/vue": "^1.5.0", "@vueuse/nuxt": "^12.7.0", "date-fns": "^4.1.0", - "nuxt": "^3.15.4" + "nuxt": "^3.15.4", + "zod": "^3.24.2" }, "devDependencies": { "@nuxt/eslint": "^1.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 21218a5..1e2eadf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^1.2.24 version: 1.2.24 '@nuxt/ui-pro': - specifier: https://pkg.pr.new/@nuxt/ui-pro@429d8fd - version: https://pkg.pr.new/@nuxt/ui-pro@429d8fd(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + specifier: https://pkg.pr.new/@nuxt/ui-pro@17d88f7 + version: https://pkg.pr.new/@nuxt/ui-pro@17d88f7(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) '@unovis/ts': specifier: ^1.5.0 version: 1.5.0 @@ -32,6 +32,9 @@ importers: nuxt: specifier: ^3.15.4 version: 3.15.4(@parcel/watcher@2.5.1)(@types/node@22.13.4)(db0@0.2.4)(eslint@9.20.1(jiti@2.4.2))(ioredis@5.5.0)(lightningcss@1.29.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.34.8)(terser@5.39.0)(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue-tsc@2.2.2(typescript@5.7.3))(yaml@2.7.0) + zod: + specifier: ^3.24.2 + version: 3.24.2 devDependencies: '@nuxt/eslint': specifier: ^1.0.1 @@ -709,14 +712,14 @@ packages: engines: {node: '>=18.12.0'} hasBin: true - '@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@429d8fd': - resolution: {tarball: https://pkg.pr.new/@nuxt/ui-pro@429d8fd} + '@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@17d88f7': + resolution: {tarball: https://pkg.pr.new/@nuxt/ui-pro@17d88f7} version: 3.0.0-alpha.13 peerDependencies: typescript: ^5.6.3 - '@nuxt/ui@https://pkg.pr.new/@nuxt/ui@d33a83e': - resolution: {tarball: https://pkg.pr.new/@nuxt/ui@d33a83e} + '@nuxt/ui@https://pkg.pr.new/@nuxt/ui@ca659bd': + resolution: {tarball: https://pkg.pr.new/@nuxt/ui@ca659bd} version: 3.0.0-alpha.13 hasBin: true peerDependencies: @@ -4806,6 +4809,9 @@ packages: resolution: {integrity: sha512-zK7YHHz4ZXpW89AHXUPbQVGKI7uvkd3hzusTdotCg1UxyaVtg0zFJSTfW/Dq5f7OBBVnq6cZIaC8Ti4hb6dtCA==} engines: {node: '>= 14'} + zod@3.24.2: + resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==} + snapshots: '@alloc/quick-lru@5.2.0': {} @@ -5742,11 +5748,11 @@ snapshots: - magicast - supports-color - '@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@429d8fd(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': + '@nuxt/ui-pro@https://pkg.pr.new/@nuxt/ui-pro@17d88f7(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': dependencies: '@nuxt/kit': 3.15.4(magicast@0.3.5) '@nuxt/schema': 3.15.4 - '@nuxt/ui': https://pkg.pr.new/@nuxt/ui@d33a83e(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) + '@nuxt/ui': https://pkg.pr.new/@nuxt/ui@ca659bd(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3)) '@vueuse/core': 12.7.0(typescript@5.7.3) consola: 3.4.0 defu: 6.1.4 @@ -5796,7 +5802,7 @@ snapshots: - vite - vue - '@nuxt/ui@https://pkg.pr.new/@nuxt/ui@d33a83e(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': + '@nuxt/ui@https://pkg.pr.new/@nuxt/ui@ca659bd(@babel/parser@7.26.9)(change-case@5.4.4)(db0@0.2.4)(embla-carousel@8.5.2)(ioredis@5.5.0)(magicast@0.3.5)(radix-vue@1.9.14(vue@3.5.13(typescript@5.7.3)))(typescript@5.7.3)(vite@6.1.0(@types/node@22.13.4)(jiti@2.4.2)(lightningcss@1.29.1)(terser@5.39.0)(yaml@2.7.0))(vue@3.5.13(typescript@5.7.3))': dependencies: '@iconify/vue': 4.3.0(vue@3.5.13(typescript@5.7.3)) '@internationalized/date': 3.7.0 @@ -10377,3 +10383,5 @@ snapshots: archiver-utils: 5.0.2 compress-commons: 6.0.2 readable-stream: 4.7.0 + + zod@3.24.2: {} diff --git a/server/api/users.ts b/server/api/customers.ts similarity index 80% rename from server/api/users.ts rename to server/api/customers.ts index 90c0a24..16c24c8 100644 --- a/server/api/users.ts +++ b/server/api/customers.ts @@ -1,6 +1,6 @@ -import type { User, UserStatus } from '~/types' +import type { User } from '~/types' -const users: User[] = [{ +const customers: User[] = [{ id: 1, name: 'Alex Smith', email: 'alex.smith@example.com', @@ -182,29 +182,6 @@ const users: User[] = [{ location: 'London, UK' }] -export default eventHandler(async (event) => { - const { q, statuses, locations, sort, order } = getQuery(event) as { q?: string, statuses?: UserStatus[], locations?: string[], sort?: 'name' | 'email', order?: 'asc' | 'desc' } - - return users.filter((user) => { - if (!q) return true - - return user.name.search(new RegExp(q, 'i')) !== -1 || user.email.search(new RegExp(q, 'i')) !== -1 - }).filter((user) => { - if (!statuses?.length) return true - - return statuses.includes(user.status) - }).filter((user) => { - if (!locations?.length) return true - - return locations.includes(user.location) - }).sort((a, b) => { - if (!sort) return 0 - - const aValue = a[sort] - const bValue = b[sort] - - if (aValue < bValue) return order === 'asc' ? -1 : 1 - if (aValue > bValue) return order === 'asc' ? 1 : -1 - return 0 - }) +export default eventHandler(async () => { + return customers })