

import React from 'react'
import LayoutModal from '../../Layout/Dashboard/LayoutModal'
import FormTeamMember from './FormTeamMember'
import { useAddTeamMember } from '../../api/teamMember'
import { getDataToSend, getInitialValues, getValidationSchema } from './formUtil'
import { QueryStatusEnum } from '../../config/QueryStatus'
import { useTranslation } from 'react-i18next'

function AddTeamMemberModal() {


  const [t] = useTranslation()
  const {mutate , status} = useAddTeamMember()
  const handelSubmit = (values:any )=>{

    const dataToSend = getDataToSend(values)

    mutate(dataToSend)
    // Submit Value
  }
  return (
    <LayoutModal
    
     isAddModal={true}
     getInitialValues={getInitialValues()} 
     handleSubmit={handelSubmit} 
     status={status as QueryStatusEnum}
     headerText={t('Add') +t('teamMember')}
     
     getValidationSchema={getValidationSchema()}>

    <FormTeamMember />
  </LayoutModal>
  )
}

export default AddTeamMemberModal

