Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSADT1-722 #435

Merged
merged 13 commits into from
Apr 19, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"code": "00000002",
"name": "BAXTER",
"status": "ACTIVE",
"clientType": "SP"
"legalType": "SP"
}"""
)
public record ClientLookUpDto(
Expand All @@ -22,7 +22,7 @@ public record ClientLookUpDto(
@Schema(description = "The status of the client, could be ACTIVE or INACTIVE",
example = "ACTIVE")
String status,
@Schema(description = "The type of the client", example = "SP")
String clientType
@Schema(description = "The legal type of the client", example = "SP")
String legalType
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ insert into nrfc.client_type_code (client_type_code, description, effective_date
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('S', 'Society', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('T', 'First Nation Tribal Council', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('U', 'Unregistered Company', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;
insert into nrfc.client_type_code (client_type_code, description, effective_date, create_user) values ('Z', 'Sole Proprietorship', current_timestamp, 'mariamar') on conflict (client_type_code) do nothing;

update nrfc.client_type_code set expiry_date = current_timestamp where client_type_code not in ('C', 'Z');

insert into nrfc.contact_type_code (contact_type_code, description, effective_date, create_user) values ('AP', 'Accounts Payable', current_timestamp, 'mariamar') on conflict (contact_type_code) do nothing;
insert into nrfc.contact_type_code (contact_type_code, description, effective_date, create_user) values ('AR', 'Accounts Receivable', current_timestamp, 'mariamar') on conflict (contact_type_code) do nothing;
Expand Down
4 changes: 2 additions & 2 deletions backend/src/test/java/ca/bc/gov/app/TestConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class TestConstants {
"code": "BC0772006",
"name": "U3 POWER CORP.",
"status": "ACTIVE",
"clientType": "SP"
"legalType": "SP"
}
]""";

Expand Down Expand Up @@ -151,7 +151,7 @@ public class TestConstants {
"code": "BC0772006",
"name": "U3 POWER CORP.",
"status": "ACTIVE",
"clientType": "SP"
"legalType": "SP"
}""";

public static final String OPENMAPS_OK = """
Expand Down
4 changes: 2 additions & 2 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ declare module '@vue/runtime-core' {
BCardHeader: typeof import('bootstrap-vue-3')['BCardHeader']
BCol: typeof import('bootstrap-vue-3')['BCol']
BCollapse: typeof import('bootstrap-vue-3')['BCollapse']
BFormGroup: typeof import('bootstrap-vue-3')['BFormGroup']
BFormInput: typeof import('bootstrap-vue-3')['BFormInput']
BFormRadio: typeof import('bootstrap-vue-3')['BFormRadio']
BFormSelect: typeof import('bootstrap-vue-3')['BFormSelect']
BPopover: typeof import('bootstrap-vue-3')['BPopover']
BRow: typeof import('bootstrap-vue-3')['BRow']
BTab: typeof import('bootstrap-vue-3')['BTab']
BTabs: typeof import('bootstrap-vue-3')['BTabs']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
}
7 changes: 5 additions & 2 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
:title="tab.title"
:key="index"
:active="index == 0"
><component :is="tab.content"
/></b-tab>
>
<component :is="tab.content" :businessName="bceidBusinessName"/>
</b-tab>
</b-tabs>
</div>
</div>
Expand All @@ -26,6 +27,7 @@ import { navBlue, navSelectBlue } from "./utils/color";

const keycloak: KeycloakInstance | undefined = inject("keycloak");
let tabs: Ref<Array<{ title: string; content: DefineComponent }>> = ref([]);
let bceidBusinessName = ref();

