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

CSL-20-premises-address-contact-details #3

Merged

Conversation

RobertMcCann
Copy link
Contributor

Relates CSL-20

What?

add premises address page
add premises contact details page

Why?

How?

Testing?

Screenshots (optional)

Anything Else? (optional)

Check list

  • I have reviewed my own pull request
  • I have written tests (if relevant)

]
},
'premises-address-line-1': {
mixins: ['input-text'],
Copy link
Collaborator

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(', '));
Copy link
Collaborator

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

Copy link
Contributor Author

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?

Copy link
Collaborator

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.

Comment on lines 7 to 82
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');
}
}
Copy link
Collaborator

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

Comment on lines 61 to 63
if (req.form.values[key]?.length < 8 || req.form.values[key]?.length > 16) {
return validationErrorFunc('maxlength');
}
Copy link
Collaborator

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}}
Copy link
Collaborator

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

Copy link
Collaborator

@dk4g dk4g left a 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

@dk4g dk4g changed the base branch from main to feature/CSL-4-about-the-applicants November 19, 2024 19:06
@RobertMcCann RobertMcCann marked this pull request as ready for review November 20, 2024 11:05
Copy link
Contributor

@vinodhasamiyappanHO vinodhasamiyappanHO left a 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

@RobertMcCann RobertMcCann merged commit 2e70f8d into feature/CSL-4-about-the-applicants Nov 20, 2024
2 checks passed
@RobertMcCann RobertMcCann deleted the CSL-20-premises-address branch November 20, 2024 12:50
@dk4g dk4g mentioned this pull request Nov 21, 2024
2 tasks
dk4g added a commit that referenced this pull request Nov 27, 2024
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants