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

Add new input preferred_client_id to ClientCreateContainer #7

Merged
merged 7 commits into from
Dec 15, 2022

Conversation

aringocode
Copy link
Collaborator

@aringocode aringocode commented Dec 12, 2022

Add new input preferred_client_id to ClientCreateContainer.

This is an optional field. If it's empty, request won't send anything.

new-input.mp4

@aringocode aringocode self-assigned this Dec 12, 2022
@aringocode aringocode requested a review from Pe5h4 December 12, 2022 11:54
@aringocode
Copy link
Collaborator Author

@Pe5h4 can you review pls?)

@@ -133,6 +134,7 @@
"ClientFormField": {
"Add new input": "Přidat pole",
"Remove input": "Odstranit pole",
"Invalid format, should have minimum of 8 characters": "Nesprávný formát, musí mít minimálně 8 znaků",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway "Invalid format, input should have minimum of 8 characters": "Nesprávný formát, pole musí mít minimálně 8 znaků"

@@ -133,6 +134,7 @@
"ClientFormField": {
"Add new input": "Add new input",
"Remove input": "Remove input",
"Invalid format, should have minimum of 8 characters": "Invalid format, should have minimum of 8 characters",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway "Invalid format, input should have minimum of 8 characters":"Invalid format, input should have minimum of 8 characters"

@@ -108,6 +108,10 @@ const ClientCreateContainer = (props) => {
body.client_name = "";
}

if (body.preferred_client_id == "") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway I think you want to check for undefined here as well

name,
(name == "preferred_client_id") && {
validate: {
validation: value => (/^[-_a-zA-Z0-9]{8,64}$|^$/).test(value) || t("ClientFormField|Invalid format, should have minimum of 8 characters"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway As per my comment in locales Invalid format, input should have minimum of 8 characters

validate: {
validation: value => (/^[-_a-zA-Z0-9]{8,64}$|^$/).test(value) || t("ClientFormField|Invalid format, should have minimum of 8 characters"),
}
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway Remove comma here

onChange={reg.onChange}
onBlur={reg.onBlur}
innerRef={reg.ref}

invalid={(errors?.preferred_client_id) && errors.preferred_client_id}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway invalid={errors.preferred_client_id && errors.preferred_client_id} should be enough

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pe5h4 I tested it and ? here it is necessary => invalid={errors?.preferred_client_id && errors.preferred_client_id}

/>
{(errors?.preferred_client_id) && <FormFeedback>{errors.preferred_client_id?.message}</FormFeedback>}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway `{errors.preferred_client_id && {errors.preferred_client_id?.message}}

should be enough, but please test that

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Pe5h4 I tested it and ? is aslo here is necessary {errors?.preferred_client_id && <FormFeedback>{errors.preferred_client_id.message}</FormFeedback>}

This is a check that should be here. Because I use this component for different inputs and only this input preferred_client_id has an error message.

@aringocode aringocode requested a review from Pe5h4 December 15, 2022 07:15
Copy link
Collaborator

@Pe5h4 Pe5h4 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway Minor change in wrapping conditions, pls fix first and then you can merge it

@@ -108,6 +108,10 @@ const ClientCreateContainer = (props) => {
body.client_name = "";
}

if (body.preferred_client_id == "" || body.preferred_client_id == undefined) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Aringoaway wrap conditions ((body.preferred_client_id == "") || (body.preferred_client_id == undefined))

@aringocode aringocode marked this pull request as ready for review December 15, 2022 10:32
@aringocode aringocode merged commit fb4637f into main Dec 15, 2022
@aringocode aringocode deleted the refactor/client-create-add-input branch December 15, 2022 10:33
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.

2 participants