Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 

70 lignes
2.2 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 CardActions from "@mui/material/CardActions";
  11. import RestartAlt from "@mui/icons-material/RestartAlt";
  12. import Button from "@mui/material/Button";
  13. import { Controller, useFormContext } from "react-hook-form";
  14. import { FormControl, InputLabel, MenuItem, Select } from "@mui/material";
  15. import { useCallback } from "react";
  16. import { CreateTeamInputs } from "@/app/api/team/actions";
  17. const TeamInfo: React.FC = (
  18. {
  19. // customerTypes,
  20. }
  21. ) => {
  22. const { t } = useTranslation();
  23. const {
  24. register,
  25. formState: { errors, defaultValues },
  26. control,
  27. reset,
  28. resetField,
  29. setValue,
  30. } = useFormContext<CreateTeamInputs>();
  31. const resetCustomer = useCallback(() => {
  32. console.log(defaultValues);
  33. if (defaultValues !== undefined) {
  34. resetField("description");
  35. }
  36. }, [defaultValues]);
  37. return (
  38. <>
  39. <Card sx={{ display: "block" }}>
  40. <CardContent component={Stack} spacing={4}>
  41. <Box>
  42. <Typography variant="overline" display="block" marginBlockEnd={1}>
  43. {t("Team Info")}
  44. </Typography>
  45. <Grid container spacing={2} columns={{ xs: 6, sm: 12 }}>
  46. <Grid item xs={12}>
  47. <TextField
  48. label={t("Team Description")}
  49. fullWidth
  50. multiline
  51. rows={4}
  52. {...register("description", {
  53. required: true,
  54. })}
  55. error={Boolean(errors.description)}
  56. helperText={Boolean(errors.description) && (errors.description?.message ? t(errors.description.message) : t("Please input correct description"))}
  57. />
  58. </Grid>
  59. </Grid>
  60. </Box>
  61. </CardContent>
  62. </Card>
  63. </>
  64. );
  65. };
  66. export default TeamInfo;