Skip to content

Commit

Permalink
feat(FSADT1-1390): First nartions - Part #2
Browse files Browse the repository at this point in the history
  • Loading branch information
mamartinezmejia committed Aug 7, 2024
1 parent 4d782e8 commit 8ad7eaf
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public enum ClientTypeEnum {
// Enum constants representing client types
C, S, A, I, P, L, RSP, USP;
C, S, A, I, P, L, RSP, USP, B;

// A map for reverse lookup of enum constants by their name
private static final Map<String, ClientTypeEnum> CONSTANTS = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ private Mono<ClientDetailsDto> convertToDto(Feature openDataFeature) {
openDataFeature.properties().addressLine2(),
openDataFeature.properties().addressLine1()
),
StringUtils.EMPTY,
StringUtils.isNotBlank(openDataFeature.properties().addressLine2()) ?
openDataFeature.properties().addressLine1() : StringUtils.EMPTY,
null,
new ClientValueTextDto("CA", "Canada"),
provinceDto,
Expand Down
10 changes: 10 additions & 0 deletions frontend/src/helpers/validators/StaffFormValidations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ fieldValidations["businessInformation.lastName"] = [
hasOnlyNamingCharacters("last name"),
];

fieldValidations["businessInformation.workSafeBcNumber"] = [
optional(isOnlyNumbers("WorkSafeBC number should contain only numbers")),
optional(isMaxSizeMsg("WorkSafeBC", 6))
];

fieldValidations["businessInformation.clientAcronym"] = [
optional(isMaxSizeMsg("acronym", 8)),
optional(isAscii("acronym")),
];

// For the input field.
fieldValidations["identificationType.text"] = [isNotEmpty("You must select an ID type.")];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
// @ts-ignore
import Information16 from "@carbon/icons-vue/es/information/16";
// Defining the props and emiter to reveice the data and emit an update
// Defining the props and emiter to receive the data and emit an update
const props = defineProps<{
data: FormDataDto;
active: boolean;
Expand All @@ -53,6 +53,8 @@ watch(
// -- Validation of the component --
const validation = reactive<Record<string, boolean>>({
businessName: !!formData.value.businessInformation.businessName,
workSafeBcNumber: true,
clientAcronym: true
});
const checkValid = () =>
Expand Down Expand Up @@ -148,5 +150,34 @@ const mapFirstNationInfo = (firstNations: ForestClientDetailsDto[] = []) => {
<cds-inline-loading status="active" v-if="loading">Loading first nation details...</cds-inline-loading>
</data-fetcher>

<text-input-component
id="workSafeBcNumber"
label="WorkSafeBC Number"
placeholder=""
autocomplete="off"
v-model="formData.businessInformation.workSafeBcNumber"
:validations="[
...getValidations('businessInformation.workSafeBcNumber'),
submissionValidation(`businessInformation.workSafeBcNumber`),
]"
enabled
@empty="validation.workSafeBcNumber = true"
@error="validation.workSafeBcNumber = !$event"
/>

<text-input-component
id="clientAcronym"
label="Acronym"
placeholder=""
autocomplete="off"
v-model="formData.businessInformation.clientAcronym"
:validations="[
...getValidations('businessInformation.clientAcronym'),
submissionValidation(`businessInformation.clientAcronym`),
]"
enabled
@empty="validation.clientAcronym = true"
@error="validation.clientAcronym = !$event"
/>
</div>
</template>

0 comments on commit 8ad7eaf

Please sign in to comment.