Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
arcshiftsolutions committed Dec 19, 2023
2 parents eb2c9b7 + fb60d07 commit 602e20c
Show file tree
Hide file tree
Showing 12 changed files with 97 additions and 79 deletions.
26 changes: 23 additions & 3 deletions backend/src/components/institute/institute.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
const { logApiError, getData, errorResponse } = require('../utils');
const { logApiError, getData, errorResponse} = require('../utils');
const HttpStatus = require('http-status-codes');
const cacheService = require('../cache-service');
const {FILTER_OPERATION, VALUE_TYPE, CONDITION} = require('../../util/constants');
Expand Down Expand Up @@ -1026,8 +1026,28 @@ async function getSchoolHistoryPaginated(req, res) {
searchCriteriaList: JSON.stringify(historySearchCriteria)
}
};
let response = await getData(config.get('server:institute:rootURL') + '/school/history/paginated', schoolHistorySearchParam);
return res.status(HttpStatus.OK).json(response);

Promise.all([
getData(config.get('server:edx:edxUsersURL')),
getData(config.get('server:institute:rootURL') + '/school/history/paginated', schoolHistorySearchParam)
])
.then(async ([edxUserResponse, schoolHistoryResponse]) => {
if (edxUserResponse && schoolHistoryResponse) {
schoolHistoryResponse.content.forEach((element) => {
if(element.updateUser?.length > 10){
let val = edxUserResponse.find(user => user.edxUserID === element.updateUser.replace('EDX/', ''));
if(val){
element.updateUser = (val.firstName + ' ' + val.lastName).trim();
}
}
});

return res.status(HttpStatus.OK).json(schoolHistoryResponse);
}
}).catch(async e => {
await logApiError(e, 'getSchoolsPaginated', 'Error occurred while attempting to GET schools paginated.');
return errorResponse(res);
});
} catch (e) {
logApiError(e, 'getSchoolsPaginated', 'Error occurred while attempting to GET schools paginated.');
return errorResponse(res);
Expand Down
36 changes: 24 additions & 12 deletions frontend/src/components/institute/MoveSchoolPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -352,14 +352,16 @@
no-gutters
class="pt-4"
>
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
density="compact"
label="Same as Mailing Address"
class="mt-n3 pt-0"
@update:model-value="fireFormValidate"
/>
<v-col cols="4">
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
density="compact"
label="Same as Mailing Address"
class="mt-n3 pt-0"
@update:model-value="fireFormValidate"
/>
</v-col>
</v-row>
<v-row
v-else
Expand Down Expand Up @@ -450,7 +452,7 @@
no-gutters
class="pt-4"
>
<v-col>
<v-col cols="4">
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
Expand Down Expand Up @@ -598,12 +600,22 @@ export default {
},
schoolCategoryTypeCodes() {
let returnedCodes = [];
let publicOnlyTypes = this.activeSchoolCategoryTypeCodes ? this.activeSchoolCategoryTypeCodes.filter(cat => !this.independentArray.includes(cat.schoolCategoryCode) && !this.offshoreArray.includes(cat.schoolCategoryCode) && cat.schoolCategoryCode !== 'YUKON') : [];
if(this.canMoveOtherSchoolTypes) {
let publicOnlyTypes = this.activeSchoolCategoryTypeCodes
? this.activeSchoolCategoryTypeCodes
.filter(cat =>
!this.independentArray.includes(cat.schoolCategoryCode)
&& !this.offshoreArray.includes(cat.schoolCategoryCode)
&& cat.schoolCategoryCode !== 'YUKON'
&& cat.schoolCategoryCode !== 'POST_SEC'
)
: [];
if (this.canMoveOtherSchoolTypes) {
returnedCodes = publicOnlyTypes;
}
if (this.canMoveIndependentSchools) {
returnedCodes = returnedCodes.concat(this.activeSchoolCategoryTypeCodes.filter(cat => this.independentArray.includes(cat.schoolCategoryCode)));
returnedCodes = returnedCodes
.concat(this.activeSchoolCategoryTypeCodes
.filter(cat => this.independentArray.includes(cat.schoolCategoryCode)));
}
return sortBy(returnedCodes, ['displayOrder']);
},
Expand Down
20 changes: 11 additions & 9 deletions frontend/src/components/institute/NewSchoolPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,16 @@
no-gutters
class="pt-4"
>
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
dense
label="Same as Mailing Address"
class="mt-n3 pt-0"
@update:model-value="combobulatePhysicalAddress"
/>
<v-col cols="4">
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
dense
label="Same as Mailing Address"
class="mt-n3 pt-0"
@update:model-value="combobulatePhysicalAddress"
/>
</v-col>
</v-row>
<div v-else>
<v-row>
Expand Down Expand Up @@ -447,7 +449,7 @@
no-gutters
class="pt-4"
>
<v-col>
<v-col cols="4">
<v-checkbox
id="sameAsMailingCheckbox"
v-model="sameAsMailingCheckbox"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class="pt-0"
item-value="schoolContactTypeCode"
label="School Contact Type"
@update:model-value="validateForm"
/>
<v-text-field
id="editSchoolContactFirstNameInput"
Expand Down Expand Up @@ -63,7 +64,7 @@
<v-text-field
id="editSchoolContactPhoneNumberInput"
v-model="editContact.phoneNumber"
:rules="[rules.required(), rules.phoneNumber()]"
:rules="[rules.requiredIf(isOffshoreContact), rules.phoneNumber()]"
class="pt-0"
variant="underlined"
:maxlength="10"
Expand Down Expand Up @@ -188,20 +189,28 @@ export default {
schoolID: {
type: String,
required: true
},
school: {
type: Object,
required: true
}
},
emits: ['editSchoolContact:editSchoolContactSuccess', 'editSchoolContact:cancelEditSchoolContactPage'],
data() {
let clonedContact = _.cloneDeep(this.contact);
return {
isFormValid: false,
offshoreContactTypes: ['PRINCIPAL','VPRINCIPAL','STUDREGIS'],
processing: false,
editContact: clonedContact,
rules: Rules
};
},
computed: {
...mapState(authStore, ['isAuthenticated', 'userInfo']),
isOffshoreContact(){
return !(this.offshoreContactTypes.includes(this.editContact?.schoolContactTypeCode) && this.school.schoolCategoryCode === 'OFFSHORE');
}
},
mounted() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
class="pt-0"
item-value="schoolContactTypeCode"
label="School Contact Type"
@update:model-value="validateForm"
/>
<v-text-field
id="newContactFirstNameInput"
Expand Down Expand Up @@ -63,7 +64,7 @@
<v-text-field
id="newContactPhoneNumberInput"
v-model="newContact.phoneNumber"
:rules="[rules.required(), rules.phoneNumber()]"
:rules="[rules.requiredIf(isOffshoreContact), rules.phoneNumber()]"
class="pt-0"
variant="underlined"
:maxlength="10"
Expand Down Expand Up @@ -182,12 +183,17 @@ export default {
schoolID: {
type: String,
required: true
},
school: {
type: Object,
required: true
}
},
data() {
return {
isFormValid: false,
processing: false,
offshoreContactTypes: ['PRINCIPAL','VPRINCIPAL','STUDREGIS'],
newContact: {
schoolContactTypeCode: null,
firstName: null,
Expand All @@ -206,6 +212,9 @@ export default {
},
computed: {
...mapState(authStore, ['isAuthenticated', 'userInfo']),
isOffshoreContact(){
return !(this.offshoreContactTypes.includes(this.newContact?.schoolContactTypeCode) && this.school.schoolCategoryCode === 'OFFSHORE');
}
},
mounted() {
this.validateForm();
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/institute/common/SchoolContacts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
v-if="newContactSheet"
:school-contact-types="schoolContactTypes"
:school-i-d="$route.params.schoolID"
:school="school"
@newSchoolContact:closeNewSchoolContactPage="newContactSheet = !newContactSheet"
@newSchoolContact:addNewSchoolContact="newSchoolContactAdded"
/>
Expand All @@ -137,6 +138,7 @@
:contact="editContact"
:school-contact-types="schoolContactTypes"
:school-i-d="$route.params.schoolID"
:school="school"
@editSchoolContact:cancelEditSchoolContactPage="editContactSheet = !editContactSheet"
@editSchoolContact:editSchoolContactSuccess="contactEditSuccess"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
item-value="districtContactTypeCode"
:menu-props="{closeOnContentClick:true}"
label="Contact Type"
@update:model-value="searchButtonClicked"
/>
</v-col>
<v-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,29 +173,12 @@
</v-col>
</v-row>
<ConfirmationDialog ref="fixableConfirmationDialog">
<template #title="{cancel}">
<v-row
justify="space-between"
no-gutters
>
<v-col class="pl-4 pt-4">
{{ archiveAndReturnMessage }}<br><br>
{{ archiveAndReturnSubtext }}
</v-col>
<v-btn
id="closeBtn"
variant="flat"
icon
@click-action="cancel"
>
<v-icon color="#38598A">
mdi-close
</v-icon>
</v-btn>
</v-row>
<template #message>
{{ archiveAndReturnMessage }}<br><br>
{{ archiveAndReturnSubtext }}
</template>
</ConfirmationDialog>
<ConfirmationDialog ref="confirmationDialog"/>
<ConfirmationDialog ref="confirmationDialog" />
</v-container>
</template>

Expand Down Expand Up @@ -398,7 +381,7 @@ export default {
const fileNumber = this.selectedFiles.length;
this.archiveAndReturnMessage = `Please confirm that you would like to return the response files to ${fileNumber} PEN request ${pluralize('file', fileNumber)}.`;
this.archiveAndReturnSubtext = 'Note this action will not return any files to the submitting school if FIXABLE requests exist.';
const result = await this.$refs.fixableConfirmationDialog.open(null, null,
const result = await this.$refs.fixableConfirmationDialog.open('Please confirm your return submission', null,
{
width: '620px',
messagePadding: 'px-4 pt-4',
Expand Down Expand Up @@ -445,7 +428,7 @@ export default {
const fileNumber = this.selectedFiles.length;
this.archiveAndReturnMessage = `Please confirm that you would like to return the response files to ${fileNumber} PEN request ${pluralize('file', fileNumber)}.`;
this.archiveAndReturnSubtext = 'Note this action will return all files to the submitting school.';
const result = await this.$refs.fixableConfirmationDialog.open(null, null,
const result = await this.$refs.fixableConfirmationDialog.open('Please confirm your return submission', null,
{
width: '520px',
messagePadding: 'px-4 pt-4',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
<v-data-table
id="dataTable"
v-model="selectedRecords"
v-model:page="pageNumber"
:headers="headers"
:items="prbStudentSearchResponse.content"
:items-per-page="prbStudentSearchResponse.pageable.pageSize"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
</v-row>
<v-row>
<v-col :cols="listDetailMode? 6 : 12">
<v-data-table
<v-data-table-server
id="dataTable"
:key="selectedStudentHistoryId"
v-model="selectedRecords"
v-model:page="pageNumber"
v-model:items-length="studentHistoryResp.totalElements"
class="batch-file-table"
:headers="getHeaders()"
:items="studentHistoryResp.content"
Expand Down Expand Up @@ -75,7 +76,7 @@
</td>
</tr>
</template>
</v-data-table>
</v-data-table-server>
</v-col>
<v-col v-if="listDetailMode">
<StudentAuditHistoryDetail
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
</v-row>
<v-data-table
id="details-table"
v-model:page="pageNumber"
v-model="selectedTwins"
return-object
:headers="headers"
Expand Down
33 changes: 7 additions & 26 deletions frontend/src/components/util/ConfirmationDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,21 @@
@keydown.esc="cancel"
>
<v-card>
<slot
name="title"
<v-card-title
v-if="showTitleBar"
:cancel="cancel"
class="header pt-1 pb-1"
>
<v-toolbar
density="compact"
class="header"
flat
>
<span class="pb-2 pl-3" style="font-size: 1.15em" :class="{'white--text': options.dark, 'align-self-end': options.closeIcon, 'font-weight-bold': options.titleBold, 'dialog-subtitle': options.subtitle}">
{{ title }}
</span>
<v-spacer />
<v-btn
v-if="options.closeIcon"
id="closeBtn"
text
icon
@click-action="cancel"
>
<v-icon color="#38598A">
mdi-close
</v-icon>
</v-btn>
</v-toolbar>
</slot>
<slot name="title">
{{ title }}
</slot>
</v-card-title>
<v-card-text :class="[options.messagePadding, { 'black--text': !options.dark }]">
{{ message }}
<slot name="message" />
<v-divider
v-if="options.divider"
class="mt-1"
/>
/>
</v-card-text>
<v-card-actions class="pt-0">
<v-spacer />
Expand Down

0 comments on commit 602e20c

Please sign in to comment.