@@ -14,14 +14,13 @@ q-page.container
1414 :fieldsList ="fieldsList"
1515 :selected ="selected"
1616 :pending ="pending"
17+ :pagination ="pagination"
1718 :refresh ="refreshEvent"
1819 :error ="error"
1920 :titleKey =[" username" ]
2021 :crud ="crud"
2122 :actions ="actions"
2223 :defaultRightPanelButton ="true"
23- hide-pagination
24- hidePanModeSwitch
2524 )
2625 //- template(#top-left)
2726 //- sesame-table-top-left(:selected="selected" @updateLifestep="updateLifestep($event)" @clear="selected = []")
@@ -72,16 +71,16 @@ const $q = useQuasar()
7271const { handleError } = useErrorHandling ()
7372const form = ref <any >(null )
7473
75- // onMounted(() => {
76- // // initializePagination(agents.value?.total)
77- // })
74+ onMounted (() => {
75+ initializePagination (agents .value ?.total )
76+ })
7877
79- // const { pagination, onRequest, initializePagination } = usePagination()
78+ const { pagination, onRequest, initializePagination } = usePagination ()
8079
81- // const queryWithoutRead = computed(() => {
82- // const { read, ...rest } = route.query
83- // return rest
84- // })
80+ const queryWithoutRead = computed (() => {
81+ const { read, ... rest } = route .query
82+ return rest
83+ })
8584
8685const {
8786 data : agents,
@@ -90,9 +89,10 @@ const {
9089 error,
9190} = await useHttp <Response >(' /core/agents' , {
9291 method: ' get' ,
93- query: {
94- limit: 99999 ,
95- },
92+ query: queryWithoutRead ,
93+ // query: {
94+ // limit: 99999,
95+ // },
9696})
9797
9898if (error .value ) {
@@ -105,7 +105,7 @@ if (error.value) {
105105const columns = ref <QTableProps [' columns' ]>([
106106 {
107107 name: ' username' ,
108- label: ' Nom d\ ' utilisateur' ,
108+ label: " Nom d'utilisateur" ,
109109 field : (row : Agent ) => row .username ,
110110 align: ' left' ,
111111 sortable: true ,
@@ -124,11 +124,7 @@ const columns = ref<QTableProps['columns']>([
124124 align: ' left' ,
125125 },
126126])
127- const visibleColumns = ref <QTableProps [' visibleColumns' ]>([
128- ' username' ,
129- ' email' ,
130- ' actions' ,
131- ])
127+ const visibleColumns = ref <QTableProps [' visibleColumns' ]>([' username' , ' email' , ' actions' ])
132128const columnsType = ref ([
133129 { name: ' username' , type: ' text' },
134130 { name: ' email' , type: ' text' },
@@ -171,20 +167,24 @@ const actions = {
171167 validations .value = {}
172168 },
173169 create : async (row : Agent ) => {
174-
175170 // console.log('row', row)
176171
177172 const sanitizedAgent = { ... row }
178173 delete sanitizedAgent .metadata
179174
180- const { data : result, pending, error, refresh } = await useHttp (` /core/agents ` , {
175+ const {
176+ data : result,
177+ pending,
178+ error,
179+ refresh,
180+ } = await useHttp (` /core/agents ` , {
181181 method: ' POST' ,
182182 body: { ... sanitizedAgent },
183- });
183+ })
184184 if (error .value ) {
185185 handleError ({
186186 error: error .value ,
187- message: ' Erreur lors de la création'
187+ message: ' Erreur lors de la création' ,
188188 })
189189 validations .value = error .value .data .validations
190190 } else {
@@ -201,14 +201,19 @@ const actions = {
201201 const sanitizedAgent = { ... row }
202202 delete sanitizedAgent .metadata
203203
204- const { data : result, pending, error, refresh } = await useHttp (` /core/agents/${row ._id } ` , {
204+ const {
205+ data : result,
206+ pending,
207+ error,
208+ refresh,
209+ } = await useHttp (` /core/agents/${row ._id } ` , {
205210 method: ' PATCH' ,
206211 body: sanitizedAgent ,
207- });
212+ })
208213 if (error .value ) {
209214 handleError ({
210215 error: error .value ,
211- message: ' Erreur lors de la sauvegarde'
216+ message: ' Erreur lors de la sauvegarde' ,
212217 })
213218 validations .value = error .value .data .validations
214219 } else {
@@ -224,7 +229,7 @@ const actions = {
224229 delete : async (row : Agent ) => {
225230 $q .dialog ({
226231 dark: true ,
227- title: ' Suppresion d\ ' un l\ ' agent' ,
232+ title: " Suppresion d'un l'agent" ,
228233 message: ` Vous êtes sur le point de supprimer l\' agent <b>${row .username }</b>. Êtes-vous sûr ? ` ,
229234 persistent: true ,
230235 html: true ,
@@ -239,9 +244,14 @@ const actions = {
239244 label: ' Annuler' ,
240245 },
241246 }).onOk (async () => {
242- const { data : result, pending, error, refresh } = await useHttp (` /core/agents/${row ._id } ` , {
247+ const {
248+ data : result,
249+ pending,
250+ error,
251+ refresh,
252+ } = await useHttp (` /core/agents/${row ._id } ` , {
243253 method: ' DELETE' ,
244- });
254+ })
245255 if (error .value ) {
246256 handleError ({
247257 error: error .value ,
@@ -256,7 +266,6 @@ const actions = {
256266 icon: ' mdi-check-circle-outline' ,
257267 })
258268 }
259-
260269 })
261270 return row
262271 },
@@ -282,8 +291,7 @@ const actions = {
282291 // }
283292 }
284293 return null
285- }
286-
294+ },
287295}
288296
289297const fieldsList = computed (() => {
0 commit comments