Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

feat(ledensysteem): add groups and member pages #35

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
51deb2a
feat: Add getAll functionality for groups and members
Gerbuuun Nov 26, 2022
65be92d
feat: Add getAll endpoints for groups and members
Gerbuuun Nov 26, 2022
2a34a15
feat: table with all groups/members and group/member page
Gerbuuun Dec 8, 2022
3d2186b
fix(logic): remove wrong return types
Gerbuuun Dec 10, 2022
55df7f3
Merge branch 'main' into feat/ledenlijst
Gerbuuun Dec 10, 2022
c5529b0
Merge branch 'main' into feat/ledenlijst
Gerbuuun Dec 12, 2022
5cc0ac8
feat: update gitignore
Gerbuuun Dec 12, 2022
8f7ad49
fix: lint and typecheck
Gerbuuun Dec 12, 2022
39661cf
fix: missing group logic
Gerbuuun Dec 12, 2022
6333499
chore(prisma): upgrade prisma and prisma client to 4.7.1
Gerbuuun Dec 12, 2022
3c6e302
feat(member): add member page and mijn-profiel page
Gerbuuun Dec 12, 2022
50d835e
feat(groups): add groups page
Gerbuuun Dec 13, 2022
db3f03e
feat(groups): add groups members page
Gerbuuun Dec 13, 2022
24c62ea
feat(members): change members menu
Gerbuuun Dec 13, 2022
c84604a
chore(members): remove double page
Gerbuuun Dec 13, 2022
e58f8e1
feat(input): add Date picker component
Gerbuuun Dec 15, 2022
3c45a8f
feat(groups): add 'Mijn Groepen' page
Gerbuuun Dec 15, 2022
d65de2d
feat(groups): improve several pages
Gerbuuun Dec 15, 2022
88eca2f
Merge branch 'main' into feat/ledenlijst
Gerbuuun Dec 15, 2022
4c2cf85
feat(groups): add group creation page
Gerbuuun Dec 15, 2022
d116d78
Merge remote-tracking branch 'origin/feat/ledenlijst' into feat/leden…
Gerbuuun Dec 15, 2022
2ed5e06
fix(groups): missing date on child groups
Gerbuuun Dec 15, 2022
dcb8860
fix(groups): improve routing
Gerbuuun Dec 15, 2022
a110358
fix(search): add search match for more properties
Gerbuuun Dec 15, 2022
e72c1cd
fix(members): add pages and improve routing
Gerbuuun Dec 15, 2022
32652d3
feat(members): add pages and improve routing
Gerbuuun Dec 16, 2022
b2867d4
fix: type export
Gerbuuun Dec 16, 2022
f907e62
fix: typecheck / codestyle
Gerbuuun Dec 16, 2022
7fd9478
fix: additional typecheck / codestyle
Gerbuuun Dec 16, 2022
67feb81
fix: apply requested changes
Gerbuuun Dec 19, 2022
4de588c
Merge branch 'main' into feat/ledenlijst
Gerbuuun Dec 20, 2022
fa1ccaf
feat: infer breadcrumbs from url (and small fixes)
Gerbuuun Dec 20, 2022
f5539ab
fix: several type-errors and lint-errors
Gerbuuun Dec 20, 2022
8e3bb0d
fix: prettier
Gerbuuun Dec 20, 2022
3fbc53c
fix: few more small fixes
Gerbuuun Dec 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"vue/no-multiple-template-root": "off",
"vue/component-api-style": ["error", ["script-setup"]],
"vue/define-emits-declaration": ["error", "type-based"],
"vue/no-v-for-template-key": "off",
"import/order": [
"warn",
{
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ yarn.lock
.DS_Store
.pnp.*
.yarn
.idea
69 changes: 69 additions & 0 deletions components/Input/Date.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<template>
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
<div class="form-control">
<label v-if="title" class="label">
<span class="label-text text-base font-bold">{{ title }}</span>
<span v-if="required" class="label-text-alt text-error text-lg">*</span>
</label>
<input
type="date"
class="input"
:class="classes"
:title="title"
:disabled="disabled"
:required="required"
:value="modelValue"
@input="
$emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)
"
/>
<label v-if="error" class="label">
<span class="label-text-alt text-error font-bold">{{ error }}</span>
</label>
</div>
</template>

<script lang="ts" setup>
interface Props {
modelValue?: string;
title?: string;
error?: string;
size?: "xs" | "sm" | "md" | "lg";
color?:
| "primary"
| "secondary"
| "accent"
| "info"
| "success"
| "warning"
| "error";
bordered?: boolean;
ghost?: boolean;
disabled?: boolean;
required?: boolean;
}

interface Emits {
(eventName: "update:modelValue", value: string): void;
}

const props = defineProps<Props>();
defineEmits<Emits>();

const classes = computed(() => {
return {
"input-xs": props.size === "xs",
"input-sm": props.size === "sm",
"input-md": props.size === "md",
"input-lg": props.size === "lg",
"input-primary": props.color === "primary",
"input-secondary": props.color === "secondary",
"input-accent": props.color === "accent",
"input-info": props.color === "info",
"input-success": props.color === "success",
"input-warning": props.color === "warning",
"input-error": props.color === "error" || props.error,
"input-bordered": props.bordered,
"input-ghost": props.ghost,
};
});
</script>
2 changes: 1 addition & 1 deletion components/Input/Select.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="form-control mb-4">
<div class="form-control">
<label v-if="title" class="label">
<span class="label-text text-base font-bold">{{ title }}</span>
<span v-if="required" class="label-text-alt text-error text-lg">*</span>
Expand Down
14 changes: 9 additions & 5 deletions components/NavBar/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,32 @@ const menuItems: MenuItem[] = [
},
],
},
{ name: "Foto's", icon: "material-symbols:camera", target: "/foto" },
{
name: "Foto's",
icon: "material-symbols:camera",
target: "https://proteus-eretes.nl/fotos",
},
{
name: "Leden",
icon: "material-symbols:person",
target: "/lid",
target: "/leden/zoeken",
children: [
{
name: "Groepen",
icon: "material-symbols:group",
target: "/groups",
target: "/groepen/zoeken",
},
{
name: "Lebberlijst",
icon: "ph:graph",
target: "/lebberlijst",
target: "https://proteus-eretes.nl/lebberlijst",
},
],
},
{
name: "Evenementen",
icon: "material-symbols:calendar-today",
target: "/event",
target: "https://proteus-eretes.nl/eetlijst",
},
];
</script>
20 changes: 19 additions & 1 deletion components/NavBar/ProfileDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,25 @@
class="menu menu-compact dropdown-content mt-3 p-2 shadow bg-base-100 rounded-box w-52"
>
<li>
<NuxtLink to="/me" title="Mijn Profiel">Profiel</NuxtLink>
<NuxtLink
:to="`/leden/${data?.user?.proteusId}/profiel`"
title="Mijn Profiel"
>Profiel
</NuxtLink>
</li>
<li>
<NuxtLink
:to="`/leden/${data?.user?.proteusId}/groepen`"
title="Lidmaatschappen"
>Lidmaatschappen
</NuxtLink>
</li>
<li>
<NuxtLink
:to="`/leden/${data?.user?.proteusId}/instellingen`"
title="Instellingen"
>Instellingen
</NuxtLink>
</li>
<li><a @click.prevent="() => signOut()">Log uit</a></li>
</ul>
Expand Down
35 changes: 35 additions & 0 deletions components/SideMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<template>
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
<ul class="menu">
<li v-for="item in items" :key="item.title" :class="classes(item.to)">
<span v-if="!item.to">{{ item.title }}</span>
<NuxtLink v-else :to="item.to">
<Icon :name="item.icon || 'ic:baseline-question-mark'" size="20px" />
{{ item.title }}
<span
v-if="item.badge"
class="indicator-item indicator-middle badge badge-secondary"
>
{{ item.badge }}
</span>
</NuxtLink>
</li>
</ul>
</template>

