Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

118 Zeilen
4.6 KiB

  1. // material-ui
  2. import {
  3. FormControl,
  4. Button,
  5. Grid,
  6. Typography, FormLabel,
  7. } from '@mui/material';
  8. import * as React from "react";
  9. import * as StatusUtils from "utils/statusUtils/DnStatus";
  10. import Loadable from 'components/Loadable';
  11. const MainCard = Loadable(React.lazy(() => import('components/MainCard')));
  12. import DownloadIcon from '@mui/icons-material/Download';
  13. // ==============================|| DASHBOARD - DEFAULT ||============================== //
  14. const DnDetailCard = ({ data }) => {
  15. const [dnData, setDnData] = React.useState({});
  16. React.useEffect(() => {
  17. if (Object.keys(data).length > 0) {
  18. setDnData(data)
  19. }
  20. }, [data]);
  21. const onDownloadClick = () => {
  22. }
  23. const getDisplayField = (label, value) => {
  24. return <Grid item xs={12} md={5} lg={5} sx={{ mb: 1 }}>
  25. <Grid container alignItems={"center"}>
  26. <Grid item xs={12} md={3} lg={3}
  27. sx={{ display: 'flex', alignItems: 'center' }}>
  28. <FormLabel><Typography variant="h5">{label}:</Typography></FormLabel>
  29. </Grid>
  30. <Grid item xs={12} md={9} lg={9}>
  31. <Typography variant="h5">
  32. {value}
  33. </Typography>
  34. </Grid>
  35. </Grid>
  36. </Grid>
  37. }
  38. return (
  39. <MainCard elevation={0}
  40. border={false}
  41. content={false}
  42. >
  43. <Typography variant="h4" xs={12} md={12} sx={{ mb: 2, borderBottom: "1px solid black" }}>
  44. Demand Note
  45. </Typography>
  46. <Grid container direction="column">
  47. <Grid item xs={12} md={12}>
  48. <Grid container direction="row" justifyContent="space-between" alignItems="center">
  49. {getDisplayField("DN No.", dnData.dnNo)}
  50. <Grid item xs={12} md={5} lg={5} sx={{ mb: 1, ml: 1 }}>
  51. <Grid container alignItems={"center"}>
  52. <Grid item xs={12} md={3} lg={3}
  53. sx={{ display: 'flex', alignItems: 'center' }}>
  54. <FormLabel><Typography variant="h5">Status:</Typography></FormLabel>
  55. </Grid>
  56. <Grid item xs={12} md={9} lg={9}>
  57. <FormControl variant="outlined">
  58. {StatusUtils.getStatus_Eng(dnData.status)}
  59. </FormControl>
  60. </Grid>
  61. </Grid>
  62. </Grid>
  63. </Grid>
  64. <Grid container direction="row" justifyContent="space-between" alignItems="center">
  65. {getDisplayField("Issue Date", dnData.issueDate)}
  66. {getDisplayField("DN Sent", dnData?.sentDate ? dnData.sentDate + " - " + dnData.sentBy : "")}
  67. </Grid>
  68. <Grid container direction="row" justifyContent="space-between" alignItems="center">
  69. <Grid item xs={12} md={6} lg={6} mt={1}>
  70. <Grid container direction="row" justifyContent="flex-start">
  71. <Grid item xs={12} md={3} lg={3}
  72. sx={{ display: 'flex', alignItems: 'center' }}>
  73. <FormLabel><Typography variant="h5">File:</Typography></FormLabel>
  74. </Grid>
  75. <Grid item xs={12} md={5} lg={5} sx={{ display: 'flex', alignItems: 'center' }}>
  76. <Typography variant="h5">{dnData.filename} </Typography>
  77. </Grid>
  78. <Grid item md={4} lg={4}>
  79. <Button
  80. size="small"
  81. variant="contained"
  82. onClick={onDownloadClick()}
  83. sx={{
  84. textTransform: 'capitalize',
  85. alignItems: 'end',
  86. }}>
  87. <DownloadIcon />
  88. </Button>
  89. </Grid>
  90. </Grid>
  91. </Grid>
  92. </Grid>
  93. </Grid>
  94. </Grid>
  95. </MainCard>
  96. );
  97. };
  98. export default DnDetailCard;