|
|
@@ -52,6 +52,8 @@ interface Props { |
|
|
disabled: boolean; |
|
|
disabled: boolean; |
|
|
/** When true, use smaller typography and input size to match 來貨詳情 section (e.g. in QcStockInModal). */ |
|
|
/** When true, use smaller typography and input size to match 來貨詳情 section (e.g. in QcStockInModal). */ |
|
|
compactLayout?: boolean; |
|
|
compactLayout?: boolean; |
|
|
|
|
|
/** When true, use even denser/smaller layout (e.g. for productionProcess / tablet). */ |
|
|
|
|
|
denseLayout?: boolean; |
|
|
// qcItems: QcData[] |
|
|
// qcItems: QcData[] |
|
|
// setQcItems: Dispatch<SetStateAction<QcData[]>> |
|
|
// setQcItems: Dispatch<SetStateAction<QcData[]>> |
|
|
} |
|
|
} |
|
|
@@ -64,7 +66,7 @@ type EntryError = |
|
|
|
|
|
|
|
|
type QcRow = TableRow<Partial<QcResult>, EntryError>; |
|
|
type QcRow = TableRow<Partial<QcResult>, EntryError>; |
|
|
// fetchQcItemCheck |
|
|
// fetchQcItemCheck |
|
|
const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false, compactLayout = false }) => { |
|
|
|
|
|
|
|
|
const QcComponent: React.FC<Props> = ({ itemDetail, disabled = false, compactLayout = false, denseLayout = false }) => { |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const apiRef = useGridApiRef(); |
|
|
const apiRef = useGridApiRef(); |
|
|
const { |
|
|
const { |
|
|
@@ -423,9 +425,9 @@ useEffect(() => { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const headerVariant = compactLayout ? "subtitle1" : "h5"; |
|
|
|
|
|
const subVariant = compactLayout ? "body2" : "subtitle1"; |
|
|
|
|
|
const sub2Variant = compactLayout ? "body2" : "subtitle2"; |
|
|
|
|
|
|
|
|
const headerVariant = denseLayout ? "body2" : (compactLayout ? "subtitle1" : "h5"); |
|
|
|
|
|
const subVariant = denseLayout ? "caption" : (compactLayout ? "body2" : "subtitle1"); |
|
|
|
|
|
const sub2Variant = denseLayout ? "caption" : (compactLayout ? "body2" : "subtitle2"); |
|
|
const QcHeader = useMemo(() => () => { |
|
|
const QcHeader = useMemo(() => () => { |
|
|
if (qcCategory === undefined || qcCategory === null) { |
|
|
if (qcCategory === undefined || qcCategory === null) { |
|
|
return ( |
|
|
return ( |
|
|
@@ -449,7 +451,7 @@ useEffect(() => { |
|
|
</Box> |
|
|
</Box> |
|
|
</> |
|
|
</> |
|
|
); |
|
|
); |
|
|
}, [qcType, qcCategory, headerVariant, subVariant, sub2Variant]); |
|
|
|
|
|
|
|
|
}, [qcType, qcCategory, headerVariant, subVariant, sub2Variant, denseLayout]); |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
@@ -487,7 +489,7 @@ useEffect(() => { |
|
|
<QcForm |
|
|
<QcForm |
|
|
rows={qcResult} |
|
|
rows={qcResult} |
|
|
disabled={disabled} |
|
|
disabled={disabled} |
|
|
compactLayout={compactLayout} |
|
|
|
|
|
|
|
|
denseLayout={denseLayout} |
|
|
/> |
|
|
/> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</> |
|
|
</> |
|
|
@@ -512,15 +514,15 @@ useEffect(() => { |
|
|
<QcForm |
|
|
<QcForm |
|
|
disabled={disabled} |
|
|
disabled={disabled} |
|
|
rows={qcHistory} |
|
|
rows={qcHistory} |
|
|
compactLayout={compactLayout} |
|
|
|
|
|
|
|
|
denseLayout={denseLayout} |
|
|
/> |
|
|
/> |
|
|
</CollapsibleCard> |
|
|
</CollapsibleCard> |
|
|
</Grid> |
|
|
</Grid> |
|
|
</> |
|
|
</> |
|
|
)} |
|
|
)} |
|
|
<Grid item xs={12}> |
|
|
<Grid item xs={12}> |
|
|
<Card sx={{p:2}}> |
|
|
|
|
|
<Typography variant={compactLayout ? "subtitle1" : "h6"} display="block" marginBlockEnd={1}> |
|
|
|
|
|
|
|
|
<Card sx={{ p: denseLayout ? 1 : 2 }}> |
|
|
|
|
|
<Typography variant={denseLayout ? "body2" : (compactLayout ? "subtitle1" : "h6")} display="block" marginBlockEnd={1} fontWeight={600}> |
|
|
{t("Qc Decision")} |
|
|
{t("Qc Decision")} |
|
|
</Typography> |
|
|
</Typography> |
|
|
<FormControl> |
|
|
<FormControl> |
|
|
@@ -573,7 +575,7 @@ useEffect(() => { |
|
|
// type="number" |
|
|
// type="number" |
|
|
id="accQty" |
|
|
id="accQty" |
|
|
label={t("acceptQty")} |
|
|
label={t("acceptQty")} |
|
|
size={compactLayout ? "small" : "medium"} |
|
|
|
|
|
|
|
|
size={compactLayout || denseLayout ? "small" : "medium"} |
|
|
sx={{ width: '150px' }} |
|
|
sx={{ width: '150px' }} |
|
|
// value={Number(accQty)} |
|
|
// value={Number(accQty)} |
|
|
defaultValue={Number(accQty)} |
|
|
defaultValue={Number(accQty)} |
|
|
@@ -626,7 +628,7 @@ useEffect(() => { |
|
|
<TextField |
|
|
<TextField |
|
|
type="number" |
|
|
type="number" |
|
|
label={t("rejectQty")} |
|
|
label={t("rejectQty")} |
|
|
size={compactLayout ? "small" : "medium"} |
|
|
|
|
|
|
|
|
size={compactLayout || denseLayout ? "small" : "medium"} |
|
|
sx={{ width: '150px' }} |
|
|
sx={{ width: '150px' }} |
|
|
value={ |
|
|
value={ |
|
|
(!Boolean(errors.acceptQty) && qcDecision !== undefined && qcDecision != 3) ? |
|
|
(!Boolean(errors.acceptQty) && qcDecision !== undefined && qcDecision != 3) ? |
|
|
|