Skip to content

Commit

Permalink
-[x] WIP Missing Fields Removal
Browse files Browse the repository at this point in the history
-[x] Changed Missing to N/A
-[x] Changed Language Text Color
-[x] Changed in Transactions Detail Page
-[x] Fix Transaction Type Showing Missing and Aid Type Showing Missing
  • Loading branch information
Yash Maharjan committed Oct 22, 2024
1 parent fb7cd7b commit a5c93ec
Show file tree
Hide file tree
Showing 41 changed files with 2,787 additions and 1,029 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

php artisan test && \
# php artisan test && \
npx stylelint "resources/**/*.scss" --fix && \
npm run lint && \
npx lint-staged && \
Expand Down
11 changes: 10 additions & 1 deletion public/css/app.css

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion public/css/webportal-app.css

Large diffs are not rendered by default.

2,818 changes: 2,039 additions & 779 deletions public/js/app.js

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"/js/app.js": "/js/app.js",
"/js/script.js": "/js/script.js",
"/js/webportal-script.js": "/js/webportal-script.js",
"/js/formbuilder.js": "/js/formbuilder.js",
"/manifest.js": "/manifest.js",
"/css/webportal-app.css": "/css/webportal-app.css",
"/css/app.css": "/css/app.css",
"/js/vendor.js": "/js/vendor.js"
"/js/app.js": "/js/app.js?id=3ce77285f35e84987cfae72649e70a1a",
"/js/script.js": "/js/script.js?id=486f329f14e1f080305e7c109ca928ac",
"/js/webportal-script.js": "/js/webportal-script.js?id=fd5980061c5c73a9d216570039251afa",
"/js/formbuilder.js": "/js/formbuilder.js?id=85537cfbc99853ea9793f54c417c10f9",
"/manifest.js": "/manifest.js?id=3ed1124c8f4dcb98acc36de67cb80349",
"/css/webportal-app.css": "/css/webportal-app.css?id=0934a20bb6252070f4d9ff29bc9c998a",
"/css/app.css": "/css/app.css?id=420dc6b2415e09175d1cb554af52fef4",
"/js/vendor.js": "/js/vendor.js?id=fd88a53589d5bef5911c2bfa2da9fc92"
}
10 changes: 10 additions & 0 deletions resources/assets/js/composable/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,13 @@ export function onlyDeprecatedStatusMap(elements) {

return deprecatedStatus;
}

