Skip to content

Commit 82d9ba7

Browse files
committed
Squashed commit of the following:
commit f8bcd6e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 18:34:43 2023 +0200 Update auth.service.ts commit 91c206c Merge: ef69bd6 6d0ef48 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 18:12:43 2023 +0200 Merge branch 'app-developement' of https://github.com/Libertech-FR/teaket into app-developement commit 6d0ef48 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 18:06:22 2023 +0200 FIX makefile action name commit ef69bd6 Merge: 3eaa4d1 d475193 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:52:59 2023 +0200 Merge pull request #12 from Libertech-FR/authentication Authentication commit d475193 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:51:40 2023 +0200 WIP auth expire commit 4136afc Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 17:47:23 2023 +0200 WIP auth commit 3eaa4d1 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:50:39 2023 +0200 refactor searchFields commit 1f6f55b Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:49:55 2023 +0200 fix metadata schema name + optionnal commit 146fec5 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 17:48:57 2023 +0200 populate script commit bb1080a Merge: e7b69d8 7b8103e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:37:19 2023 +0200 Merge pull request #11 from Libertech-FR/authentication Authentication commit 7b8103e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:36:08 2023 +0200 Delete .env commit a4787db Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Mon Sep 11 11:26:05 2023 +0200 WIP auth commit 38d3637 Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:55:01 2023 +0200 FIX useless console log commit 41dda1b Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:34:34 2023 +0200 WIP auth system commit 6d3327a Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 17:33:56 2023 +0200 FIX use api fetch commit e7b69d8 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Mon Sep 11 11:24:10 2023 +0200 remove updateQuery commit db000a7 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Fri Sep 8 18:12:40 2023 +0200 Pagination + filters commit e792c1f Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 19:38:57 2023 +0200 add metadata dto change custom fields dto commit 1227c58 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 19:38:34 2023 +0200 Add filters commit 42f4739 Merge: 59b27ef 9056314 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Thu Sep 7 09:11:13 2023 +0200 Merge branch 'app-developement' of https://github.com/Libertech-FR/teaket into app-developement commit 59b27ef Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:54 2023 +0200 create ticket add vueuse commit bdedc9e Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:32 2023 +0200 Layout commit 9056314 Merge: d48f3bd 729794e Author: Tacx <12997062+tacxou@users.noreply.github.com> Date: Thu Sep 7 02:46:30 2023 +0200 Merge branch 'main' into app-developement commit d48f3bd Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:54 2023 +0200 create ticket add vueuse commit ae9f263 Author: RICHARD-Quentin <56677909+RICHARD-Quentin@users.noreply.github.com> Date: Wed Sep 6 17:54:32 2023 +0200 Layout
1 parent c90cc9a commit 82d9ba7

File tree

8 files changed

+281
-432
lines changed

8 files changed

+281
-432
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ buildseeds: ## Build populate image
3030
docker build -t seeding -f ./populate/Dockerfile ./populate
3131

3232
populate-db: ## Populate database
33-
docker run --rm --network dev -v ./populate:/app -v ./service/.dev-token.json:/app/.dev-token.json seeding
33+
docker run --rm --network dev -v ./populate:/app -v ./service/.dev-token.json:/app/.dev-token.json seeding

app/src/components/appbar/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
q-header
33
q-toolbar.bg-primary.text-white(style={height: '32px'})
44
q-btn(flat)
5-
q-avatar
5+
q-avatar
66
img(src="/logo.svg")
77
q-toolbar-title Teaket
88
q-separator(vertical dark inset).q-mx-md
99
tk-AppbarMenu
10-
q-space
10+
q-space
1111
tk-AppbarSearchfield
1212
q-separator(vertical dark inset).q-mx-md
1313
tk-AppbarRightButtons
1414
</template>
1515

1616
<script lang="ts" setup>
17-
</script>
17+
</script>
Lines changed: 7 additions & 185 deletions
Original file line numberDiff line numberDiff line change
@@ -1,194 +1,16 @@
11
<template lang="pug">
22
q-select(
3-
:options="options"
4-
multiple
5-
emit-value
6-
map-options
7-
:model-value="filters"
8-
:option-value="(item) => item"
9-
:label="`Etats: ${filters.length} filtre(s) appliqué(s)`"
10-
options-dense
11-
use-chips
12-
hide-selected
13-
@add="addFilter($event)"
14-
@remove="removeFilter($event)"
3+
:options="lifeSteps"
154
)
16-
template(v-slot:option="{ itemProps, opt, selected, toggleOption }")
17-
q-item-label(v-bind="itemProps" v-if="opt.header" header) {{ opt.label }}
18-
q-item(v-bind="itemProps" v-else)
19-
q-item-section(side)
20-
q-icon(:name="opt.icon" :color="opt.color" size="xs")
21-
q-item-section
22-
q-item-label(v-html="opt.label")
23-
q-item-section(side)
24-
q-toggle(:model-value="selected" @update:model-value="toggleOption")
25-
265
</template>
276

