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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    place: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    day_of_week: 'monday',
    
    
    
    
    
    
    
    open_time: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    close_time: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_closed: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_24_hours: false,
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="DayofWeek" labelFor="day_of_week">
      <Field name="day_of_week" id="day_of_week" component="select">
      
        <option value="monday">monday</option>
      
        <option value="tuesday">tuesday</option>
      
        <option value="wednesday">wednesday</option>
      
        <option value="thursday">thursday</option>
      
        <option value="friday">friday</option>
      
        <option value="saturday">saturday</option>
      
        <option value="sunday">sunday</option>
      
      </Field>
  </FormField>













  <FormField
      label="OpenTime"
  >
      <Field
          name="open_time"
          placeholder="OpenTime"
      />
  </FormField>



























  <FormField
      label="CloseTime"
  >
      <Field
          name="close_time"
          placeholder="CloseTime"
      />
  </FormField>











































  <FormField label='IsClosed' labelFor='is_closed'>
      <Field
          name='is_closed'
          id='is_closed'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Is24Hours' labelFor='is_24_hours'>
      <Field
          name='is_24_hours'
          id='is_24_hours'
          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('/place_opening_hours/place_opening_hours-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Place_opening_hoursNew
