Skip to content

Commit

Permalink
Merge pull request #777 from bcgov/GRAD2-3314
Browse files Browse the repository at this point in the history
Institute event alert updates
  • Loading branch information
shaunlumbcgov authored Feb 28, 2025
2 parents b9fadc0 + d29cf08 commit c854b41
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 79 deletions.
116 changes: 41 additions & 75 deletions frontend/src/components/Admin/InstituteAlerts.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<template>
<div>
<v-card title="Filter Options"
><v-card-text>
<!--TODO: Review this when we implement batch filtering in GRAD2-2553 -->
<v-radio-group
class="mt-6"
v-model="filterOptions.acknowledgeFlag"
inline
@input="getInstituteAlerts"
>
<v-radio label="Unacknowledged" value="N" />
<v-radio label="Acknowledged" value="Y" />
<v-radio label="All" value="All" /> </v-radio-group></v-card-text
></v-card>
<v-data-table-server
v-model:items-per-page="itemsPerPage"
:items-per-page-options="itemsPerPageOptions"
Expand All @@ -17,29 +30,8 @@
<template v-slot:item.subject="{ item }">
<a :href="getPassthroughURL(item)" target="_blank">{{
getPassthroughURLText(item)
}}</a
>&nbsp;
<i>{{ getInstituteEventLabel(item.event.eventType) }}</i>
</template>

<template v-slot:item.acknowledgeFlag="{ item }">
<v-btn
v-if="item.acknowledgeFlag == 'Y'"
class="text-none pointer-events-none"
icon="mdi-check-bold"
color="success"
density="comfortable"
></v-btn>
<v-btn
v-else
class="text-none pointer-events-none"
icon="mdi-minus-thick"
color="primary"
density="comfortable"
disabled
></v-btn>
}}</a>
</template>

<template v-slot:item.updateUser="{ item }">
{{ item.acknowledgeFlag == "Y" ? item.updateUser : "" }}
</template>
Expand Down Expand Up @@ -108,55 +100,13 @@ export default {
{ key: "createDate", title: "Create Date", sortable: false },
{ key: "event.eventType", title: "Alert Event Type", sortable: false },
{ key: "subject", title: "Subject", sortable: false },
{ key: "acknowledgeFlag", title: "Acknowledge", sortable: false },
{ key: "updateUser", title: "IDIR", sortable: false },
{ key: "updateDate", title: "Acknowledge Date", sortable: false },
{ key: "actions", title: "Actions", sortable: false },
],
// these should align with events defined in TRAX API:
// https://github.com/bcgov/EDUC-GRAD-TRAX-API/blob/main/api/src/main/java/ca/bc/gov/educ/api/trax/constant/EventType.java
instituteEvents: [
{ key: "UPDATE_SCHOOL", description: "Update School" },
{ key: "CREATE_SCHOOL", description: "New School" },
{ key: "UPDATE_DISTRICT", description: "Update District" },
{ key: "CREATE_DISTRICT", description: "Create District" },
{ key: "UPDATE_AUTHORITY", description: "Update Authority" },
{ key: "CREATE_AUTHORITY", description: "Create Authority" },
{ key: "GET_AUTHORITY", description: "Get Authority" },
{ key: "GET_PAGINATED_SCHOOLS", description: "Get Paginated Schools" },
{
key: "GET_PAGINATED_AUTHORITIES",
description: "Get Paginated Authorities",
},
{ key: "MOVE_SCHOOL", description: "Move School" },
{ key: "CREATE_SCHOOL_CONTACT", description: "Create School Contact" },
{ key: "UPDATE_SCHOOL_CONTACT", description: "Update School Contact" },
{ key: "DELETE_SCHOOL_CONTACT", description: "Delete School Contact" },
{
key: "CREATE_DISTRICT_CONTACT",
description: "Create District Contact",
},
{
key: "UPDATE_DISTRICT_CONTACT",
description: "Update District Contact",
},
{
key: "DELETE_DISTRICT_CONTACT",
description: "Delete District Contact",
},
{
key: "CREATE_AUTHORITY_CONTACT",
description: "Create Authority Contact",
},
{
key: "UPDATE_AUTHORITY_CONTACT",
description: "Update Authority Contact",
},
{
key: "DELETE_AUTHORITY_CONTACT",
description: "Delete Authority Contact",
},
{ key: "actions", title: "Acknowledge", sortable: false },
],
filterOptions: {
acknowledgeFlag: "N",
},
};
},
created() {
Expand All @@ -178,10 +128,6 @@ export default {
isSchoolActivity(activity) {
return activity.event.eventType.includes("SCHOOL");
},
getInstituteEventLabel(key) {
return this.instituteEvents.find((event) => key === event.key)
?.description;
},
getPassthroughURL(activity) {
if (this.isDistrictActivity(activity)) {
return `${
Expand All @@ -208,11 +154,31 @@ export default {
this.currentPage = page;
this.getInstituteAlerts();
},
// TODO: Review this when we implement batch filtering in GRAD2-2553
getInstituteAlerts: function () {
this.loadingTable = true;
let params = `pageNumber=${this.currentPage - 1}&pageSize=${
this.itemsPerPage
}`;
let params = {
pageNumber: this.currentPage - 1,
pageSize: this.itemsPerPage,
sort: {
createDate: "DEC",
},
searchParams: [],
};
if (this.filterOptions.acknowledgeFlag !== "All") {
params.searchParams.push({
condition: null,
searchCriteriaList: [
{
key: "acknowledgeFlag",
operation: "eq",
value: this.filterOptions.acknowledgeFlag,
valueType: "STRING",
condition: null,
},
],
});
}
// update to pass in page, itemsPerPage, and sortBy
TRAXService.getInstituteEventHistory(params)
.then((response) => {
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/services/TRAXService.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ export default {
getDistrict(district) {
return ApiService.apiAxios.get("/api/v1/trax/district/" + district);
},
// Note: Sort is currently hard coded in the URL, however we'll want to update this when we tackle sorting & filtering in a future ticket
// TODO: Review this when we implement batch filtering in GRAD2-2553
getInstituteEventHistory(params) {
const encodedSortParams = encodeURIComponent(JSON.stringify(params.sort));
const encodedSearchParams = encodeURIComponent(
JSON.stringify(params.searchParams)
);
console.log(params.pageSize);
return ApiService.apiAxios.get(
"/api/v1/trax/event/history/paginated?" +
params +
"&sort=%7B%22createDate%22%3A%22DEC%22%7D"
`/api/v1/trax/event/history/paginated?pageNumber=${params.pageNumber}&pageSize=${params.pageSize}&sort=${encodedSortParams}&searchParams=${encodedSearchParams}`
);
},
putInstituteEventHistory(json) {
Expand Down

0 comments on commit c854b41

Please sign in to comment.