mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-23 06:45:46 +00:00
refactor(FE): Support inputPrefix/inputSuffix on SelectInput
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user