

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

function AddRecentWorksModal() {


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

    <FormRecentWorks />
  </LayoutModal>
  )
}

export default AddRecentWorksModal

