Skip to content

Commit

Permalink
Strata - UI: UAT (#371)
Browse files Browse the repository at this point in the history
* update info collection notice modal for strata

* update unit number validation

* update error modal text

* remove alert on review step

* handle payment due for strata

* update todos in platform

* update todos for hosts

* remove alert on review step platforms

* remove comment

* fix nuxt config
  • Loading branch information
deetz99 authored Dec 10, 2024
1 parent 0b55750 commit 93729b8
Show file tree
Hide file tree
Showing 20 changed files with 196 additions and 107 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<ModalBase :title="$t('modal.info.collectionNotice.title')">
<div class="space-y-8">
<i18n-t keypath="modal.info.collectionNotice.content" tag="p" scope="global">
<template #act>
<template #straAct>
<em class="italic">{{ $t('act.strrAccomodations') }}</em>
</template>

Expand Down
3 changes: 3 additions & 0 deletions strr-base-web/app/enums/host-actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export enum HostActions {
SUBMIT_PAYMENT = 'SUBMIT_PAYMENT'
}
11 changes: 7 additions & 4 deletions strr-base-web/app/locales/en-CA.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* eslint-disable max-len */
export default {
act: {
strrAccomodations: 'Short-Term Rental Accommodations Act'
strrAccomodations: 'Short-Term Rental Accommodations Act',
fippa: 'Freedom of Information and Protection of Privacy Act'
},
badge: {
basicAccount: 'BASIC ACCOUNT',
Expand Down Expand Up @@ -264,7 +265,9 @@ export default {
createNewAccount: 'Create New Account',
contToCreateAccount: 'Continue to Create Account',
myStrr: 'My Short-term Rental Registry',
completingParty: 'Completing Party'
completingParty: 'Completing Party',
completePayment: 'Complete Payment',
payNow: 'Pay Now'
},
modal: {
declineTos: {
Expand All @@ -288,7 +291,7 @@ export default {
collectionNotice: {
triggerBtn: 'Information collection notice',
title: 'Information Collection Notice',
content: 'Any personal information required is collected to support the administration and enforcement of the {act}, under the authority of section 33(1) of that Act. Any questions about the collection of any information can be directed to the Executive Director of the Short-Term Rental Branch, at {email}.'
content: 'Any personal information required is collected to support the administration and enforcement of the {straAct}, under the authority of section 33(1) of that Act. Any questions about the collection of any information can be directed to the Executive Director of the Short-Term Rental Branch, at {email}.'
}
}
},
Expand Down Expand Up @@ -464,7 +467,7 @@ export default {
},
hint: {
businessLegalNamePlatform: 'The full legal name of the platform service provider',
businessLegalNameStrataHotel: 'The full legal name of the business that is operating the strata-titled hotel or motel. Include corporate designations (e.g., “Ltd.”, “Inc.”, “LLC.”',
businessLegalNameStrataHotel: 'The full legal name of the business that is operating the strata-titled hotel or motel. Include corporate designations (e.g., “Ltd.”, “Inc.”, “LLC.”)',
businessNumber: 'Canada Revenue Agency (CRA) Business Number',
humeJurisdiction: 'The regional or federal jurisdiction where the business was incorporated or registered, if applicable',
position: 'Enter your current job title or position'
Expand Down
67 changes: 51 additions & 16 deletions strr-base-web/app/utils/todoItems.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,58 @@
export const getTodoApplication = (applicationPath: string, applicationInfo?: ApplicationHeader) => {
import { HostActions } from '~/enums/host-actions'

// TODO: host actions enums
export const getTodoApplication = (
applicationPath: string,
payRedirectPath: string,
applicationInfo?: ApplicationHeader
) => {
// NOTE: even though this function is called within 'setup', useNuxtApp is required for the app context
const { t } = useNuxtApp().$i18n
return {
title: t('strr.title.application'),
// NOTE: currently this status could only ever be DRAFT as there is no review process for platforms
subtitle: applicationInfo ? applicationInfo.status : undefined,
button: {
label: applicationInfo ? t('btn.resumeApplication') : t('btn.beginApplication'),
action: () => {
if (applicationInfo) {
const localePath = useLocalePath()
const todos = []

if (!applicationInfo) {
todos.push({
title: t('strr.title.application'),
subtitle: undefined,
button: {
label: t('btn.beginApplication'),
action: async () => {
if (applicationInfo) {
await navigateTo(localePath(applicationPath))
}
}
}
})
} else if (applicationInfo?.status === ApplicationStatus.DRAFT) {
todos.push({
title: t('strr.title.application'),
// NOTE: currently this status could only ever be DRAFT as there is no review process for platforms
subtitle: applicationInfo.status,
button: {
label: t('btn.resumeApplication'),
action: async () => {
if (applicationInfo) {
// pass application number so that the application form can load in the saved data
useRouter().push({
path: useLocalePath()(applicationPath),
query: { applicationId: applicationInfo.applicationNumber }
})
} else {
useRouter().push({ path: useLocalePath()(applicationPath) })
await navigateTo(
{ path: localePath(applicationPath), query: { applicationId: applicationInfo.applicationNumber } }
)
}
}
}
}
})
} else if (applicationInfo?.hostActions.includes(HostActions.SUBMIT_PAYMENT)) { // TODO: handle other host actions
const { handlePaymentRedirect } = useNavigate()
todos.push({
title: t('label.completePayment'),
subtitle: undefined, // TODO: add subtitle ?
button: {
label: t('label.payNow'),
action: () => // TODO: how to complete payment for PAD accounts?
handlePaymentRedirect(applicationInfo.paymentToken, payRedirectPath)
}
})
}

return todos
}
6 changes: 5 additions & 1 deletion strr-host-pm-web/app/pages/dashboard/[applicationId].vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ onMounted(async () => {
const applicationId = route.params.applicationId as string
await permitStore.loadHostData(applicationId)
// set header stuff
todos.value = getTodoApplication(
'/application',
'/dashboard/' + application.value?.header.applicationNumber,
application.value?.header
)
if (!permitDetails.value || !showPermitDetails.value) {
// TODO: probably not ever going to get here? Filing would launch from the other account dashboard?
title.value = t('strr.title.dashboard')
todos.value = [getTodoApplication('/application', application.value?.header)]
} else {
// existing registration or application under the account
// set left side of header
Expand Down
14 changes: 0 additions & 14 deletions strr-platform-web/app/components/form/platform/ReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,6 @@ onMounted(async () => {
</script>
<template>
<div class="space-y-10" data-testid="platform-review-confirm">
<UAlert
color="yellow"
icon="i-mdi-alert"
:close-button="null"
variant="subtle"
:ui="{
inner: 'pt-0',
}"
>
<template #description>
<ConnectI18nBold class="text-bcGovGray-900" translation-path="strr.review.alert.contactInfo" />
</template>
</UAlert>

<!-- person completing platform application -->
<ConnectPageSection
:heading="{
Expand Down
6 changes: 5 additions & 1 deletion strr-platform-web/app/pages/platform/dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ onMounted(async () => {
$reset()
await loadPlatform()
// set header stuff
todos.value = getTodoApplication(
'/platform/application',
'/platform/dashboard/' + application.value?.header.applicationNumber,
application.value?.header
)
if (!permitDetails.value || !showPermitDetails.value) {
// no registration or valid complete application under the account, set static header
title.value = t('strr.title.dashboard')
todos.value = [getTodoApplication('/platform/application', application.value?.header)]
} else {
// existing registration or application under the account
// set left side of header
Expand Down
2 changes: 1 addition & 1 deletion strr-platform-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "strr-platform-web",
"private": true,
"type": "module",
"version": "0.0.14",
"version": "0.0.15",
"scripts": {
"build-check": "nuxt build",
"build": "nuxt generate",
Expand Down
14 changes: 0 additions & 14 deletions strr-strata-web/app/components/form/ReviewConfirm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ onMounted(async () => {
</script>
<template>
<div class="space-y-10" data-testid="strata-review-confirm">
<UAlert
color="yellow"
icon="i-mdi-alert"
:close-button="null"
variant="subtle"
:ui="{
inner: 'pt-0',
}"
>
<template #description>
<ConnectI18nBold class="text-bcGovGray-900" translation-path="strr.review.alert.contactInfo" />
</template>
</UAlert>

<!-- person completing strata application -->
<ConnectPageSection
:heading="{
Expand Down
38 changes: 38 additions & 0 deletions strr-strata-web/app/components/modal/error/ApplicationSubmit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script setup lang="ts">
import { FetchError } from 'ofetch'
const props = defineProps<{
error: unknown
}>()
const getErrorKey = () => {
if (props.error instanceof FetchError) {
const code = props.error.statusCode
if (code) {
if (code > 399 && code < 500) {
return 'badRequest'
} else if (code >= 500) {
return 'internal'
}
}
}
return 'unknown'
}
const errorKey = getErrorKey()
</script>
<template>
<ModalBase :actions="[{ label: $t('btn.close'), handler: () => useStrataModals().close() }]">
<div class="-mt-6 flex flex-col items-center gap-4 text-center">
<UIcon
name="i-mdi-alert-circle-outline"
class="size-8 text-red-500"
/>
<h2 class="text-xl font-semibold">
{{ $t(`modal.error.applicationSubmit.${errorKey}.title`) }}
</h2>
<p>{{ $t(`modal.error.applicationSubmit.${errorKey}.content`) }}</p>
<ContactSTRR class="self-start text-left" />
</div>
</ModalBase>
</template>
24 changes: 0 additions & 24 deletions strr-strata-web/app/components/modal/help/RegisterStrataHotel.vue

This file was deleted.

26 changes: 26 additions & 0 deletions strr-strata-web/app/components/modal/info/CollectionNotice.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<template>
<ModalBase :title="$t('modal.info.collectionNotice.title')">
<div class="space-y-4">
<i18n-t keypath="modal.info.collectionNotice.content.p1" tag="p" scope="global">
<template #straAct>
<em class="italic">{{ $t('act.strrAccomodations') }}</em>
</template>

<template #fippaAct>
<em class="italic">{{ $t('act.fippa') }}</em>
</template>
</i18n-t>
<i18n-t keypath="modal.info.collectionNotice.content.p2" tag="p" scope="global">
<template #email>
<a
class="text-blue-500 underline"
href="mailto:[email protected]"
target="_blank"
>
[email protected]
</a>
</template>
</i18n-t>
</div>
</ModalBase>
</template>
25 changes: 8 additions & 17 deletions strr-strata-web/app/composables/useStrataModals.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,17 @@
// https://ui.nuxt.com/components/modal#control-programmatically

import {
ModalBase,
ModalHelpRegisterStrataHotel
// ModalBase,
ModalErrorApplicationSubmit
} from '#components'

export const useStrataModals = () => {
const modal = useModal()
const { t } = useI18n()

function openhelpRegisteringStrataModal () {
modal.open(ModalBase, {
title: t('modal.helpRegisteringStrata.title'),
content: t('modal.helpRegisteringStrata.content'),
actions: [{ label: t('btn.close'), handler: () => close() }]
})
}
// const { t } = useI18n()

// might change the above modal to match this one
function openHelpRegisterStrataHotelModal () {
modal.open(ModalHelpRegisterStrataHotel, {
actions: [{ label: t('btn.close'), handler: () => close() }]
function openApplicationSubmitErrorModal (e: unknown) {
modal.open(ModalErrorApplicationSubmit, {
error: e
})
}

Expand All @@ -28,8 +20,7 @@ export const useStrataModals = () => {
}

return {
openhelpRegisteringStrataModal,
openHelpRegisterStrataHotelModal,
openApplicationSubmitErrorModal,
close
}
}
Loading

0 comments on commit 93729b8

Please sign in to comment.