<script setup lang="ts">
export interface MenuItem {
icon?: string;
title: string;
to?: string;
badge?: string;
}

defineProps<{
items: MenuItem[];
}>();

const classes = (route?: string): string => {
if (!route) return "menu-title pt-5";
return useRoute().path.endsWith(route) ? "bordered" : "";
};
</script>
15 changes: 15 additions & 0 deletions composables/useDateFormatter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const useDateFormatter = () => {
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
return function toDateString(
dateTimeString: string | Date | undefined | null,
): string {
if (!dateTimeString) return "-";
const date =
typeof dateTimeString === "string"
? new Date(dateTimeString)
: dateTimeString;
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();
return `${day}-${month}-${year}`;
};
};
7 changes: 7 additions & 0 deletions middleware/validateRouteUUID.global.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import validator from "validator";

export default defineNuxtRouteMiddleware((to) => {
if (to.params.id && !validator.isUUID(to.params.id as string)) {
return false;
}
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"devDependencies": {
"@nuxtjs/eslint-config-typescript": "^11.0.0",
"@nuxtjs/tailwindcss": "^6.1.3",
"@prisma/client": "^4.6.1",
"@prisma/client": "^4.7.1",
"@types/node": "^18.11.9",
"@types/validator": "^13.7.10",
"@typescript-eslint/eslint-plugin": "^5.42.0",
Expand All @@ -39,7 +39,7 @@
"nuxt-icon": "^0.1.7",
"postcss-custom-properties": "^13.0.0",
"prettier": "^2.7.1",
"prisma": "^4.6.1",
"prisma": "^4.7.1",
"typescript": "^4.8.4",
"vue-eslint-parser": "^9.1.0"
},
Expand Down
58 changes: 58 additions & 0 deletions pages/groepen.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<TwoColumn title="Groepen">
<template #content>
<SideMenu :items="menuItems" />
</template>
<NuxtPage />
</TwoColumn>
</template>

<script lang="ts" setup>
import { MenuItem } from "~~/components/SideMenu.vue";

Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
const numberOfUitschrijvingen = undefined;
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
const route = useRoute();

const menuItems = computed(() => {
if (!route.params.id) return standard;
return [...standard, ...selected.value];
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
});

const standard: MenuItem[] = [
{ icon: "ic:search", title: "Zoeken", to: "/groepen/zoeken" },
{ icon: "ic:group", title: "Mijn Groepen", to: "/groepen/mijn-groepen" },
{ icon: "ic:add", title: "Groep Maken", to: "/groepen/nieuw" },
];

const selected = computed<MenuItem[]>(() => [
{
title: "Groep",
},
{
icon: "ic:baseline-groups",
title: "Overzicht",
to: `/groepen/${route.params.id}/overzicht`,
},
{
icon: "ic:baseline-person-add-alt-1",
title: "Lid toevoegen",
to: `/groepen/${route.params.id}/toevoegen`,
},
{
icon: "ic:baseline-person-remove",
title: "Uitschrijvingen",
to: `/groepen/${route.params.id}/uitschrijvingen`,
badge: numberOfUitschrijvingen,
},
{
icon: "ic:baseline-manage-accounts",
title: "Leden Beheren",
to: `/groepen/${route.params.id}/leden`,
},
{
icon: "ic:baseline-settings",
title: "Instellingen",
to: `/groepen/${route.params.id}/instellingen`,
},
]);
</script>
11 changes: 11 additions & 0 deletions pages/groepen/[id].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<NuxtPage :group="group" />
</template>

<script lang="ts" setup>
const { data: group } = await useFetch<
Awaited<
ReturnType<typeof import("~/server/api/groups/[id]/index.get").default>
>
>("/api/groups/" + useRoute().params.id);
</script>
32 changes: 32 additions & 0 deletions pages/groepen/[id]/instellingen.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<template>
<h1 class="text-4xl text-primary font-bold mb-4">
{{ group.name }}
<Icon name="ic:chevron-right" />
Instellingen
</h1>
<div class="overflow-x-auto shadow">
groep dingen hiero<br />
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
<button class="btn btn-error btn-outline" @click="deleteGroup">
Groep Verwijderen
</button>
</div>
</template>

<script setup lang="ts">
import { Contact, Group, Membership } from ".prisma/client";

defineProps<{
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
group: Group & {
contacts: Contact[];
children: Group[];
members: Membership[];
};
}>();

const deleteGroup = async () => {
await $fetch("/api/groups/" + useRoute().params.id, {
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
method: "DELETE",
});
await navigateTo("/groepen/zoeken");
};
</script>
41 changes: 41 additions & 0 deletions pages/groepen/[id]/leden.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<template>
<h1 class="text-4xl text-primary font-bold mb-4">
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
{{ group.name }}
<Icon name="ic:chevron-right" />
Leden Beheren
</h1>
<div class="overflow-x-auto shadow">
<table class="table w-full">
<thead>
<tr>
<td>Naam</td>
<td>Functie</td>
<td>Sinds</td>
<td>Tot</td>
<td>Lid Type</td>
</tr>
</thead>
<tbody>
<tr v-for="member in group.members" :key="member.id">
<td>{{ member.id }}</td>
Gerbuuun marked this conversation as resolved.
Show resolved Hide resolved
<td>{{ member.function }}</td>
<td>{{ member.startDate }}</td>
<td>{{ member.stopDate }}</td>
<td>{{ member.isAdmin ? "Beheerder" : "Lid" }}</td>
</tr>
</tbody>
</table>
</div>
</template>

<script setup lang="ts">
import { Contact, Group, Membership } from ".prisma/client";

defineProps<{
group: Group & {
contacts: Contact[];
children: Group[];
members: Membership[];
};
}>();
</script>
Loading