Skip to content

Commit

Permalink
ofmcc-6113 - move funding envelope assitance requests
Browse files Browse the repository at this point in the history
  • Loading branch information
vietle-cgi committed Oct 17, 2024
1 parent 69e73c8 commit b0ae4d4
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 5 deletions.
61 changes: 61 additions & 0 deletions frontend/src/components/funding/FundingAllocationTab.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<template>
<v-container fluid class="pa-0">
<div class="my-2">View or submit a change for your centre's current monthly funding allocations. Funds can be re-allocated based on the rules below.</div>
<v-row v-if="hasPermission(PERMISSIONS.SUBMIT_CHANGE_REQUEST)" no-gutters class="my-4 pr-2 justify-end">
<AppButton :loading="loading" @click="toggleAssistanceRequestDialog()">Request to Re-allocate Funds</AppButton>
</v-row>
<h2 class="mb-2">Funding Re-Allocation Rules</h2>
<AppAlertBanner type="info">Note: Total funds re-allocated cannot be more than the base funding for each envelope.</AppAlertBanner>
<FundingSearchCard :loading="loading" :select-single-facility="true" :show-date-filter="false" class="my-6" @search="loadFundingDetails" />
<NewRequestDialog
class="pa-0"
:show="showAssistanceRequestDialog"
:default-facility="selectedFacility"
:default-request-category-id="getRequestCategoryIdByName(REQUEST_CATEGORY_NAMES.FUNDING_ENVELOPE_CR)"
@close="toggleAssistanceRequestDialog" />
</v-container>
</template>

