From 4cee36caec545210c31033380468dcc88a1d1a11 Mon Sep 17 00:00:00 2001 From: CameronFreshworks <53542131+cameron-freshworks@users.noreply.github.com> Date: Wed, 9 Sep 2020 12:02:21 -0700 Subject: [PATCH] 4602 Name Request Correct Component (#15) * initial commit * Updated for initial PR * Removed padding class * Pr Comments Update * Initial Commit. Form Implementation * Wrap up NameRequest UI correction * import clean up * Console clean up * Pr Updates --- src/App.vue | 26 ++-- .../CompanyName/CorrectNameOptions.vue | 53 +++++-- .../CompanyName/CorrectNameRequest.vue | 141 ++++++++++++++++++ src/components/Company/CompanyName/index.ts | 1 + src/components/DefineCompany/YourCompany.vue | 35 ++++- src/components/common/Actions.vue | 23 --- .../dialogs/NameRequestErrorDialog.vue | 83 +++++++++++ src/components/dialogs/index.ts | 1 + .../correct-name-interface.ts | 5 + src/mixins/legal-api-mixin.ts | 24 --- src/mixins/name-request-mixin.ts | 58 ++++++- 11 files changed, 372 insertions(+), 78 deletions(-) create mode 100644 src/components/Company/CompanyName/CorrectNameRequest.vue create mode 100644 src/components/dialogs/NameRequestErrorDialog.vue diff --git a/src/App.vue b/src/App.vue index 729aac0fa..024dfefe0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -57,6 +57,13 @@ @okay="saveErrorDialog = false" /> + + = [] private saveWarnings: Array = [] private fileAndPayInvalidNameRequestDialog: boolean = false @@ -290,15 +301,10 @@ export default class App extends Mixins(BcolMixin, DateMixin, FilingTemplateMixi }) // listen for name request invalid error events - this.$root.$on('name-request-invalid-error', async error => { - console.log('NR error during File and Pay =', error) // eslint-disable-line no-console - this.fileAndPayInvalidNameRequestDialog = true - }) - - // listen for name request retrieve error events - this.$root.$on('name-request-retrieve-error', async () => { - console.log('Error while retrieving NR during File and Pay') // eslint-disable-line no-console - this.nameRequestInvalidErrorDialog = true + this.$root.$on('invalid-name-request', async error => { + console.log('Name request error:', error) // eslint-disable-line no-console + this.nameRequestErrorType = error + this.nameRequestErrorDialog = true }) // if we are already authenticated then go right to init diff --git a/src/components/Company/CompanyName/CorrectNameOptions.vue b/src/components/Company/CompanyName/CorrectNameOptions.vue index 14b66ea06..436c5cb8f 100644 --- a/src/components/Company/CompanyName/CorrectNameOptions.vue +++ b/src/components/Company/CompanyName/CorrectNameOptions.vue @@ -9,16 +9,28 @@ {{item.description}} - +
- - Done - + + Done + Cancel
@@ -29,6 +41,9 @@ // Libraries import { Component, Emit, Prop, Vue } from 'vue-property-decorator' +// Components +import CorrectNameRequest from './CorrectNameRequest.vue' + // Interfaces & Enums import { CorrectNameOptionIF } from '@/interfaces' import { CorrectionTypes } from '@/enums' @@ -40,14 +55,21 @@ import { CorrectionTypes } from '@/enums' * 2. If this options list is only passed one value the option panel will be open by default. * 3. The parent component will have to watch for the 'save' and 'cancel' events and handle them accordingly. */ -@Component({}) +@Component({ + components: { + CorrectNameRequest + } +}) export default class CorrectNameOptions extends Vue { /** The options to display */ - @Prop() private correctionNameChoices: Array + @Prop() correctionNameChoices: Array // local properties private displayedOptions: Array = [] private panel = null as number + private submit = false + private isLoading = false + private isFormValid = false private correctionNameOptions: Array = [ { id: CorrectionTypes.CORRECT_NAME, @@ -62,7 +84,7 @@ export default class CorrectNameOptions extends Vue { { id: CorrectionTypes.CORRECT_NEW_NR, description: 'Use a new name request number', - component: '' // CorrectNameRequest + component: CorrectNameRequest } ] @@ -74,16 +96,23 @@ export default class CorrectNameOptions extends Vue { if (this.correctionNameChoices.length === 1) this.panel = 0 // open by default if only 1 option } - /** save name correction */ - @Emit('save') - private emitSave (): void { - // Pass up event data for parent to handle setting to store etc + /** Trigger form submission */ + private submitNameCorrection (): void { + this.isLoading = true + this.submit = !this.submit + } + + /** Inform Parent name correction process is done. */ + @Emit('done') + private emitDone (isSaved: boolean): void { + this.isLoading = false + if (isSaved) this.panel = null } /** cancel name correction */ @Emit('cancel') private emitCancel (): void { - this.panel = 0 + this.panel = null } } diff --git a/src/components/Company/CompanyName/CorrectNameRequest.vue b/src/components/Company/CompanyName/CorrectNameRequest.vue new file mode 100644 index 000000000..9c4b3f494 --- /dev/null +++ b/src/components/Company/CompanyName/CorrectNameRequest.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/components/Company/CompanyName/index.ts b/src/components/Company/CompanyName/index.ts index c9f7c3866..e79f3a95d 100644 --- a/src/components/Company/CompanyName/index.ts +++ b/src/components/Company/CompanyName/index.ts @@ -1 +1,2 @@ export { default as CorrectNameOptions } from './CorrectNameOptions.vue' +export { default as CorrectNameRequest } from './CorrectNameRequest.vue' diff --git a/src/components/DefineCompany/YourCompany.vue b/src/components/DefineCompany/YourCompany.vue index 237a12d63..851fcbf78 100644 --- a/src/components/DefineCompany/YourCompany.vue +++ b/src/components/DefineCompany/YourCompany.vue @@ -11,13 +11,20 @@ - +
{{ companyName }}
BC Benefit Company BC Cooperative Association
+ + +