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

const initialValues = {
    
    
    
    
    
    trust_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    trust_tier: 'unverified',
    
    
    
    
    
    
    
    
    
    
    
    
    score_last_calculated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_human_verified: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_business_verified: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_identity_verified: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_tax_verified: false,
    
    
    
    
    
    
    
    
    
    
    risk_flags_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/trust_profiles/trust_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="TrustScore"
    >
        <Field
            type="number"
            name="trust_score"
            placeholder="TrustScore"
        />
    </FormField>



































  <FormField label="TrustTier" labelFor="trust_tier">
      <Field name="trust_tier" id="trust_tier" component="select">
      
        <option value="unverified">unverified</option>
      
        <option value="basic">basic</option>
      
        <option value="verified">verified</option>
      
        <option value="trusted">trusted</option>
      
        <option value="elite">elite</option>
      
      </Field>
  </FormField>























  <FormField
      label="ScoreLastCalculatedAt"
  >
      <Field
          type="datetime-local"
          name="score_last_calculated_at"
          placeholder="ScoreLastCalculatedAt"
      />
  </FormField>

































  <FormField label='HumanVerified' labelFor='is_human_verified'>
      <Field
          name='is_human_verified'
          id='is_human_verified'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='BusinessVerified' labelFor='is_business_verified'>
      <Field
          name='is_business_verified'
          id='is_business_verified'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='IdentityVerified' labelFor='is_identity_verified'>
      <Field
          name='is_identity_verified'
          id='is_identity_verified'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='TaxVerified' labelFor='is_tax_verified'>
      <Field
          name='is_tax_verified'
          id='is_tax_verified'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="RiskFlagsSummary" hasTextareaHeight>
        <Field name="risk_flags_summary" as="textarea" placeholder="RiskFlagsSummary" />
    </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('/trust_profiles/trust_profiles-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Trust_profilesNew
