forked from bcgov/STRR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
368 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<script setup lang="ts"> | ||
const modalModel = defineModel({ type: Boolean, default: false }) | ||
const isSmallScreen = useMediaQuery('(max-width: 640px)') | ||
defineProps<{ | ||
title?: string | ||
content?: string | ||
actions?: { label: string, handler:() => void, color?: string, variant?: string }[] | ||
error?: { | ||
title: string | ||
description: string | ||
// showContactInfo?: boolean | ||
}, | ||
fullscreen?: boolean | ||
}>() | ||
defineEmits<{ | ||
modalClosed: [void] | ||
}>() | ||
</script> | ||
<template> | ||
<UModal | ||
v-model="modalModel" | ||
:fullscreen | ||
:ui="{ | ||
width: 'w-full sm:max-w-lg md:min-w-min' | ||
}" | ||
@after-leave="$emit('modalClosed')" | ||
> | ||
<UCard | ||
:ui="{ | ||
divide: '', | ||
rounded: fullscreen ? 'rounded-none' : 'rounded-lg', | ||
base: fullscreen ? 'h-screen' : '' | ||
}" | ||
> | ||
<template #header> | ||
<div class="flex items-center justify-between"> | ||
<span class="text-xl font-semibold text-bcGovColor-darkGray">{{ title }}</span> | ||
<UButton | ||
:ui="{ icon: { base: 'shrink-0 scale-150' } }" | ||
icon="i-mdi-close" | ||
color="primary" | ||
:aria-label="$t('btn.close')" | ||
square | ||
variant="ghost" | ||
@click="modalModel = false" | ||
/> | ||
</div> | ||
</template> | ||
<slot> | ||
<p v-if="content" class="text-bcGovColor-midGray"> | ||
{{ content }} | ||
</p> | ||
<div v-if="error" class="flex flex-col items-center gap-4 text-center"> | ||
<UIcon name="i-mdi-alert-circle-outline" class="-mt-10 size-8 text-red-500" /> | ||
<h2 class="text-xl font-semibold"> | ||
{{ error.title }} | ||
</h2> | ||
<p>{{ error.description }}</p> | ||
<!-- should we have a contact info section ?? --> | ||
<!-- <p v-if="error.showContactInfo" class="self-start"> | ||
Please contact us if you require assistance. | ||
</p> | ||
<BCRegContactInfo v-if="error.showContactInfo" class="self-start text-left" /> --> | ||
</div> | ||
</slot> | ||
<template v-if="actions !== undefined || $slots.footer" #footer> | ||
<slot name="footer"> | ||
<div v-if="actions !== undefined" class="flex flex-wrap items-center justify-center gap-4"> | ||
<UButton | ||
v-for="(action, index) in actions" | ||
:key="index" | ||
:block="isSmallScreen" | ||
:label="action.label" | ||
:variant="action.variant || 'solid'" | ||
:color="action.color || 'primary'" | ||
@click="action.handler" | ||
/> | ||
</div> | ||
</slot> | ||
</template> | ||
</UCard> | ||
</UModal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// https://ui.nuxt.com/components/modal#control-programmatically | ||
import { ModalBase } from '#components' | ||
|
||
export const useStrrModals = () => { | ||
const modal = useModal() | ||
const { t } = useI18n() | ||
|
||
function openAppSubmitError () { | ||
modal.open(ModalBase, { | ||
error: { | ||
title: 'Error submitting application', // need to come up with different error messages for different scenarios | ||
description: 'Some description here.' | ||
}, | ||
actions: [{ label: t('btn.close'), handler: () => close() }] | ||
}) | ||
} | ||
|
||
function close () { | ||
modal.close() | ||
} | ||
|
||
return { | ||
openAppSubmitError, | ||
close | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum ApplicationType { | ||
PLATFORM = 'PLATFORM' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
export interface ApiAddress { | ||
country: string | ||
address: string | ||
addressLineTwo: string | ||
city: string | ||
province: string | ||
postalCode: string | ||
} | ||
|
||
export interface ApiParty { | ||
firstName: string | ||
lastName: string | ||
middleName: string | ||
phoneNumber: string | ||
extension: string | ||
faxNumber: string | ||
emailAddress: string | ||
} | ||
|
||
export interface ApiRep extends ApiParty { | ||
jobTitle: string | ||
} | ||
|
||
export interface ApiBusinessDetails { | ||
legalName: string | ||
homeJurisdiction: string | ||
businessNumber: string | ||
consumerProtectionBCLicenceNumber: string | ||
noticeOfNonComplianceEmail: string | ||
noticeOfNonComplianceOptionalEmail: string | ||
takeDownRequestEmail: string | ||
takeDownRequestOptionalEmail: string | ||
mailingAddress: ApiAddress | ||
registeredOfficeOrAttorneyForServiceDetails: { | ||
attorneyName: string | ||
mailingAddress: ApiAddress | ||
} | ||
} | ||
|
||
export interface ApiPlatformDetails { | ||
brands: PlatBrand[] | ||
listingSize: ListingSize | ||
} | ||
|
||
export interface PlatformApplicationPayload { | ||
registration: { | ||
registrationType: ApplicationType | ||
completingParty: ApiParty | ||
platformRepresentatives: ApiRep[] | ||
businessDetails: ApiBusinessDetails | ||
platformDetails: ApiPlatformDetails | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export default defineNuxtPlugin(() => { | ||
const strrApiUrl = useRuntimeConfig().public.strrApiURL | ||
const accountStore = useConnectAccountStore() | ||
|
||
const { $keycloak } = useNuxtApp() | ||
|
||
const api = $fetch.create({ | ||
baseURL: strrApiUrl, | ||
onRequest ({ options }) { | ||
const headers = options.headers ||= {} | ||
if (Array.isArray(headers)) { | ||
headers.push(['Authorization', `Bearer ${$keycloak.token}`]) | ||
headers.push(['Account-Id', accountStore.currentAccount.id]) | ||
} else if (headers instanceof Headers) { | ||
headers.set('Authorization', `Bearer ${$keycloak.token}`) | ||
headers.set('Account-Id', accountStore.currentAccount.id) | ||
} else { | ||
headers.Authorization = `Bearer ${$keycloak.token}` | ||
headers['Account-Id'] = accountStore.currentAccount.id | ||
} | ||
} | ||
}) | ||
|
||
return { | ||
provide: { | ||
strrApi: api | ||
} | ||
} | ||
}) |
Oops, something went wrong.