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

const initialValues = {
    
    
    
    
    
    
    
    snapshot_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_accounts: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_users: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    total_patients: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    active_devices: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    alerts_last_24h: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cognitive_sessions_last_7d: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reminders_sent_last_24h: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accounts: '',
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/admin_metrics_snapshots/admin_metrics_snapshots-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="Snapshotat"
  >
      <Field
          type="datetime-local"
          name="snapshot_at"
          placeholder="Snapshotat"
      />
  </FormField>























    <FormField
        label="Totalaccounts"
    >
        <Field
            type="number"
            name="total_accounts"
            placeholder="Totalaccounts"
        />
    </FormField>



























    <FormField
        label="Totalusers"
    >
        <Field
            type="number"
            name="total_users"
            placeholder="Totalusers"
        />
    </FormField>



























    <FormField
        label="Totalpatients"
    >
        <Field
            type="number"
            name="total_patients"
            placeholder="Totalpatients"
        />
    </FormField>



























    <FormField
        label="Activedevices"
    >
        <Field
            type="number"
            name="active_devices"
            placeholder="Activedevices"
        />
    </FormField>



























    <FormField
        label="Alertslast24h"
    >
        <Field
            type="number"
            name="alerts_last_24h"
            placeholder="Alertslast24h"
        />
    </FormField>



























    <FormField
        label="Cognitivesessionslast7d"
    >
        <Field
            type="number"
            name="cognitive_sessions_last_7d"
            placeholder="Cognitivesessionslast7d"
        />
    </FormField>



























    <FormField
        label="Reminderssentlast24h"
    >
        <Field
            type="number"
            name="reminders_sent_last_24h"
            placeholder="Reminderssentlast24h"
        />
    </FormField>























    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </FormField>











































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

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

export default Admin_metrics_snapshotsNew
