Skip to content

Commit

Permalink
-[x] Completed replacing text with component in : result, indicator, …
Browse files Browse the repository at this point in the history
…period, transaction and organisation
  • Loading branch information
PG-Momik authored and aashish-t-magar committed Jan 23, 2024
1 parent 422606c commit ff87093
Show file tree
Hide file tree
Showing 34 changed files with 2,894 additions and 1,408 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
2,866 changes: 1,934 additions & 932 deletions public/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=d03477f5371498a1d7abd7950da8287d",
"/js/app.js": "/js/app.js?id=6dfb5b1f2c356f05e5d47dfc4d328d41",
"/js/script.js": "/js/script.js?id=4920eb85d84da1e87cb71769c04a12a2",
"/js/webportal-script.js": "/js/webportal-script.js?id=f9c23d4bccd261db9414465886315f45",
"/js/formbuilder.js": "/js/formbuilder.js?id=96f1b9dd5890b8ff09e613117dd94592",
Expand Down
31 changes: 18 additions & 13 deletions resources/assets/js/views/activity/elements/Result.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
) === 'Untitled'
"
>
<MissingDataItem />
<MissingDataItem />)
</span>
<span>
{{
Expand Down Expand Up @@ -236,7 +236,7 @@
{{ baseline.value }},
</template>
<template v-else>
<MissingDataItem />,
<MissingDataItem item="value" />,
</template>
</span>
<span>
Expand All @@ -245,7 +245,7 @@
{{ baseline.date }}
</template>
<template v-else>
<MissingDataItem />
<MissingDataItem item="date" />
</template>
</span>
</div>
Expand Down Expand Up @@ -275,19 +275,24 @@
:href="`/indicator/${indicator.id}/period/${period.id}`"
>
{{
dateFormat(
period.period.period_start[0]
.date,
format
)
period.period.period_start[0]
.date
? dateFormat(
period.period
.period_start[0].date,
format
)
: 'Missing'
}}
-
{{
dateFormat(
period.period.period_end[0]
.date,
format
)
period.period.period_end[0].date
? dateFormat(
period.period
.period_end[0].date,
format
)
: 'Missing'
}}
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
<template>
<tr>
<td>Aggregation Status</td>
<td class="capitalize">
{{ parseInt(data) ? 'True' : data ? 'False' : 'Missing' }}
<td>
<ConditionalTextDisplay
success-text="True"
:condition="parseInt(data)"
:show-failure-text-as-plain-text="!!data"
:failure-text="data ? 'False' : 'aggregation status'"
/>
</td>
</tr>
</template>

<script lang="ts">
import { defineComponent, toRefs } from 'vue';
import ConditionalTextDisplay from 'Components/ConditionalTextDisplay.vue';
export default defineComponent({
name: 'IndicatorAggregationStatus',
components: {},
components: { ConditionalTextDisplay },
props: {
data: {
type: String,
Expand Down
51 changes: 38 additions & 13 deletions resources/assets/js/views/activity/indicators/elements/Baseline.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,57 @@
<template v-if="base.year">
{{ base.year }}
</template>
<template v-else>Missing</template>
<template v-else>
<MissingDataItem item="year" />
</template>
,
</span>
<span>
Date:
<template v-if="base.date">
{{ base.date }}
</template>
<template v-else>Missing</template>
<template v-else>
<MissingDataItem item="date" />
</template>
,
</span>
<span>
Value:
<template v-if="base.value">
{{ base.value }}
</template>
<template v-else>Missing</template>
<template v-else>
<MissingDataItem item="value" />
</template>
</span>
</div>

<div class="flex" :class="elementSpacing">
<div>Location:&nbsp;</div>
<div>
{{ location(base.location) ? location(base.location) : 'Missing' }}
<ConditionalTextDisplay
:success-text="location(base.location)"
:condition="location(base.location)"
failure-text="location"
/>
</div>
</div>

<div class="flex" :class="elementSpacing">
<div>Dimension:&nbsp;</div>
<div class="description">
{{ dimensions(base.dimension) }}
Code:
<ConditionalTextDisplay
:success-text="base.dimension[0].name"
:condition="base.dimension[0].name"
failure-text="name"
/>, Value:
<ConditionalTextDisplay
:success-text="base.dimension[0].value"
:condition="base.dimension[0].value"
failure-text="value"
/>
</div>
</div>

Expand All @@ -62,15 +82,17 @@
>
<div>
<div class="description">
{{ com.narrative ? com.narrative : 'Missing' }}
<ConditionalTextDisplay
:success-text="com.narrative"
:condition="com.narrative"
/>
<span class="text-n-30">
(Language:
{{
com.language
? baseType.language[com.language]
: 'Missing'
}})</span
>
<ConditionalTextDisplay
:success-text="baseType.language[com.language]"
:condition="com.language"
/>)
</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -98,10 +120,12 @@
import { defineComponent, toRefs } from 'vue';
import { DocumentLink } from './Index';
import { countDocumentLink } from 'Composable/utils';
import ConditionalTextDisplay from 'Components/ConditionalTextDisplay.vue';
import MissingDataItem from 'Components/MissingDataItem.vue';
export default defineComponent({
name: 'IndicatorBaseline',
components: { DocumentLink },
components: { MissingDataItem, ConditionalTextDisplay, DocumentLink },
props: {
data: {
type: Array,
Expand Down Expand Up @@ -180,6 +204,7 @@ export default defineComponent({
const dimensions = (data: Dimension[]) => {
let dimensions: string[] = [];
console.log(data);
dimensions = data.map((item) => {
const name = item.name ?? 'Missing',
value = item.value ?? 'Missing';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
}"
>
<div class="text-n-30">
(Language:
{{
description.language ? descType[description.language] : 'Missing'
}})
(Language:<ConditionalTextDisplay
:success-text="descType[description.language]"
:condition="description.language"
/>)
</div>
<div class="description text-xs">
{{ description.narrative }}
Expand All @@ -26,10 +26,11 @@

<script lang="ts">
import { defineComponent, toRefs } from 'vue';
import ConditionalTextDisplay from 'Components/ConditionalTextDisplay.vue';
export default defineComponent({
name: 'IndicatorDescription',
components: {},
components: { ConditionalTextDisplay },
props: {
data: {
type: Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@
>
<div class="language mb-1">
(Language:
{{
na.language
? type.language[na.language]
: 'Missing'
}})
<ConditionalTextDisplay
:success-text="type.language[na.language]"
:condition="na.language"
/>)
</div>
<div class="description text-xs">
{{ na.narrative ?? 'Missing' }}
<ConditionalTextDisplay
:success-text="na.narrative"
:condition="na.narrative"
failure-text="narrative"
/>
</div>
</div>
</td>
Expand All @@ -49,13 +52,21 @@
<a v-if="post.url" target="_blank" :href="post.url">{{
post.url
}}</a>
<span v-else>Missing</span>
<span v-else
><MissingDataItem item="document link"
/></span>
</td>
</tr>

<tr>
<td>Format</td>
<td>{{ post.format ?? 'Missing' }}</td>
<td>
<ConditionalTextDisplay
:success-text="post.format"
:condition="post.format"
failure-text="format"
/>
</td>
</tr>

<tr>
Expand All @@ -72,14 +83,17 @@
>
<div class="language mb-1">
(Language:
{{
na.language
? type.language[na.language]
: 'Missing'
}})
<ConditionalTextDisplay
:success-text="type.language[na.narrative]"
:condition="na.narrative"
/>)
</div>
<div class="description text-xs">
{{ na.narrative ?? 'Missing' }}
<ConditionalTextDisplay
:success-text="na.narrative"
:condition="na.narrative"
failure-text="narrative"
/>
</div>
</div>
</td>
Expand All @@ -94,11 +108,11 @@
class="text-xs"
:class="{ 'mb-1': post.category.length - 1 != c }"
>
{{
cat.code
? type.documentCategory[cat.code]
: 'Missing'
}}
<ConditionalTextDisplay
:success-text="type.documentCategory[cat.code]"
:condition="cat.code"
failure-text="category"
/>
</div>
</td>
</tr>
Expand All @@ -107,15 +121,15 @@
<td>Language</td>
<td>
<div class="text-xs">
{{
post.language[0].language
? post.language
.map(
(entry) => type.language[entry.language]
)
.join(', ')
: 'Missing'
}}
<ConditionalTextDisplay
:success-text="
post.language
.map((entry) => type.language[entry.language])
.join(', ')
"
:condition="post.language[0].language"
failure-text="language"
/>
</div>
</td>
</tr>
Expand All @@ -124,7 +138,11 @@
<td>Document Date</td>
<td>
<div class="text-xs">
{{ post.document_date[0].date ?? 'Missing' }}
<ConditionalTextDisplay
:success-text="post.document_date[0].date"
:condition="post.document_date[0].date"
failure-text="document date"
/>
</div>
</td>
</tr>
Expand All @@ -145,10 +163,12 @@ import { defineComponent, toRefs } from 'vue';
//composable
import getActivityTitle from 'Composable/title';
import ConditionalTextDisplay from 'Components/ConditionalTextDisplay.vue';
import MissingDataItem from 'Components/MissingDataItem.vue';
export default defineComponent({
name: 'IndicatorDocumentLink',
components: {},
components: { MissingDataItem, ConditionalTextDisplay },
props: {
data: {
type: Array,
Expand Down
Loading

0 comments on commit ff87093

Please sign in to comment.