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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    patient: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    prescription_item: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    patient_vaccination: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    reminder_type: 'medicine',
    
    
    
    
    
    
    
    
    
    
    
    
    scheduled_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    sent_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    channel: 'push',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    delivery_status: 'pending',
    
    
    
    
    
    
    
    
    message_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="PrescriptionItem" labelFor="prescription_item">
      <Field name="prescription_item" id="prescription_item" component={SelectField} options={[]} itemRef={'prescription_items'}></Field>
  </FormField>



























  <FormField label="PatientVaccination" labelFor="patient_vaccination">
      <Field name="patient_vaccination" id="patient_vaccination" component={SelectField} options={[]} itemRef={'patient_vaccinations'}></Field>
  </FormField>























  <FormField label="ReminderType" labelFor="reminder_type">
      <Field name="reminder_type" id="reminder_type" component="select">
      
        <option value="medicine">medicine</option>
      
        <option value="vaccination">vaccination</option>
      
        <option value="appointment">appointment</option>
      
        <option value="follow_up">follow_up</option>
      
      </Field>
  </FormField>























  <FormField
      label="ScheduledAt"
  >
      <Field
          type="datetime-local"
          name="scheduled_at"
          placeholder="ScheduledAt"
      />
  </FormField>



























  <FormField
      label="SentAt"
  >
      <Field
          type="datetime-local"
          name="sent_at"
          placeholder="SentAt"
      />
  </FormField>































  <FormField label="Channel" labelFor="channel">
      <Field name="channel" id="channel" component="select">
      
        <option value="push">push</option>
      
        <option value="email">email</option>
      
        <option value="sms">sms</option>
      
      </Field>
  </FormField>



























  <FormField label="DeliveryStatus" labelFor="delivery_status">
      <Field name="delivery_status" id="delivery_status" component="select">
      
        <option value="pending">pending</option>
      
        <option value="sent">sent</option>
      
        <option value="delivered">delivered</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>















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

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

export default RemindersNew
