Skip to content

Commit

Permalink
fix: updating contact components for staff
Browse files Browse the repository at this point in the history
  • Loading branch information
paulushcgcj committed Jul 11, 2024
1 parent 7194411 commit a5830b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
16 changes: 8 additions & 8 deletions frontend/src/components/grouping/StaffContactGroupComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ const updateContactType = (value: CodeNameType | undefined) => {
autocomplete="off"
v-model="selectedValue.email"
:validations="[
...getValidations('location.addresses.*.email'),
submissionValidation(`location.addresses[${id}].email`)
...getValidations('location.contacts.*.email'),
submissionValidation(`location.contacts[${id}].email`)
]"
:enabled="true"
@empty="validation.email = true"
Expand All @@ -179,8 +179,8 @@ const updateContactType = (value: CodeNameType | undefined) => {
v-model="selectedValue.phoneNumber"
:enabled="true"
:validations="[
...getValidations('location.addresses.*.phoneNumber'),
submissionValidation(`location.addresses[${id}].phoneNumber`)
...getValidations('location.contacts.*.phoneNumber'),
submissionValidation(`location.contacts[${id}].phoneNumber`)
]"
@empty="validation.phoneNumber = true"
@error="validation.phoneNumber = !$event"
Expand All @@ -196,8 +196,8 @@ const updateContactType = (value: CodeNameType | undefined) => {
v-model="selectedValue.secondaryPhoneNumber"
:enabled="true"
:validations="[
...getValidations('location.addresses.*.secondaryPhoneNumber'),
submissionValidation(`location.addresses[${id}].secondaryPhoneNumber`)
...getValidations('location.contacts.*.secondaryPhoneNumber'),
submissionValidation(`location.contacts[${id}].secondaryPhoneNumber`)
]"
@empty="validation.secondaryPhoneNumber = true"
@error="validation.secondaryPhoneNumber = !$event"
Expand All @@ -213,8 +213,8 @@ const updateContactType = (value: CodeNameType | undefined) => {
v-model="selectedValue.faxNumber"
:enabled="true"
:validations="[
...getValidations('location.addresses.*.faxNumber'),
submissionValidation(`location.addresses[${id}].faxNumber`)
...getValidations('location.contacts.*.faxNumber'),
submissionValidation(`location.contacts[${id}].faxNumber`)
]"
@empty="validation.faxNumber = true"
@error="validation.faxNumber = !$event"
Expand Down
14 changes: 5 additions & 9 deletions frontend/src/pages/staffform/ContactsWizardStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Add16 from "@carbon/icons-vue/es/add/16";
//Defining the props and emitter to receive the data and emit an update
const props = withDefaults(
defineProps<{ data: FormDataDto; active: boolean; maxLocations?: number }>(),
{ maxLocations: 25 },
defineProps<{ data: FormDataDto; active: boolean; maxContacts?: number }>(),
{ maxContacts: 25 },
);
const emit = defineEmits<{
Expand Down Expand Up @@ -49,10 +49,6 @@ const updateContact = (value: Contact | undefined, index: number) => {
}
revalidate.value = !revalidate.value;
}
console.log(
'formData.location.contacts',
JSON.stringify(formData.location.contacts)
)
};
//Country related data
Expand Down Expand Up @@ -224,16 +220,16 @@ const contactName = (contact: Contact) =>{
<div class="grouping-02">
<p class="body-02 light-theme-text-text-primary">
{{
formData.location.contacts.length < props.maxLocations
formData.location.contacts.length < props.maxContacts
? "Contacts can be added to the applicant's account"
: `You can only add a maximum of ${props.maxLocations} contacts.`
: `You can only add a maximum of ${props.maxContacts} contacts.`
}}
</p>
</div>
<cds-button
kind="tertiary"
@click.prevent="addContact"
v-if="formData.location.contacts.length < props.maxLocations"
v-if="formData.location.contacts.length < props.maxContacts"
>
<span>Add another contact</span>
<Add16 slot="icon" />
Expand Down

0 comments on commit a5830b3

Please sign in to comment.