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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    team: '',
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    as_a: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    i_want: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    so_that: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    template_type: 'feature_story',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    board_column: 'backlog',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    priority: 'low',
    
    
    
    
    
    
    
    
    
    
    quality_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    quality_suggestions: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    tags_csv: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    assignee: '',
    
    
    
    
    
    
    
    
    
    created_at_time: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    updated_at_time: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









  <FormField
      label="Title"
  >
      <Field
          name="title"
          placeholder="Title"
      />
  </FormField>



























  <FormField
      label="Asa"
  >
      <Field
          name="as_a"
          placeholder="Asa"
      />
  </FormField>



























  <FormField
      label="Iwant"
  >
      <Field
          name="i_want"
          placeholder="Iwant"
      />
  </FormField>



























  <FormField
      label="Sothat"
  >
      <Field
          name="so_that"
          placeholder="Sothat"
      />
  </FormField>









































  <FormField label="SmartTemplate" labelFor="template_type">
      <Field name="template_type" id="template_type" component="select">
      
        <option value="feature_story">feature_story</option>
      
        <option value="bug_fix">bug_fix</option>
      
        <option value="tech_debt">tech_debt</option>
      
        <option value="spike">spike</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="ready">ready</option>
      
        <option value="in_progress">in_progress</option>
      
        <option value="done">done</option>
      
      </Field>
  </FormField>



























  <FormField label="BoardColumn" labelFor="board_column">
      <Field name="board_column" id="board_column" component="select">
      
        <option value="backlog">backlog</option>
      
        <option value="todo">todo</option>
      
        <option value="in_progress">in_progress</option>
      
        <option value="review">review</option>
      
        <option value="done">done</option>
      
      </Field>
  </FormField>



























  <FormField label="Priority" labelFor="priority">
      <Field name="priority" id="priority" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
        <option value="critical">critical</option>
      
      </Field>
  </FormField>



















    <FormField
        label="QualityScore"
    >
        <Field
            type="number"
            name="quality_score"
            placeholder="QualityScore"
        />
    </FormField>























    <FormField label="QualitySuggestions" hasTextareaHeight>
        <Field name="quality_suggestions" as="textarea" placeholder="QualitySuggestions" />
    </FormField>

























  <FormField
      label="Tags(CSV)"
  >
      <Field
          name="tags_csv"
          placeholder="Tags(CSV)"
      />
  </FormField>













































  <FormField label="Assignee" labelFor="assignee">
      <Field name="assignee" id="assignee" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>



















  <FormField
      label="CreatedAt"
  >
      <Field
          type="datetime-local"
          name="created_at_time"
          placeholder="CreatedAt"
      />
  </FormField>



























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

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

export default User_storiesNew
