Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 8 additions & 24 deletions src/views/inquiry/InquiryStep3.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@ import { useStudioStore } from '@/stores/studio'
*
* The last chance to catch something before a reviewer's time is spent on it,
* so the page leads with what is *wrong* rather than with what is there: empty
* addresses, missing foundation types, and every cross-field finding across the
* whole dossier collected into one list. Below that, the dossier as the
* reviewer will see it.
* addresses and every cross-field finding across the whole dossier collected
* into one list. Below that, the dossier as the reviewer will see it.
*
* A missing foundation type is *not* one of those wrongs — a sample records what
* the report observed, and plenty of reports observe an address without ever
* establishing its foundation type.
*/
const route = useRoute()
const router = useRouter()
Expand Down Expand Up @@ -86,10 +89,6 @@ const emptyAddresses = computed(() =>
samples.value.filter((s) => countFilledSampleFields(s) === 0),
)

const withoutFoundationType = computed(() =>
samples.value.filter((s) => s.foundationType === null),
)

/**
* Every cross-field finding in the dossier, tagged with the address it belongs
* to. Collected here rather than left in the editor because this is the moment
Expand All @@ -109,7 +108,6 @@ const isClean = computed(
() =>
samples.value.length > 0 &&
!emptyAddresses.value.length &&
!withoutFoundationType.value.length &&
!findings.value.length,
)

Expand All @@ -136,9 +134,6 @@ async function submit() {
if (emptyAddresses.value.length) {
warnings.push(`${emptyAddresses.value.length} adres(sen) zijn nog helemaal leeg.`)
}
if (withoutFoundationType.value.length) {
warnings.push(`${withoutFoundationType.value.length} adres(sen) missen een funderingstype.`)
}
if (findings.value.length) {
warnings.push(`${findings.value.length} waarde(n) zijn nog niet gecontroleerd.`)
}
Expand Down Expand Up @@ -210,8 +205,8 @@ useActionShortcuts((): Record<string, () => void> =>
</Callout>

<Callout v-else-if="isClean" tone="green" title="Klaar om aan te bieden">
Alle {{ samples.length }} adressen zijn gevuld, hebben een funderingstype en er zijn geen
waarden die elkaar tegenspreken.
Alle {{ samples.length }} adressen zijn gevuld en er zijn geen waarden die elkaar
tegenspreken.
</Callout>

<template v-else>
Expand All @@ -226,17 +221,6 @@ useActionShortcuts((): Record<string, () => void> =>
</template>
</Callout>

<Callout
v-if="withoutFoundationType.length"
tone="amber"
:title="`${withoutFoundationType.length} ${withoutFoundationType.length === 1 ? 'adres mist' : 'adressen missen'} een funderingstype`"
>
Zonder funderingstype werkt het adres niet door in de kaart en de producten.
<template #action>
<Button label="Naar invoer" @click="previous" />
</template>
</Callout>

<Panel v-if="findings.length" caption="TE CONTROLEREN WAARDEN" :meta="String(findings.length)">
<ul class="flex flex-col gap-2">
<li
Expand Down
6 changes: 1 addition & 5 deletions src/views/inquiry/InquiryView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,13 @@ const step = computed(() => nextStep(status.value))
*/
const blocker = computed<string | null>(() => {
if (!canSubmitForReview.value) return null
const { total, withFoundationType, empty } = completeness.value
const { total, empty } = completeness.value
if (total === 0) return 'Dit dossier heeft nog geen adressen. Voeg er minstens één toe in stap 2.'
if (empty > 0) {
return empty === 1
? '1 van de adressen is nog helemaal leeg. Zodra dat gevuld is kan het dossier ter controle.'
: `${empty} van de ${total} adressen zijn nog helemaal leeg. Zodra die gevuld zijn kan het dossier ter controle.`
}
const missing = total - withFoundationType
if (missing > 0) {
return `${missing} van de ${total} adressen mist een funderingstype. Zodra dat gevuld is kan het dossier ter controle.`
}
return null
})

Expand Down
Loading