Skip to content

OBPIH-6109 Implement preference type variations subsection with the table#4510

Merged
awalkowiak merged 16 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6109
Feb 22, 2024
Merged

OBPIH-6109 Implement preference type variations subsection with the table#4510
awalkowiak merged 16 commits intofeature/product-supplier-list-redesignfrom
OBPIH-6109

Conversation

@alannadolny
Copy link
Collaborator

No description provided.

import usePreferenceTypeVariationsColumns
from 'hooks/productSupplier/form/usePreferenceTypeVariationsColumns';

const PreferenceTypeVariations = ({ control, errors: { productSupplierPreferences } }) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't like the naming (productSuppllierPreferences). Let's stick to errors or at least pass it to the hook like:

usePreferenceTypeVariationsColumns({
    errors: productSupplierPreferences,
    control,
    remove,
  });

and use it in the hook via errors.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I get, why you wanted to do it like this, but I think it's not a big of a deal to receive all errors here, or you could just pass productSupplierPreferences' errors when invoking the component:

<PreferenceTypeSection
        control={control}
        errors={errors.productSupplierPreferences}
/>

preferenceType: {},
validityStartDate: '',
validityEndDate: '',
bidName: '',
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's maybe store those in a const to a better readability?

})}
StartIcon={<RiAddLine className="button-add-icon" />}
defaultLabel="Add new"
label="Add new"
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't it be a translation key?

/>
),
},
], [productSupplierPreferences]);
Copy link
Collaborator

@kchelstowski kchelstowski Feb 20, 2024

Choose a reason for hiding this comment

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

buyers and preferenceTypes should also be in the dependency array (and errors potentially too)

invalid_type_error: 'Preference type is required',
required_error: 'Preference type is required',
}).required(),
validityEndDate: z.string().optional().nullable(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's maybe also chain it, as I've started with such convention for properties above?

remove,
});

const defualtTableRow = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

defualt -> default

validityEndDate: '',
bidName: '',
})}
onClick={() => append(defualtTableRow)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

defualt -> default

),
},
], [productSupplierPreferences]);
], [errors]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

include the dependencies I've mentioned in the previous comment

@awalkowiak awalkowiak merged commit 000995c into feature/product-supplier-list-redesign Feb 22, 2024
@awalkowiak awalkowiak deleted the OBPIH-6109 branch February 22, 2024 11:29
awalkowiak pushed a commit that referenced this pull request Mar 12, 2024
…able (#4510)

* OBPIH-6109 Create section and subsection for preference type variations

* OBPIH-6109 Adjust form and validation hook

* OBPIH-6109 Create util for differentiate default preference types from others

* OBPIH-6109 Use section and subsection in new form

* OBPIH-6109 Create invalid items indicator

* OBPIH-6109 Create hooks for preference type variations columns

* OBPIH-6109 Add styling

* OBPIH-6109 Fix datepicker format

* OBPIH-6109 Add translations

* OBPIH-6109 Fix styling of v2 input components

* OBPIH-6109 Fix fontSize of react select icons

* OBPIH-6109 Fix placement of datefield component in subsections

* OBPIH-6109 Sort imports

* OBPIH-6109 Fixes after review

* OBPIH-6109 Fixes after review

* OBPIH-6109 Fixes after rebase
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