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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    campaign: '',
    
    
    
    
    project_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    channel: 'meta',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    brand_voice_profile: '',
    
    
    
    
    
    
    creative_brief: '',
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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









  <FormField
      label="ProjectName"
  >
      <Field
          name="project_name"
          placeholder="ProjectName"
      />
  </FormField>









































  <FormField label="Channel" labelFor="channel">
      <Field name="channel" id="channel" component="select">
      
        <option value="meta">meta</option>
      
        <option value="google_search">google_search</option>
      
        <option value="google_display">google_display</option>
      
        <option value="tiktok">tiktok</option>
      
        <option value="linkedin">linkedin</option>
      
        <option value="youtube">youtube</option>
      
        <option value="email">email</option>
      
        <option value="landing_page">landing_page</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="in_review">in_review</option>
      
        <option value="approved">approved</option>
      
        <option value="scheduled">scheduled</option>
      
        <option value="live">live</option>
      
        <option value="paused">paused</option>
      
        <option value="completed">completed</option>
      
      </Field>
  </FormField>































  <FormField label="BrandVoiceProfile" labelFor="brand_voice_profile">
      <Field name="brand_voice_profile" id="brand_voice_profile" component={SelectField} options={[]} itemRef={'brand_voice_profiles'}></Field>
  </FormField>













      <FormField label='CreativeBrief' hasTextareaHeight>
          <Field
              name='creative_brief'
              id='creative_brief'
              component={RichTextField}
          ></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('/ad_projects/ad_projects-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ad_projectsNew
