mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
feat(FE): Add "has_chickin" property to disable quantity editing
This commit is contained in:
@@ -402,6 +402,13 @@ const PurchaseOrderAcceptApprovalForm = ({
|
||||
<tbody>
|
||||
{purchaseItems?.map((purchaseItem, idx) => {
|
||||
const formItem = formik.values.items?.[idx];
|
||||
|
||||
const originalPurchaseItem = initialValues?.items?.find(
|
||||
(item) => item.id === purchaseItem.id
|
||||
);
|
||||
const isReceivedQtyDisabled =
|
||||
originalPurchaseItem?.has_chickin === true;
|
||||
|
||||
return (
|
||||
<tr key={`purchase-item-${idx}`}>
|
||||
<td>
|
||||
@@ -580,7 +587,12 @@ const PurchaseOrderAcceptApprovalForm = ({
|
||||
decimalScale={0}
|
||||
thousandSeparator=','
|
||||
decimalSeparator='.'
|
||||
bottomLabel={`Total: ${purchaseItems[idx]?.quantity ? formatNumber(purchaseItems[idx].quantity) : 0}`}
|
||||
disabled={isReceivedQtyDisabled}
|
||||
bottomLabel={
|
||||
isReceivedQtyDisabled
|
||||
? 'Sudah chickin, tidak bisa diubah'
|
||||
: `Total: ${purchaseItems[idx]?.quantity ? formatNumber(purchaseItems[idx].quantity) : 0}`
|
||||
}
|
||||
isError={
|
||||
isRepeaterInputError(idx, 'received_qty').isError ||
|
||||
(formItem?.received_qty
|
||||
|
||||
@@ -740,6 +740,13 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
)
|
||||
return null;
|
||||
|
||||
const originalPurchaseItem =
|
||||
initialValues?.items?.find(
|
||||
(item) => item.id === purchaseItem.id
|
||||
);
|
||||
const isQtyDisabled =
|
||||
originalPurchaseItem?.has_chickin === true;
|
||||
|
||||
return (
|
||||
<tr key={`purchase-item-${purchaseItem.id}`}>
|
||||
<td>
|
||||
@@ -807,7 +814,12 @@ const PurchaseOrderStaffApprovalForm = ({
|
||||
placeholder='Masukkan jumlah'
|
||||
allowNegative={false}
|
||||
decimalScale={0}
|
||||
bottomLabel={`Previous: ${formatNumber(purchaseItem.quantity)}`}
|
||||
disabled={isQtyDisabled}
|
||||
bottomLabel={
|
||||
isQtyDisabled
|
||||
? 'Sudah chickin, tidak bisa diubah'
|
||||
: `Previous: ${formatNumber(purchaseItem.quantity)}`
|
||||
}
|
||||
className={{
|
||||
wrapper: 'min-w-32',
|
||||
}}
|
||||
|
||||
Vendored
+1
@@ -50,6 +50,7 @@ export type PurchaseItem = {
|
||||
expedition_vendor_name?: string | null;
|
||||
received_qty?: number | null;
|
||||
transport_per_item?: number | null;
|
||||
has_chickin?: boolean;
|
||||
expedition_vendor?: {
|
||||
id?: number;
|
||||
name?: string;
|
||||
|
||||
Reference in New Issue
Block a user