text: import React from "react";
  import {
    CRow,
    CCol,
    CButton,
    CModal,
    CModalHeader,
    CModalTitle,
    CModalBody,
    CForm,
    CFormGroup,
    CModalFooter,
  } from "@coreui/react";
  import {
    FormControl,
    InputLabel,
    MenuItem,
    Select,
    TextField,
  } from "@material-ui/core";
  
  const ModalAdministrator = (props) => {
    const {
      success,
      closeModalHandler,
      buttonSubmitName,
      color,
      modalTitle,
      input,
      changeHandler,
      formDisabled,
      buttonVisibility,
      submitHandler,
      loadDataCabang,
      dataCabang,
    } = props;
  
    return (
      <CModal
        show={success}
        onClose={closeModalHandler}
        color={color}
        closeOnBackdrop={false}
      >
        <CModalHeader closeButton>
          <CModalTitle>{modalTitle}</CModalTitle>
        </CModalHeader>
        <CModalBody>
          <CForm action="" method="post">
            <CFormGroup>
              <TextField
                type="text"
                id="nama"
                name="name"
                className="w-100"
                label="Nama"
                value={input.name}
                onChange={changeHandler}
                disabled={formDisabled}
              />
            </CFormGroup>
            <CFormGroup>
              <TextField
                type="text"
                id="alamat"
                name="alamat"
                className="w-100"
                label="Alamat"
                value={input.alamat}
                onChange={changeHandler}
                disabled={formDisabled}
              />
            </CFormGroup>
  
            <CRow>
              <CCol xs="12" lg="6">
                <CFormGroup>
                  <TextField
                    type="text"
                    id="email"
                    name="email"
                    className="w-100"
                    label="Email"
                    value={input.email}
                    onChange={changeHandler}
                    disabled={formDisabled}
                  />
                </CFormGroup>
              </CCol>
              <CCol xs="12" lg="6">
                <CFormGroup>
                  <TextField
                    type="number"
                    id="nomorhp"
                    name="nomorhp"
                    className="w-100"
                    label="Nomor HP"
                    value={input.nomorhp}
                    onChange={changeHandler}
                    disabled={formDisabled}
                  />
                </CFormGroup>
              </CCol>
            </CRow>
  
            <CRow>
              <CCol xs="12" lg="6">
                <FormControl className="w-100">
                  <InputLabel id="cab-penempatan">Cabang Penempatan</InputLabel>
                  <Select
                    displayEmpty
                    id="cab-penempatan"
                    name="cabang_id"
                    value={input.cabang_id}
                    onChange={changeHandler}
                    disabled={formDisabled}
                  >
                    {!loadDataCabang &&
                      dataCabang.map((item) => (
                        <MenuItem key={item.id} value={item.id}>
                          {item.nama_cabang}
                        </MenuItem>
                      ))}
                  </Select>
                </FormControl>
              </CCol>
              <CCol xs="12" lg="6">
                <FormControl className="w-100">
                  <InputLabel id="status-akun">Status Akun</InputLabel>
                  <Select
                    displayEmpty
                    id="status-akun"
                    name="status_akun"
                    value={input.status_akun}
                    onChange={changeHandler}
                    disabled={formDisabled}
                  >
                    <MenuItem value="0">Tidak Aktif</MenuItem>
                    <MenuItem value="1">Aktif</MenuItem>
                  </Select>
                </FormControl>
              </CCol>
            </CRow>
          </CForm>
        </CModalBody>
        <CModalFooter>
          <CButton
            color="success"
            className={buttonVisibility}
            onClick={() => submitHandler(buttonSubmitName)}
          >
            {buttonSubmitName}
          </CButton>{" "}
          <CButton
            color="secondary"
            className={buttonVisibility}
            onClick={() => closeModalHandler()}
          >
            Cancel
          </CButton>
        </CModalFooter>
      </CModal>
    );
  };
  
  export default ModalAdministrator;
  