import { Switch, TableBody, TableCell, TableRow } from "@mui/material";
import { useState } from "react";
import { Grid } from "../../../../components/grid/Grid";

export const ProvinceManageUsersRowJahadCity = ({ row, item }) => {
  const { details } = item;
  const [checked, setChecked] = useState(details.active);

  const handleChange = () => {
    setChecked(!checked);
  };

  return (
    <TableBody>
      <TableRow key={details.name}>
        <TableCell align="center">{details.address.province.name}</TableCell>
        <TableCell align="center">{details.address.city.name}</TableCell>
        <TableCell align="center">{details.address.address}</TableCell>
        <TableCell align="center">{details.identityDocuments}</TableCell>
        <TableCell align="center">
          {details.userBankInfo && details.userBankInfo.bankName ? (
            <Grid container direction="column">
              <Grid>نام بانک: {details.userBankInfo.bankName}</Grid>
              <Grid>شماره کارت: {details.userBankInfo.card}</Grid>
              <Grid>شماره حساب: {details.userBankInfo.account}</Grid>
              <Grid>شبا: {details.userBankInfo.shaba}</Grid>
            </Grid>
          ) : (
            "-"
          )}
        </TableCell>
        <TableCell align="center">
          <Switch checked={checked} onChange={handleChange} color="primary" />
        </TableCell>
      </TableRow>
    </TableBody>
  );
};
