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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    reporter: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reported_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    report_type: 'harassment',
    
    
    
    
    
    
    
    
    details: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'new',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    assigned_moderator: '',
    
    
    
    
    
    
    
    
    
    reported_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    resolved_at: '',
    
    
    
    
    
    
    
    
    
    
    
    resolution_notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    attachments: [],
    
    
}


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

    
    

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



























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























  <FormField label="ReportType" labelFor="report_type">
      <Field name="report_type" id="report_type" component="select">
      
        <option value="harassment">harassment</option>
      
        <option value="hate_speech">hate_speech</option>
      
        <option value="spam">spam</option>
      
        <option value="scam">scam</option>
      
        <option value="impersonation">impersonation</option>
      
        <option value="underage">underage</option>
      
        <option value="nudity">nudity</option>
      
        <option value="violence">violence</option>
      
        <option value="other">other</option>
      
        <option value="fake_profile">fake_profile</option>
      
      </Field>
  </FormField>















    <FormField label="Details" hasTextareaHeight>
        <Field name="details" as="textarea" placeholder="Details" />
    </FormField>







































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="new">new</option>
      
        <option value="triaged">triaged</option>
      
        <option value="in_review">in_review</option>
      
        <option value="action_taken">action_taken</option>
      
        <option value="dismissed">dismissed</option>
      
      </Field>
  </FormField>































  <FormField label="AssignedModerator" labelFor="assigned_moderator">
      <Field name="assigned_moderator" id="assigned_moderator" component={SelectField} options={[]} itemRef={'admin_users'}></Field>
  </FormField>



















  <FormField
      label="ReportedAt"
  >
      <Field
          type="datetime-local"
          name="reported_at"
          placeholder="ReportedAt"
      />
  </FormField>



























  <FormField
      label="ResolvedAt"
  >
      <Field
          type="datetime-local"
          name="resolved_at"
          placeholder="ResolvedAt"
      />
  </FormField>



















    <FormField label="ResolutionNotes" hasTextareaHeight>
        <Field name="resolution_notes" as="textarea" placeholder="ResolutionNotes" />
    </FormField>













































    <FormField label='Attachments' labelFor='attachments'>
        <Field
            name='attachments'
            id='attachments'
            itemRef={'report_attachments'}
            options={[]}
            component={SelectFieldMany}>
        </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('/reports/reports-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default ReportsNew
