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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    creator: '',
    
    
    
    
    slug: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    headline: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    thank_you_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    background_type: 'color',
    
    
    
    
    
    
    
    background_value: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    accent_color_hex: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    preset_amount_1: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    preset_amount_2: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    preset_amount_3: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    allow_custom_amount: false,
    
    
    
    
    
    
    
    
    
    
    
    
    minimum_amount: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tts_enabled: false,
    
    
    
    
    
    
    
    
    
    tts_voice: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    show_supporter_feed: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









  <FormField
      label="TipPageSlug"
  >
      <Field
          name="slug"
          placeholder="TipPageSlug"
      />
  </FormField>



























  <FormField
      label="Headline"
  >
      <Field
          name="headline"
          placeholder="Headline"
      />
  </FormField>































      <FormField label='ThankYouMessage' hasTextareaHeight>
          <Field
              name='thank_you_message'
              id='thank_you_message'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="BackgroundType" labelFor="background_type">
      <Field name="background_type" id="background_type" component="select">
      
        <option value="color">color</option>
      
        <option value="gradient">gradient</option>
      
        <option value="image">image</option>
      
        <option value="video">video</option>
      
      </Field>
  </FormField>













  <FormField
      label="BackgroundValue"
  >
      <Field
          name="background_value"
          placeholder="BackgroundValue"
      />
  </FormField>



























  <FormField
      label="AccentColorHex"
  >
      <Field
          name="accent_color_hex"
          placeholder="AccentColorHex"
      />
  </FormField>

































    <FormField
        label="PresetAmount1"
    >
        <Field
            type="number"
            name="preset_amount_1"
            placeholder="PresetAmount1"
        />
    </FormField>



























    <FormField
        label="PresetAmount2"
    >
        <Field
            type="number"
            name="preset_amount_2"
            placeholder="PresetAmount2"
        />
    </FormField>



























    <FormField
        label="PresetAmount3"
    >
        <Field
            type="number"
            name="preset_amount_3"
            placeholder="PresetAmount3"
        />
    </FormField>





































  <FormField label='AllowCustomAmount' labelFor='allow_custom_amount'>
      <Field
          name='allow_custom_amount'
          id='allow_custom_amount'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="MinimumAmount"
    >
        <Field
            type="number"
            name="minimum_amount"
            placeholder="MinimumAmount"
        />
    </FormField>





































  <FormField label='TTSEnabled' labelFor='tts_enabled'>
      <Field
          name='tts_enabled'
          id='tts_enabled'
          component={SwitchField}
      ></Field>
  </FormField>











  <FormField
      label="TTSVoice"
  >
      <Field
          name="tts_voice"
          placeholder="TTSVoice"
      />
  </FormField>











































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

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

export default Tip_pagesNew
