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

#2741 - Ministry Filter: Search Programs & Offerings [Data Table Conversion to Vuetify] #3805

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions sources/packages/web/src/types/contracts/DataTableContract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,14 @@ export const ApplicationRestrictionManagementHeaders = [
key: "removeBypassRule",
},
];
/**
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
* Program Headers.
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
*/
export const ProgramHeaders = [
{ title: "Date Submitted", sortable: true, key: "submittedDate" },
{ title: "Program Name", sortable: true, key: "programName" },
{ title: "Location", sortable: true, key: "locationName" },
{ title: "Study Periods", sortable: false, key: "totalOfferings" },
{ title: "Status", sortable: true, key: "programStatus" },
{ title: "Action", sortable: false, key: "action" },
];
110 changes: 32 additions & 78 deletions sources/packages/web/src/views/aest/institution/Programs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
density="compact"
v-model="searchProgramName"
label="Search Program Name"
data-cy="searchProgramName"
variant="outlined"
@keyup.enter="goToSearchProgramName()"
prepend-inner-icon="mdi-magnify"
Expand All @@ -21,77 +20,44 @@
</body-header>
</template>
<content-group>
<DataTable
:value="institutionProgramsSummary.results"
:lazy="true"
:paginator="true"
:rows="DEFAULT_PAGE_LIMIT"
:rowsPerPageOptions="PAGINATION_LIST"
:totalRecords="institutionProgramsSummary.count"
@page="pageSortEvent($event)"
@sort="pageSortEvent($event)"
:loading="loading"
<toggle-content
:toggled="!loading && !institutionProgramsSummary.count"
message="No records found."
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
>
<template #empty>
<p class="text-center font-weight-bold">No records found.</p>
</template>
<Column
:field="ProgramSummaryFields.SubmittedDate"
header="Date Submitted"
:sortable="true"
<v-data-table
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
:headers="ProgramHeaders"
:items="institutionProgramsSummary.results"
:items-per-page="DEFAULT_PAGE_LIMIT"
:items-per-page-options="ITEMS_PER_PAGE"
:loading="loading"
>
<template #body="slotProps">
<div class="p-text-capitalize">
{{ slotProps.data.submittedDateFormatted }}
</div>
<template #[`item.submittedDate`]="{ item }">
{{ item.submittedDateFormatted }}
</template>
</Column>
<Column
:field="ProgramSummaryFields.ProgramName"
header="Program Name"
>
<template #body="slotProps">
<div class="p-text-capitalize">
{{ slotProps.data.programName }}
</div>
<template #[`item.programName`]="{ item }">
{{ item.programName }}
</template>
</Column>
<Column :field="ProgramSummaryFields.LocationName" header="Location">
<template #body="slotProps">
<div class="p-text-capitalize">
{{ slotProps.data.locationName }}
</div>
<template #[`item.locationName`]="{ item }">
{{ item.locationName }}
</template>
</Column>
<Column
:field="ProgramSummaryFields.TotalOfferings"
header="Study periods"
>
</Column>
<Column :field="ProgramSummaryFields.ProgramStatus" header="Status"
><template #body="slotProps">
<template #[`item.totalOfferings`]="{ item }">
{{ item.totalOfferings }}
</template>
<template #[`item.programStatus`]="{ item }">
<status-chip-program
:status="slotProps.data.programStatus"
:is-active="
slotProps.data.isActive && !slotProps.data.isExpired
"
></status-chip-program> </template
></Column>
<Column header="Action">
<template #body="slotProps">
:status="item.programStatus"
:is-active="item.isActive && !item.isExpired"
></status-chip-program>
</template>
<template #[`item.action`]="{ item }">
<v-btn
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
variant="outlined"
@click="
goToViewProgramDetail(
slotProps.data.programId,
slotProps.data.locationId,
)
"
@click="goToViewProgramDetail(item.programId, item.locationId)"
>View</v-btn
>
</template>
</Column>
</DataTable>
</v-data-table>
</toggle-content>
</content-group>
</body-header-container>
</tab-container>
Expand All @@ -104,11 +70,11 @@ import {
DataTableSortOrder,
ProgramSummaryFields,
DEFAULT_PAGE_NUMBER,
PAGINATION_LIST,
DEFAULT_PAGE_LIMIT,
PaginatedResults,
EducationProgramsSummary,
LayoutTemplates,
ProgramHeaders,
ITEMS_PER_PAGE,
} from "@/types";
import { AESTRoutesConst } from "@/constants/routes/RouteConstants";
import StatusChipProgram from "@/components/generic/StatusChipProgram.vue";
Expand All @@ -129,7 +95,7 @@ export default defineComponent({
);
const searchProgramName = ref("");
const currentPageSize = ref();
const loading = ref(false);
const loading = ref(true);

const getProgramsSummaryList = async (
institutionId: number,
Expand Down Expand Up @@ -175,17 +141,6 @@ export default defineComponent({
},
});
};
const pageSortEvent = async (event: any) => {
andrewsignori-aot marked this conversation as resolved.
Show resolved Hide resolved
currentPageSize.value = event?.rows;
await getProgramsSummaryList(
props.institutionId,
event.rows,
event.page,
searchProgramName.value,
event.sortField,
event.sortOrder,
);
};
const goToSearchProgramName = async () => {
await getProgramsSummaryList(
props.institutionId,
Expand All @@ -198,13 +153,12 @@ export default defineComponent({
institutionProgramsSummary,
goToViewProgramDetail,
DEFAULT_PAGE_LIMIT,
pageSortEvent,
goToSearchProgramName,
searchProgramName,
loading,
ProgramSummaryFields,
PAGINATION_LIST,
LayoutTemplates,
ProgramHeaders,
ITEMS_PER_PAGE,
};
},
});
Expand Down