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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'uploaded',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_images: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pattern_files: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pattern_preview_images: [],
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    selected_size: '20x30',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    selected_difficulty: 'easy',
    
    
    
    
    
    
    
    
    
    
    estimated_color_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    estimated_price: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    instructions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_model_version: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    submitted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    processed_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    approved_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/custom_artwork_requests/custom_artwork_requests-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="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="uploaded">uploaded</option>
      
        <option value="processing">processing</option>
      
        <option value="ready_for_selection">ready_for_selection</option>
      
        <option value="awaiting_payment">awaiting_payment</option>
      
        <option value="in_production">in_production</option>
      
        <option value="completed">completed</option>
      
        <option value="rejected">rejected</option>
      
      </Field>
  </FormField>



































  <FormField>
      <Field
          label='SourceImages'
          color='info'
          icon={mdiUpload}
          path={'custom_artwork_requests/source_images'}
          name='source_images'
          id='source_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </FormField>




























  <FormField>
      <Field
          label='PatternFiles'
          color='info'
          icon={mdiUpload}
          path={'custom_artwork_requests/pattern_files'}
          name='pattern_files'
          id='pattern_files'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormFilePicker}
      ></Field>
  </FormField>


























  <FormField>
      <Field
          label='PatternPreviewImages'
          color='info'
          icon={mdiUpload}
          path={'custom_artwork_requests/pattern_preview_images'}
          name='pattern_preview_images'
          id='pattern_preview_images'
          schema={{
            size: undefined,
            formats: undefined,
          }}
          component={FormImagePicker}
      ></Field>
  </FormField>



















  <FormField label="SelectedSize" labelFor="selected_size">
      <Field name="selected_size" id="selected_size" component="select">
      
        <option value="20x30">20x30</option>
      
        <option value="30x40">30x40</option>
      
        <option value="40x50">40x50</option>
      
        <option value="50x70">50x70</option>
      
        <option value="60x80">60x80</option>
      
      </Field>
  </FormField>



























  <FormField label="SelectedDifficulty" labelFor="selected_difficulty">
      <Field name="selected_difficulty" id="selected_difficulty" component="select">
      
        <option value="easy">easy</option>
      
        <option value="medium">medium</option>
      
        <option value="hard">hard</option>
      
        <option value="expert">expert</option>
      
      </Field>
  </FormField>



















    <FormField
        label="EstimatedColorCount"
    >
        <Field
            type="number"
            name="estimated_color_count"
            placeholder="EstimatedColorCount"
        />
    </FormField>



























    <FormField
        label="EstimatedPrice"
    >
        <Field
            type="number"
            name="estimated_price"
            placeholder="EstimatedPrice"
        />
    </FormField>























    <FormField label="Instructions" hasTextareaHeight>
        <Field name="instructions" as="textarea" placeholder="Instructions" />
    </FormField>

























  <FormField
      label="AIModelVersion"
  >
      <Field
          name="ai_model_version"
          placeholder="AIModelVersion"
      />
  </FormField>





































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



























  <FormField
      label="ProcessedAt"
  >
      <Field
          type="datetime-local"
          name="processed_at"
          placeholder="ProcessedAt"
      />
  </FormField>



























  <FormField
      label="ApprovedAt"
  >
      <Field
          type="datetime-local"
          name="approved_at"
          placeholder="ApprovedAt"
      />
  </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('/custom_artwork_requests/custom_artwork_requests-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Custom_artwork_requestsNew