<script>
import { mapState } from 'pinia'
import FundingSearchCard from '@/components/funding/FundingSearchCard.vue'
import NewRequestDialog from '@/components/messages/NewRequestDialog.vue'
import AppAlertBanner from '@/components/ui/AppAlertBanner.vue'
import AppButton from '@/components/ui/AppButton.vue'
import { useAppStore } from '@/stores/app'
import alertMixin from '@/mixins/alertMixin.js'
import permissionsMixin from '@/mixins/permissionsMixin'
import { REQUEST_CATEGORY_NAMES } from '@/utils/constants'
export default {
name: 'FundingAllocationTab',
components: { AppAlertBanner, AppButton, FundingSearchCard, NewRequestDialog },
mixins: [alertMixin, permissionsMixin],
data() {
return {
loading: false,
showAssistanceRequestDialog: false,
selectedFacility: null,
}
},
computed: {
...mapState(useAppStore, ['getRequestCategoryIdByName']),
},
created() {
this.REQUEST_CATEGORY_NAMES = REQUEST_CATEGORY_NAMES
},
methods: {
loadFundingDetails(searchQueries) {
this.selectedFacility = searchQueries?.facilities
},
toggleAssistanceRequestDialog() {
this.showAssistanceRequestDialog = !this.showAssistanceRequestDialog
},
},
}
</script>
26 changes: 23 additions & 3 deletions frontend/src/components/funding/FundingSearchCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
<v-col cols="12" lg="6" class="mb-6 mb-lg-0">
<v-row>
<v-col cols="12" sm="6" lg="3" xl="2" class="pb-0">
<AppLabel>Facility(s):</AppLabel>
<AppLabel>{{ selectSingleFacility ? 'Facility:' : 'Facility(s):' }}</AppLabel>
</v-col>
<v-col cols="12" sm="9" lg="8">
<v-select
v-if="selectSingleFacility"
v-model="selectedFacilities"
:items="userInfo.facilities"
item-title="facilityName"
label="Select Facility"
:disabled="loading"
:rules="rules.required"
density="compact"
variant="outlined"
return-object />
<v-select
v-else
v-model="selectedFacilities"
:items="userInfo.facilities"
item-title="facilityName"
Expand Down Expand Up @@ -67,7 +79,7 @@
</v-col>
</v-row>
</v-col>
<v-col cols="12" lg="6">
<v-col v-if="showDateFilter" cols="12" lg="6">
<v-row>
<v-col cols="12" sm="5" lg="2" xl="2" class="pb-0">
<AppLabel>Date:</AppLabel>
Expand Down Expand Up @@ -133,6 +145,14 @@ export default {
type: String,
default: null,
},
showDateFilter: {
type: Boolean,
default: true,
},
selectSingleFacility: {
type: Boolean,
default: false,
},
},
emits: ['search'],
Expand Down Expand Up @@ -205,7 +225,7 @@ export default {
methods: {
resetFilter() {
this.selectedFacilities = this.userInfo?.facilities
this.selectedFacilities = this.selectSingleFacility ? this.userInfo?.facilities[0] : this.userInfo?.facilities
this.selectedDateFilterType = this.defaultDateFilter
this.selectedPaymentFilterTypes = this.paymentTypes
this.selectedDateFrom = null
Expand Down
19 changes: 18 additions & 1 deletion frontend/src/components/messages/NewRequestDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,15 @@
<v-row v-if="showRequestDescription" no-gutters>
<v-col class="v-col-12 pb-0">
<AppLabel variant="modal">Request description:</AppLabel>
<div v-if="isFundingEnvelopeRequest" class="mt-2 mb-4">
<div class="mb-2">
Each Funding Envelope has restrictions for how the funding can be used and if or how it can be re-allocated between the Funding Envelopes and between line items within the Funding
Envelopes, as applicable. Please see the Policy and Procedures Manual for detailed information.
</div>
<div>
In the box below, please outline your request to re-allocate funds, including the amount and the envelopes you are moving funds between. Please also attach any relevant documents.
</div>
</div>
</v-col>
<v-col class="v-col-12">
<v-textarea
Expand Down Expand Up @@ -417,6 +426,9 @@ export default {
isReportingRequest() {
return this.newRequestModel.requestCategoryId === this.getRequestCategoryIdByName(REQUEST_CATEGORY_NAMES.REPORTING)
},
isFundingEnvelopeRequest() {
return this.newRequestModel.requestCategoryId === this.getRequestCategoryIdByName(REQUEST_CATEGORY_NAMES.FUNDING_ENVELOPE_CR)
},
isAnySubCategoryChecked() {
return this.newRequestModel.subCategories.length > 0
},
Expand Down Expand Up @@ -503,7 +515,7 @@ export default {
return this.documentsToUpload.length
},
isMultipleFacilities() {
return !(this.isAccountMaintenanceRequest || this.isIrregularExpenseRequest || this.isReportingRequest)
return !(this.isAccountMaintenanceRequest || this.isFundingEnvelopeRequest || this.isIrregularExpenseRequest || this.isReportingRequest)
},
facilityLabel() {
return `Facility${this.isMultipleFacilities ? '(s)' : ''}:`
Expand Down Expand Up @@ -858,4 +870,9 @@ export default {
.v-messages {
opacity: 1;
}
:deep(.v-select__selection-text) {
white-space: normal; /* Wraps the selected item text */
word-wrap: break-word;
}
</style>
1 change: 1 addition & 0 deletions frontend/src/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const SUPPLEMENTARY_TYPES = Object.freeze({

export const REQUEST_CATEGORY_NAMES = Object.freeze({
ACCOUNT_MAINTENANCE: 'Account Maintenance',
FUNDING_ENVELOPE_CR: 'Funding Envelope Change Request',
REPORTING: 'Reporting',
IRREGULAR_EXPENSES: 'Irregular Expense',
})
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/views/funding/FundingOverviewView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
<v-icon size="large">mdi-history</v-icon>
<strong>Payment Records</strong>
</v-tab>
<v-tab v-if="hasPermission(PERMISSIONS.VIEW_FUNDING_AMOUNTS)" value="funding-allocation">
<v-icon size="large">mdi-call-split</v-icon>
<strong>Funding Allocation</strong>
</v-tab>
</v-tabs>
<v-card-text>
<v-window v-model="tab">
Expand All @@ -21,6 +25,9 @@
<v-window-item v-if="hasPermission(PERMISSIONS.VIEW_FUNDING_AMOUNTS)" value="payment-records">
<PaymentRecordsTab />
</v-window-item>
<v-window-item v-if="hasPermission(PERMISSIONS.VIEW_FUNDING_AMOUNTS)" value="funding-allocation">
<FundingAllocationTab />
</v-window-item>
</v-window>
</v-card-text>
</v-card>
Expand All @@ -32,13 +39,14 @@
<script>
import OrganizationHeader from '@/components/organizations/OrganizationHeader.vue'
import FundingAgreementsTab from '@/components/funding/FundingAgreementsTab.vue'
import FundingAllocationTab from '@/components/funding/FundingAllocationTab.vue'
import PaymentRecordsTab from '@/components/funding/PaymentRecordsTab.vue'
import AppBackButton from '@/components/ui/AppBackButton.vue'
import permissionsMixin from '@/mixins/permissionsMixin'
export default {
name: 'FundingOverviewView',
components: { AppBackButton, FundingAgreementsTab, PaymentRecordsTab, OrganizationHeader },
components: { AppBackButton, FundingAgreementsTab, FundingAllocationTab, PaymentRecordsTab, OrganizationHeader },
mixins: [permissionsMixin],
data() {
return {
Expand Down

0 comments on commit b0ae4d4

Please sign in to comment.