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

const initialValues = {
    
    
    time_zone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    locale: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    theme: 'light',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    default_entry_mode: 'chat',
    
    
    
    
    
    
    
    
    
    
    
    
    
    voice_mode_enabled: false,
    
    
    
    
    
    
    
    
    
    preferred_voice: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    speech_rate: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    speech_pitch: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    safe_confirmations_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    auto_archive_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/user_settings/user_settings-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="TimeZone"
  >
      <Field
          name="time_zone"
          placeholder="TimeZone"
      />
  </FormField>



























  <FormField
      label="Locale"
  >
      <Field
          name="locale"
          placeholder="Locale"
      />
  </FormField>









































  <FormField label="Theme" labelFor="theme">
      <Field name="theme" id="theme" component="select">
      
        <option value="light">light</option>
      
        <option value="dark">dark</option>
      
        <option value="system">system</option>
      
      </Field>
  </FormField>



























  <FormField label="DefaultEntryMode" labelFor="default_entry_mode">
      <Field name="default_entry_mode" id="default_entry_mode" component="select">
      
        <option value="chat">chat</option>
      
        <option value="voice">voice</option>
      
      </Field>
  </FormField>





























  <FormField label='VoiceModeEnabled' labelFor='voice_mode_enabled'>
      <Field
          name='voice_mode_enabled'
          id='voice_mode_enabled'
          component={SwitchField}
      ></Field>
  </FormField>











  <FormField
      label="PreferredVoice"
  >
      <Field
          name="preferred_voice"
          placeholder="PreferredVoice"
      />
  </FormField>

































    <FormField
        label="SpeechRate"
    >
        <Field
            type="number"
            name="speech_rate"
            placeholder="SpeechRate"
        />
    </FormField>



























    <FormField
        label="SpeechPitch"
    >
        <Field
            type="number"
            name="speech_pitch"
            placeholder="SpeechPitch"
        />
    </FormField>





































  <FormField label='SafeConfirmationsEnabled' labelFor='safe_confirmations_enabled'>
      <Field
          name='safe_confirmations_enabled'
          id='safe_confirmations_enabled'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="AutoArchiveDays"
    >
        <Field
            type="number"
            name="auto_archive_days"
            placeholder="AutoArchiveDays"
        />
    </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_settings/user_settings-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default User_settingsNew
