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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    book: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    scan_type: 'cover',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'started',
    
    
    
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ended_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    frames_analyzed: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pages_detected: '',
    
    
    
    
    
    
    
    
    
    
    
    
    confidence_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    page_turning_detected: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    duplicate_page_detected: false,
    
    
    
    
    
    
    
    
    
    
    fraud_reason: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    coins_awarded: '',
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Book" labelFor="book">
      <Field name="book" id="book" component={SelectField} options={[]} itemRef={'books'}></Field>
  </FormField>























  <FormField label="Scantype" labelFor="scan_type">
      <Field name="scan_type" id="scan_type" component="select">
      
        <option value="cover">cover</option>
      
        <option value="page">page</option>
      
        <option value="shelf">shelf</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="started">started</option>
      
        <option value="verifying">verifying</option>
      
        <option value="failed">failed</option>
      
        <option value="completed">completed</option>
      
        <option value="flagged">flagged</option>
      
      </Field>
  </FormField>























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



























  <FormField
      label="Endedat"
  >
      <Field
          type="datetime-local"
          name="ended_at"
          placeholder="Endedat"
      />
  </FormField>























    <FormField
        label="Framesanalyzed"
    >
        <Field
            type="number"
            name="frames_analyzed"
            placeholder="Framesanalyzed"
        />
    </FormField>



























    <FormField
        label="Pagesdetected"
    >
        <Field
            type="number"
            name="pages_detected"
            placeholder="Pagesdetected"
        />
    </FormField>



























    <FormField
        label="Confidencescore"
    >
        <Field
            type="number"
            name="confidence_score"
            placeholder="Confidencescore"
        />
    </FormField>





































  <FormField label='Pageturningdetected' labelFor='page_turning_detected'>
      <Field
          name='page_turning_detected'
          id='page_turning_detected'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Duplicatepagedetected' labelFor='duplicate_page_detected'>
      <Field
          name='duplicate_page_detected'
          id='duplicate_page_detected'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="Fraudreason" hasTextareaHeight>
        <Field name="fraud_reason" as="textarea" placeholder="Fraudreason" />
    </FormField>































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

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

export default Camera_scan_sessionsNew
