feat: update quantity display and stock update button visibility in SparepartCardList component

This commit is contained in:
2025-12-04 13:59:25 +07:00
parent f22e120204
commit 147171373c

View File

@@ -298,7 +298,6 @@ const SparepartCardList = ({
> >
{item[header]} {item[header]}
</Title> </Title>
<Text type="secondary">Qty: {item.sparepart_qty || 0}</Text>
<Text type="secondary" style={{ display: 'block' }}> <Text type="secondary" style={{ display: 'block' }}>
Stok: {item.sparepart_stok || 'Not Available'} Stok: {item.sparepart_stok || 'Not Available'}
</Text> </Text>
@@ -309,9 +308,9 @@ const SparepartCardList = ({
style={{ style={{
marginBottom: '8px', marginBottom: '8px',
display: 'flex', display: 'flex',
justifyContent: 'center',
}} }}
> >
<Text type="secondary">Qty</Text>
<Button <Button
icon={<MinusOutlined />} icon={<MinusOutlined />}
onClick={() => onClick={() =>
@@ -327,7 +326,7 @@ const SparepartCardList = ({
strong strong
style={{ padding: '0 8px', fontSize: '16px' }} style={{ padding: '0 8px', fontSize: '16px' }}
> >
{quantity} {item.sparepart_qty + (quantity || 0)}
</Text> </Text>
<Button <Button
icon={<PlusOutlined />} icon={<PlusOutlined />}
@@ -347,15 +346,17 @@ const SparepartCardList = ({
</Text> </Text>
</Space> </Space>
<Button {quantity !== 0 && (
type={quantity === 0 ? 'default' : 'primary'} <Button
size="small" type={quantity === 0 ? 'default' : 'primary'}
style={{ width: '100%' }} size="small"
onClick={() => handleUpdateStock(item)} style={{ width: '100%' }}
loading={isLoading} onClick={() => handleUpdateStock(item)}
> loading={isLoading}
Update Stock >
</Button> Update Stock
</Button>
)}
<br /> <br />
<Text <Text