OBPIH-6109 Implement preference type variations subsection with the table#4510
OBPIH-6109 Implement preference type variations subsection with the table#4510awalkowiak merged 16 commits intofeature/product-supplier-list-redesignfrom
Conversation
src/js/components/productSupplier/create/subsections/PreferenceTypeVariations.jsx
Show resolved
Hide resolved
src/js/components/productSupplier/create/subsections/PreferenceTypeVariations.jsx
Show resolved
Hide resolved
| import usePreferenceTypeVariationsColumns | ||
| from 'hooks/productSupplier/form/usePreferenceTypeVariationsColumns'; | ||
|
|
||
| const PreferenceTypeVariations = ({ control, errors: { productSupplierPreferences } }) => { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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: '', |
There was a problem hiding this comment.
let's maybe store those in a const to a better readability?
| })} | ||
| StartIcon={<RiAddLine className="button-add-icon" />} | ||
| defaultLabel="Add new" | ||
| label="Add new" |
There was a problem hiding this comment.
shouldn't it be a translation key?
src/js/components/productSupplier/create/subsections/PreferenceTypeVariations.jsx
Show resolved
Hide resolved
| /> | ||
| ), | ||
| }, | ||
| ], [productSupplierPreferences]); |
There was a problem hiding this comment.
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(), |
There was a problem hiding this comment.
let's maybe also chain it, as I've started with such convention for properties above?
| remove, | ||
| }); | ||
|
|
||
| const defualtTableRow = { |
| validityEndDate: '', | ||
| bidName: '', | ||
| })} | ||
| onClick={() => append(defualtTableRow)} |
| ), | ||
| }, | ||
| ], [productSupplierPreferences]); | ||
| ], [errors]); |
There was a problem hiding this comment.
include the dependencies I've mentioned in the previous comment
f8cb311 to
778c1be
Compare
778c1be to
c0fe27c
Compare
…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
No description provided.