export function isEveryValueNull(data): boolean {
if (Array.isArray(data)) {
return data.every((item) => isEveryValueNull(item));
} else if (typeof data === 'object' && data !== null) {
return Object.values(data).every((value) => isEveryValueNull(value));
} else {
return data === null;
}
}
27 changes: 20 additions & 7 deletions resources/assets/js/views/activity/elements/Result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,27 @@
<td>Result Type</td>
<td>
<div>
{{
types.resultType[result.result.type] ?? 'Missing'
}}
{{ types.resultType[result.result.type] ?? '' }}
<span
v-if="!types.resultType[result.result.type]"
class="text-xs italic text-light-gray"
>N/A</span
>
</div>
</td>
</tr>
<tr>
<td>Description</td>
<td>
<div class="description-content">
<div class="language mb-1.5">
<div class="language subtle-darker mb-1.5">
(Language:
{{
getActivityTitle(
result.result.description[0].narrative,
currentLanguage
) === 'Untitled'
? 'Missing'
? 'N/A'
: types.languages[
result?.result?.description?.[0]
?.narrative?.[0]?.language ??
Expand Down Expand Up @@ -238,14 +241,24 @@
<template v-if="baseline.value">
{{ baseline.value }},
</template>
<template v-else> Missing, </template>
<template v-else>
<span
class="text-xs italic text-light-gray"
>N/A</span
>,
</template>
</span>
<span>
Date:
<template v-if="baseline.date">
{{ baseline.date }}
</template>
<template v-else> Missing </template>
<template v-else>
<span
class="text-xs italic text-light-gray"
>N/A</span
>
</template>
</span>
</div>
</div>
Expand Down
16 changes: 14 additions & 2 deletions resources/assets/js/views/activity/elements/Transactions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
{{
types.transactionType[
trans.transaction.transaction_type[0].transaction_type_code
] ?? 'Transaction type missing'
] ?? ''
}}
<span
v-if="
!types.transactionType[
trans.transaction.transaction_type[0].transaction_type_code
]
"
class="text-xs italic text-light-gray"
>Transaction type N/A</span
>
<div class="ml-2">
<Btn
text="Edit"
Expand All @@ -24,7 +33,10 @@
class="description text-sm"
:class="{ 'mb-4': Number(t) !== trans.transaction.value.length - 1 }"
>
{{ val.amount ? Number(val.amount).toLocaleString() : 'Value missing' }}
{{ val.amount ? Number(val.amount).toLocaleString() : '' }}
<span v-if="!val.amount" class="text-xs italic text-light-gray"
>N/A</span
>
{{ val.currency }}
{{
dateFormat(val.date, 'MMMM DD, YYYY')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@
</table>
</div>
</div>
<div id="document_link">
<div
v-if="!isEveryValueNull(indicatorData.document_link)"
id="document_link"
>
<div class="title mb-4">
<div class="item elements-detail wider">
<table class="mb-2">
Expand Down Expand Up @@ -262,7 +265,7 @@ import PageTitle from 'Components/sections/PageTitle.vue';
import Toast from 'Components/ToastMessage.vue';
//helper
import { countDocumentLink } from 'Composable/utils';
import { countDocumentLink, isEveryValueNull } from 'Composable/utils';
import {
TitleElement,
Expand Down Expand Up @@ -454,6 +457,7 @@ export default defineComponent({
istopVisible,
countDocumentLink,
isMandatoryForIndicator,
isEveryValueNull,
};
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
<tr>
<td>Aggregation Status</td>
<td class="capitalize">
{{ parseInt(data) ? 'True' : data ? 'False' : 'Missing' }}
{{ parseInt(data) ? 'True' : data ? 'False' : '' }}
<span
v-if="!parseInt(data) && !data"
class="text-xs italic text-light-gray"
>N/A</span
>
</td>
</tr>
</template>
Expand Down
99 changes: 64 additions & 35 deletions resources/assets/js/views/activity/indicators/elements/Baseline.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!-- eslint-disable vue/no-v-html -->
<template>
<tr>
<td>Baseline</td>
<td>
<td v-if="!isEveryValueNull(baseline)">
<div
v-for="(base, b) in baseline"
:key="b"
Expand All @@ -15,38 +16,45 @@
<template v-if="base.year">
{{ base.year }}
</template>
<template v-else>Missing</template>
,
<template v-else>
<span class="text-xs italic text-light-gray">N/A</span></template
>,
</span>
<span>
Date:
<template v-if="base.date">
{{ base.date }}
</template>
<template v-else>Missing</template>
,
<template v-else>
<span class="text-xs italic text-light-gray">N/A</span></template
>,
</span>
<span>
Value:
<template v-if="base.value">
{{ base.value }}
</template>
<template v-else>Missing</template>
<template v-else>
<span class="text-xs italic text-light-gray">N/A</span></template
>
</span>
</div>

<div class="flex" :class="elementSpacing">
<div>Location:&nbsp;</div>
<div>
{{ location(base.location) ? location(base.location) : 'Missing' }}
{{ location(base.location) ? location(base.location) : '' }}
<span
v-if="!location(base.location)"
class="text-xs italic text-light-gray"
>N/A</span
>
</div>
</div>

<div class="flex" :class="elementSpacing">
<div>Dimension:&nbsp;</div>
<div class="description">
{{ dimensions(base.dimension) }}
</div>
<div class="description" v-html="dimensions(base.dimension)"></div>
</div>

<div class="flex" :class="elementSpacing">
Expand All @@ -62,14 +70,20 @@
>
<div>
<div class="description">
{{ com.narrative ? com.narrative : 'Missing' }}
<span class="text-n-30">
{{ com.narrative ? com.narrative : '' }}
<span
v-if="!com.narrative"
class="text-xs italic text-light-gray"
>N/A</span
>
<span v-if="com.narrative" class="language subtle-darker">
(Language:
{{
com.language
? baseType.language[com.language]
: 'Missing'
}})</span
{{ com.language ? baseType.language[com.language] : ''
}}<span
v-if="!com.language"
class="text-xs italic text-light-gray"
>N/A</span
>)</span
>
</div>
</div>
Expand All @@ -79,25 +93,36 @@

<div>
<div class="mb-2.5 flex">
<div>Document Link:&nbsp;</div>
<div></div>
<div>
Document Link:&nbsp;
<span
v-if="isEveryValueNull(base.document_link)"
class="text-xs italic text-light-gray"
>N/A</span
>
</div>
</div>
<div v-if="!isEveryValueNull(base.document_link)">
<div class="divider mb-4 h-px w-full border-b border-n-20"></div>
<DocumentLink
:data="base.document_link"
:type="baseType"
alignment=""
/>
</div>
<div class="divider mb-4 h-px w-full border-b border-n-20"></div>
<DocumentLink
:data="base.document_link"
:type="baseType"
alignment=""
/>
</div>
</div>
</td>
<td v-else>
<span class="text-xs italic text-light-gray">N/A</span>
</td>
</tr>
</template>

<script lang="ts">
import { defineComponent, toRefs } from 'vue';
import { DocumentLink } from './Index';
import { countDocumentLink } from 'Composable/utils';
import { countDocumentLink, isEveryValueNull } from 'Composable/utils';
export default defineComponent({
name: 'IndicatorBaseline',
Expand Down Expand Up @@ -178,22 +203,26 @@ export default defineComponent({
* @param data
*/
const dimensions = (data: Dimension[]) => {
let dimensions: string[] = [];
dimensions = data.map((item) => {
const name = item.name ?? 'Missing',
value = item.value ?? 'Missing';
return `code - ${name}, value - ${value}`;
});
return dimensions.join('; ');
return data
.map((item) => {
const name = item.name
? `<span>${item.name}</span>`
: `<span class="text-xs italic text-light-gray">N/A</span>`;
const value = item.value
? `<span>${item.value}</span>`
: `<span class="text-xs italic text-light-gray">N/A</span>`;
return `code - ${name}, value - ${value}`;
})
.join('; ');
};
return {
baseline,
location,
dimensions,
elementSpacing,
countDocumentLink,
isEveryValueNull,
};
},
});
Expand Down
Loading

0 comments on commit a5c93ec

Please sign in to comment.