287
<script lang="ts" setup>
29-
import { ref, computed, onMounted, watch, inject } from 'vue'
30-
import type { Ref } from 'vue'
8+
import { ref } from 'vue'
319
import { useHttpApi } from "~/composables/useHttpApi";
32-
import type { components } from '#build/types/service-api'
33-
import { useRoute, useRouter } from 'nuxt/app';
34-
35-
type Category = components['schemas']['CategoriesDto']
36-
type State = components['schemas']['StatesDto']
37-
38-
type Option = {
39-
label: string
40-
value?: string
41-
group?: string
42-
header?: boolean
43-
icon?: string
44-
color?: string
45-
}
46-
const route = useRoute()
47-
const router = useRouter()
48-
49-
const { data: statesData } = inject('stateFetch')
50-
const { data: categoriesData } = inject('categoriesFetch')
51-
const ticketType: {
52-
label: string,
53-
value: number,
54-
icon: string,
55-
color: string
56-
}[] | undefined = inject('ticketType')
57-
onMounted(() => {
58-
getFilters()
59-
})
60-
61-
watch(() => route.query, () => {
62-
filters.value = []
63-
getFilters()
64-
})
65-
66-
const getFilters = () => {
67-
const query = { ...route.query }
68-
for (const key in query) {
69-
if (key.startsWith('filters[@') && query[key] !== null) {
70-
const values = query[key]
71-
if (Array.isArray(values)) {
72-
for (const value of values) {
73-
const option = options.value.find(option => option.value === value)
74-
if (option) {
75-
filters.value.push(option)
76-
}
77-
}
78-
} else {
79-
const option = options.value.find(option => option.value === values)
80-
if (option) {
81-
filters.value.push(option)
82-
}
83-
}
84-
}
85-
}
86-
}
87-
88-
89-
const filters = ref<Option[]>([])
90-
const lifeSteps = ref<Option[]>([
91-
{ label: 'Lifestep', header: true },
92-
{ label: 'Ouvert', value: '1', group: 'lifestep', icon: 'mdi-circle', color: "green" },
93-
{ label: 'Clos', value: '0', group: 'lifestep', icon: 'mdi-circle', color: "red" },
94-
])
95-
96-
const options = computed(() => {
97-
// const categories: Option[] = categoriesData.value.data.map((category: Category) => {
98-
// return {
99-
// label: category.name,
100-
// value: category._id,
101-
// group: 'categories'
102-
// }
103-
// }) ?? []
104-
// categories.unshift({ label: 'Catégories', header: true })
105-
const ticketTypeOptions: Option[] = ticketType.value.map((type) => {
106-
return {
107-
label: type.label,
108-
value: type.value.toString(),
109-
group: 'type',
110-
icon: type.icon,
111-
color: type.color
112-
}
113-
})
114-
ticketTypeOptions.unshift({ label: 'Types', header: true })
115-
const states: Option[] = statesData.value.data.map((state: State) => {
116-
return {
117-
label: state.name,
118-
value: state._id,
119-
group: 'state.id',
120-
icon: state.icon ?? '',
121-
color: state.color ?? ''
122-
}
123-
}) ?? []
124-
states.unshift({ label: 'États', header: true })
125-
return [
126-
...lifeSteps.value,
127-
...ticketTypeOptions,
128-
// ...categories,
129-
...states
130-
]
131-
})
132-
133-
const regroupFilters = async () => {
134-
return filters.value.reduce((acc: any, filter: Option) => {
135-
const key = `filters[@${filter.group}]`
136-
if (!acc[key]) {
137-
acc[key] = []
138-
}
139-
acc[key].push(filter.value)
140-
return acc
141-
}, {})
142-
}
143-
144-
const pushQuery = async () => {
145-
const query = { ...route.query };
146-
const regroupedFilters = await regroupFilters();
147-
148-
const keysToDelete = new Set<string>();
149-
150-
for (const key in query) {
151-
if (key.startsWith('filters[@')) {
152-
keysToDelete.add(key);
153-
}
154-
}
155-
156-
keysToDelete.forEach((keyToDelete) => {
157-
delete query[keyToDelete];
158-
});
159-
160-
for (const key in regroupedFilters) {
161-
const values = regroupedFilters[key];
162-
const length = values.length;
163-
164-
if (length === 1) {
165-
query[`${key}[]`] = values;
166-
} else {
167-
const keyWithBrackets = `${key}[]`;
168-
if (query[keyWithBrackets]) {
169-
delete query[keyWithBrackets];
170-
}
171-
query[key] = values;
172-
}
173-
}
174-
175-
router.push({
176-
query
177-
})
178-
};
179-
180-
const addFilter = (option: { index: number, value: Option }) => {
181-
filters.value.push(option.value)
182-
pushQuery()
183-
}
184-
185-
186-
const removeFilter = (option: { index: number, value: Option }) => {
187-
filters.value.splice(option.index, 1)
188-
pushQuery()
189-
}
10+
const { data, pending, error, refresh } = useHttpApi('core/categories')
11+
const lifeSteps = [
12+
{ label: 'Ouvert', value: 1 },
13+
{ label: 'Clos', value: 0 },
14+
]
19015
191-
defineExpose({
192-
options,
193-
})
19416
</script>

0 commit comments

Comments
 (0)