@@ -50,8 +50,8 @@ export interface PurchaseQCInput { | |||
export interface EscalationInput { | |||
status: string | |||
handler: string | |||
acceptedQty: number | |||
rejectedQty: number | |||
acceptedQty: number // this is the qty to be escalated | |||
// escalationQty: number | |||
} | |||
export interface PutawayInput { | |||
status: string | |||
@@ -39,9 +39,12 @@ export interface StockInLine { | |||
acceptedQty: number | |||
price: number | |||
priceUnit: string | |||
productDate: string | |||
shelfLifeDate: string | |||
productionDate: string | |||
expiryDate: string | |||
status: string | |||
supplier: string | |||
lotNo: string | |||
poCode: string | |||
} | |||
export const fetchPoList = cache(async () => { | |||
@@ -76,9 +76,12 @@ const EscalationForm: React.FC<Props> = ({ | |||
} | |||
}, [itemDetail]) | |||
const acceptedQty = watch("acceptedQty") | |||
const rejectedQty = watch("rejectedQty") | |||
// const acceptedQty = watch("acceptedQty") || 0 | |||
const acceptedQty = watch("acceptedQty") || 0 | |||
// console.log(acceptedQty) | |||
console.log(acceptedQty) | |||
console.log(itemDetail.acceptedQty) | |||
useEffect(() => { | |||
console.log("triggered") | |||
setValue("status", status) | |||
@@ -93,7 +96,7 @@ const EscalationForm: React.FC<Props> = ({ | |||
</Grid> | |||
<Grid item xs={12}> | |||
<Typography variant="h6" display="block" marginBlockEnd={1}> | |||
{t(`to be processed`)}: {itemDetail.acceptedQty - acceptedQty - rejectedQty} | |||
{t(`to be processed`)}: {itemDetail.acceptedQty - acceptedQty} | |||
</Typography> | |||
</Grid> | |||
<Grid | |||
@@ -103,17 +106,6 @@ const EscalationForm: React.FC<Props> = ({ | |||
spacing={2} | |||
sx={{ mt: 0.5 }} | |||
> | |||
{/* <Grid item xs={4}> | |||
<TextField | |||
label={t("handler")} | |||
fullWidth | |||
{...register("handler", { | |||
required: "handler required!", | |||
})} | |||
error={Boolean(errors.handler)} | |||
helperText={errors.handler?.message} | |||
/> | |||
</Grid> */} | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("acceptedQty")} | |||
@@ -122,24 +114,11 @@ const EscalationForm: React.FC<Props> = ({ | |||
required: "acceptedQty required!", | |||
min: 0, | |||
valueAsNumber: true, | |||
max: itemDetail.acceptedQty | |||
})} | |||
// defaultValue={itemDetail.acceptedQty} | |||
// error={Boolean(errors.handler)} | |||
// helperText={errors.handler?.message} | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("rejectedQty")} | |||
fullWidth | |||
{...register("rejectedQty", { | |||
required: "rejectedQty required!", | |||
min: 0, | |||
valueAsNumber: true, | |||
})} | |||
defaultValue={0} | |||
// error={Boolean(errors.handler)} | |||
// helperText={errors.handler?.message} | |||
defaultValue={itemDetail.acceptedQty} | |||
error={Boolean(errors.acceptedQty)} | |||
helperText={errors.acceptedQty?.message} | |||
/> | |||
</Grid> | |||
</Grid> | |||
@@ -98,6 +98,7 @@ function PoInputGrid({ | |||
stockInLine, | |||
warehouse, | |||
}: Props) { | |||
console.log(itemDetail) | |||
const { t } = useTranslation("home"); | |||
const apiRef = useGridApiRef(); | |||
const [rowModesModel, setRowModesModel] = useState<GridRowModesModel>({}); | |||
@@ -161,6 +161,20 @@ const PoQcStockInModal: React.FC<Props> = ({ | |||
[t, itemDetail] | |||
); | |||
const canSubmit = useMemo(() => { | |||
if (type === "qc") { | |||
// console.log(itemDetail.status) | |||
return formProps.formState.isValid | |||
} | |||
if (type === "stockIn") { | |||
return formProps.formState.isValid | |||
} | |||
if (type === "putaway") { | |||
return formProps.formState.isValid | |||
} | |||
return true | |||
}, [type, itemDetail]) | |||
console.log(canSubmit) | |||
return ( | |||
<> | |||
<Modal open={open} onClose={closeHandler}> | |||
@@ -113,7 +113,7 @@ const PutawayForm: React.FC<Props> = ({ itemDetail, warehouse }) => { | |||
<Grid container justifyContent="flex-start" alignItems="flex-start"> | |||
<Grid item xs={12}> | |||
<Typography variant="h6" display="block" marginBlockEnd={1}> | |||
{t("Qc Detail")} | |||
{t("Putaway Detail")} | |||
</Typography> | |||
</Grid> | |||
<Grid | |||
@@ -123,9 +123,49 @@ const PutawayForm: React.FC<Props> = ({ itemDetail, warehouse }) => { | |||
spacing={2} | |||
sx={{ mt: 0.5 }} | |||
> | |||
<Grid item xs={12}> | |||
<TextField | |||
label={t("LotNo")} | |||
fullWidth | |||
value={itemDetail.lotNo} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("Supplier")} | |||
fullWidth | |||
value={itemDetail.supplier} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("Po Code")} | |||
fullWidth | |||
value={itemDetail.poCode} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("item name")} | |||
fullWidth | |||
value={itemDetail.itemName} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("item no")} | |||
fullWidth | |||
value={itemDetail.itemNo} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("Total qty")} | |||
label={t("qty")} | |||
fullWidth | |||
value={itemDetail.acceptedQty} | |||
disabled | |||
@@ -133,24 +173,35 @@ const PutawayForm: React.FC<Props> = ({ itemDetail, warehouse }) => { | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("Total record qty")} | |||
label={t("productionDate")} | |||
fullWidth | |||
value={recordQty} | |||
value={itemDetail.productionDate} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={4}> | |||
<Grid item xs={12}> | |||
<TextField | |||
label={t("expiryDate")} | |||
fullWidth | |||
value={itemDetail.expiryDate} | |||
disabled | |||
/> | |||
</Grid> | |||
<Grid item xs={6}> | |||
<TextField | |||
label={t("acceptedQty")} | |||
fullWidth | |||
{...register("acceptedQty", { | |||
required: "acceptedQty required!", | |||
min: 1, | |||
max: itemDetail.acceptedQty, | |||
valueAsNumber: true, | |||
})} | |||
error={Boolean(errors.acceptedQty)} | |||
helperText={errors.acceptedQty?.message} | |||
/> | |||
</Grid> | |||
<Grid item xs={4}> | |||
<Grid item xs={6}> | |||
<FormControl fullWidth> | |||
<Autocomplete | |||
noOptionsText={t("No Warehouse")} | |||