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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    track: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    artist_profile: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    target_playlists: [],
    
    
    
    pitch_title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    pitch_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    mood: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    similar_artists: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    achievements: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    submitted_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    decided_at: '',
    
    
    
    
    
    
    
    
    
    
    
    decision_notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Artistprofile" labelFor="artist_profile">
      <Field name="artist_profile" id="artist_profile" component={SelectField} options={[]} itemRef={'artist_profiles'}></Field>
  </FormField>





























    <FormField label='Targetplaylists' labelFor='target_playlists'>
        <Field
            name='target_playlists'
            id='target_playlists'
            itemRef={'playlists'}
            options={[]}
            component={SelectFieldMany}>
        </Field>
    </FormField>







  <FormField
      label="Pitchtitle"
  >
      <Field
          name="pitch_title"
          placeholder="Pitchtitle"
      />
  </FormField>































      <FormField label='Pitchtext' hasTextareaHeight>
          <Field
              name='pitch_text'
              id='pitch_text'
              component={RichTextField}
          ></Field>
      </FormField>























  <FormField
      label="Mood"
  >
      <Field
          name="mood"
          placeholder="Mood"
      />
  </FormField>





























    <FormField label="Similarartists" hasTextareaHeight>
        <Field name="similar_artists" as="textarea" placeholder="Similarartists" />
    </FormField>



























    <FormField label="Achievements" hasTextareaHeight>
        <Field name="achievements" as="textarea" placeholder="Achievements" />
    </FormField>







































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="sent">sent</option>
      
        <option value="under_review">under_review</option>
      
        <option value="accepted">accepted</option>
      
        <option value="rejected">rejected</option>
      
      </Field>
  </FormField>























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



























  <FormField
      label="Decidedat"
  >
      <Field
          type="datetime-local"
          name="decided_at"
          placeholder="Decidedat"
      />
  </FormField>



















    <FormField label="Decisionnotes" hasTextareaHeight>
        <Field name="decision_notes" as="textarea" placeholder="Decisionnotes" />
    </FormField>











































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></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('/pitch_requests/pitch_requests-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Pitch_requestsNew
