|
|
@@ -20,9 +20,11 @@ import { QcFormInput, QcResult } from "@/app/api/qc"; |
|
|
interface Props { |
|
|
interface Props { |
|
|
rows: QcResult[]; |
|
|
rows: QcResult[]; |
|
|
disabled?: boolean; |
|
|
disabled?: boolean; |
|
|
|
|
|
/** When true, use smaller typography and inputs to match 來貨詳情 (e.g. in QcStockInModal). */ |
|
|
|
|
|
compactLayout?: boolean; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const QcForm: React.FC<Props> = ({ rows, disabled = false }) => { |
|
|
|
|
|
|
|
|
const QcForm: React.FC<Props> = ({ rows, disabled = false, compactLayout = false }) => { |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const { t } = useTranslation("purchaseOrder"); |
|
|
const apiRef = useGridApiRef(); |
|
|
const apiRef = useGridApiRef(); |
|
|
const { |
|
|
const { |
|
|
@@ -71,7 +73,7 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => { |
|
|
sx={{ |
|
|
sx={{ |
|
|
lineHeight: 1.5, |
|
|
lineHeight: 1.5, |
|
|
padding: "4px", |
|
|
padding: "4px", |
|
|
fontSize: 18, |
|
|
|
|
|
|
|
|
fontSize: compactLayout ? 14 : 18, |
|
|
}} |
|
|
}} |
|
|
> |
|
|
> |
|
|
<b>{`${params.row.order ?? "N/A"}. ${params.value}`}</b><br/> |
|
|
<b>{`${params.row.order ?? "N/A"}. ${params.value}`}</b><br/> |
|
|
@@ -161,8 +163,9 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => { |
|
|
onMouseDown={(e) => e.stopPropagation()} |
|
|
onMouseDown={(e) => e.stopPropagation()} |
|
|
onKeyDown={(e) => e.stopPropagation()} |
|
|
onKeyDown={(e) => e.stopPropagation()} |
|
|
inputProps={{ min: 0 }} |
|
|
inputProps={{ min: 0 }} |
|
|
|
|
|
size={compactLayout ? "small" : "medium"} |
|
|
sx={{ width: '100%', |
|
|
sx={{ width: '100%', |
|
|
"& .MuiInputBase-input": { |
|
|
|
|
|
|
|
|
"& .MuiInputBase-input": compactLayout ? undefined : { |
|
|
padding: "0.75rem", |
|
|
padding: "0.75rem", |
|
|
fontSize: 24, |
|
|
fontSize: 24, |
|
|
}, |
|
|
}, |
|
|
@@ -202,7 +205,7 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => { |
|
|
onMouseDown={(e) => e.stopPropagation()} |
|
|
onMouseDown={(e) => e.stopPropagation()} |
|
|
onKeyDown={(e) => e.stopPropagation()} |
|
|
onKeyDown={(e) => e.stopPropagation()} |
|
|
sx={{ width: '100%', |
|
|
sx={{ width: '100%', |
|
|
"& .MuiInputBase-input": { |
|
|
|
|
|
|
|
|
"& .MuiInputBase-input": compactLayout ? undefined : { |
|
|
padding: "0.75rem", |
|
|
padding: "0.75rem", |
|
|
fontSize: 24, |
|
|
fontSize: 24, |
|
|
}, |
|
|
}, |
|
|
@@ -211,7 +214,7 @@ const QcForm: React.FC<Props> = ({ rows, disabled = false }) => { |
|
|
); |
|
|
); |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
], []) |
|
|
|
|
|
|
|
|
], [compactLayout, t, setValue, qcDisabled]) |
|
|
|
|
|
|
|
|
// const getRowId = (row :any) => { |
|
|
// const getRowId = (row :any) => { |
|
|
// return qcRecord.findIndex(qc => qc == row); |
|
|
// return qcRecord.findIndex(qc => qc == row); |
|
|
|