From 402adc3e566a117e62f5d2b05969e81643b3432f Mon Sep 17 00:00:00 2001 From: Hrvoje Fekete Date: Thu, 11 Jul 2024 15:46:26 -0700 Subject: [PATCH] 21297 - Fix for name for soleprop, fix for view and change address link (#16) * 21297 - Fixes for name and type display for sole prop. * 21297 - Fixed view and change business information disabled state. * 21297 - PR comments. * 21297 - Added env variables to examples and vaults.env. --- .env.example | 1 + devops/vaults.env | 1 + nuxt.config.ts | 1 + .../bcros/businessDetails/Header.vue | 1 + .../bcros/businessDetails/Links.vue | 30 ++++++++++++++++--- src/interfaces/business-i.ts | 4 +-- src/lang/en.json | 2 +- src/stores/business.ts | 10 +++++-- 8 files changed, 41 insertions(+), 9 deletions(-) diff --git a/.env.example b/.env.example index bf0479b0..e64d52b0 100644 --- a/.env.example +++ b/.env.example @@ -17,6 +17,7 @@ VUE_APP_LEGAL_API_URL="https://legal-api-dev.apps.silver.devops.gov.bc.ca" VUE_APP_LEGAL_API_VERSION_2="/api/v2" VUE_APP_STATUS_API_URL="https://status-api-dev.apps.silver.devops.gov.bc.ca" VUE_APP_STATUS_API_VERSION="/api/v1" +VUE_APP_BUSINESS_EDIT_URL="https://dev.edit.business.bcregistry.gov.bc.ca" #vaults launchdarkly # this is here to help CI pass and as this is already public it is OK to leave it here (dev value) diff --git a/devops/vaults.env b/devops/vaults.env index ca3bcca3..4f651631 100644 --- a/devops/vaults.env +++ b/devops/vaults.env @@ -22,6 +22,7 @@ VUE_APP_LEGAL_API_URL="op://API/$APP_ENV/legal-api/LEGAL_API_URL" VUE_APP_LEGAL_API_VERSION_2="op://API/$APP_ENV/legal-api/LEGAL_API_VERSION_2" VUE_APP_STATUS_API_URL="op://API/$APP_ENV/status-api/STATUS_API_URL" VUE_APP_STATUS_API_VERSION="op://API/$APP_ENV/status-api/STATUS_API_VERSION" +VUE_APP_BUSINESS_EDIT_URL="op://web-url/$APP_ENV/business-edit/BUSINESS_EDIT_URL" # vaults launchdarkly VUE_APP_LD_CLIENT_ID="op://launchdarkly/$APP_ENV/business-filings/BUSINESS_FILING_LD_CLIENT_ID" diff --git a/nuxt.config.ts b/nuxt.config.ts index 0857bcc7..2279ed1f 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -56,6 +56,7 @@ export default defineNuxtConfig({ ldClientId: process.env.VUE_APP_LD_CLIENT_ID || '', legalApiURL: `${process.env.VUE_APP_LEGAL_API_URL || ''}${process.env.VUE_APP_LEGAL_API_VERSION_2 || ''}`, payApiURL: `${process.env.VUE_APP_PAY_API_URL || ''}${process.env.VUE_APP_PAY_API_VERSION || ''}`, + editApiURL: `${process.env.VUE_APP_BUSINESS_EDIT_URL || ''}`, registryHomeURL: process.env.VUE_APP_REGISTRY_HOME_URL || '', appEnv: `${process.env.VUE_APP_POD_NAMESPACE || 'unknown'}`, requireLogin: true, diff --git a/src/components/bcros/businessDetails/Header.vue b/src/components/bcros/businessDetails/Header.vue index 2b6cc58d..9af4787f 100644 --- a/src/components/bcros/businessDetails/Header.vue +++ b/src/components/bcros/businessDetails/Header.vue @@ -25,5 +25,6 @@ diff --git a/src/components/bcros/businessDetails/Links.vue b/src/components/bcros/businessDetails/Links.vue index b66a1b41..55b85c8b 100644 --- a/src/components/bcros/businessDetails/Links.vue +++ b/src/components/bcros/businessDetails/Links.vue @@ -125,7 +125,12 @@ const isPendingDissolution = computed(() => { }) const isChangeBusinessInfoDisabled = computed(() => { - // todo: add staff exclusion. Staff should be allowed when business is not in good standing + if (!currentBusiness.value.goodStanding) { + // todo: add staff exclusion. Staff should not be allowed to skip rules for business + // as if this is enabled, and not in good standing, only thing that will come is popup warning + return false + } + const isAllowed = // if it's coop (currentBusiness.value.legalType === CorpTypeCd.COOP && @@ -133,15 +138,32 @@ const isChangeBusinessInfoDisabled = computed(() => { isAllowedToFile(FilingTypes.SPECIAL_RESOLUTION)) || // if it's firm (isFirm && isAllowedToFile(FilingTypes.CHANGE_OF_REGISTRATION)) || + // otherwise isAllowedToFile(FilingTypes.ALTERATION) - return !currentBusiness.value.goodStanding || isAllowed + return !isAllowed }) + +/** + * If business is Not In Good Standing and user isn't staff, emits an event to display NIGS dialog. + * Otherwise, navigates to Edit UI to create a Special Resolution or Change or Alteration filing. + */ const promptChangeBusinessInfo = () => { - // todo: implement + const baseUrl = useRuntimeConfig().public.editApiURL + const editUrl = `${baseUrl}/${currentBusiness.value.identifier}` - navigateTo('https://www.corporateonline.gov.bc.ca/', { external: true }) + // if (!isGoodStanding && !isRoleStaff) { + if (!currentBusiness.value.goodStanding) { + alert('change company info') + // this.emitNotInGoodStanding(NigsMessage.CHANGE_COMPANY_INFO) + } else if (currentBusiness.value.legalType === CorpTypeCd.COOP) { + navigateTo(`${editUrl}/special-resolution`, { external: true }) + } else if (isFirm) { + navigateTo(`${editUrl}/change`, { external: true }) + } else { + navigateTo(`${editUrl}/alteration`, { external: true }) + } } /** Request and Download Business Summary Document. */ diff --git a/src/interfaces/business-i.ts b/src/interfaces/business-i.ts index 1a1becf1..372b680a 100644 --- a/src/interfaces/business-i.ts +++ b/src/interfaces/business-i.ts @@ -1,5 +1,5 @@ import type { CorpTypeCd, AmalgamationTypes, FilingTypes } from '@bcrs-shared-components/enums' -import type { ApiDateTimeUtc, IsoDatePacific } from '@bcrs-shared-components/interfaces' +import type { AlternateNameIF, ApiDateTimeUtc, IsoDatePacific } from '@bcrs-shared-components/interfaces' import { BusinessStateE } from '~/enums/business-state-e' import { FilingSubTypeE } from '~/enums/filing-sub-type-e' @@ -8,7 +8,7 @@ import type { WarningTypesE } from '~/enums/warning-types-e' export interface SlimBusinessI { adminFreeze: boolean - alternateNames: { operatingName: string }[] + alternateNames: AlternateNameIF[] goodStanding: boolean identifier: string legalName: string diff --git a/src/lang/en.json b/src/lang/en.json index 0bb434d0..f6fb2959 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -59,7 +59,7 @@ "BEN": "BC Benefit Company", "BC": "BC Limited Company", "CP": "BC Cooperative Association", - "SP": "Sole Proprietorship", + "SP": "BC Sole Proprietorship", "GP": "BC General Partnership", "undefined": "N/A" } diff --git a/src/stores/business.ts b/src/stores/business.ts index 4ba18c74..4726b561 100644 --- a/src/stores/business.ts +++ b/src/stores/business.ts @@ -14,9 +14,15 @@ export const useBcrosBusiness = defineStore('bcros/business', () => { const currentParties: Ref = ref({} as PartiesI) const currentBusinessIdentifier = computed((): string => currentBusiness.value.identifier) const currentBusinessName = computed((): string => { - if (currentBusiness.value.alternateNames && currentBusiness.value.legalType === CorpTypeCd.SOLE_PROP) { - return currentBusiness.value.alternateNames[0].operatingName + const isSolePropOrGp = currentBusiness.value.legalType === CorpTypeCd.SOLE_PROP || + currentBusiness.value.legalType === CorpTypeCd.PARTNERSHIP + + if (currentBusiness.value.alternateNames && isSolePropOrGp) { + const alternateName = currentBusiness.value.alternateNames + .find(alternateName => alternateName.identifier === currentBusinessIdentifier.value) + return alternateName?.name || currentBusiness.value.legalName } + return currentBusiness.value.legalName }) const currentBusinessContact = ref({} as ContactBusinessI)