mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
refactor(FE-114): auto-populate notes with product name and enhance tooltip visibility in RecordingForm
This commit is contained in:
@@ -815,8 +815,14 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
<span className='text-error'>*</span>
|
<span className='text-error'>*</span>
|
||||||
</span>
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th>Jumlah Pakai</th>
|
<th>Jumlah Pakai
|
||||||
<th>Catatan</th>
|
<span
|
||||||
|
className="tooltip tooltip-error tooltip-bottom z-[9999]"
|
||||||
|
data-tip="required"
|
||||||
|
>
|
||||||
|
<span className="text-error">*</span>
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
{type !== 'detail' && <th>Action</th>}
|
{type !== 'detail' && <th>Action</th>}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -859,6 +865,18 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
`stocks.${idx}.product_warehouse_id`,
|
`stocks.${idx}.product_warehouse_id`,
|
||||||
option?.value || 0
|
option?.value || 0
|
||||||
);
|
);
|
||||||
|
// Auto-populate notes with product name by finding it in stockProducts data
|
||||||
|
if (option?.value && isResponseSuccess(stockProducts)) {
|
||||||
|
const selectedProduct = stockProducts.data.find(
|
||||||
|
(product) => product.id === option.value
|
||||||
|
);
|
||||||
|
if (selectedProduct) {
|
||||||
|
formik.setFieldValue(
|
||||||
|
`stocks.${idx}.notes`,
|
||||||
|
selectedProduct.product.name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
options={unifiedStockProducts}
|
options={unifiedStockProducts}
|
||||||
placeholder='Pilih Produk'
|
placeholder='Pilih Produk'
|
||||||
@@ -909,20 +927,7 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
placeholder='Jumlah Pakai'
|
placeholder='Jumlah Pakai'
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
{type !== 'detail' && (
|
||||||
<TextInput
|
|
||||||
name={`stocks.${idx}.notes`}
|
|
||||||
value={stock.notes || ''}
|
|
||||||
onChange={formik.handleChange}
|
|
||||||
onBlur={formik.handleBlur}
|
|
||||||
placeholder='Catatan...'
|
|
||||||
readOnly={type === 'detail'}
|
|
||||||
className={{
|
|
||||||
wrapper: 'w-full min-w-32',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</td>
|
|
||||||
{type !== 'detail' && (
|
|
||||||
<td>
|
<td>
|
||||||
<div className='flex justify-center'>
|
<div className='flex justify-center'>
|
||||||
<Button
|
<Button
|
||||||
@@ -1008,12 +1013,18 @@ const RecordingForm = ({ type = 'add', initialValues }: RecordingFormProps) => {
|
|||||||
)}
|
)}
|
||||||
<th>
|
<th>
|
||||||
Kondisi
|
Kondisi
|
||||||
|
<span
|
||||||
|
className="tooltip tooltip-error tooltip-bottom z-[9999]"
|
||||||
|
data-tip="required"
|
||||||
|
>
|
||||||
|
<span className="text-error">*</span>
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
<th>
|
<th>
|
||||||
Total
|
Total
|
||||||
<span
|
<span
|
||||||
className='tooltip tooltip-error tooltip-bottom z-[9999]'
|
className="tooltip tooltip-error tooltip-bottom z-[9999]"
|
||||||
data-tip='required'
|
data-tip="required"
|
||||||
>
|
>
|
||||||
<span className='text-error'>*</span>
|
<span className='text-error'>*</span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user