Browse Source

update

master
CANCERYS\kw093 2 weeks ago
parent
commit
29cb77a9fa
2 changed files with 50 additions and 0 deletions
  1. +13
    -0
      src/components/JoSearch/JoCreateFormModal.tsx
  2. +37
    -0
      src/components/Qc/QcStockInModal.tsx

+ 13
- 0
src/components/JoSearch/JoCreateFormModal.tsx View File

@@ -163,6 +163,19 @@ const JoCreateFormModal: React.FC<Props> = ({
type="number"
/>
</Grid>
<Grid item xs={12} sm={12} md={6}>
<TextField
{...register("reqQty", {
required: "Req. Qty. required!",
validate: (value) => value > 0
})}
label={t("Job Type")}
fullWidth
error={Boolean(errors.reqQty)}
variant="outlined"
type="number"
/>
</Grid>
<Grid item xs={12} sm={12} md={6}>
<Controller
control={control}


+ 37
- 0
src/components/Qc/QcStockInModal.tsx View File

@@ -89,6 +89,22 @@ const QcStockInModal: React.FC<Props> = ({
// const [viewOnly, setViewOnly] = useState(false);

// Select Printer
const getDefaultPrinter = useMemo(() => {
if (typeof window === 'undefined' || printerCombo.length === 0) {
return printerCombo[0];
}
const savedPrinterId = localStorage.getItem('qcStockInModal_selectedPrinterId');
if (savedPrinterId) {
const savedId = Number(savedPrinterId);
const foundPrinter = printerCombo.find(p => p.id === savedId);
if (foundPrinter) {
return foundPrinter;
}
}
return printerCombo[0];
}, [printerCombo]);
const [selectedPrinter, setSelectedPrinter] = useState(printerCombo[0]);
const [printQty, setPrintQty] = useState(1);
const [tabIndex, setTabIndex] = useState(0);
@@ -457,6 +473,24 @@ const QcStockInModal: React.FC<Props> = ({
[closeHandler],
);
// Print handler
useEffect(() => {
if (printerCombo.length > 0) {
const savedPrinterId = typeof window !== 'undefined'
? localStorage.getItem('qcStockInModal_selectedPrinterId')
: null;
if (savedPrinterId) {
const savedId = Number(savedPrinterId);
const foundPrinter = printerCombo.find(p => p.id === savedId);
if (foundPrinter) {
setSelectedPrinter(foundPrinter);
return;
}
}
setSelectedPrinter(printerCombo[0]);
}
}, [printerCombo]);
const [isPrinting, setIsPrinting] = useState(false)
const handlePrint = useCallback(async () => {
// console.log("Print putaway documents");
@@ -487,6 +521,9 @@ const QcStockInModal: React.FC<Props> = ({
if (response) {
console.log(response)
}
if (typeof window !== 'undefined' && selectedPrinter) {
localStorage.setItem('qcStockInModal_selectedPrinterId', String(selectedPrinter.id));
}
} finally {
setIsPrinting(() => false)
}


Loading…
Cancel
Save