mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
refactor(FE-137): replace stock availability text with Badge component in MovementForm
This commit is contained in:
@@ -30,6 +30,7 @@ import { ProductWarehouseApi } from '@/services/api/inventory';
|
||||
import { toast } from 'react-hot-toast';
|
||||
import FileInput from '@/components/input/FileInput';
|
||||
import CheckboxInput from '@/components/input/CheckboxInput';
|
||||
import Badge from '@/components/Badge';
|
||||
|
||||
interface MovementFormProps {
|
||||
type?: 'add' | 'edit' | 'detail';
|
||||
@@ -518,16 +519,31 @@ const MovementForm = ({ type = 'add', initialValues }: MovementFormProps) => {
|
||||
const stockInfo = warehouseStockMap.get(warehouseId);
|
||||
if (!stockInfo) {
|
||||
return (
|
||||
<span className='text-sm text-gray-500 whitespace-nowrap'>
|
||||
(Kosong)
|
||||
</span>
|
||||
<Badge
|
||||
variant="ghost"
|
||||
color="neutral"
|
||||
size="sm"
|
||||
className={{ badge: 'whitespace-nowrap font-semibold' }}
|
||||
>
|
||||
Kosong
|
||||
</Badge>
|
||||
);
|
||||
}
|
||||
|
||||
const { productCount } = stockInfo;
|
||||
let color: 'neutral' | 'success' | 'warning' = 'neutral';
|
||||
if (productCount === 0) color = 'warning';
|
||||
else if (productCount > 0) color = 'success';
|
||||
|
||||
return (
|
||||
<span className='text-sm text-gray-500 whitespace-nowrap'>
|
||||
(Tersedia {stockInfo.productCount} produk)
|
||||
</span>
|
||||
<Badge
|
||||
variant="soft"
|
||||
color={color}
|
||||
size="sm"
|
||||
className={{ badge: 'whitespace-nowrap font-semibold' }}
|
||||
>
|
||||
Tersedia {productCount} produk
|
||||
</Badge>
|
||||
);
|
||||
},
|
||||
[warehouseStockMap]
|
||||
|
||||
Reference in New Issue
Block a user