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

feat(FE:FSADT1-785): updating frontend to new components and wizard #478

Merged
merged 236 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
236 commits
Select commit Hold shift + click to select a range
54a218e
feat(FE:FSADT1-772): adding stub server
May 23, 2023
fef4ff2
feat(FE:FSADT1-772): updating radio to use new component
May 23, 2023
779131e
SonarCloud Frontend config
DerekRoberts May 23, 2023
cf3978b
feat(FE:FSADT1-772): adding text input component
May 23, 2023
a50c3c0
chore: reordering folders
May 24, 2023
dcf8353
ci: updating frontend sonar config
May 24, 2023
6606547
ci: fixing test command
May 24, 2023
557cfe0
SonarCloud adjustments
DerekRoberts May 24, 2023
7ff6f06
chore: updating files
May 24, 2023
bec7722
feat(FE:FSADT1-772): adding new autocomplete component
May 24, 2023
f5b59c1
ci: updating coverage details
May 24, 2023
aafef4b
chore: updating report config
May 24, 2023
c7d6c37
chore(FE): changing sonar report to clover
May 24, 2023
191cbaa
fix(FE): fixing coverage report
May 24, 2023
14a5c2f
chore(FE): changing radio button response
May 25, 2023
8588294
chore: fixing bootstrap component events
May 25, 2023
4556260
feat(FE:FSADT1-772): updating form and components to carbon
Jun 2, 2023
628266c
Merge branch 'main' into feat/fe/FSADT1-772
Jun 2, 2023
9fc3039
chore: updating style
paulushcgcj Jun 13, 2023
a3e83ef
chore: updating devcontainer and workspace
paulushcgcj Jun 13, 2023
2ccd9e3
chore: removing debug code
paulushcgcj Jun 13, 2023
5fcfd15
feat(FE:FSADT1-785): updating business info
paulushcgcj Jun 13, 2023
d129b64
chore: adding type to ForestClientService.ts
paulushcgcj Jun 15, 2023
bb946f1
chore: updating dtos
paulushcgcj Jun 15, 2023
fb052df
chore: updating stubs
paulushcgcj Jun 15, 2023
1bb4829
chore: updating forms to reflect existing data
paulushcgcj Jun 15, 2023
6884d61
chore: updating some global styles
paulushcgcj Jun 15, 2023
062bedb
feat: adding new notification component
paulushcgcj Jun 15, 2023
23007da
chore: updating pages
paulushcgcj Jun 15, 2023
f9e4be4
fix: fixing business info screen
paulushcgcj Jun 15, 2023
d012ea9
fix: fix component initial value
paulushcgcj Jun 15, 2023
439d56e
chore: fixing form style
paulushcgcj Jun 15, 2023
e40580b
chore: fixing component labels
paulushcgcj Jun 15, 2023
3758faa
feat: adding wizard progress indicator component
paulushcgcj Jun 15, 2023
0829a1d
chore: added bc gov sans font
paulushcgcj Jun 16, 2023
ff8ba98
chore: updating styles
paulushcgcj Jun 16, 2023
145ebd5
feat(FE:FSADT1-785): adding review page
paulushcgcj Jun 16, 2023
83ebc58
feat(fe):
mamartinezmejia Jun 16, 2023
80693c5
feat(fe):
mamartinezmejia Jun 17, 2023
cb51b58
chore: adding initial validators
paulushcgcj Jun 19, 2023
95b76a2
chore: fixing style and adding validation
paulushcgcj Jun 19, 2023
1f6683c
chore: stylying multi-select tags
paulushcgcj Jun 19, 2023
8544156
chore: updating validators
paulushcgcj Jun 19, 2023
9f35254
chore: adding ignore case to unique validator
paulushcgcj Jun 19, 2023
d192f11
feat: adding modal and toast for delete
paulushcgcj Jun 20, 2023
9b66845
chore: adding provide/inject to modal
paulushcgcj Jun 20, 2023
63b5f11
feat: add links to progress indicator bar
paulushcgcj Jun 20, 2023
517d60e
feat: footer buttons change when review is ok
paulushcgcj Jun 20, 2023
26a7ebd
chore: updating workspace
paulushcgcj Jun 20, 2023
ff4645e
chore: adding extension suggestion
paulushcgcj Jun 20, 2023
ed46925
chore: organize dependencies
fterra-encora Jun 20, 2023
5344913
chore: organize dependencies
fterra-encora Jun 21, 2023
0911d06
chore: adding submission complete page and router
paulushcgcj Jun 20, 2023
c246bf3
feat: adding form completion and updating route
paulushcgcj Jun 21, 2023
501de5c
chore: updating style
paulushcgcj Jun 21, 2023
e018cd6
chore: updating modal mechanism to use vueuse
paulushcgcj Jun 21, 2023
be8edad
chore: readding vueuse
paulushcgcj Jun 21, 2023
865d5db
chore: code formatting
paulushcgcj Jun 21, 2023
c1edaa4
fix: autocomplete fetch when returning to screen
paulushcgcj Jun 21, 2023
3822bbe
chore: updating to use pictograms
paulushcgcj Jun 21, 2023
6e9fc23
chore: updating toast
paulushcgcj Jun 22, 2023
d6c7369
chore: changing icon for pictogram
paulushcgcj Jun 22, 2023
aee0cac
chore: updating validators
paulushcgcj Jun 22, 2023
bf8eebe
feat: adding new inputmask for webcomponents
paulushcgcj Jun 22, 2023
19e3c82
chore: updating stubs
paulushcgcj Jun 23, 2023
5d6af9d
chore: adding test content to the home page
paulushcgcj Jun 23, 2023
8014fe8
chore: adding logout and exit in case of error
paulushcgcj Jun 23, 2023
ea482d1
chore: updated MainHeader to carbon
paulushcgcj Jun 23, 2023
7b22ec1
chore: updating progress and style
paulushcgcj Jun 23, 2023
1b1a793
fix: fixing file name
paulushcgcj Jun 23, 2023
7e17c3b
fix: fixing progress indicator
paulushcgcj Jun 23, 2023
1069737
feat: adding mail message when duplicated
paulushcgcj Jun 23, 2023
20e7ae2
fix: removing vault due to inconsistency (#490)
Jun 7, 2023
f0d3e30
chore(deps): update maven all non-major dependencies (#488)
bcgov-devops Jun 7, 2023
5554aed
chore: clip digests (#484)
DerekRoberts Jun 7, 2023
512da33
FSADT1-749 (#482)
mamartinezmejia Jun 7, 2023
a19b25d
chore: updating codeowners (#492)
Jun 9, 2023
ad1ac62
feat(BE:FSADT-745): updating mail template (#491)
Jun 12, 2023
00bd59c
feat(be): (#493)
mamartinezmejia Jun 13, 2023
9827715
feat(BE:FSADT1-794): updating content (#494)
Jun 14, 2023
a9e6f68
(FSADT1-796) Changes in the DB (#496)
mamartinezmejia Jun 15, 2023
82194a6
chore(deps): update dependency c8 to v8 (#499)
bcgov-devops Jun 23, 2023
da3141e
chore(deps): update dependency jsdom to v22 (#500)
bcgov-devops Jun 23, 2023
bb1689a
chore: updating package lock
paulushcgcj Jun 23, 2023
0f06fcd
Merge branch 'main' into feat/fe/FSADT1-772
Jun 23, 2023
3e00b83
chore: adding username
paulushcgcj Jun 23, 2023
400d2f0
fix: fixing package lock
paulushcgcj Jun 23, 2023
628997e
fix: fixing build
paulushcgcj Jun 24, 2023
3a5bb13
fix: adding vue tsc
paulushcgcj Jun 24, 2023
3700e1c
chore: updating dockerfile
paulushcgcj Jun 24, 2023
cdf999a
docs: updating extensions
paulushcgcj Jun 26, 2023
f2e1280
fix: fixing invisible HR
paulushcgcj Jun 26, 2023
e3b0e9b
chore: removing bootstrap
paulushcgcj Jun 26, 2023
01db9d2
ci: fixing build
paulushcgcj Jun 26, 2023
87e6025
ci: fixing deployment order
paulushcgcj Jun 26, 2023
4c94479
chore: cleaning up the backend code
paulushcgcj Jun 26, 2023
72ad744
chore: adding submission info
paulushcgcj Jun 26, 2023
02fdead
chore: removing phone mask to check for validity
paulushcgcj Jun 26, 2023
a412df7
chore: trimming postal code
paulushcgcj Jun 26, 2023
50d5195
chore(temp): adding temporary presentation mail
paulushcgcj Jun 26, 2023
fc333d9
feat: adding initial loading info to ac and fetcher
paulushcgcj Jun 26, 2023
39f6f42
chore: adding data conversion
paulushcgcj Jun 26, 2023
35c1866
ci: adding platform for oracle db
paulushcgcj Jun 26, 2023
618813d
chore: overwriting route
paulushcgcj Jun 26, 2023
0852b37
fix: fixing replace
paulushcgcj Jun 26, 2023
79bd743
fix: fixing BE build
paulushcgcj Jun 26, 2023
afb77f8
fix: fixing BcRegistryExceptionMessageDto
paulushcgcj Jun 26, 2023
6e98830
fix: set state to invalid when business name input gets changed
fterra-encora Jun 26, 2023
421a4b5
chore: renaming dto and enabling to reflection
paulushcgcj Jun 26, 2023
6dae0dc
chore: setting content to 50% of screen
paulushcgcj Jun 26, 2023
14d32b4
chore: adding margin to header
paulushcgcj Jun 26, 2023
39dc072
chore: fixing tab header space
paulushcgcj Jun 26, 2023
c507d75
chore: adding scroll to top
paulushcgcj Jun 26, 2023
22bdd3a
fix: reset data after form submission
paulushcgcj Jun 26, 2023
dad983a
fix(deps): update vitest monorepo to ^0.32.2
paulushcgcj Jun 26, 2023
5ca1a3a
chore: updating deploy check
paulushcgcj Jun 26, 2023
9584745
fix: adding new CORS header keys
paulushcgcj Jun 26, 2023
15dd6df
fix: fixing native build
paulushcgcj Jun 26, 2023
e4b6bda
fix: adding cors header manually
paulushcgcj Jun 26, 2023
10f5639
fix: adding new CORS header keys
mamartinezmejia Jun 27, 2023
2b0e805
ci: increasing resource due to constant restarts
paulushcgcj Jun 27, 2023
51ee0e2
chore: fixing dto property name
paulushcgcj Jun 27, 2023
2e094b1
chore: adding location contact association
paulushcgcj Jun 27, 2023
d6dfffa
ci: fixing cypress test
paulushcgcj Jun 27, 2023
b641d66
ci: changing CHES to prod
paulushcgcj Jun 27, 2023
ed5aa8d
Merge branch 'main' into feat/fe/FSADT1-772
Jun 27, 2023
a73fe7d
fix(fe):
mamartinezmejia Jun 27, 2023
a194262
chore: adding error log to ches
paulushcgcj Jun 27, 2023
731df79
chore: adding ChesMailRequest to reflection
paulushcgcj Jun 27, 2023
1f33855
chore: adding ChesMailResponse to reflection
paulushcgcj Jun 27, 2023
0ddccec
fix(fe):
mamartinezmejia Jun 27, 2023
df9e836
feat(fe):
mamartinezmejia Jun 27, 2023
bd8e0f2
chore: fixing unregistered client type
paulushcgcj Jun 27, 2023
8b8aff1
feat: adding global validator for submission
paulushcgcj Jun 28, 2023
1afaeb8
chore: updating stubs
paulushcgcj Jun 28, 2023
d085775
chore: adding on-load validation check
paulushcgcj Jun 28, 2023
34a9e74
chore: cleanung up app.vue
paulushcgcj Jun 28, 2023
66fbab1
chore: updating recommended extensions
paulushcgcj Jun 28, 2023
a2862cb
chore: updating gitignore
paulushcgcj Jun 28, 2023
d4973d5
chore: renaming components to short imports
paulushcgcj Jun 28, 2023
42fe330
chore: adding import back
paulushcgcj Jun 28, 2023
08b65ec
chore(fe):
mamartinezmejia Jun 28, 2023
6a5673a
chore: changing colors
paulushcgcj Jun 28, 2023
eab876e
chore: removing field from buttons
paulushcgcj Jun 28, 2023
c307905
chore: removing form reset
paulushcgcj Jun 28, 2023
3f70825
chore: updating autocomplete and textinput components
paulushcgcj Jun 28, 2023
b3c06de
feat: address autocomplete stubs
paulushcgcj Jun 28, 2023
4ab6f0e
feat(FE:FSADT1-812): add autocomplete to frontend
paulushcgcj Jun 28, 2023
ea94165
feat(BE:FSADT1-812): updating address backend api
paulushcgcj Jun 28, 2023
16ecbec
fix(FE:FSADT1-805): fixing country not selected
paulushcgcj Jun 28, 2023
7d96400
chore: fixing loading image during api loading
paulushcgcj Jun 29, 2023
26376cc
fix: fixing dropdown updates
paulushcgcj Jun 29, 2023
a070568
fix: fixing reset on province data after changes
paulushcgcj Jun 29, 2023
05ba170
chore: adding delay to some stub apis
paulushcgcj Jun 29, 2023
d0e1c90
chore: removing format on paste
paulushcgcj Jun 29, 2023
1cfe372
feat(FE:FSADT1-812): adding loading on details loading and global error
paulushcgcj Jun 29, 2023
2014347
feat: adding canada post api to deployment
paulushcgcj Jun 29, 2023
f8292ce
chore: fire update:selected-value with undefined
fterra-encora Jun 29, 2023
fae0d5a
test: emits update:selected-value
fterra-encora Jun 29, 2023
c1eeab2
test: emit update:selected-value with new value
fterra-encora Jun 29, 2023
8216a85
fix: remove duplicated error handler
fterra-encora Jun 30, 2023
ba9bb00
test: fix element finding
fterra-encora Jun 30, 2023
29a7fac
test: fix expected text in the header
fterra-encora Jun 30, 2023
7199c1d
Merge branch 'main' into feat/fe/FSADT1-772
Jun 30, 2023
b8712e6
chore: moving composables to its own folder
paulushcgcj Jun 30, 2023
37c171e
fix: fixing refactor issues
paulushcgcj Jun 30, 2023
564bb5b
Merge branch 'main' into feat/fe/FSADT1-772
Jun 30, 2023
b92a87c
ci: fixing frontend build
paulushcgcj Jul 4, 2023
c2e8ea5
Merge branch 'main' into feat/fe/FSADT1-772
Jul 4, 2023
639ad01
chore: cleaning imports
paulushcgcj Jul 4, 2023
67f20c1
chore: increasing coverage
paulushcgcj Jul 5, 2023
66fb875
chore: fixing code smell on backend
paulushcgcj Jul 5, 2023
653d32c
chore: fixing code smell on backend
paulushcgcj Jul 5, 2023
8ec8530
chore: fixing sonar bugs
paulushcgcj Jul 5, 2023
eff27b1
fix: removing unused components
paulushcgcj Jul 5, 2023
fe3145c
fix(security): mitigating a few frontend security issues
paulushcgcj Jul 5, 2023
f1ceeae
chore: updating workspace and extensions
paulushcgcj Jul 5, 2023
2919721
fix(codesmell): fixing codesmell
paulushcgcj Jul 5, 2023
99c994b
feat(fe):
mamartinezmejia Jul 5, 2023
8b4d920
ci: adding vite node env as part of deployment
paulushcgcj Jul 5, 2023
67504d9
chore: updating lint and adding reformatted code
paulushcgcj Jul 5, 2023
c3b420f
chore: simplifying keycloak loading and passing
paulushcgcj Jul 5, 2023
4cb5e4f
fix(typescript:S905): fixing logout issue
paulushcgcj Jul 5, 2023
a7bbdda
fix: trying to disable sonar rules
paulushcgcj Jul 5, 2023
3338b28
test: updating coverage configuration
paulushcgcj Jul 5, 2023
001516c
feat(fe):
mamartinezmejia Jul 5, 2023
ad57420
fix:
mamartinezmejia Jul 5, 2023
ac7339c
test: updating coverage configuration
paulushcgcj Jul 5, 2023
82d710f
chore: adding lint dependencies
paulushcgcj Jul 5, 2023
ea1645d
chore: updating validators and function signature
paulushcgcj Jul 5, 2023
6faf041
test: adding some tests
paulushcgcj Jul 5, 2023
23eb031
fix:
mamartinezmejia Jul 6, 2023
0055cec
fix: fixing code smells
paulushcgcj Jul 6, 2023
f56cb0c
test: ignoring more files
paulushcgcj Jul 6, 2023
ea4ac3f
chore: fixing code smell and adding new ignores
paulushcgcj Jul 6, 2023
6fc5796
chore: refactoring files
paulushcgcj Jul 6, 2023
c9e9534
test: ignoring files
paulushcgcj Jul 6, 2023
3b13cc1
chore: removing unused components
paulushcgcj Jul 6, 2023
0b3c485
chore: refactoring component location
paulushcgcj Jul 6, 2023
507f436
chore: removing default header
paulushcgcj Jul 6, 2023
415f768
test: removing test
paulushcgcj Jul 6, 2023
540d064
test: fixing existing tests warn messages
paulushcgcj Jul 6, 2023
d1c73d8
test: adding test
paulushcgcj Jul 6, 2023
439a3e7
test: adding useFetch test
paulushcgcj Jul 6, 2023
46f5b37
chore: updating components
paulushcgcj Jul 6, 2023
ea4c021
feat(fe):
mamartinezmejia Jul 6, 2023
9aa78e4
test: testing App.vue
paulushcgcj Jul 6, 2023
edfda6c
fix: fixing dropdown initial value
paulushcgcj Jul 6, 2023
b5d5682
chore: refactoring NoteComponent
paulushcgcj Jul 6, 2023
30f0386
chore: updating App test to mock header
paulushcgcj Jul 6, 2023
58b3873
chore: updating useFetch test
paulushcgcj Jul 6, 2023
c71bcf3
test: adding few more tests
paulushcgcj Jul 6, 2023
f3d037c
test: adding multi select test
paulushcgcj Jul 6, 2023
cf9437f
chore: removing main from coverage
paulushcgcj Jul 6, 2023
5c62193
ci: adding env configuration
paulushcgcj Jul 6, 2023
b25f515
feat(fe):
mamartinezmejia Jul 7, 2023
46b27d7
chore: fixing code smell
paulushcgcj Jul 6, 2023
21f0b63
chore: updating gitignore
paulushcgcj Jul 7, 2023
712dbd0
chore: updating vite configuration
paulushcgcj Jul 7, 2023
42e972c
test: adding/updating test dependencies
paulushcgcj Jul 7, 2023
b7d2306
test(cypress): updating cypress configuration
paulushcgcj Jul 7, 2023
2e34fca
test: adding HomePage component test
paulushcgcj Jul 7, 2023
823603d
docs: updating gitignore
paulushcgcj Jul 7, 2023
624ceb8
chore: updating/removing old cypress files
paulushcgcj Jul 7, 2023
174e810
ci: updating frontend test configuration
paulushcgcj Jul 7, 2023
5d15c01
test: updating some tests and test configuration
paulushcgcj Jul 10, 2023
11bc695
test: updating tests
paulushcgcj Jul 10, 2023
280a215
chore: tweaking coverage results
paulushcgcj Jul 10, 2023
0c910ac
chore: fixing bug
paulushcgcj Jul 10, 2023
0fbaf3d
feat(FE:FSADT1-814): Vertical wizard (breadcrumb) (#515)
fterra-encora Jul 10, 2023
b954e6c
ci: fixing lcov report issue
paulushcgcj Jul 10, 2023
d165303
feat(fe):
mamartinezmejia Jul 11, 2023
05691fc
chore: removing dependency
paulushcgcj Jul 11, 2023
ffd043b
chore: removing rm
paulushcgcj Jul 11, 2023
2c406fd
chore: fixing nyc
paulushcgcj Jul 11, 2023
f49d3d9
Merge branch 'main' into feat/fe/FSADT1-772
Jul 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,13 @@ jobs:
npm run test
dir: frontend
sonar_args: >
-Dsonar.exclusions=**/coverage/**,**/examples/**,**/pages/**
-Dsonar.javascript.lcov.reportPaths=./coverage/coverage-final.json
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=forest-client-frontend
-Dsonar.sources=src
-Dsonar.tests=src/tests
-Dsonar.exclusions=**/coverage/**/*,**/dist/**/*,**/examples/**/*,**/pages/**/*,**/tests/**/*
-Dsonar.test.inclusions=**/tests/**/*
sonar_project_token: ${{ secrets.SONAR_TOKEN_FRONTEND }}

trivy:
Expand Down
67 changes: 6 additions & 61 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ Press "option+shift+f" and select prettier as the formatter

## **Technology options**

## **Stubs**:

To speed-up development and allow a simple development environment, a stub server was added to fake backend responses. For this we use the same technology as we use
in our backend, that is [wiremock](https://wiremock.org/). For that run `npm run stub` in a separated window to execute the backend server. You can add new responses or update
the existing ones by tweeking the content of the [stub](stub/) folder following the [response templating](https://wiremock.org/docs/response-templating/) format and the [request matching](https://wiremock.org/docs/request-matching/) to suit your needs.

### **Style**:

[Bootstrap for vue3](https://www.npmjs.com/package/bootstrap-vue-3), installed through this [prefered installation method](https://cdmoro.github.io/bootstrap-vue-3/getting-started/#preferred-installation), so it can automatically importing components, to aviod the warn message that cannot find components when run unit tests
Expand All @@ -53,67 +59,6 @@ Press "option+shift+f" and select prettier as the formatter
[Vitest](https://vitest.dev/api/)
[Vue test util](https://test-utils.vuejs.org/api/)

### **Reusable Form Component Structure**:

#### **FormData in a json format**:

```
{
"container_id": {
"model_name": "value",
"model_name": [{
"model_name": "value",
...
}],
...
},
...
}
```

where **container_id** is whatever we'd like to use for each form section, **model_name** is for the form content in this section, for example: input, select, radio, checkbox, table, etc. **model_name** is for the fields inside a table or a group

#### **Form json schema**:

```
{
container: {
title: string;
id: string;
defaultOpen?: boolean;
nextId?: string;
nextText?: string;
alwaysOpen?: boolean;
},
content: [{
fieldProps: {
label: string;
required?: boolean;
id: string;
modelName: string; // It is required and need to be aligned with the field name in formData
note?: string;
tooltip?: string;
errorMsg?: string;
};
type: string;
disabled?: boolean;
state?: boolean;
depend?: {
fieldModelName: string;
value: string | number | boolean;
};
options?: Array<CommonObjectType>; // for select, checkbox group, radio group
addButtonText?: string; // for table
subfields?: Array<CommonObjectType>; // for table and group
},
...
]
}
```

where the:
**container** part has the properties for each form section, using the properties from the CollapseCard component, id need to be aliged with the one in formData
**content** part has the properties for each field in this form section

### **Vite vs vue cli**

Expand Down
1 change: 1 addition & 0 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ declare module '@vue/runtime-core' {
BRow: typeof import('bootstrap-vue-3')['BRow']
BTab: typeof import('bootstrap-vue-3')['BTab']
BTabs: typeof import('bootstrap-vue-3')['BTabs']
RadioInputComponent: typeof import('./src/components/forms/RadioInputComponent.vue')['default']
}
}
36 changes: 35 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"test:e2e": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress open'",
"test:e2e:ci": "start-server-and-test preview http://127.0.0.1:5050/ 'cypress run'",
"typecheck": "vue-tsc --noEmit -p tsconfig.vitest.json --composite false",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore"
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"stub":"wiremock --enable-stub-cors --port 3000 --preserve-host-header --root-dir ./stub --verbose --global-response-templating"
},
"dependencies": {
"@dsb-norge/vue-keycloak-js": "^2.2.0",
Expand Down Expand Up @@ -73,6 +74,7 @@
"prettier": "^2.8.4",
"start-server-and-test": "^2.0.0",
"typescript": "~5.0.0",
"vitest": "^0.31.0"
"vitest": "^0.31.0",
"wiremock": "^2.35.0"
}
}
64 changes: 64 additions & 0 deletions frontend/src/components/forms/RadioInputComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<template>
<b-form-group label="Choose one these options:" v-slot="{ ariaDescribedby}">
<b-form-radio v-for="(option, index) in modelValue" :key="index"
v-model="selectedValue"
:id="id+'_'+option.value"
:value="option.value"
:name="option.text"
:aria-describedby="ariaDescribedby"
@change="validateInput"
>{{ option.text }}</b-form-radio>
</b-form-group>
</template>

<script setup lang="ts">
import { ref, watch } from "vue";
import { CodeDescrType, isEmpty } from "@/core/CommonTypes";

const props = defineProps({
id: { type: String, required: true },
modelValue: {
type: Array as () => CodeDescrType[],
required: true,
},
validations: { type: Array<Function>, required: true },
});

//Events we emit during component lifecycle
const emit = defineEmits<{
(e: "error", value: string): void;
(e: "empty", value: boolean): void;
(e: "update:modelValue", value: Object): void;
}>();

const selectedValue = ref({});
//We initialize the error message handling for validation
const error = ref<string | undefined>("");

//We call all the validations
const validateInput = () => {
if (props.validations) {
error.value = props.validations
.map((validation) => validation(selectedValue.value))
.filter((errorMessage) => {
if (errorMessage) return true;
return false;
})
.shift() ?? "";
}
emit("empty", isEmpty(selectedValue));
};

//We watch for input changes to emit events
watch(selectedValue, () => {
if (error.value) {
error.value = "";
}
emit("update:modelValue",
props.modelValue.find((entry) => entry.value === selectedValue.value)
);
});

//We watch for error changes to emit events
watch(error, () => emit("error", error.value));
</script>
9 changes: 8 additions & 1 deletion frontend/src/core/CommonTypes.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { Ref } from "vue";

export interface CodeDescrType {
value: string;
text: string;
Expand All @@ -6,4 +8,9 @@ export interface CodeDescrType {
export interface ValidationMessageType {
fieldId: string;
errorMsg: string;
}
}

export const isEmpty = (ref: Ref): boolean => {
const value = ref.value;
return value === undefined || value === null || value === "";
};
29 changes: 17 additions & 12 deletions frontend/src/pages/applyclientnumber/ApplyClientNumberPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,17 @@
<CollapseCard title="Registered business"
id="businessInformationId"
defaultOpen>
<Label label="Choose one these options:"
id="clientTypeLabelId" />

<b-form-group @change="getBusinessName">
<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>

<RadioInputComponent
:id="'businessType'"
:modelValue="[
{ value: 'R',text: 'I have a BC registered business (corporation, sole proprietorship, society, etc.)' },
{ value: 'U',text: 'I have an unregistered sole proprietorship' },
]"
:validations="[]"
@update:modelValue="formData = { ...formData, businessInformation:{ businessType: $event } }"
/>

<ValidationMessages fieldId = 'businessInformation.businessType'
:validationMessages="validationMessages"
:modelValue="formData.businessInformation.businessType" />
Expand Down Expand Up @@ -141,6 +140,9 @@ import ValidationMessages from "@/common/ValidationMessagesComponent.vue";
import AddressSection from "@/pages/applyclientnumber/AddressSectionComponent.vue";
import ContactSectionComponent from '@/pages/applyclientnumber/ContactSectionComponent.vue';


import RadioInputComponent from '@/components/forms/RadioInputComponent.vue';

const props = defineProps({
submitterInformation: {
type: Object,
Expand All @@ -151,6 +153,9 @@ const props = defineProps({
//---- Form Data ----//
let formData = ref(formDataDto);

watch([formData],() => console.log('Updated',formData.value));


//--- Initializing the Addresses array ---//
addNewAddress(formDataDto.location.addresses);

Expand Down
Loading