import { mdiAccount, mdiChartTimelineVariant, mdiMail, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement } from 'react'
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 { SwitchField } from '../../components/SwitchField'

import { SelectField } from '../../components/SelectField'
import { SelectFieldMany } from "../../components/SelectFieldMany";
import {RichTextField} from "../../components/RichTextField";

import { create } from '../../stores/team_members/team_membersSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    tenant: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    employment_type: 'employee',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    seniority: 'junior',
    
    
    
    
    
    
    
    hourly_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    rate_currency: 'USD',
    
    
    
    
    
    
    
    
    
    
    weekly_capacity_hours: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    active: false,
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


const Team_membersNew = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/team_members/team_members-list')
  }
  return (
    <>
      <Head>
        <title>{getPageTitle('New Item')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title="New Item" main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            initialValues={
                
                initialValues
                
            }
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>





















  <FormField label="Tenant" labelFor="tenant">
      <Field name="tenant" id="tenant" component={SelectField} options={[]} itemRef={'tenants'}></Field>
  </FormField>



























  <FormField label="User" labelFor="user">
      <Field name="user" id="user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>























  <FormField label="Employmenttype" labelFor="employment_type">
      <Field name="employment_type" id="employment_type" component="select">
      
        <option value="employee">employee</option>
      
        <option value="contractor">contractor</option>
      
        <option value="freelancer">freelancer</option>
      
      </Field>
  </FormField>



























  <FormField label="Seniority" labelFor="seniority">
      <Field name="seniority" id="seniority" component="select">
      
        <option value="junior">junior</option>
      
        <option value="mid">mid</option>
      
        <option value="senior">senior</option>
      
        <option value="lead">lead</option>
      
        <option value="principal">principal</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Hourlyrate"
    >
        <Field
            type="number"
            name="hourly_rate"
            placeholder="Hourlyrate"
        />
    </FormField>



































  <FormField label="Ratecurrency" labelFor="rate_currency">
      <Field name="rate_currency" id="rate_currency" component="select">
      
        <option value="USD">USD</option>
      
        <option value="CDF">CDF</option>
      
        <option value="EUR">EUR</option>
      
        <option value="XAF">XAF</option>
      
        <option value="XOF">XOF</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Weeklycapacity(hours)"
    >
        <Field
            type="number"
            name="weekly_capacity_hours"
            placeholder="Weeklycapacity(hours)"
        />
    </FormField>





































  <FormField label='Active' labelFor='active'>
      <Field
          name='active'
          id='active'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </FormField>











































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></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('/team_members/team_members-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Team_membersNew
