refactor(FE): Support inputPrefix/inputSuffix on SelectInput

This commit is contained in:
rstubryan
2026-01-29 10:27:47 +07:00
parent 737d8e943c
commit 97bf785fe9
2 changed files with 265 additions and 125 deletions
@@ -874,32 +874,15 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
(warehouseId: number) => {
const stockInfo = warehouseStockMap.get(warehouseId);
if (!stockInfo) {
return (
<Badge
variant='ghost'
color='neutral'
size='sm'
className={{ badge: 'whitespace-nowrap font-semibold' }}
>
Kosong
</Badge>
);
return <span className='text-xs'>Kosong</span>;
}
const { productCount } = stockInfo;
let color: 'neutral' | 'success' | 'warning' = 'neutral';
if (productCount === 0) color = 'warning';
else if (productCount > 0) color = 'success';
return (
<Badge
variant='soft'
color={color}
size='sm'
className={{ badge: 'whitespace-nowrap font-semibold' }}
>
<span className='text-xs whitespace-nowrap'>
Tersedia {productCount} produk
</Badge>
</span>
);
},
[warehouseStockMap]
@@ -1360,7 +1343,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
errorMessage={formik.errors.source_warehouse_id as string}
isDisabled={type === 'detail'}
isClearable
startAdornment={
inputPrefix={
formik.values.source_warehouse_id
? getWarehouseStockAdornment(
formik.values.source_warehouse_id
@@ -1418,7 +1401,7 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
errorMessage={formik.errors.destination_warehouse_id as string}
isDisabled={type === 'detail'}
isClearable
startAdornment={
inputPrefix={
formik.values.destination_warehouse_id
? getWarehouseStockAdornment(
formik.values.destination_warehouse_id