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