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