FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

95 lines
2.8 KiB

  1. "use client";
  2. import Stack from "@mui/material/Stack";
  3. import Box from "@mui/material/Box";
  4. import Card from "@mui/material/Card";
  5. import CardContent from "@mui/material/CardContent";
  6. import Grid from "@mui/material/Grid";
  7. import TextField from "@mui/material/TextField";
  8. import Typography from "@mui/material/Typography";
  9. import { useTranslation } from "react-i18next";
  10. import { Controller, useFormContext } from "react-hook-form";
  11. import Link from "next/link";
  12. import React from "react";
  13. import MailField from "../MailField/MailField";
  14. import { MailSave } from "@/app/api/mail/actions";
  15. interface Props {
  16. isActive: boolean;
  17. }
  18. const TimesheetMailDetails: React.FC<Props> = ({ isActive }) => {
  19. const { t } = useTranslation();
  20. const {
  21. register,
  22. formState: { errors },
  23. control,
  24. } = useFormContext<MailSave>();
  25. return (
  26. <Card sx={{ display: isActive ? "block" : "none" }}>
  27. <CardContent component={Stack} spacing={4}>
  28. <Box>
  29. <Typography variant="overline" display="block" marginBlockEnd={1}>
  30. {t("Timesheet Template")}
  31. </Typography>
  32. <Grid container spacing={2} columns={{ xs: 6, sm: 12 }}>
  33. {/* <Grid item xs={8}>
  34. <TextField
  35. label={t("Cc")}
  36. fullWidth
  37. {...register("template.cc")}
  38. />
  39. </Grid>
  40. <Grid item xs={8}>
  41. <TextField
  42. label={t("Bcc")}
  43. fullWidth
  44. {...register("template.bcc")}
  45. />
  46. </Grid>
  47. <Grid item xs={8}>
  48. <TextField
  49. label={t("Subject")}
  50. fullWidth
  51. {...register("template.subject", {
  52. required: "Subject required!",
  53. })}
  54. error={Boolean(errors.template?.subject)}
  55. />
  56. </Grid> */}
  57. <Grid item xs={8}>
  58. <TextField
  59. label={t("Required Params")}
  60. fullWidth
  61. value={"${date}"}
  62. // disabled
  63. // error={Boolean(errors.template?.template)}
  64. />
  65. </Grid>
  66. {/* <Grid item xs={12}>
  67. <Controller
  68. control={control}
  69. name="template.template"
  70. render={({ field }) => (
  71. <MailField
  72. content={field.value}
  73. onChange={field.onChange}
  74. error={Boolean(errors.template?.template)}
  75. />
  76. )}
  77. rules={{
  78. required: true,
  79. validate: (value) => value?.includes("${date}"),
  80. }}
  81. />
  82. </Grid> */}
  83. </Grid>
  84. </Box>
  85. </CardContent>
  86. </Card>
  87. );
  88. };
  89. export default TimesheetMailDetails;