-
Notifications
You must be signed in to change notification settings - Fork 70
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
17573/17467: Support for Manufacturer and HomeDealer QS Applicant Reviews #2687
Merged
seeker25
merged 1 commit into
bcgov:main
from
cameron-eyds:17573-User-Access-Staff-Templates
Jan 22, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,46 +24,76 @@ | |
</v-row> | ||
|
||
<!-- QS Applicant Info --> | ||
<v-row> | ||
<v-col class="cols-12 mt-5 py-2"> | ||
<h3>Qualified Supplier ({{ qsApplicationTypeDisplay }}) Information</h3> | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2 pr-2"> | ||
Qualified Supplier Name | ||
</v-col> | ||
<v-col | ||
class="py-2" | ||
data-test="qs-org-name" | ||
> | ||
{{ qsApplicantData && qsApplicantData.businessName }} | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2"> | ||
Phone Number | ||
</v-col> | ||
<v-col | ||
class="py-2" | ||
data-test="qs-phone" | ||
<template v-if="qsApplicantData"> | ||
<v-row> | ||
<v-col class="cols-12 mt-5 py-2"> | ||
<h3>Qualified Supplier ({{ qsApplicationTypeDisplay }}) Information</h3> | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2 pr-2"> | ||
Qualified Supplier Name | ||
</v-col> | ||
<v-col | ||
class="py-2" | ||
data-test="qs-org-name" | ||
> | ||
{{ qsApplicantData.businessName }} | ||
</v-col> | ||
</v-row> | ||
<v-row v-if="!isLawyerNotaryApplication"> | ||
<v-col class="cols-12 col-sm-3 py-2 pr-2"> | ||
DBA / Operating Name | ||
</v-col> | ||
<v-col | ||
class="py-2" | ||
data-test="qs-dba-name" | ||
> | ||
{{ qsApplicantData.dbaName || '(Not Entered)' }} | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2"> | ||
Phone Number | ||
</v-col> | ||
<v-col | ||
class="py-2" | ||
data-test="qs-phone" | ||
> | ||
{{ qsApplicantPhone }} | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2"> | ||
Mailing Address | ||
</v-col> | ||
<v-col class="py-2"> | ||
<BaseAddressForm | ||
v-if="qsApplicantData" | ||
:schema="null" | ||
:editing="false" | ||
:address="formatAddress(qsApplicantData.address)" | ||
/> | ||
</v-col> | ||
</v-row> | ||
<v-row | ||
v-if="isManufacturerApplication" | ||
data-test="qs-mf-location-row" | ||
> | ||
{{ qsApplicantData && qsApplicantPhone }} | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 col-sm-3 py-2"> | ||
Mailing Address | ||
</v-col> | ||
<v-col class="py-2"> | ||
<BaseAddressForm | ||
v-if="qsApplicantData" | ||
:schema="null" | ||
:editing="false" | ||
:address="formatAddress(qsApplicantData.address)" | ||
/> | ||
</v-col> | ||
</v-row> | ||
<v-col class="cols-12 col-sm-3 py-2"> | ||
Location of the Manufactured Home(s) | ||
</v-col> | ||
<v-col class="py-2"> | ||
<BaseAddressForm | ||
v-if="qsApplicantData.mfLocation" | ||
:schema="null" | ||
:editing="false" | ||
:address="formatAddress(qsApplicantData.mfLocation)" | ||
data-test="qs-mf-location" | ||
/> | ||
</v-col> | ||
</v-row> | ||
</template> | ||
|
||
<!-- Submitting Party Info --> | ||
<v-row> | ||
|
@@ -147,7 +177,7 @@ | |
</v-col> | ||
</v-row> | ||
<v-row> | ||
<v-col class="cols-12 py-2 icon-text"> | ||
<v-col class="cols-12 py-0 icon-text"> | ||
<v-icon | ||
class="pr-2" | ||
color="success" | ||
|
@@ -166,8 +196,10 @@ | |
</v-row> | ||
<v-row> | ||
<v-col class="py-2"> | ||
Legal name of the person authorized to complete and submit this application. <b>Note:</b> The authorized person | ||
must be an active B.C. lawyer or notary in good standing. | ||
Legal name of the person authorized to complete and submit this application. | ||
<span v-if="isLawyerNotaryApplication"> | ||
<b>Note:</b> The authorized person must be an active B.C. lawyer or notary in good standing. | ||
</span> | ||
</v-col> | ||
</v-row> | ||
<v-row> | ||
|
@@ -199,7 +231,11 @@ | |
</template> | ||
|
||
<script lang="ts"> | ||
import { QualifiedSupplierApplicant, QualifiedSupplierRequirementsConfig } from '@/models/external' | ||
import { | ||
MhrManufacturerInfoIF, | ||
QualifiedSupplierApplicant, | ||
QualifiedSupplierRequirementsConfig | ||
} from '@/models/external' | ||
import { computed, defineComponent, onMounted, reactive, toRefs } from '@vue/composition-api' | ||
import { userAccessDisplayNames, userAccessRequirements } from '@/resources/QualifiedSupplierAccessResource' | ||
import { Address } from '@/models/address' | ||
|
@@ -209,6 +245,7 @@ import { Contact } from '@/models/contact' | |
import { Organization } from '@/models/Organization' | ||
import { Task } from '@/models/Task' | ||
import TaskService from '@/services/task.services' | ||
import { TaskType } from '@/util/constants' | ||
import { User } from '@/models/user' | ||
import moment from 'moment/moment' | ||
|
||
|
@@ -236,22 +273,58 @@ export default defineComponent({ | |
}), | ||
qsRequirements: computed((): QualifiedSupplierRequirementsConfig[] => { | ||
return userAccessRequirements[props.taskDetails?.type] | ||
}) | ||
}), | ||
isLawyerNotaryApplication: computed((): boolean => props.taskDetails?.type === TaskType.MHR_LAWYER_NOTARY), | ||
isManufacturerApplication: computed((): boolean => props.taskDetails?.type === TaskType.MHR_MANUFACTURERS) | ||
}) | ||
|
||
/** | ||
* Converts manufacturer data to a qualified supplier applicant. | ||
* @param {MhrManufacturerInfoIF} mfData - The manufacturer data to convert. | ||
* @returns {QualifiedSupplierApplicant} The converted qualified supplier applicant. | ||
*/ | ||
const formatManufacturer = (mfData: MhrManufacturerInfoIF): QualifiedSupplierApplicant => { | ||
// Always 1 group with 1 owner in Manufacturer Owner record | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for this |
||
const mfOwner = mfData.ownerGroups[0].owners[0] | ||
return { | ||
address: mfOwner.address, | ||
authorizationName: mfData.authorizationName, | ||
businessName: mfOwner.organizationName, | ||
dbaName: mfData.dbaName, | ||
phoneNumber: mfOwner.phoneNumber, | ||
termsAccepted: mfData.termsAccepted, | ||
mfLocation: mfData.location.address | ||
} | ||
} | ||
|
||
/** On Mount: Fetch and parse Qualified Supplier applicant into local model. */ | ||
onMounted(async () => { | ||
await TaskService.getQsApplicantForTaskReview(props.accountUnderReview.id).then(response => { | ||
// Fetch Qualified Suppler application data | ||
await TaskService.getQsApplicantForTaskReview(props.accountUnderReview.id, props.taskDetails?.type).then(response => { | ||
if (!response?.data) { | ||
throw new Error('Invalid API response') | ||
} | ||
localState.qsApplicantData = response.data | ||
// Format response to fit QS model when Manufacturer | ||
localState.qsApplicantData = localState.isManufacturerApplication | ||
? formatManufacturer(response.data) | ||
: response.data | ||
}).catch(error => { console.error(error) }) | ||
}) | ||
|
||
/** | ||
* Formats the given date into a string representation. | ||
* @param {Date} date - The date object to format. | ||
* @returns {string} The formatted date string. | ||
*/ | ||
const formatDate = (date: Date): string => { | ||
return moment(date).format('MMM DD, YYYY') | ||
} | ||
|
||
/** | ||
* Formats the address by converting the city and street values to lowercase. | ||
* @param {Address} address - The address object to be formatted. | ||
* @returns {Address} - The formatted address object. | ||
*/ | ||
const formatAddress = (address: Address): Address => { | ||
address && Object.keys(address).forEach(key => { | ||
if (['city', 'street'].includes(key)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool, I wonder what's the difference between this and
computed<boolean>(()=> props.taskDetails?.type === TaskType.MHR_LAWYER_NOTARY)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm not sure!
It may be a case of either or. Both seem to do the trick.
Do you have a preference? I wonder if one is preferred in a more strict typing scenario 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
either works I think, any feature flags or timing this needs to be released at? or can we just merge and push to prod anytime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No feature flags required for this one!
Support to create these Qualified Supplier applications lives on our end and is flagged/unreleased.
This code can go anytime that works for Relationships release schedule 👍