-
Notifications
You must be signed in to change notification settings - Fork 0
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
CSL-20-premises-address-contact-details #3
CSL-20-premises-address-contact-details #3
Conversation
] | ||
}, | ||
'premises-address-line-1': { | ||
mixins: ['input-text'], |
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 would recommend adding a reference to the validation rules for each field, even if they are specified elsewhere, that would help for future maintainers to quickly see that there is validation in place and where to find it.
validate: [], // additional validation rules added in custom-validation.js
const contactDetails = []; | ||
contactDetails.push(req.sessionModel.get('premises-telephone')); | ||
contactDetails.push(req.sessionModel.get('premises-email')); | ||
req.sessionModel.set('contactDetails', contactDetails.join(', ')); |
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 would recommend leaving this out as it is unlikely to be used in this format
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.
Right now it matches the figma, but do we know which format will be used?
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 mean, there is no point in storing contactDetails
in sessionModel at this point.
if (key === 'premises-address-line-1') { | ||
if (!validators.required(req.form.values[key])) { | ||
return validationErrorFunc('required'); | ||
} | ||
if (req.form.values[key]?.length > 250) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
if (!validators.notUrl(req.form.values[key])) { | ||
return validationErrorFunc('notUrl'); | ||
} | ||
} | ||
|
||
if (key === 'premises-address-line-2') { | ||
if (req.form.values[key]?.length > 250) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
if (!validators.notUrl(req.form.values[key])) { | ||
return validationErrorFunc('notUrl'); | ||
} | ||
} | ||
|
||
if (key === 'premises-town-or-city') { | ||
if (!validators.required(req.form.values[key])) { | ||
return validationErrorFunc('required'); | ||
} | ||
if (req.form.values[key]?.length > 250) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
if (!validators.notUrl(req.form.values[key])) { | ||
return validationErrorFunc('notUrl'); | ||
} | ||
} | ||
|
||
if (key === 'premises-postcode') { | ||
if (!validators.required(req.form.values[key])) { | ||
return validationErrorFunc('required'); | ||
} | ||
if (req.form.values[key]?.length > 250) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
if (!validators.notUrl(req.form.values[key])) { | ||
return validationErrorFunc('notUrl'); | ||
} | ||
|
||
if (!validators.postcode(req.form.values[key])) { | ||
return validationErrorFunc('postcode'); | ||
} | ||
} | ||
|
||
if(key === 'premises-telephone') { | ||
if (!validators.required(req.form.values[key])) { | ||
return validationErrorFunc('required'); | ||
} | ||
|
||
if (req.form.values[key]?.length < 8 || req.form.values[key]?.length > 16) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
|
||
if (!validators.ukPhoneNumber(req.form.values[key])) { | ||
return validationErrorFunc('ukPhoneNumber'); | ||
} | ||
} | ||
|
||
if(key === 'premises-email') { | ||
if (!validators.required(req.form.values[key])) { | ||
return validationErrorFunc('required'); | ||
} | ||
|
||
if (req.form.values[key]?.length < 6 || req.form.values[key]?.length > 256) { | ||
return validationErrorFunc('maxlength'); | ||
} | ||
|
||
if (!validators.email(req.form.values[key])) { | ||
return validationErrorFunc('email'); | ||
} | ||
} |
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.
Technically, we can keep everything in this file, but it would be better to keep it in fields/index if it doesn't require any custom validation. I suggest to move it.
Although it would be useful to keep this custom-validation behaviour, as it will be used later
if (req.form.values[key]?.length < 8 || req.form.values[key]?.length > 16) { | ||
return validationErrorFunc('maxlength'); | ||
} |
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.
This is a redundant check, discussion has been held with UCD team to drop this as ukPhoneNumber
will cover this.
|
||
{{#input-submit}}continue{{/input-submit}} | ||
{{/page-content}} | ||
{{/partials-page}} |
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 newline at end of file
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.
All good, thanks for making changes
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.
Looks good to me
2e70f8d
into
feature/CSL-4-about-the-applicants
* CSL-20-premises-address-contact-details (#3) * CSL 13 - PCA - Added Licence holder details and address page (#7) * CSL-21: PCA - Responsible officer details (#6) * CSL-18: Guarantor details (#13) * CSL 28- PCA - Added new pages received criminal convictions, Invoicing address and contact details (#14) --------- Co-authored-by: Vinodha Samiyappan <155738658+vinodhasamiyappanHO@users.noreply.github.com> Co-authored-by: dk4g <157156245+dk4g@users.noreply.github.com>
Relates CSL-20
What?
add premises address page
add premises contact details page
Why?
How?
Testing?
Screenshots (optional)
Anything Else? (optional)
Check list