diff --git a/frontend/components/pop/hardcoded/production/DefectTypeModal.tsx b/frontend/components/pop/hardcoded/production/DefectTypeModal.tsx index aed322f7..b4c58699 100644 --- a/frontend/components/pop/hardcoded/production/DefectTypeModal.tsx +++ b/frontend/components/pop/hardcoded/production/DefectTypeModal.tsx @@ -45,27 +45,89 @@ function QtyInput({ onChange: (v: number) => void; max: number; }) { + const [padOpen, setPadOpen] = useState(false); + const [padValue, setPadValue] = useState(String(value)); + + const handlePadOpen = () => { + setPadValue(String(value)); + setPadOpen(true); + }; + + const handlePadKey = (key: string) => { + if (key === "backspace") { + setPadValue((prev) => prev.length > 1 ? prev.slice(0, -1) : "0"); + } else if (key === "clear") { + setPadValue("0"); + } else if (key === "max") { + setPadValue(String(max)); + } else { + setPadValue((prev) => prev === "0" ? key : prev + key); + } + }; + + const handlePadConfirm = () => { + const num = Math.min(Math.max(0, parseInt(padValue, 10) || 0), max); + onChange(num); + setPadOpen(false); + }; + return ( -
- - - {value} - - -
+ <> +
+ + + +
+ + {/* 숫자 키패드 모달 */} + {padOpen && ( +
+
setPadOpen(false)} /> +
+
+

불량 수량 (최대 {max})

+

{padValue}

+
+
+ {["1","2","3","4","5","6","7","8","9"].map((k) => ( + + ))} + + + +
+ +
+ + +
+
+
+ )} + ); }