Skip to content

Commit edd5ca4

Browse files
Update table columns
1 parent 7e58a83 commit edd5ca4

1 file changed

Lines changed: 85 additions & 14 deletions

File tree

resources/js/admin/cases-retention/components/CasesRetentionLogs.vue

Lines changed: 85 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,35 @@
3131
<span v-uni-id="props.rowData.id.toString()">{{ props.rowData.process_id }}</span>
3232
</template>
3333
<template
34-
slot="case_id"
34+
slot="case_ids"
3535
slot-scope="props"
3636
>
37-
<span v-uni-id="`case-id-${props.rowData.id}`">{{ props.rowData.case_id }}</span>
37+
<span v-uni-id="`case-id-${props.rowData.id}`">{{ props.rowData.case_ids.join(', ') }}</span>
38+
</template>
39+
<template
40+
slot="deleted_count"
41+
slot-scope="props"
42+
>
43+
{{ props.rowData.deleted_count }}
44+
</template>
45+
<template
46+
slot="total_time_taken"
47+
slot-scope="props"
48+
>
49+
{{ props.rowData.total_time_taken }}
3850
</template>
3951
<template
4052
slot="deleted_at"
4153
slot-scope="props"
4254
>
4355
{{ formatDate(props.rowData.deleted_at) }}
4456
</template>
57+
<template
58+
slot="created_at"
59+
slot-scope="props"
60+
>
61+
{{ formatDate(props.rowData.created_at) }}
62+
</template>
4563
</vuetable>
4664
<pagination
4765
ref="pagination"
@@ -65,41 +83,51 @@ const uniqIdsMixin = createUniqIdsMixin();
6583
6684
/**
6785
* Fake data matching retention_policy_logs schema until the table/API exists.
68-
* - id, process_id, case_id (single or serialized list), deleted_at, created_at
86+
* - id, process_id, case_ids (array of case IDs), deleted_at, created_at
6987
*/
7088
const FAKE_RETENTION_LOGS = [
7189
{
7290
id: 1,
7391
process_id: 101,
74-
case_id: 5001,
92+
case_ids: [5001],
93+
deleted_count: 1,
94+
total_time_taken: 1000,
7595
deleted_at: "2025-03-01T14:30:00.000000Z",
7696
created_at: "2025-03-01T14:30:05.000000Z",
7797
},
7898
{
7999
id: 2,
80100
process_id: 101,
81-
case_id: 5002,
101+
case_ids: [500, 501, 502],
102+
deleted_count: 3,
103+
total_time_taken: 1000,
82104
deleted_at: "2025-03-02T09:15:00.000000Z",
83105
created_at: "2025-03-02T09:15:02.000000Z",
84106
},
85107
{
86108
id: 3,
87109
process_id: 204,
88-
case_id: 7003,
110+
case_ids: [7003],
111+
deleted_count: 1,
112+
total_time_taken: 1000,
89113
deleted_at: "2025-03-03T16:45:00.000000Z",
90114
created_at: "2025-03-03T16:45:10.000000Z",
91115
},
92116
{
93117
id: 4,
94118
process_id: 305,
95-
case_id: 8010,
119+
case_ids: [8010],
120+
deleted_count: 1,
121+
total_time_taken: 1000,
96122
deleted_at: "2025-03-04T11:00:00.000000Z",
97123
created_at: "2025-03-04T11:00:01.000000Z",
98124
},
99125
{
100126
id: 5,
101127
process_id: 204,
102-
case_id: 7005,
128+
case_ids: [7005],
129+
deleted_count: 1,
130+
total_time_taken: 1000,
103131
deleted_at: "2025-03-05T08:22:00.000000Z",
104132
created_at: "2025-03-05T08:22:03.000000Z",
105133
},
@@ -126,20 +154,39 @@ export default {
126154
title: () => this.$t("Process ID"),
127155
name: "__slot:process_id",
128156
sortField: "process_id",
129-
width: "33%",
157+
width: "16.66%",
158+
},
159+
{
160+
title: () => this.$t("Case IDs"),
161+
name: "__slot:case_ids",
162+
sortField: "case_ids",
163+
width: "16.66%",
164+
},
165+
{
166+
title: () => this.$t("Deleted Count"),
167+
name: "__slot:deleted_count",
168+
sortField: "deleted_count",
169+
width: "16.66%",
130170
},
131171
{
132-
title: () => this.$t("Case ID"),
133-
name: "__slot:case_id",
134-
sortField: "case_id",
135-
width: "33%",
172+
title: () => this.$t("Total Time Taken (ms)"),
173+
name: "__slot:total_time_taken",
174+
sortField: "total_time_taken",
175+
width: "16.66%",
136176
},
137177
{
138178
title: () => this.$t("Deleted At"),
139179
name: "__slot:deleted_at",
140180
sortField: "deleted_at",
141181
callback: "formatDate",
142-
width: "33%",
182+
width: "16.66%",
183+
},
184+
{
185+
title: () => this.$t("Created At"),
186+
name: "__slot:created_at",
187+
sortField: "created_at",
188+
callback: "formatDate",
189+
width: "16.66%",
143190
},
144191
],
145192
};
@@ -172,6 +219,30 @@ export default {
172219
reload() {
173220
this.fetch();
174221
},
222+
changePerPage(value) {
223+
this.perPage = value;
224+
if (this.page * value > this.$refs.pagination.tablePagination.total) {
225+
this.page = Math.floor(this.$refs.pagination.tablePagination.total / value) + 1;
226+
}
227+
this.fetch();
228+
},
229+
onPageChange(page) {
230+
if (page == "next") {
231+
this.page = this.page + 1;
232+
} else if (page == "prev") {
233+
this.page = this.page - 1;
234+
} else {
235+
this.page = page;
236+
}
237+
if (this.page <= 0) {
238+
this.page = 1;
239+
}
240+
let meta = this.$refs.pagination.tablePagination;
241+
if (this.page > meta.last_page) {
242+
this.page = meta.last_page;
243+
}
244+
this.fetch();
245+
},
175246
},
176247
};
177248
</script>

0 commit comments

Comments
 (0)