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/user_profiles/user_profilesSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    cpf: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    birth_date: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    marital_status: 'solteiro',
    
    
    
    
    
    
    
    spouse_cpf: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    spouse_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mother_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cep: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    street: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    house_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    address_complement: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    neighborhood: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    city: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    state_uf: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    phone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    occupation_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    occupation_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cbo_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    main_source_cnpj: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    voter_title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    voter_zone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    voter_section: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    nit_pis_pasep: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    caepf_number: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/user_profiles/user_profiles-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="Usuário" labelFor="user">
      <Field name="user" id="user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>









  <FormField
      label="CPF"
  >
      <Field
          name="cpf"
          placeholder="CPF"
      />
  </FormField>





































  <FormField
      label="Datadenascimento"
  >
      <Field
          type="datetime-local"
          name="birth_date"
          placeholder="Datadenascimento"
      />
  </FormField>































  <FormField label="Estadocivil" labelFor="marital_status">
      <Field name="marital_status" id="marital_status" component="select">
      
        <option value="solteiro">solteiro</option>
      
        <option value="casado">casado</option>
      
        <option value="divorciado">divorciado</option>
      
        <option value="viuvo">viuvo</option>
      
        <option value="uniao_estavel">uniao_estavel</option>
      
      </Field>
  </FormField>













  <FormField
      label="CPFdocônjuge"
  >
      <Field
          name="spouse_cpf"
          placeholder="CPFdocônjuge"
      />
  </FormField>



























  <FormField
      label="Nomedocônjuge"
  >
      <Field
          name="spouse_name"
          placeholder="Nomedocônjuge"
      />
  </FormField>



























  <FormField
      label="Nomedamãe"
  >
      <Field
          name="mother_name"
          placeholder="Nomedamãe"
      />
  </FormField>



























  <FormField
      label="CEP"
  >
      <Field
          name="cep"
          placeholder="CEP"
      />
  </FormField>



























  <FormField
      label="Logradouro"
  >
      <Field
          name="street"
          placeholder="Logradouro"
      />
  </FormField>



























  <FormField
      label="Número"
  >
      <Field
          name="house_number"
          placeholder="Número"
      />
  </FormField>



























  <FormField
      label="Complemento"
  >
      <Field
          name="address_complement"
          placeholder="Complemento"
      />
  </FormField>



























  <FormField
      label="Bairro"
  >
      <Field
          name="neighborhood"
          placeholder="Bairro"
      />
  </FormField>



























  <FormField
      label="Cidade"
  >
      <Field
          name="city"
          placeholder="Cidade"
      />
  </FormField>



























  <FormField
      label="UF"
  >
      <Field
          name="state_uf"
          placeholder="UF"
      />
  </FormField>



























  <FormField
      label="Telefone"
  >
      <Field
          name="phone"
          placeholder="Telefone"
      />
  </FormField>



























  <FormField
      label="Ocupação"
  >
      <Field
          name="occupation_text"
          placeholder="Ocupação"
      />
  </FormField>



























  <FormField
      label="Naturezadaocupação(código)"
  >
      <Field
          name="occupation_code"
          placeholder="Naturezadaocupação(código)"
      />
  </FormField>



























  <FormField
      label="Ocupaçãoprincipal(CBO)"
  >
      <Field
          name="cbo_code"
          placeholder="Ocupaçãoprincipal(CBO)"
      />
  </FormField>



























  <FormField
      label="CNPJdafonteprincipal"
  >
      <Field
          name="main_source_cnpj"
          placeholder="CNPJdafonteprincipal"
      />
  </FormField>



























  <FormField
      label="Títulodeeleitor"
  >
      <Field
          name="voter_title"
          placeholder="Títulodeeleitor"
      />
  </FormField>



























  <FormField
      label="Zonaeleitoral"
  >
      <Field
          name="voter_zone"
          placeholder="Zonaeleitoral"
      />
  </FormField>



























  <FormField
      label="Seçãoeleitoral"
  >
      <Field
          name="voter_section"
          placeholder="Seçãoeleitoral"
      />
  </FormField>



























  <FormField
      label="NIT/PIS/PASEP"
  >
      <Field
          name="nit_pis_pasep"
          placeholder="NIT/PIS/PASEP"
      />
  </FormField>



























  <FormField
      label="CAEPF"
  >
      <Field
          name="caepf_number"
          placeholder="CAEPF"
      />
  </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('/user_profiles/user_profiles-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default User_profilesNew
