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

Mostly working batch #1511

Merged
merged 4 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion frontend/src/assets/styles/batchFileDataTable.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#dataTable.batch-file-table /deep/ table td {
border-bottom: none !important;
background: none;
}
#dataTable.batch-file-table /deep/ table td:nth-child(5),
#dataTable.batch-file-table /deep/ table td:nth-child(8),
Expand All @@ -44,6 +45,7 @@
}
#dataTable.batch-file-table /deep/ table tr.first-active-file td{
border-top: thin solid #d8d8d8;
font-size: 0.85em !important;
}
#dataTable.batch-file-table /deep/ table {
border-top: thin solid #d7d7d7;
Expand All @@ -54,7 +56,7 @@
}
#dataTable.batch-file-table /deep/ table tr.selected-file,
#dataTable.batch-file-table /deep/ table tbody tr:hover {
background-color: #E1F5FE
background-color: #E1F5FE !important;
}
#dataTable.batch-file-table /deep/ table td:nth-child(11),
#dataTable.batch-file-table /deep/ table th:nth-child(11) {
Expand Down
14 changes: 13 additions & 1 deletion frontend/src/components/common/SearchDemographicModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
</v-card-title>
<v-spacer/>
<v-card-text>
<div>{{isValidForm}}</div>
<v-form
ref="searchDemographicModalForm"
v-model="isValidForm"
:model-value="isValidForm"
>
<v-row
density="compact"
Expand Down Expand Up @@ -411,6 +412,7 @@ export default {
watch: {
dialog(newValue) {
this.searchDemographicDialog = newValue;
this.validateForm();
},
searchDemographicDialog(newValue) {
if (!newValue && this.dialog) {
Expand All @@ -421,6 +423,9 @@ export default {
this.student = newValue;
}
},
created(){
this.validateForm();
},
methods: {
formatPostalCode,
formatDob,
Expand Down Expand Up @@ -470,6 +475,13 @@ export default {
return true;
}];
},
async validateForm() {
await this.$nextTick();
if(this.$refs.searchDemographicModalForm){
const isValid = await this.$refs.searchDemographicModalForm?.validate();
this.isValidForm = isValid.valid;
}
},
validateDOB() {
if (!this.student.dob) {
return ['Birth Date is Required.'];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<template>
<v-tooltip right>
<template #activator="{ on }">
<template #activator="{ props }">
<v-icon
small
v-bind="props"
icon="mdi-alert-circle"
color="#FCBA19"
class="mt-n1"
:class="[hasDoubleText ? 'mx-1' : 'ml-2']"
>
fa-exclamation-circle
</v-icon>
</template>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
color="#FCBA19"
class="ml-2"
>
fa-exclamation-circle
mdi-alert-circle
</v-icon>
</v-row>
<v-row>{{ warning.description }}</v-row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
style="width: 100%"
:overlay="false"
>
<v-data-table
<v-data-table-server
id="dataTable"
v-model:page="pageNumber"
v-model:page="currentPageNumber"
:class="[{'filterable-table': hasFilterHeader}, 'batch-file-table']"
:headers="headers"
:items-length="penRequestBatchResponse.length > 0 ? penRequestBatchResponse.totalElements : 0"
:items="penRequestBatchResponse.content"
:items-per-page="penRequestBatchResponse.pageable.pageSize"
hide-default-footer
item-key="penRequestBatchID"
:loading="loadingTable"
@page-count="penRequestBatchResponse.pageable.pageNumber = $event"
>
<template
v-for="h in headers"
Expand All @@ -39,22 +38,23 @@
>
{{ column.text }}
</span>
<template v-if="hasFilterHeader">
<br :key="h.id">
<span
:key="h.id"
:class="column.countable ? 'countable-column-header' : 'file-column'"
>
<v-checkbox
v-if="column.filterName"
v-model="column.isFiltered"
class="file-checkbox filter-checkbox"
hide-details="auto"
color="#606060"
@update:model-value="selectFilter(column)"
/>
</span>
</template>
<v-row :key="h.id" v-if="hasFilterHeader">
<v-col class="d-flex justify-center">
<span
:key="h.id"
:class="column.countable ? 'countable-column-header' : 'file-column'"
>
<v-checkbox
v-if="column.filterName"
v-model="column.isFiltered"
class="file-checkbox filter-checkbox"
hide-details="auto"
color="#606060"
@update:model-value="selectFilter(column)"
/>
</span>
</v-col>
</v-row>
</template>
<template #item="item">
<tr
Expand Down Expand Up @@ -116,10 +116,10 @@
>{{ item.item.raw[header.value] }}</span>
</span>
<PrimaryButton
v-else-if="header.value === 'actions'"
v-else-if="header.value === 'actions'"
:id="hoveredOveredRowBatchID === item.item.raw.penRequestBatchID ? 'more-info-action': ''"
:class="{'file-action': hoveredOveredRowBatchID != item.item.raw.penRequestBatchID}"
short
short
text="More Info"
:disabled="item.item.raw.sagaInProgress"
@click-action="clickMoreInfo"
Expand Down Expand Up @@ -158,12 +158,13 @@
</td>
</tr>
</template>
</v-data-table>
</v-data-table-server>
<Pagination
v-model="pageNumber"
:value="pageNumber"
:data-response="penRequestBatchResponse"
:page-commands="pageCommands"
@page-change="pageChange"
/>
<PenRequestBatchHistoryModal
v-if="historyModalOpen"
Expand All @@ -187,6 +188,7 @@ import Pagination from '@/components/util/Pagination.vue';

export default {
name: 'PenRequestBatchDataTable',
emits: ['update:batchPageNumber','select-filter'],
components: {
PrimaryButton,
Pagination,
Expand Down Expand Up @@ -222,22 +224,24 @@ export default {
type: Array
}
},
data () {
data() {
return {
allSelected: false,
partialSelected: false,
hoveredOveredRowBatchID: null,
historyModalOpen: false,
hoveredOveredRow: null
hoveredOveredRow: null,
currentPageNumber: 1
};
},
computed: {
...mapState(notificationsStore, ['notification']),
pageNumber: {
get(){
get() {
return this.batchPageNumber;
},
set(newPage){
set(newPage) {
this.currentPageNumber = newPage;
return this.$emit('update:batchPageNumber', newPage);
}
},
Expand All @@ -254,7 +258,7 @@ export default {
watch: {
loadingTable: {
handler(v) {
if(!v) {
if (!v) {
const files = this.penRequestBatchResponse.content;
this.allSelected = files?.length > 0 && files?.every(file => file.isSelected);
this.partialSelected = files?.some(file => file.isSelected) && !this.allSelected;
Expand All @@ -268,17 +272,17 @@ export default {
const notificationData = val;
if (notificationData.sagaName === 'PEN_REQUEST_BATCH_ARCHIVE_AND_RETURN_SAGA' && this.inProgressSagaIDs) {
this.inProgressSagaIDs.forEach(sagaObjects => {
if(sagaObjects.sagaID === notificationData.sagaId && notificationData.sagaStatus === 'COMPLETED') {
if (sagaObjects.sagaID === notificationData.sagaId && notificationData.sagaStatus === 'COMPLETED') {
this.setSuccessAlert(`Archive and Return completed for Batch Submission Number ${this.penRequestBatchResponse.content.find(x => x.penRequestBatchID === notificationData.penRequestBatchID).submissionNumber}`);
}
});
}
this.penRequestBatchResponse.content.forEach((x, index) => {
const pageHasObjectsRunningSagas = x.penRequestBatchID === notificationData.penRequestBatchID || (notificationData?.eventPayload && x.penRequestBatchID === JSON.parse(notificationData?.eventPayload)?.penRequestBatchID);
if(pageHasObjectsRunningSagas && notificationData.sagaStatus === 'INITIATED' && notificationData.sagaName === 'PEN_REQUEST_BATCH_ARCHIVE_AND_RETURN_SAGA') {
if (pageHasObjectsRunningSagas && notificationData.sagaStatus === 'INITIATED' && notificationData.sagaName === 'PEN_REQUEST_BATCH_ARCHIVE_AND_RETURN_SAGA') {
x.sagaInProgress = true;
this.selectItem(x);
} else if(pageHasObjectsRunningSagas && notificationData.sagaStatus === 'COMPLETED' && notificationData.sagaName === 'PEN_REQUEST_BATCH_ARCHIVE_AND_RETURN_SAGA') {
} else if (pageHasObjectsRunningSagas && notificationData.sagaStatus === 'COMPLETED' && notificationData.sagaName === 'PEN_REQUEST_BATCH_ARCHIVE_AND_RETURN_SAGA') {
this.penRequestBatchResponse.content.splice(index, 1);
}
});
Expand All @@ -288,14 +292,17 @@ export default {
formatTableColumn(format, column) {
return (format && column) ? format(column) : (column || ' ');
},
pageChange(newPage){
this.pageNumber = newPage;
},
tableRowClass(item) {
let rowClass = [item.firstActiveFile ? 'first-active-file' : 'batch-file'];
(item.isSelected || item.viewMore) && rowClass.push('selected-file');
return rowClass;
},
isUnarchived(item) {
return item.penRequestBatchStatusCode === PEN_REQ_BATCH_STATUS_CODES.UNARCHIVED
|| item.penRequestBatchStatusCode === PEN_REQ_BATCH_STATUS_CODES.UNARCH_CHG;
return item.penRequestBatchStatusCode === PEN_REQ_BATCH_STATUS_CODES.UNARCHIVED
|| item.penRequestBatchStatusCode === PEN_REQ_BATCH_STATUS_CODES.UNARCH_CHG;
},
isUnarchivedBatchChanged(item) {
return item.penRequestBatchStatusCode === PEN_REQ_BATCH_STATUS_CODES.UNARCH_CHG;
Expand Down Expand Up @@ -328,7 +335,7 @@ export default {
auStore.setSelectedFiles(newSelectedFiles);
},
selectItem(item) {
if(!item.sagaInProgress) {
if (!item.sagaInProgress) {
item.isSelected = !item.isSelected;
} else {
item.isSelected = false;
Expand All @@ -345,7 +352,7 @@ export default {
newSelectedFiles = uniqBy(newSelectedFiles, a => a.submissionNumber);
} else {
const unselectedFilesFromCurrentData = this.penRequestBatchResponse.content.filter(file => !file.isSelected);
newSelectedFiles = [ ...this.selectedFiles];
newSelectedFiles = [...this.selectedFiles];
unselectedFilesFromCurrentData.forEach(file => {
newSelectedFiles = newSelectedFiles.filter(item => item.submissionNumber !== file.submissionNumber);
});
Expand All @@ -359,7 +366,7 @@ export default {
handleSubmissionNumberClicked(submissionNumber) {
const batchID = this.penRequestBatchResponse.content.find(file => file.submissionNumber === submissionNumber)?.penRequestBatchID;
const name = this.archived ? 'archivedPrbStudentList' : 'prbStudentList';
const route = router.resolve({name, query: { batchIDs: batchID, statusFilters: '' }});
const route = router.resolve({name, query: {batchIDs: batchID, statusFilters: ''}});
window.open(route.href, '_blank');
},
enableActions(item) {
Expand All @@ -379,30 +386,32 @@ export default {
};
</script>

<style scoped src="@/assets/styles/batchFileDataTable.css"></style>
<style scoped
src="@/assets/styles/batchFileDataTable.css"
></style>
<style scoped>
.submission {
.submission {
text-decoration: underline;
}
}

.file-action {
.file-action {
visibility: hidden;
}
}

:deep(.v-data-table-footer){
:deep(.v-data-table-footer) {
display: none;
}
}

:deep(.v-data-table__th){
:deep(.v-data-table__th) {
font-size: 0.75em !important;
font-weight: bold !important;
}
}

:deep(.batch-file){
font-size: 0.875em;
}
:deep(.batch-file) {
font-size: 0.85em;
}

#dataTable /deep/ table th {
font-size: 0.875rem;
}
#dataTable /deep/ table th {
font-size: 0.85rem;
}
</style>
Loading
Loading