FPSMS-frontend
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

124 строки
3.3 KiB

  1. "use client";
  2. import {
  3. Box,
  4. Button,
  5. Dialog,
  6. DialogActions,
  7. DialogContent,
  8. DialogTitle,
  9. Typography,
  10. Alert,
  11. Stack,
  12. Divider,
  13. } from "@mui/material";
  14. import { useTranslation } from "react-i18next";
  15. interface LotConfirmationModalProps {
  16. open: boolean;
  17. onClose: () => void;
  18. onConfirm: () => void;
  19. expectedLot: {
  20. lotNo: string;
  21. itemCode: string;
  22. itemName: string;
  23. };
  24. scannedLot: {
  25. lotNo: string;
  26. itemCode: string;
  27. itemName: string;
  28. };
  29. isLoading?: boolean;
  30. }
  31. const LotConfirmationModal: React.FC<LotConfirmationModalProps> = ({
  32. open,
  33. onClose,
  34. onConfirm,
  35. expectedLot,
  36. scannedLot,
  37. isLoading = false,
  38. }) => {
  39. const { t } = useTranslation("pickOrder");
  40. return (
  41. <Dialog open={open} onClose={onClose} maxWidth="md" fullWidth>
  42. <DialogTitle>
  43. <Typography variant="h6" component="div" color="warning.main">
  44. {t("Lot Number Mismatch")}
  45. </Typography>
  46. </DialogTitle>
  47. <DialogContent>
  48. <Stack spacing={3}>
  49. <Alert severity="warning">
  50. {t("The scanned item matches the expected item, but the lot number is different. Do you want to proceed with this different lot?")}
  51. </Alert>
  52. <Box>
  53. <Typography variant="subtitle1" gutterBottom color="primary">
  54. {t("Expected Lot:")}
  55. </Typography>
  56. <Box sx={{ pl: 2, py: 1, backgroundColor: 'grey.50', borderRadius: 1 }}>
  57. <Typography variant="body2">
  58. <strong>{t("Item Code")}:</strong> {expectedLot.itemCode}
  59. </Typography>
  60. <Typography variant="body2">
  61. <strong>{t("Item Name")}:</strong> {expectedLot.itemName}
  62. </Typography>
  63. <Typography variant="body2">
  64. <strong>{t("Lot No")}:</strong> {expectedLot.lotNo}
  65. </Typography>
  66. </Box>
  67. </Box>
  68. <Divider />
  69. <Box>
  70. <Typography variant="subtitle1" gutterBottom color="warning.main">
  71. {t("Scanned Lot:")}
  72. </Typography>
  73. <Box sx={{ pl: 2, py: 1, backgroundColor: 'warning.50', borderRadius: 1 }}>
  74. <Typography variant="body2">
  75. <strong>{t("Item Code")}:</strong> {scannedLot.itemCode}
  76. </Typography>
  77. <Typography variant="body2">
  78. <strong>{t("Item Name")}:</strong> {scannedLot.itemName}
  79. </Typography>
  80. <Typography variant="body2">
  81. <strong>{t("Lot No")}:</strong> {scannedLot.lotNo}
  82. </Typography>
  83. </Box>
  84. </Box>
  85. <Alert severity="info">
  86. {t("If you confirm, the system will:")}
  87. <ul style={{ margin: '8px 0 0 16px' }}>
  88. <li>{t("Update your suggested lot to the this scanned lot")}</li>
  89. </ul>
  90. </Alert>
  91. </Stack>
  92. </DialogContent>
  93. <DialogActions>
  94. <Button
  95. onClick={onClose}
  96. variant="outlined"
  97. disabled={isLoading}
  98. >
  99. {t("Cancel")}
  100. </Button>
  101. <Button
  102. onClick={onConfirm}
  103. variant="contained"
  104. color="warning"
  105. disabled={isLoading}
  106. >
  107. {isLoading ? t("Processing...") : t("Confirm")}
  108. </Button>
  109. </DialogActions>
  110. </Dialog>
  111. );
  112. };
  113. export default LotConfirmationModal;