if (keycloak &&
keycloak.tokenParsed &&
Expand All @@ -34,6 +36,7 @@ if (keycloak &&
}
else {
tabs.value = [{ title: "Apply a New Client", content: ApplyClientNumber }];
bceidBusinessName = keycloak && keycloak.tokenParsed ? keycloak.tokenParsed.displayed : "Dev Test Client Name";
}
</script>

Expand Down
23 changes: 15 additions & 8 deletions frontend/src/common/LabelComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
<label>{{ label }}</label>
<!-- <bi-asterisk v-if="required"
style="font-size: 8px; color: red; margin-top: 2px; margin-right: 6px" /> -->
<bi-question-circle-fill :id="'form-field-label-' + id"
v-if="tooltip"
style="font-size: 12px; color: #6c757d" />
<b-popover :target="'form-field-label-' + id"
triggers="hover"
placement="top"
:content="tooltip">
</b-popover>
<div v-if="tooltip">
&nbsp;
<!-- <bi-question-circle-fill :id="'popover' + id"
style="font-size: 12px;
color: #6c757d;
vertical-align: top;" /> -->
<bi-question-circle-fill :id="'popover' + id"
style="font-size: 12px;
color: #6c757d;
vertical-align: top;" />
<b-popover :target="'popover' + id"
placement="right">
<span v-html="tooltip" />
</b-popover>
</div>
</div>
</template>

Expand Down
12 changes: 6 additions & 6 deletions frontend/src/dto/ApplyClientNumberDto.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { CodeDescrType } from "@/core/CommonTypes";

export interface FormDataDto {
businessType: {
clientType: CodeDescrType;
};
businessInformation: {
businessType: string,
legalType: string,
clientType: CodeDescrType;
incorporationNumber: string;
businessName: null | string;
goodStanding: string;
Expand Down Expand Up @@ -42,10 +42,10 @@ export interface Contact {
}

export const formDataDto: FormDataDto = {
businessType: {
clientType: { value: "", text: "" },
},
businessInformation: {
businessType: "",
legalType: "",
clientType: { value: "", text: "" },
incorporationNumber: "",
businessName: "",
goodStanding: "",
Expand Down
120 changes: 63 additions & 57 deletions frontend/src/pages/applyclientnumber/ApplyClientNumberPage.vue
Original file line number Diff line number Diff line change
@@ -1,47 +1,55 @@
<template>

<div style="margin: 24px">

<CollapseCard title="Business Type"
id="clientTypeId"
defaultOpen>

<Label label="What type of business are you?"
:required="true" />
<div class="col-xs-12 col-sm-12 col-md-6 col-lg-4">
<b-form-select id="businessTypeId"
v-model="formData.businessType.clientType"
:options="clientTypeCodes" />
</div>
<ValidationMessages fieldId = 'businessType.clientType'
:validationMessages="validationMessages" />
</CollapseCard>

<CollapseCard title="Registered business"
id="businessInformationId"
:display="displayBusinessInformation"
defaultOpen>
<Label label="Start typing to search for your B.C. registered business"
:required="true" />

<!-- TODO: Value should be an object. It displays the name, but on the back, this should contain:
the code, the name, the id, and the address (for BC registry) -->
<Autocomplete id="businessNameId"
:value="formData.businessInformation.businessName"
:searchData="businessNames"
datalistId="businessNameListId"
@updateValue="formData.businessInformation.businessName = $event;
populateBusinessList($event);
filterSearchData($event)" />
<Note note="The name must be the same as it is in BC Registries" />
<ValidationMessages fieldId = 'businessInformation.businessName'
<Label label="Please choose one of the options below"
tooltip="Go to <a href='https://www.bcregistry.ca/business/auth/home/decide-business' target='_blank'>BC Registries and Online Services</a>
to read more about registered businesses. Sole proprietorships can be registered and unregistered."
id="clientTypeLabelId" />

<b-form-group>
<b-form-radio v-model="formData.businessInformation.businessType"
value="R">
I have a BC registered business (corporation, sole proprietorship, society, etc.)
</b-form-radio>
<b-form-radio v-model="formData.businessInformation.businessType"
value="U">I have an unregistered sole proprietorship
</b-form-radio>
</b-form-group>
<ValidationMessages fieldId = 'businessInformation.businessType'
:validationMessages="validationMessages" />


<div v-if="formData.businessInformation.businessType == 'R'">
<Label label="Start typing to search for your B.C. registered business"
tooltip="If your business name isn't in the list, go to BC Registries to confirm."
id="businessNameLabelId" />

<Autocomplete id="businessNameId"
:value="formData.businessInformation.businessName"
:searchData="businessNames"
datalistId="businessNameListId"
@updateValue="formData.businessInformation.businessName = $event;
populateBusinessList($event);
filterSearchData($event)" />
<Note note="The name must be the same as it is in BC Registries" />
<ValidationMessages fieldId = 'businessInformation.businessName'
:validationMessages="validationMessages" />
</div>

<div v-if="formData.businessInformation.businessType == 'U'">
<Label label="Unregistered sole proprietorship" />
{{ businessName }}
</div>

<span v-if="'' !== formData.businessInformation.incorporationNumber &&
'' !== formData.businessInformation.goodStanding &&
!formData.businessInformation.goodStanding">
!formData.businessInformation.goodStanding &&
('SP' === formData.businessInformation.legalType ||
'GP' === formData.businessInformation.legalType)">
<strong>Your business is not in good standing with BC Registries. You must go to
<a href="https://www.bcregistry.ca/business/auth/home/decide-business">BC Registries </a>
<a href="https://www.bcregistry.ca/business/auth/home/decide-business" target="_blank">BC Registries </a>
to resolve this before you can apply for a client number.
</strong>
</span>
Expand All @@ -54,7 +62,7 @@

<span>
<strong>This information is from
<a href="https://www.bcregistry.ca/business/auth/home/decide-business">BC Registries</a>.
<a href="https://www.bcregistry.ca/business/auth/home/decide-business" target="_blank">BC Registries</a>.
If it's incorrect, go to BC Registries to update it before continuing.</strong>
</span>

Expand Down Expand Up @@ -129,6 +137,13 @@ import Autocomplete from "@/common/AutocompleteComponent.vue";
import ValidationMessages from "@/common/ValidationMessagesComponent.vue";
import AddressSection from "@/pages/applyclientnumber/AddressSectionComponent.vue";

const props = defineProps({
businessName: {
type: String,
required: false
}
});

//---- Form Data ----//
let formData = ref(formDataDto);

Expand Down Expand Up @@ -160,7 +175,11 @@ function filterSearchData(event: any) {
const filteredSearchDataValues = businessNames.value.filter(p => p.text.toLowerCase() === event.toLowerCase());

if (filteredSearchDataValues.length === 1) {
formData.value.businessInformation.incorporationNumber = filteredSearchDataValues[0].value.value;
formData.value.businessInformation.incorporationNumber = filteredSearchDataValues[0].value.value;
formData.value.businessInformation.legalType = filteredSearchDataValues[0].legalType;
//TODO: Do mapping function

console.log(JSON.stringify(filteredSearchDataValues[0]));
useFetchTo(`/api/clients/${formData.value.businessInformation.incorporationNumber}`, addressDataRef, { method:'get' });
}
else {
Expand All @@ -178,30 +197,17 @@ watch(
}
);

const displayBusinessInformation = computed(() => {
return null !== formData.value.businessType.clientType &&
formData.value.businessType.clientType.value.length > 0 &&
"I" !== formData.value.businessType.clientType.value &&
"Z" !== formData.value.businessType.clientType.value;
});

const displayCommonSections = computed(() => {
if (null !== formData.value.businessType.clientType &&
"I" === formData.value.businessType.clientType.value) {
//TODO
if ("" === formData.value.businessInformation.businessType ||
"" === formData.value.businessInformation.legalType ||
"" === formData.value.businessInformation.incorporationNumber) {
return false;
}
else if ("true" === formData.value.businessInformation.goodStanding) {
return true;
}
else {
if (null !== formData.value.businessType.clientType &&
null !== formData.value.businessInformation &&
null !== formData.value.businessInformation.incorporationNumber &&
"" !== formData.value.businessInformation.incorporationNumber &&
"true" === formData.value.businessInformation.goodStanding) {
return true;
}
else {
return false;
}
else {
return false;
}
});

Expand Down
10 changes: 8 additions & 2 deletions frontend/src/services/FetchService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { ref, watch } from "vue";
import { useFetchTo } from "@/services/ForestClientService";
import EventBus, { EventBusEvent } from "@/services/EventBus";

export const conversionFn = (code: any) => { return { value: { value: code.code, text: code.name }, text: code.name } };
export const conversionFn = (code: any) => {
return {
value: { value: code.code, text: code.name },
text: code.name,
legalType: code.legalType
}
};

/**
* Autocomplete function for the business name
Expand All @@ -26,7 +32,7 @@ export const useBusinessNameIdAutoComplete = () => {
watch(data, (dataFetched, _) => {
dataSelection.value = dataFetched;
EventBus.emit("businessNameListId", dataFetched.map((code: any) => {
return { value: code.name, text: code.name }
return { value: code.name, text: code.name, test: code.legalType }
}));
});

Expand Down
6 changes: 4 additions & 2 deletions frontend/tsconfig.vitest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"compilerOptions": {
"composite": true,
"lib": [],
"types": ["node", "jsdom"]
"types": ["node", "jsdom"],
"ignoreDeprecations": "5.0",
"verbatimModuleSyntax": true
}
}
}