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

const initialValues = {
    
    
    platform_fee_percent: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    auto_release_days: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    max_revision_count: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    min_review_length: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    new_user_verify_email: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tutor_two_factor_required: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    maintenance_mode: false,
    
    
    
    
    
    
    
    
    
    
    maintenance_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    announcement_banner_enabled: false,
    
    
    
    
    
    
    
    
    
    
    announcement_banner_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    jitsi_sdk_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    jitsi_sdk_secret: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























    <FormField
        label="AutoReleaseDays"
    >
        <Field
            type="number"
            name="auto_release_days"
            placeholder="AutoReleaseDays"
        />
    </FormField>



























    <FormField
        label="MaxRevisionCount"
    >
        <Field
            type="number"
            name="max_revision_count"
            placeholder="MaxRevisionCount"
        />
    </FormField>



























    <FormField
        label="MinReviewLength"
    >
        <Field
            type="number"
            name="min_review_length"
            placeholder="MinReviewLength"
        />
    </FormField>





































  <FormField label='VerifyEmailForNewUsers' labelFor='new_user_verify_email'>
      <Field
          name='new_user_verify_email'
          id='new_user_verify_email'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='Tutor2FARequired' labelFor='tutor_two_factor_required'>
      <Field
          name='tutor_two_factor_required'
          id='tutor_two_factor_required'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='MaintenanceMode' labelFor='maintenance_mode'>
      <Field
          name='maintenance_mode'
          id='maintenance_mode'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="MaintenanceMessage" hasTextareaHeight>
        <Field name="maintenance_message" as="textarea" placeholder="MaintenanceMessage" />
    </FormField>









































  <FormField label='AnnouncementBannerEnabled' labelFor='announcement_banner_enabled'>
      <Field
          name='announcement_banner_enabled'
          id='announcement_banner_enabled'
          component={SwitchField}
      ></Field>
  </FormField>













    <FormField label="AnnouncementBannerText" hasTextareaHeight>
        <Field name="announcement_banner_text" as="textarea" placeholder="AnnouncementBannerText" />
    </FormField>

























  <FormField
      label="JitsiSDKKey"
  >
      <Field
          name="jitsi_sdk_key"
          placeholder="JitsiSDKKey"
      />
  </FormField>



























  <FormField
      label="JitsiSDKSecret"
  >
      <Field
          name="jitsi_sdk_secret"
          placeholder="JitsiSDKSecret"
      />
  </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('/platform_config/platform_config-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Platform_configNew
