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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    topic: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    npc: '',
    
    
    
    
    
    
    line_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mood_tag: 'neutral',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    voice_files: [],
    
    
    
    
    
    
    
    
    
    priority: '',
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/dialogue_lines/dialogue_lines-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="Topic" labelFor="topic">
      <Field name="topic" id="topic" component={SelectField} options={[]} itemRef={'dialogue_topics'}></Field>
  </FormField>



























  <FormField label="NPC" labelFor="npc">
      <Field name="npc" id="npc" component={SelectField} options={[]} itemRef={'npcs'}></Field>
  </FormField>













      <FormField label='LineText' hasTextareaHeight>
          <Field
              name='line_text'
              id='line_text'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="MoodTag" labelFor="mood_tag">
      <Field name="mood_tag" id="mood_tag" component="select">
      
        <option value="neutral">neutral</option>
      
        <option value="happy">happy</option>
      
        <option value="sad">sad</option>
      
        <option value="angry">angry</option>
      
        <option value="funny">funny</option>
      
        <option value="romantic">romantic</option>
      
        <option value="serious">serious</option>
      
      </Field>
  </FormField>




































  <FormField>
      <Field
          label='VoiceFiles'
          color='info'
          icon={mdiUpload}
          path={'dialogue_lines/voice_files'}
          name='voice_files'
          id='voice_files'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </FormField>










    <FormField
        label="Priority"
    >
        <Field
            type="number"
            name="priority"
            placeholder="Priority"
        />
    </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('/dialogue_lines/dialogue_lines-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Dialogue_linesNew
