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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    feedback_type: 'nps',
    
    
    
    
    
    
    
    
    
    
    score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    comment: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_surface: 'landing',
    
    
    
    
    
    
    
    
    
    
    
    
    submitted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    needs_follow_up: false,
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/feedback_entries/feedback_entries-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="FeedbackType" labelFor="feedback_type">
      <Field name="feedback_type" id="feedback_type" component="select">
      
        <option value="nps">nps</option>
      
        <option value="csat">csat</option>
      
        <option value="bug">bug</option>
      
        <option value="feature_request">feature_request</option>
      
        <option value="freeform">freeform</option>
      
      </Field>
  </FormField>



















    <FormField
        label="Score"
    >
        <Field
            type="number"
            name="score"
            placeholder="Score"
        />
    </FormField>























    <FormField label="Comment" hasTextareaHeight>
        <Field name="comment" as="textarea" placeholder="Comment" />
    </FormField>







































  <FormField label="SourceSurface" labelFor="source_surface">
      <Field name="source_surface" id="source_surface" component="select">
      
        <option value="landing">landing</option>
      
        <option value="onboarding">onboarding</option>
      
        <option value="profile">profile</option>
      
        <option value="coach">coach</option>
      
        <option value="offer">offer</option>
      
        <option value="checkout">checkout</option>
      
        <option value="course">course</option>
      
        <option value="lesson">lesson</option>
      
        <option value="trophy_case">trophy_case</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>























  <FormField
      label="SubmittedAt"
  >
      <Field
          type="datetime-local"
          name="submitted_at"
          placeholder="SubmittedAt"
      />
  </FormField>

































  <FormField label='NeedsFollowUp' labelFor='needs_follow_up'>
      <Field
          name='needs_follow_up'
          id='needs_follow_up'
          component={SwitchField}
      ></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('/feedback_entries/feedback_entries-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Feedback_entriesNew
