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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    session_type: 'doctor_patient',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    patient: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    doctor: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    second_doctor: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    created_by_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    session_status: 'open',
    
    
    
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ended_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/chat_sessions/chat_sessions-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="SessionType" labelFor="session_type">
      <Field name="session_type" id="session_type" component="select">
      
        <option value="doctor_patient">doctor_patient</option>
      
        <option value="doctor_doctor">doctor_doctor</option>
      
        <option value="patient_chatbot">patient_chatbot</option>
      
      </Field>
  </FormField>































  <FormField label="Patient" labelFor="patient">
      <Field name="patient" id="patient" component={SelectField} options={[]} itemRef={'patient_profiles'}></Field>
  </FormField>



























  <FormField label="Doctor" labelFor="doctor">
      <Field name="doctor" id="doctor" component={SelectField} options={[]} itemRef={'doctor_profiles'}></Field>
  </FormField>



























  <FormField label="SecondDoctor" labelFor="second_doctor">
      <Field name="second_doctor" id="second_doctor" component={SelectField} options={[]} itemRef={'doctor_profiles'}></Field>
  </FormField>



























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























  <FormField label="SessionStatus" labelFor="session_status">
      <Field name="session_status" id="session_status" component="select">
      
        <option value="open">open</option>
      
        <option value="closed">closed</option>
      
        <option value="archived">archived</option>
      
      </Field>
  </FormField>























  <FormField
      label="StartedAt"
  >
      <Field
          type="datetime-local"
          name="started_at"
          placeholder="StartedAt"
      />
  </FormField>



























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

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

export default Chat_sessionsNew
