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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    family_group: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    granter_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    grantee_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    data_category: 'profile',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    access_level: 'no_access',
    
    
    
    
    
    
}


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

    
    

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



























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



























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























  <FormField label="DataCategory" labelFor="data_category">
      <Field name="data_category" id="data_category" component="select">
      
        <option value="profile">profile</option>
      
        <option value="fitness">fitness</option>
      
        <option value="nutrition">nutrition</option>
      
        <option value="sleep">sleep</option>
      
        <option value="mood">mood</option>
      
        <option value="medical_metrics">medical_metrics</option>
      
        <option value="symptoms">symptoms</option>
      
        <option value="medications">medications</option>
      
        <option value="location">location</option>
      
      </Field>
  </FormField>



























  <FormField label="AccessLevel" labelFor="access_level">
      <Field name="access_level" id="access_level" component="select">
      
        <option value="no_access">no_access</option>
      
        <option value="view_only">view_only</option>
      
        <option value="can_add_edit">can_add_edit</option>
      
      </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('/sharing_permissions/sharing_permissions-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Sharing_permissionsNew
