import { mdiChartTimelineVariant, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement, useEffect, useState } from 'react'
import DatePicker from "react-datepicker";
import "react-datepicker/dist/react-datepicker.css";
import dayjs from "dayjs";

import CardBox from '../../components/CardBox'
import LayoutAuthenticated from '../../layouts/Authenticated'
import SectionMain from '../../components/SectionMain'
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton'
import { getPageTitle } from '../../config'

import { Field, Form, Formik } from 'formik'
import FormField from '../../components/FormField'
import BaseDivider from '../../components/BaseDivider'
import BaseButtons from '../../components/BaseButtons'
import BaseButton from '../../components/BaseButton'
import FormCheckRadio from '../../components/FormCheckRadio'
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup'
import FormFilePicker from '../../components/FormFilePicker'
import FormImagePicker from '../../components/FormImagePicker'
import { SelectField } from "../../components/SelectField";
import { SelectFieldMany } from "../../components/SelectFieldMany";
import { SwitchField } from '../../components/SwitchField'
import {RichTextField} from "../../components/RichTextField";

import { update, fetch } from '../../stores/employees/employeesSlice'
import { useAppDispatch, useAppSelector } from '../../stores/hooks'
import { useRouter } from 'next/router'
import {saveFile} from "../../helpers/fileSaver";
import dataFormatter from '../../helpers/dataFormatter';
import ImageField from "../../components/ImageField";



