Skip to content

Commit

Permalink
Merge pull request #171 from icefoganalytics/test
Browse files Browse the repository at this point in the history
Bug fixing and flagging and dashboard
  • Loading branch information
datajohnson authored Oct 4, 2023
2 parents c874792 + 404075d commit 05791ee
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 74 deletions.
3 changes: 2 additions & 1 deletion src/api/routes/admin/csg-threshold-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,14 @@ csgThresholdRouter.put(
for (let disb of disbursements) {
disb.assessment_id = assessment_id;
disb.funding_request_id = funding_request_id;
disb.disbursed_amount = cleanNumber(disb.disbursed_amount);

delete disb.financial_batch_id; // not editable through the interface
delete disb.csl_cert_seq_number;

if (disb.id) {
let id = disb.id;
delete disb.id;
disb.disbursed_amount = cleanNumber(disb.disbursed_amount);

await db("sfa.disbursement").where({ id }).update(disb);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<template v-slot:default>
<thead>
<tr>
<th class="narrow">Reference #</th>
<th class="narrow">Certificate</th>
<th class="narrow">Amount</th>
<th class="narrow">Type</th>
<th class="narrow">Issue Date</th>
<th class="narrow">Due Date</th>
<th class="narrow">Change Reason</th>
<th class="narrow">Cert #</th>
<th class="narrow">eCert</th>
<th class="narrow"></th>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
<template v-slot:default>
<thead>
<tr>
<th class="narrow">Reference #</th>
<th class="narrow">Certificate</th>
<th class="narrow">Amount</th>
<th class="narrow">Type</th>
<th class="narrow">Issue Date</th>
<th class="narrow">Due Date</th>
<th class="narrow">Change Reason</th>
<th class="narrow">Batch #</th>
<th class="narrow">eCert</th>
<th class="narrow"></th>
</tr>
</thead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getters = {
return state.disbursements;
},
previousDisbursements(state) {
let amounts = state.disbursements.map((d) => d.disbursed_amount);
let amounts = state.disbursements.map((d) => d.disbursed_amount ?? 0);
let total = amounts.reduce((t, a) => {
return t + a;
}, 0);
Expand Down Expand Up @@ -68,10 +68,10 @@ const mutations = {
state.disbursements = value;
},
SET_EQUIPMENT(state, value) {
state.equipment = value;
state.equipment = value ?? [];
},
SET_SERVICES(state, value) {
state.services = value;
state.services = value ?? [];
},
};
const actions = {
Expand All @@ -81,11 +81,11 @@ const actions = {

store.commit(
"SET_EQUIPMENT",
app.disability_equipments.filter((e) => e.verified_equipment_need)
(app.disability_equipments ?? []).filter((e) => e.verified_equipment_need)
);
store.commit(
"SET_SERVICES",
app.disability_services.filter((s) => s.verified_service_need)
(app.disability_services ?? []).filter((s) => s.verified_service_need)
);
},

Expand Down Expand Up @@ -158,6 +158,7 @@ const actions = {

dispatch("save");
},

async removeDisbursement({ state }, { item, index }) {
if (item.id) {
state.disbursements.splice(index, 1);
Expand Down Expand Up @@ -186,7 +187,9 @@ const actions = {
`${CSG_THRESHOLD_URL}/csgftdep/${state.fundingRequest.application_id}/funding-request/${state.fundingRequest.id}/assessment/${state.assessment.id}`,
state.assessment
)
.then((resp) => {});
.then((resp) => {
dispatch("loadCSGDSEAssessment", { id: state.fundingRequest.application_id });
});
} else {
return axios
.post(
Expand Down
7 changes: 3 additions & 4 deletions src/web/src/components/application/assessments/views/CSGD.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</v-btn>
<h1 class="mb-0">Funding Status</h1>
</div>

<div class="mt-4">
<v-card class="default mb-1 bg-color-blue">
<v-card-title
Expand Down Expand Up @@ -143,7 +143,7 @@

<div class="mt-4">
<v-card class="default mb-5 bg-color-blue">
<v-card-text>
<v-card-text>
<csg-disbursements
store="csgDisabilityStore"
v-on:showError="showError"
Expand Down Expand Up @@ -174,7 +174,6 @@ export default {
if (this.applicationId != storeApp.id) {
await store.dispatch("loadApplication", this.applicationId).then(async (res) => {
await this.initialize(store.getters.selectedApplication).then((r) => {
if (isUndefined(this.parentAssessment)) {
this.$emit("showError", "Please create the CSLFT Assessment first");
Expand Down Expand Up @@ -269,4 +268,4 @@ export default {
},
},
};
</script>
</script>
13 changes: 6 additions & 7 deletions src/web/src/components/application/assessments/views/CSGDSE.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,16 @@ export default {
async created() {
this.applicationId = this.$route.params.id;
let storeApp = store.getters.selectedApplication;
store.dispatch("setAppSidebar", true);
if (this.applicationId != storeApp.id) {
await store.dispatch("loadApplication", this.applicationId);
await store.dispatch("loadApplication", this.applicationId).then(async () => {
await this.initialize(store.getters.selectedApplication);
});
} else {
await this.initialize(store.getters.selectedApplication);
}
await this.initialize(storeApp);
await this.setCslClassifications();
await this.setDisbursementTypes();
await this.setChangeReasons();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ export default {
});
},
updateAssessment() {
console.lolg("UPDATE")
console.log("UPDATE");
const custom = JSON.parse(JSON.stringify(this.customAssessment));
store.dispatch("updateApplication", ["program_division", this.application.program_division, this]);
Expand All @@ -783,7 +783,7 @@ export default {
});
},
recalcAssessment() {
console.log("RECALC")
console.log("RECALC");
const custom = JSON.parse(JSON.stringify(this.customAssessment));
if (this.programDivisionBack !== null) {
delete this.customAssessment.program_division;
Expand Down Expand Up @@ -864,7 +864,7 @@ export default {
);
},
refreshData() {
console.log("REFRESH CALLED")
console.log("REFRESH CALLED");
const previewDisburseAmountsList =
this.previewDisbursementList?.map((d) => {
return Number(d.disbursed_amount);
Expand Down
2 changes: 1 addition & 1 deletion src/web/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default new Vuex.Store({
let isRecent = JSON.parse(localStorage.RECENT_APPLICATIONS).filter((r) => r.id == value.id);

if (isRecent.length == 0) {
if (JSON.parse(localStorage.RECENT_APPLICATIONS).length >= 25) {
if (JSON.parse(localStorage.RECENT_APPLICATIONS).length >= 10) {
const currentRecentApplication = JSON.parse(localStorage.RECENT_APPLICATIONS);
currentRecentApplication.pop();
localStorage.RECENT_APPLICATIONS = JSON.stringify(currentRecentApplication);
Expand Down
147 changes: 99 additions & 48 deletions src/web/src/views/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,58 +37,39 @@
</v-col>

<v-col cols="12" md="4" sm="6">
<v-card color="#fff2d5">
<v-card-text>
<h3 class="text-h6 font-weight-regular">Recently viewed Applications</h3>
<v-card class="default mb-5">
<v-toolbar flat color="#e0d5bb" dense>
Recently Viewed Applications
</v-toolbar>
<v-card-text class="py-0">
<p v-if="recentApplications.length == 0" class="mb-0">None yet</p>
<ol v-if="recentApplications.length > 0">
<li v-for="(item, idx) of recentApplications" :key="idx">
<router-link :to="`/application/${item.id}/personal`"
>{{ getStudentName(item) }} - {{ item.academic_year_id }}: {{ item.main_institution.name }}
</router-link>
</li>
</ol>
</v-card-text>
</v-card>
</v-col>
<v-col cols="12" md="4" sm="6">
<v-card class="default">
<v-card-text>
<h3 class="text-h6 font-weight-regular">New Applications</h3>

<div v-if="loading">Loading...</div>
<p v-if="newApplications.length == 0 && !loading" class="mb-0">None yet</p>

<ol v-if="newApplications.length > 0">
<li v-for="(item, idx) of newApplications" :key="idx">
<router-link :to="`/application/${item.id}/personal`">
{{ item.title }}
</router-link>
</li>
</ol>
</v-card-text>
</v-card>
</v-col>
<v-col cols="12" md="4" sm="6">
<v-card class="default mb-5">
<v-card-text>
<h3 class="text-h6 font-weight-regular">Recent updates or messages</h3>
<p v-if="recentUpdated.length == 0" class="mb-0">None yet</p>
<ol v-if="recentUpdated.length > 0">
<li v-for="(item, idx) of recentUpdated" :key="idx" style="list">
<router-link :to="`/application/${item.id}/personal`"
>{{ item.title }} - <span style="font-size: 10px">{{ getFormattedDate(item.updated_at) }}</span>
</router-link>
</li>
</ol>
<v-list dense color="#ffffff00" v-if="recentApplications">
<div v-for="(item, idx) of recentApplications">
<v-list-item :to="`/application/${item.id}/personal`" class="pl-1">
<v-list-item-content class="">
<v-list-item-title
>{{ getStudentName(item) }} - {{ item.academic_year_id }}: {{ item.main_institution.name }}
</v-list-item-title>
<!-- <v-subheader class="my-0 py-0" style="height: 14px">
<strong>Flags:</strong>&nbsp; {{ item.flags.replace(/,/g, ", ") }}
</v-subheader> -->
</v-list-item-content>
</v-list-item>
<v-divider v-if="idx < recentApplications.length - 1" />
</div>
</v-list>
</v-card-text>
</v-card>

<v-card class="default">
<v-toolbar flat color="#e0d5bb" dense>
Flagged Applications
</v-toolbar>
<v-card-text class="pb-0">
<h3 class="text-h6 font-weight-regular">Flagged Applications</h3>

<v-select
label="Select a flag"
class="my-0"
v-model="selectedFlag"
:items="flagOptions"
dense
Expand All @@ -97,18 +78,76 @@
hide-details
>
</v-select>
<div class="d-flex" style="font-size: .8rem">
<v-switch v-model="filterFlagged" label="Also apply name filter" hide-details class="my-0" />
</div>
<v-divider class="mt-1" />
<p v-if="filteredFlagMatches.length == 0" class="mb-0">None yet</p>

<v-list dense color="#ffffff00" v-if="flagMatches">
<div v-for="(item, idx) of flagMatches">
<v-list dense color="#ffffff00" v-if="filteredFlagMatches" class="mt-0 pt-0">
<div v-for="(item, idx) of filteredFlagMatches">
<v-list-item :to="`/application/${item.id}/personal`" class="pl-1">
<v-list-item-content class="">
<v-list-item-title>{{ item.title }} </v-list-item-title>
<v-subheader class="my-0 py-0" style="height: 14px">
<strong>Flags:</strong>&nbsp; {{ item.flags.replace(",", ", ") }}
<strong>Flags:</strong>&nbsp; {{ item.flags.replace(/,/g, ", ") }}
</v-subheader>
</v-list-item-content>
</v-list-item>
<v-divider v-if="idx < flagMatches.length - 1" />
<v-divider v-if="idx < filteredFlagMatches.length - 1" />
</div>
</v-list>
</v-card-text>
</v-card>
</v-col>

<v-col cols="12" md="4" sm="6">
<v-card class="default">
<v-toolbar flat color="#e0d5bb" dense>
New Applications
</v-toolbar>
<v-card-text class="py-0">
<!-- <h3 class="text-h6 font-weight-regular mb-0">New Applications</h3> -->

<div v-if="loading">Loading...</div>
<p v-if="newApplications.length == 0 && !loading" class="mb-0">None yet</p>

<v-list dense color="#ffffff00" v-if="newApplications">
<div v-for="(item, idx) of newApplications">
<v-list-item :to="`/application/${item.id}/personal`" class="pl-1">
<v-list-item-content class="">
<v-list-item-title>{{ item.title }} </v-list-item-title>
<v-subheader class="my-0 py-0" style="height: 14px">
<strong>Submitted:</strong>&nbsp; {{ getFormattedDate(item.online_submit_date) }}
</v-subheader>
</v-list-item-content>
</v-list-item>
<v-divider v-if="idx < newApplications.length - 1" />
</div>
</v-list>
</v-card-text>
</v-card>
</v-col>

<v-col cols="12" md="4" sm="6">
<v-card class="default mb-5">
<v-toolbar flat color="#e0d5bb" dense>
Recent Updates or Messages
</v-toolbar>
<v-card-text class="py-0">
<p v-if="recentUpdated.length == 0" class="mb-0">None yet</p>

<v-list dense color="#ffffff00" v-if="recentUpdated">
<div v-for="(item, idx) of recentUpdated">
<v-list-item :to="`/application/${item.id}/personal`" class="pl-1">
<v-list-item-content class="">
<v-list-item-title>{{ item.title }} </v-list-item-title>
<v-subheader class="my-0 py-0" style="height: 14px">
<strong>Updated:</strong>&nbsp; {{ getFormattedDate(item.updated_at) }}
</v-subheader>
</v-list-item-content>
</v-list-item>
<v-divider v-if="idx < recentUpdated.length - 1" />
</div>
</v-list>
</v-card-text>
Expand Down Expand Up @@ -175,9 +214,21 @@ export default {
name: "Home",
computed: {
...mapState(["recentStudents", "flagOptions", "flagMatches"]),
filteredFlagMatches() {
if (this.filterFlagged && this.filter.length > 0) {
let matches = [];
for (let item of this.filter) {
matches.push(...this.flagMatches.filter((f) => f.last_name.startsWith(item)));
}
return matches;
} else return this.flagMatches;
},
},
data: () => ({
selectedFlag: "",
filterFlagged: false,
filter: [],
recentApplications: [],
Expand Down

0 comments on commit 05791ee

Please sign in to comment.