

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

function AddProjectsModal() {


  const [t] = useTranslation()
  const {mutate , status} = useAddProjects()
  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('projects')}
     
     getValidationSchema={getValidationSchema()}>

    <FormProjects />
  </LayoutModal>
  )
}

export default AddProjectsModal

