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

const initialValues = {
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reward_type: 'yux',
    
    
    
    
    
    
    
    
    
    
    day_index: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    yux_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    box: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    cosmetic: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    title_item: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    badge: '',
    
    
    
    
    
    
    
    
    
    
    is_enabled: false,
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/daily_rewards/daily_rewards-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="DailyRewardName"
  >
      <Field
          name="name"
          placeholder="DailyRewardName"
      />
  </FormField>









































  <FormField label="RewardType" labelFor="reward_type">
      <Field name="reward_type" id="reward_type" component="select">
      
        <option value="yux">yux</option>
      
        <option value="box">box</option>
      
        <option value="cosmetic">cosmetic</option>
      
        <option value="title">title</option>
      
        <option value="badge">badge</option>
      
      </Field>
  </FormField>



















    <FormField
        label="DayIndex"
    >
        <Field
            type="number"
            name="day_index"
            placeholder="DayIndex"
        />
    </FormField>



























    <FormField
        label="YUXAmount"
    >
        <Field
            type="number"
            name="yux_amount"
            placeholder="YUXAmount"
        />
    </FormField>







































  <FormField label="Box" labelFor="box">
      <Field name="box" id="box" component={SelectField} options={[]} itemRef={'boxes'}></Field>
  </FormField>



























  <FormField label="Cosmetic" labelFor="cosmetic">
      <Field name="cosmetic" id="cosmetic" component={SelectField} options={[]} itemRef={'cosmetics'}></Field>
  </FormField>



























  <FormField label="Title" labelFor="title_item">
      <Field name="title_item" id="title_item" component={SelectField} options={[]} itemRef={'titles'}></Field>
  </FormField>



























  <FormField label="Badge" labelFor="badge">
      <Field name="badge" id="badge" component={SelectField} options={[]} itemRef={'badges'}></Field>
  </FormField>

























  <FormField label='IsEnabled' labelFor='is_enabled'>
      <Field
          name='is_enabled'
          id='is_enabled'
          component={SwitchField}
      ></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('/daily_rewards/daily_rewards-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Daily_rewardsNew
