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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    requested_by: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    matter: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    media_file: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'queued',
    
    
    
    
    
    
    
    source_language: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    target_language: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    speaker_diarization: false,
    
    
    
    
    
    
    
    
    
    confidence_avg: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    transcript_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    summary_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    export_file: '',
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    finished_at: '',
    
    
    
    
    
    
    
    
    
    
    
    error_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Matter" labelFor="matter">
      <Field name="matter" id="matter" component={SelectField} options={[]} itemRef={'matters'}></Field>
  </FormField>



























  <FormField label="MediaFile" labelFor="media_file">
      <Field name="media_file" id="media_file" component={SelectField} options={[]} itemRef={'files'}></Field>
  </FormField>























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="running">running</option>
      
        <option value="completed">completed</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>













  <FormField
      label="SourceLanguage"
  >
      <Field
          name="source_language"
          placeholder="SourceLanguage"
      />
  </FormField>



























  <FormField
      label="TargetLanguage"
  >
      <Field
          name="target_language"
          placeholder="TargetLanguage"
      />
  </FormField>











































  <FormField label='SpeakerDiarization' labelFor='speaker_diarization'>
      <Field
          name='speaker_diarization'
          id='speaker_diarization'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="ConfidenceAvg"
    >
        <Field
            type="number"
            name="confidence_avg"
            placeholder="ConfidenceAvg"
        />
    </FormField>























    <FormField label="TranscriptText" hasTextareaHeight>
        <Field name="transcript_text" as="textarea" placeholder="TranscriptText" />
    </FormField>



























    <FormField label="SummaryText" hasTextareaHeight>
        <Field name="summary_text" as="textarea" placeholder="SummaryText" />
    </FormField>











































  <FormField label="ExportFile" labelFor="export_file">
      <Field name="export_file" id="export_file" component={SelectField} options={[]} itemRef={'files'}></Field>
  </FormField>



















  <FormField
      label="StartedAt"
  >
      <Field
          type="datetime-local"
          name="started_at"
          placeholder="StartedAt"
      />
  </FormField>



























  <FormField
      label="FinishedAt"
  >
      <Field
          type="datetime-local"
          name="finished_at"
          placeholder="FinishedAt"
      />
  </FormField>



















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

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

export default Transcription_jobsNew
