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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    staff_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    camp_session: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    age_group: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    subject: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    assignment_role: 'teacher',
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="CampSession" labelFor="camp_session">
      <Field name="camp_session" id="camp_session" component={SelectField} options={[]} itemRef={'camp_sessions'}></Field>
  </FormField>



























  <FormField label="AgeGroup" labelFor="age_group">
      <Field name="age_group" id="age_group" component={SelectField} options={[]} itemRef={'age_groups'}></Field>
  </FormField>



























  <FormField label="Subject" labelFor="subject">
      <Field name="subject" id="subject" component={SelectField} options={[]} itemRef={'curriculum_subjects'}></Field>
  </FormField>























  <FormField label="AssignmentRole" labelFor="assignment_role">
      <Field name="assignment_role" id="assignment_role" component="select">
      
        <option value="teacher">teacher</option>
      
        <option value="counselor">counselor</option>
      
        <option value="shift_lead">shift_lead</option>
      
        <option value="driver">driver</option>
      
        <option value="volunteer">volunteer</option>
      
      </Field>
  </FormField>















    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/staff_assignments/staff_assignments-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Staff_assignmentsNew
