Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: table sorting for survey and luckydraw #3

Merged
merged 3 commits into from
Jul 17, 2023
Merged
Changes from 2 commits
Commits
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
14 changes: 7 additions & 7 deletions pages/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
const toast = useToast()
const { $client } = useNuxtApp()
const { data: surveys, pending: surveysPending, error: surveysError, refresh: surveyRefresh } = await $client.survey.list.useQuery(undefined, { lazy: true })
const { data: pastWinners, pending: pastWinnersPending, error: pastWinnersError, refresh: pastWinnersRefresh } = await $client.luckyDraw.pastWinners.useQuery(undefined, { lazy: true })

Check warning on line 23 in pages/dashboard/index.vue

View workflow job for this annotation

GitHub Actions / ci

'pastWinnersPending' is assigned a value but never used. Allowed unused vars must match /^_/u

Check warning on line 23 in pages/dashboard/index.vue

View workflow job for this annotation

GitHub Actions / ci

'pastWinnersError' is assigned a value but never used. Allowed unused vars must match /^_/u

const visible = ref(false)
const createForm = reactive({
Expand Down Expand Up @@ -158,9 +158,9 @@
</div>

<DataTable v-else :value="surveys" table-style="width: 100%;">
<Column field="id" header="ID" style="width: 20%;" />
<Column field="title" header="Title" style="width: 50%" />
<Column field="workshop" header="Type" style="width: 20%">
<Column field="id" header="ID" :sortable="true" style="width: 20%;" />
CATTOLATION marked this conversation as resolved.
Show resolved Hide resolved
<Column field="title" header="Title" :sortable="true" style="width: 50%" />
<Column field="workshop" header="Type" :sortable="true" style="width: 20%">
<template #body="slotProps">
<Badge v-if="slotProps.data.workshop" value="Workshop" />
<Badge v-else value="Booth" severity="warning" />
Expand Down Expand Up @@ -199,10 +199,10 @@
</h3>

<DataTable v-if="pastWinners" :value="pastWinners">
<Column field="id" header="ID" style="width: 30%" />
<Column field="name" header="Name" style="width 20%" />
<Column field="nric" header="NRIC" style="width: 20%" />
<Column field="phone" header="Phone" style="width: 20%" />
<Column field="id" header="ID" :sortable="true" style="width: 30%" />
<Column field="name" header="Name" :sortable="true" style="width: 20%" />
<Column field="nric" header="NRIC" :sortable="true" style="width: 20%" />
<Column field="phone" header="Phone" :sortable="true" style="width: 20%" />
<Column header="Delete" style="width: 10%">
<template #body="slotProps">
<Button label="Delete" size="small" severity="danger" @click="deleteWinner(slotProps.data.id)" />
Expand Down
Loading