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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evaluator: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    agent: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    channel: 'call',
    
    
    
    
    
    
    
    interaction_reference: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    interaction_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evaluated_at: '',
    
    
    
    
    
    
    
    
    
    
    overall_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    result: 'pass',
    
    
    
    
    
    
    
    
    
    summary_notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Evaluator" labelFor="evaluator">
      <Field name="evaluator" id="evaluator" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>



























  <FormField label="Agent" labelFor="agent">
      <Field name="agent" id="agent" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>























  <FormField label="Channel" labelFor="channel">
      <Field name="channel" id="channel" component="select">
      
        <option value="call">call</option>
      
        <option value="chat">chat</option>
      
        <option value="email">email</option>
      
        <option value="in_person">in_person</option>
      
      </Field>
  </FormField>













  <FormField
      label="InteractionReference"
  >
      <Field
          name="interaction_reference"
          placeholder="InteractionReference"
      />
  </FormField>





































  <FormField
      label="InteractionAt"
  >
      <Field
          type="datetime-local"
          name="interaction_at"
          placeholder="InteractionAt"
      />
  </FormField>



























  <FormField
      label="EvaluatedAt"
  >
      <Field
          type="datetime-local"
          name="evaluated_at"
          placeholder="EvaluatedAt"
      />
  </FormField>























    <FormField
        label="OverallScore"
    >
        <Field
            type="number"
            name="overall_score"
            placeholder="OverallScore"
        />
    </FormField>



































  <FormField label="Result" labelFor="result">
      <Field name="result" id="result" component="select">
      
        <option value="pass">pass</option>
      
        <option value="needs_improvement">needs_improvement</option>
      
        <option value="fail">fail</option>
      
      </Field>
  </FormField>

















      <FormField label='SummaryNotes' hasTextareaHeight>
          <Field
              name='summary_notes'
              id='summary_notes'
              component={RichTextField}
          ></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('/qa_evaluations/qa_evaluations-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Qa_evaluationsNew
