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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    feature: 'career_coach',
    
    
    
    
    
    
    
    
    
    
    limit_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    used_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    window_start_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    window_end_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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























  <FormField label="Feature" labelFor="feature">
      <Field name="feature" id="feature" component="select">
      
        <option value="career_coach">career_coach</option>
      
        <option value="ai_tutor">ai_tutor</option>
      
        <option value="roadblock_bot">roadblock_bot</option>
      
      </Field>
  </FormField>



















    <FormField
        label="LimitCount"
    >
        <Field
            type="number"
            name="limit_count"
            placeholder="LimitCount"
        />
    </FormField>



























    <FormField
        label="UsedCount"
    >
        <Field
            type="number"
            name="used_count"
            placeholder="UsedCount"
        />
    </FormField>































  <FormField
      label="WindowStartAt"
  >
      <Field
          type="datetime-local"
          name="window_start_at"
          placeholder="WindowStartAt"
      />
  </FormField>



























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

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

export default Usage_limitsNew