const EditEmployees = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()
  const initVals = {
      
    
    'employeeCode': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'firstName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'middleName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'lastName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'nameExtension': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    
    dateOfBirth: new Date(),
    

    

    

    

    

    

    

    
    
    
    'placeOfBirth': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    sex: '',
    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    civilStatus: '',
    

    

    

    

    
    
    
    'nationality': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'religion': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'bloodType': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    

    

    
    profilePhoto: [],
    

    

    
    
    
    'homeStreet': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'homeBarangay': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'homeCity': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'homeProvince': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'homeZipCode': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    
    permanentAddressSame: false,
    

    

    

    

    

    

    
    
    
    'permanentStreet': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'permanentBarangay': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'permanentCity': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'permanentProvince': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'permanentZipCode': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'personalEmail': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'personalMobile': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'emergencyContactName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'emergencyContactRel': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'emergencyContactMobile': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'sssNumber': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'philhealthNumber': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'pagibigNumber': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'tinNumber': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'bankName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'bankAccountNumber': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'bankAccountName': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    
    employmentDate: new Date(),
    

    

    

    

    

    

    

    
    
    

    

    

    

    

    
    regularizationDate: new Date(),
    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    employmentStatus: '',
    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    employmentType: '',
    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    jobLevel: '',
    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    salaryType: '',
    

    

    

    

    
    
    
    'basicSalary': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    taxStatus: '',
    

    

    

    

    
    
    
    'workLocation': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    
    separationDate: new Date(),
    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    
    separationType: '',
    

    

    

    

    
    
    

    
    separationReason: '',
    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'clearanceStatus': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    
    'finalPayAmount': '',
    

    

    

    

    

    

    

    

    

    

    

    

    
    
    

    

    

    

    

    
    finalPayReleasedDate: new Date(),
    

    

    

    

    

    

    

    
    
    

    

    

    

    

    

    
    isActive: false,
    

    

    

    

    

    

    
    
    

    

    

    

    

    

    

    

    

    

    

    
    department: null,
    

    
    
    

    

    

    

    

    

    

    

    

    

    

    
    position: null,
    

    
    
    

    

    

    

    

    

    

    

    

    

    

    
    shift: null,
    

    
    
    

    

    

    

    

    

    

    

    

    

    

    
    reportingTo: null,
    

    
    
    
  }
  const [initialValues, setInitialValues] = useState(initVals)

  const { employees } = useAppSelector((state) => state.employees)
  

  const { employeesId } = router.query

  useEffect(() => {
    dispatch(fetch({ id: employeesId }))
  }, [employeesId])

  useEffect(() => {
    if (typeof employees === 'object') {
      setInitialValues(employees)
    }
  }, [employees])

  useEffect(() => {
      if (typeof employees === 'object') {

          const newInitialVal = {...initVals};

          Object.keys(initVals).forEach(el => newInitialVal[el] = (employees)[el])

          setInitialValues(newInitialVal);
      }
  }, [employees])

  const handleSubmit = async (data) => {
    await dispatch(update({ id: employeesId, data }))
    await router.push('/employees/employees-list')
  }

  return (
    <>
      <Head>
        <title>{getPageTitle('Edit employees')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title={'Edit employees'} main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            enableReinitialize
            initialValues={initialValues}
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>


  
    <FormField
        label="EmployeeCode"
    >
        <Field
            name="employeeCode"
            placeholder="EmployeeCode"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="FirstName"
    >
        <Field
            name="firstName"
            placeholder="FirstName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="MiddleName"
    >
        <Field
            name="middleName"
            placeholder="MiddleName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="LastName"
    >
        <Field
            name="lastName"
            placeholder="LastName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="NameExtension"
    >
        <Field
            name="nameExtension"
            placeholder="NameExtension"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  
      <FormField
          label="DateOfBirth"
      >
          <DatePicker
              dateFormat="yyyy-MM-dd hh:mm"
              showTimeSelect
              selected={initialValues.dateOfBirth ?
                  new Date(
                      dayjs(initialValues.dateOfBirth).format('YYYY-MM-DD hh:mm'),
                  ) : null
              }
              onChange={(date) => setInitialValues({...initialValues, 'dateOfBirth': date})}
          />
      </FormField>
  

  

  

  

  

  

    

  



  
    <FormField
        label="PlaceOfBirth"
    >
        <Field
            name="placeOfBirth"
            placeholder="PlaceOfBirth"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="Sex" labelFor="sex">
        <Field name="sex" id="sex" component="select">
          
            <option value="MALE">MALE</option>
          
            <option value="FEMALE">FEMALE</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="CivilStatus" labelFor="civilStatus">
        <Field name="civilStatus" id="civilStatus" component="select">
          
            <option value="SINGLE">SINGLE</option>
          
            <option value="MARRIED">MARRIED</option>
          
            <option value="WIDOWED">WIDOWED</option>
          
            <option value="SEPARATED">SEPARATED</option>
          
            <option value="LEGALLY_SEPARATED">LEGALLY_SEPARATED</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  
    <FormField
        label="Nationality"
    >
        <Field
            name="nationality"
            placeholder="Nationality"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="Religion"
    >
        <Field
            name="religion"
            placeholder="Religion"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="BloodType"
    >
        <Field
            name="bloodType"
            placeholder="BloodType"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  

  

  

  

    
        <FormField>
            <Field
                label='ProfilePhoto'
                color='info'
                icon={mdiUpload}
                path={'employees/profilePhoto'}
                name='profilePhoto'
                id='profilePhoto'
                schema={{
                    size: undefined,
                    formats: undefined,
                }}
                component={FormImagePicker}
            ></Field>
        </FormField>
    

  



  
    <FormField
        label="HomeStreet"
    >
        <Field
            name="homeStreet"
            placeholder="HomeStreet"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="HomeBarangay"
    >
        <Field
            name="homeBarangay"
            placeholder="HomeBarangay"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="HomeCity"
    >
        <Field
            name="homeCity"
            placeholder="HomeCity"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="HomeProvince"
    >
        <Field
            name="homeProvince"
            placeholder="HomeProvince"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="HomeZipCode"
    >
        <Field
            name="homeZipCode"
            placeholder="HomeZipCode"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  

  
    <FormField label='PermanentAddressSame' labelFor='permanentAddressSame'>
        <Field
            name='permanentAddressSame'
            id='permanentAddressSame'
            component={SwitchField}
        ></Field>
    </FormField>
  

  

  

    

  



  
    <FormField
        label="PermanentStreet"
    >
        <Field
            name="permanentStreet"
            placeholder="PermanentStreet"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PermanentBarangay"
    >
        <Field
            name="permanentBarangay"
            placeholder="PermanentBarangay"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PermanentCity"
    >
        <Field
            name="permanentCity"
            placeholder="PermanentCity"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PermanentProvince"
    >
        <Field
            name="permanentProvince"
            placeholder="PermanentProvince"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PermanentZipCode"
    >
        <Field
            name="permanentZipCode"
            placeholder="PermanentZipCode"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PersonalEmail"
    >
        <Field
            name="personalEmail"
            placeholder="PersonalEmail"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PersonalMobile"
    >
        <Field
            name="personalMobile"
            placeholder="PersonalMobile"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="EmergencyContactName"
    >
        <Field
            name="emergencyContactName"
            placeholder="EmergencyContactName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="EmergencyContactRelationship"
    >
        <Field
            name="emergencyContactRel"
            placeholder="EmergencyContactRelationship"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="EmergencyContactMobile"
    >
        <Field
            name="emergencyContactMobile"
            placeholder="EmergencyContactMobile"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="SSSNumber"
    >
        <Field
            name="sssNumber"
            placeholder="SSSNumber"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PhilHealthNumber"
    >
        <Field
            name="philhealthNumber"
            placeholder="PhilHealthNumber"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="PagIbigNumber"
    >
        <Field
            name="pagibigNumber"
            placeholder="PagIbigNumber"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="TINNumber"
    >
        <Field
            name="tinNumber"
            placeholder="TINNumber"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="BankName"
    >
        <Field
            name="bankName"
            placeholder="BankName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="BankAccountNumber"
    >
        <Field
            name="bankAccountNumber"
            placeholder="BankAccountNumber"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="BankAccountName"
    >
        <Field
            name="bankAccountName"
            placeholder="BankAccountName"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  
      <FormField
          label="EmploymentDate"
      >
          <DatePicker
              dateFormat="yyyy-MM-dd hh:mm"
              showTimeSelect
              selected={initialValues.employmentDate ?
                  new Date(
                      dayjs(initialValues.employmentDate).format('YYYY-MM-DD hh:mm'),
                  ) : null
              }
              onChange={(date) => setInitialValues({...initialValues, 'employmentDate': date})}
          />
      </FormField>
  

  

  

  

  

  

    

  



  

  

  

  

  

  
      <FormField
          label="RegularizationDate"
      >
          <DatePicker
              dateFormat="yyyy-MM-dd hh:mm"
              showTimeSelect
              selected={initialValues.regularizationDate ?
                  new Date(
                      dayjs(initialValues.regularizationDate).format('YYYY-MM-DD hh:mm'),
                  ) : null
              }
              onChange={(date) => setInitialValues({...initialValues, 'regularizationDate': date})}
          />
      </FormField>
  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="EmploymentStatus" labelFor="employmentStatus">
        <Field name="employmentStatus" id="employmentStatus" component="select">
          
            <option value="PROBATIONARY">PROBATIONARY</option>
          
            <option value="REGULAR">REGULAR</option>
          
            <option value="CONTRACTUAL">CONTRACTUAL</option>
          
            <option value="PROJECT_BASED">PROJECT_BASED</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="EmploymentType" labelFor="employmentType">
        <Field name="employmentType" id="employmentType" component="select">
          
            <option value="FULL_TIME">FULL_TIME</option>
          
            <option value="PART_TIME">PART_TIME</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="JobLevel" labelFor="jobLevel">
        <Field name="jobLevel" id="jobLevel" component="select">
          
            <option value="RANK_AND_FILE">RANK_AND_FILE</option>
          
            <option value="SUPERVISOR">SUPERVISOR</option>
          
            <option value="MANAGER">MANAGER</option>
          
            <option value="OFFICER">OFFICER</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="SalaryType" labelFor="salaryType">
        <Field name="salaryType" id="salaryType" component="select">
          
            <option value="MONTHLY">MONTHLY</option>
          
            <option value="DAILY">DAILY</option>
          
            <option value="HOURLY">HOURLY</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  

  

  
    <FormField
        label="BasicSalary"
    >
        <Field
            type="number"
            name="basicSalary"
            placeholder="BasicSalary"
        />
    </FormField>
  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="TaxStatus" labelFor="taxStatus">
        <Field name="taxStatus" id="taxStatus" component="select">
          
            <option value="S">S</option>
          
            <option value="ME">ME</option>
          
            <option value="S1">S1</option>
          
            <option value="S2">S2</option>
          
            <option value="S3">S3</option>
          
            <option value="S4">S4</option>
          
            <option value="ME1">ME1</option>
          
            <option value="ME2">ME2</option>
          
            <option value="ME3">ME3</option>
          
            <option value="ME4">ME4</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  
    <FormField
        label="WorkLocation"
    >
        <Field
            name="workLocation"
            placeholder="WorkLocation"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  
      <FormField
          label="SeparationDate"
      >
          <DatePicker
              dateFormat="yyyy-MM-dd hh:mm"
              showTimeSelect
              selected={initialValues.separationDate ?
                  new Date(
                      dayjs(initialValues.separationDate).format('YYYY-MM-DD hh:mm'),
                  ) : null
              }
              onChange={(date) => setInitialValues({...initialValues, 'separationDate': date})}
          />
      </FormField>
  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  
    <FormField label="SeparationType" labelFor="separationType">
        <Field name="separationType" id="separationType" component="select">
          
            <option value="RESIGNED">RESIGNED</option>
          
            <option value="TERMINATED">TERMINATED</option>
          
            <option value="RETIRED">RETIRED</option>
          
            <option value="REDUNDANCY">REDUNDANCY</option>
          
            <option value="AWOL">AWOL</option>
          
            <option value="DEATH">DEATH</option>
          
        </Field>
    </FormField>
  

  

  

  

    

  



  

  
    <FormField label="SeparationReason" hasTextareaHeight>
        <Field name="separationReason" as="textarea" placeholder="SeparationReason" />
    </FormField>
  

  

  

  

  

  

  

  

  

  

    

  



  
    <FormField
        label="ClearanceStatus"
    >
        <Field
            name="clearanceStatus"
            placeholder="ClearanceStatus"
        />
    </FormField>
  

  

  

  

  

  

  

  

  

  

  

    

  



  

  

  

  
    <FormField
        label="FinalPayAmount"
    >
        <Field
            type="number"
            name="finalPayAmount"
            placeholder="FinalPayAmount"
        />
    </FormField>
  

  

  

  

  

  

  

  

    

  



  

  

  

  

  

  
      <FormField
          label="FinalPayReleasedDate"
      >
          <DatePicker
              dateFormat="yyyy-MM-dd hh:mm"
              showTimeSelect
              selected={initialValues.finalPayReleasedDate ?
                  new Date(
                      dayjs(initialValues.finalPayReleasedDate).format('YYYY-MM-DD hh:mm'),
                  ) : null
              }
              onChange={(date) => setInitialValues({...initialValues, 'finalPayReleasedDate': date})}
          />
      </FormField>
  

  

  

  

  

  

    

  



  

  

  

  

  

  

  

  

  
    <FormField label='IsActive' labelFor='isActive'>
        <Field
            name='isActive'
            id='isActive'
            component={SwitchField}
        ></Field>
    </FormField>
  

  

  

    

  



  

  

  

  

  

  

  

  

  

  
  
    <FormField label='Department' labelFor='department'>
        <Field
            name='department'
            id='department'
            component={SelectField}
            options={initialValues.department}
            itemRef={'departments'}
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
            showField={'name'}
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        ></Field>
    </FormField>
    

  

  

    

  



  

  

  

  

  

  

  

  

  

  
  
    <FormField label='Position' labelFor='position'>
        <Field
            name='position'
            id='position'
            component={SelectField}
            options={initialValues.position}
            itemRef={'positions'}
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
            showField={'title'}
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        ></Field>
    </FormField>
    

  

  

    

  



  

  

  

  

  

  

  

  

  

  
  
    <FormField label='Shift' labelFor='shift'>
        <Field
            name='shift'
            id='shift'
            component={SelectField}
            options={initialValues.shift}
            itemRef={'shifts'}
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
            showField={'name'}
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        ></Field>
    </FormField>
    

  

  

    

  



  

  

  

  

  

  

  

  

  

  
  
    <FormField label='ReportingTo' labelFor='reportingTo'>
        <Field
            name='reportingTo'
            id='reportingTo'
            component={SelectField}
            options={initialValues.reportingTo}
            itemRef={'employees'}
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
            showField={'employeeCode'}
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        ></Field>
    </FormField>
    

  

  

    

  


  

              <BaseDivider />
              <BaseButtons>
                <BaseButton type="submit" color="info" label="Submit" />
                <BaseButton type="reset" color="info" outline label="Reset" />
                <BaseButton type='reset' color='danger' outline label='Cancel' onClick={() => router.push('/employees/employees-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

EditEmployees.getLayout = function getLayout(page: ReactElement) {
  return (
      <LayoutAuthenticated
        
          permission={'UPDATE_EMPLOYEES'}
        
      >
          {page}
      </LayoutAuthenticated>
  )
}

export default EditEmployees
