Skip to content

Commit

Permalink
Merge pull request #1810 from bcgov/feature/EDX-2622
Browse files Browse the repository at this point in the history
EDX-2622, EDX-2759: Skip steps for summer collection
  • Loading branch information
mightycox authored Aug 6, 2024
2 parents acd9915 + 5096c6f commit dead9b2
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 83 deletions.
10 changes: 5 additions & 5 deletions frontend/src/components/sdcCollection/SDCCollectionSummary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ import DoughnutChart from '../common/DoughnutChart.vue';
import { mapState, mapActions } from 'pinia';
import { sdcCollectionStore } from '../../store/modules/sdcCollection';
import router from '../../router';
import { capitalize } from 'lodash';
import {SDC_STEPS_DISTRICT, SDC_STEPS_SCHOOL, SDC_STEPS_INDP_SCHOOL} from '../../utils/sdc/SdcSteps';
import {LocalDate, LocalDateTime} from '@js-joda/core';
import {capitalize} from 'lodash';
import {SDC_STEPS_DISTRICT, SDC_STEPS_SCHOOL, SDC_STEPS_INDP_SCHOOL, SDC_STEPS_SUMMER_DISTRICT, SDC_STEPS_SUMMER_INDP_SCHOOL, SDC_STEPS_SUMMER_SCHOOL} from '../../utils/sdc/SdcSteps';
import {getDateFormatter} from '../../utils/format';
import VueDatePicker from '@vuepic/vue-datepicker';
import {COLLECTIONCODETYPE} from '../../utils/constants/CollectionCodeType';
Expand Down Expand Up @@ -228,12 +228,12 @@ export default {
totalStepsInCollection() {
if(this.isSchoolCollection) {
if(this.sdcDistrictCollectionID){
return new Set(SDC_STEPS_SCHOOL.map(step => step.step)).size;
return this.currentCollectionTypeCode === 'July' ? SDC_STEPS_SUMMER_SCHOOL.length : SDC_STEPS_SCHOOL.length;
} else {
return new Set(SDC_STEPS_INDP_SCHOOL.map(step => step.step)).size;
return this.currentCollectionTypeCode === 'July' ? SDC_STEPS_SUMMER_INDP_SCHOOL.length : SDC_STEPS_INDP_SCHOOL.length;
}
} else {
return SDC_STEPS_DISTRICT.length;
return this.currentCollectionTypeCode === 'July' ? SDC_STEPS_SUMMER_DISTRICT.length : SDC_STEPS_DISTRICT.length;
}
},
historicCollectionUrl() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
/>
</template>
</v-stepper-header>
<v-stepper-window>
<v-stepper-window v-if="SDC_STEPS_DISTRICT() === 'SDC_STEPS_DISTRICT'">
<v-stepper-window-item
:value="1"
transition="false"
Expand Down Expand Up @@ -198,6 +198,54 @@
/>
</v-stepper-window-item>
</v-stepper-window>
<v-stepper-window v-else>
<v-stepper-window-item
:value="1"
transition="false"
reverse-transition="false"
>
<StepOneUploadData
:is-step-complete="isStepComplete"
:district-collection-object="districtCollectionObject"
@next="next"
/>
</v-stepper-window-item>
<v-stepper-window-item
:value="2"
transition="false"
reverse-transition="false"
>
<StepTwoMonitor
:district-collection-object="districtCollectionObject"
:is-step-complete="isStepComplete"
@next="next"
/>
</v-stepper-window-item>
<v-stepper-window-item
:value="3"
transition="false"
reverse-transition="false"
>
<StepThreeVerifyData
:district-collection-object="districtCollectionObject"
:is-step-complete="isStepComplete"
:is-collection-active="isSdcDistrictCollectionActive"
@next="next"
/>
</v-stepper-window-item>
<v-stepper-window-item
:value="4"
transition="false"
reverse-transition="false"
>
<StepFiveSubmitToMinistry
:district-collection-object="districtCollectionObject"
:is-step-complete="isStepComplete"
@next="next"
/>
</v-stepper-window-item>
</v-stepper-window>
</template>
</v-stepper>
</v-col>
Expand Down Expand Up @@ -236,7 +284,7 @@ import {defineComponent} from 'vue';
import StepOneUploadData from './StepOneUploadData.vue';
import {sdcCollectionStore} from '../../../store/modules/sdcCollection';
import {wsNotifications} from '../../../store/modules/wsNotifications';
import {SDC_STEPS_DISTRICT} from '../../../utils/sdc/SdcSteps';
import {SDC_STEPS_DISTRICT, SDC_STEPS_SUMMER_DISTRICT} from '../../../utils/sdc/SdcSteps';
import {mapActions, mapState} from 'pinia';
import StepTwoMonitor from './StepTwoMonitor.vue';
import StepThreeVerifyData from './stepThreeVerifyData/StepThreeVerifyData.vue';
Expand Down Expand Up @@ -325,7 +373,7 @@ export default defineComponent({
methods: {
...mapActions(sdcCollectionStore, ['setCurrentCollectionSubmissionDueDate', 'setCurrentCollectionResolveDupDueDate', 'setCurrentCollectionSignOffDueDate']),
SDC_STEPS_DISTRICT() {
return SDC_STEPS_DISTRICT;
return this.districtCollectionObject?.collectionTypeCode === 'JULY' ? SDC_STEPS_SUMMER_DISTRICT : SDC_STEPS_DISTRICT;
},
next() {
this.refreshStore(true);
Expand All @@ -352,10 +400,10 @@ export default defineComponent({
this.currentStep = step;
},
getIndexOfSDCCollectionByStatusCode(sdcDistrictCollectionStatusCode) {
return SDC_STEPS_DISTRICT.find(step => step.sdcDistrictCollectionStatusCode.includes(sdcDistrictCollectionStatusCode))?.index;
return this.SDC_STEPS_DISTRICT().find(step => step.sdcDistrictCollectionStatusCode.includes(sdcDistrictCollectionStatusCode))?.index;
},
getStepOfSDCCollectionByStatusCode(sdcDistrictCollectionStatusCode) {
return SDC_STEPS_DISTRICT.find(step => step.sdcDistrictCollectionStatusCode.includes(sdcDistrictCollectionStatusCode))?.step;
return this.SDC_STEPS_DISTRICT().find(step => step.sdcDistrictCollectionStatusCode.includes(sdcDistrictCollectionStatusCode))?.step;
},
async getActiveSdcDistrictCollection() {
await ApiService.apiAxios.get(ApiRoutes.sdc.SDC_COLLECTION_BY_DISTRICT_ID + '/' + this.districtID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
<PrimaryButton
id="step-4-next-button-district"
class="mr-3 mb-3"
:disabled="disableNextButton() || apiError || !canMoveForward()"
:disabled="disableNextButton() || apiError"
icon="mdi-check"
text="Verify as Correct"
:click-action="next"
Expand Down Expand Up @@ -136,7 +136,7 @@ export default defineComponent({
required: true
}
},
emits: ['next'],
emits: ['next', 'refresh-store'],
data() {
return {
apiError: false,
Expand Down Expand Up @@ -174,9 +174,6 @@ export default defineComponent({
hasEditPermission(){
return (this.userInfo?.activeInstitutePermissions?.filter(perm => perm === PERMISSION.SCHOOL_SDC_EDIT).length > 0);
},
canMoveForward(){
return this.isStepComplete || this.hasEditPermission;
},
disableNextButton() {
return this.nonAllowableDuplicates.length > 0 || this.nonAllowableProgramDuplicates.length > 0;
},
Expand All @@ -203,19 +200,15 @@ export default defineComponent({
};
ApiService.apiAxios.put(`${ApiRoutes.sdc.SDC_SCHOOL_COLLECTION}/${this.$route.params.schoolCollectionID}`, updateCollection)
.then(() => {
this.$emit('next');
this.$emit('refresh-store');
})
.catch(error => {
console.error(error);
setFailureAlert(error?.response?.data?.message ? error?.response?.data?.message : 'An error occurred while updating status. Please try again later.');
});
},
next() {
if(this.isStepComplete) {
this.$emit('next');
} else {
this.markSchoolStepAsComplete();
}
},
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
:id="step.id"
:value="step.step"
:title="step.title"
:subtitle="step.step === stepToShowSubmissionDueDate ? submissionDueDate : null"
:subtitle="step.showSubmissionDate ? submissionDueDate : null"
:editable="step.step < currentStep && !submittedStatuses.includes(schoolCollection?.sdcSchoolCollectionStatusCode)"
:complete="step.index < stepInCollection"
:color="'rgba(56, 89, 138, 1)'"
Expand All @@ -98,9 +98,7 @@
/>
</template>
</v-stepper-header>
<v-stepper-window
v-if="schoolCollectionObject?.sdcDistrictCollectionID === null"
>
<v-stepper-window v-if="schoolCollectionObject?.sdcDistrictCollectionID === null">
<v-stepper-window-item
:value="1"
transition="false"
Expand Down Expand Up @@ -182,6 +180,18 @@
@next="next"
/>
</v-stepper-window-item>
<v-stepper-window-item
:value="8"
transition="false"
reverse-transition="false"
>
<ProvincialDuplicatesStep
:school-collection-object="schoolCollectionObject"
:is-step-complete="isStepComplete"
@refresh-store="refreshStore"
@next="next"
/>
</v-stepper-window-item>
</v-stepper-window>
<v-stepper-window
v-else
Expand Down Expand Up @@ -245,6 +255,18 @@
@next="next"
/>
</v-stepper-window-item>
<v-stepper-window-item
:value="6"
transition="false"
reverse-transition="false"
>
<ProvincialDuplicatesStep
:school-collection-object="schoolCollectionObject"
:is-step-complete="isStepComplete"
@refresh-store="refreshStore"
@next="next"
/>
</v-stepper-window-item>
</v-stepper-window>
</template>
</v-stepper>
Expand Down Expand Up @@ -284,7 +306,7 @@
<script>
import {mapActions, mapState} from 'pinia';
import { sdcCollectionStore } from '../../../store/modules/sdcCollection';
import {SDC_STEPS_SCHOOL, SDC_STEPS_INDP_SCHOOL} from '../../../utils/sdc/SdcSteps';
import {SDC_STEPS_SCHOOL, SDC_STEPS_INDP_SCHOOL, SDC_STEPS_SUMMER_SCHOOL, SDC_STEPS_SUMMER_INDP_SCHOOL} from '../../../utils/sdc/SdcSteps';
import {wsNotifications} from '../../../store/modules/wsNotifications';
import StepOneUploadData from './stepOneUploadData/StepOneUploadData.vue';
import StepTwoViewDataIssues from './stepTwoValidateData/StepTwoViewDataIssues.vue';
Expand All @@ -298,6 +320,7 @@ import {appStore} from '../../../store/modules/app';
import {formatSubmissionDate} from '../../../utils/format';
import ApiService from '../../../common/apiService';
import {ApiRoutes} from '../../../utils/constants';
import ProvincialDuplicatesStep from './ProvincialDuplicatesStep.vue';

export default {
name: 'SDCCollectionView',
Expand All @@ -309,6 +332,7 @@ export default {
StepOneUploadData,
StepSixSchoolContacts,
StepSevenSubmitData,
ProvincialDuplicatesStep
},
props: {
schoolCollectionID: {
Expand Down Expand Up @@ -351,13 +375,6 @@ export default {
return null;
}
return this.activeSchoolsMap.get(this.schoolID);
},
stepToShowSubmissionDueDate() {
if (this.schoolCollectionObject?.sdcDistrictCollectionID === null) {
//Step 7 for independent schools.
return 7;
}
return 5;
}
},
watch: {
Expand Down Expand Up @@ -395,24 +412,10 @@ export default {
methods: {
...mapActions(sdcCollectionStore, ['setCurrentCollectionSubmissionDueDate']),
compiledSdcSteps() {
let stepMap = {};
if(this.schoolCollectionObject.sdcDistrictCollectionID != null){
return SDC_STEPS_SCHOOL.filter(obj => {
if (!stepMap[obj.step]) {
stepMap[obj.step] = true;
return true;
}
return false;
});
return this.schoolCollectionObject.collectionTypeCode === 'JULY' ? SDC_STEPS_SUMMER_SCHOOL : SDC_STEPS_SCHOOL;
} else {
return SDC_STEPS_INDP_SCHOOL.filter(obj => {
if (!stepMap[obj.step]) {
stepMap[obj.step] = true;
return true;
}
return false;
});
return this.schoolCollectionObject.collectionTypeCode === 'JULY' ? SDC_STEPS_SUMMER_INDP_SCHOOL : SDC_STEPS_INDP_SCHOOL;
}
},
next() {
Expand Down Expand Up @@ -447,18 +450,10 @@ export default {
this.currentStep = step;
},
getIndexOfSDCCollectionByStatusCode(sdcSchoolCollectionStatusCode) {
if(this.schoolCollectionObject.sdcDistrictCollectionID != null){
return SDC_STEPS_SCHOOL.find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.index;
} else {
return SDC_STEPS_INDP_SCHOOL.find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.index;
}
return this.compiledSdcSteps().find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.index;
},
getStepOfSDCCollectionByStatusCode(sdcSchoolCollectionStatusCode) {
if(this.schoolCollectionObject.sdcDistrictCollectionID != null) {
return SDC_STEPS_SCHOOL.find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.step;
} else {
return SDC_STEPS_INDP_SCHOOL.find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.step;
}
return this.compiledSdcSteps().find(step => step.sdcSchoolCollectionStatusCode?.includes(sdcSchoolCollectionStatusCode))?.step;
},
getActiveSdcSchoolCollection() {
this.isLoading = true;
Expand Down
Loading

0 comments on commit dead9b2

Please sign in to comment.