content: import React from 'react'
  import DatePickerComponent from '../datepicker'
  import DatePickerComponent2 from '../datepicker/index2'
  import DatePickerComponent3 from '../datepicker/index3'
  import StatusField, { FieldComponent } from './'
  import { required, requiredInt } from '../validation'
  import moment from 'moment'
  
  const set = (type, beginDate, setValue) => {
  
      let date = moment(beginDate)
  
      switch (type) {
          case "YEAR":
              date.add(1, 'years')
              break;
          case "MONTHS":
              date.add(6, 'months')
              break;
          default:
              break;
      }
  
      setValue('end_date', date.subtract(1, 'days').format('YYYY-MM-DD'))
  
  }
  
  const setDiff = (diff, setValue) => {
      setValue('diff', diff)
  }
  
  export const getFields = (status, beginDate, setValue, diff) => {
      if(status == 2){
          return (
              <div>
                  <StatusField divclass="col-md-4" label="Дата начала" name="begin_date" component={DatePickerComponent3} type="input" validate={required}/>
                  <div className="col-md-4">
                      <div className="form-group text-center">
  						<label>&nbsp;</label>
                          <div className="btn-group">
                              <button type="button" onClick={() => set("MONTHS", beginDate, setValue)} className="btn btn-info date-modifier">На полгода</button>
                              <button type="button" onClick={() => set("YEAR", beginDate, setValue)} className="btn btn-primary date-modifier">На год</button>
                          </div>
  					</div>
  				</div>
                  <StatusField divclass="col-md-4" label="Дата окончания" name="end_date" component={FieldComponent} type="input" validate={required} disabled/>
                  <StatusField divclass="col-md-12" label="Телефон" name="phone" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-6" label="Премия" name="premium" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-6" label="Цена" name="price" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-12" label="Комментарий" name="comment" component={FieldComponent} type="input"/>
              </div>
          )
      }
      else if(status == 3){
          return (
              <div>
                  <StatusField divclass="col-md-4" label="Дата" name="date" component={DatePickerComponent2} type="input"  validate={required}/>
                  <StatusField divclass="col-md-4" label="Час" name="hour" component="select" options={['09', '10', '11', '12', '13', '14', '15', '16', '17', '18']} />
                  <StatusField divclass="col-md-4" label="Минута" name="minute" component="select" options={['00', '10', '20', '30', '40', '50']} />
                  <StatusField divclass="col-md-12" label="Клиент" name="client" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-12" label="Телефон" name="phone" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-12" label="Описание" name="text" component={FieldComponent} type="textarea" validate={required}/>
  
                  <StatusField divclass="col-md-12" label="Вероятность продажи" name="diff" component={FieldComponent} type="hidden" validate={requiredInt}/>
                  <div className="form-group col-md-12">
                      <div className="btn-group btn-group-justified" data-toggle="buttons">
                          <label className={`btn btn-default ${diff < 1 ? 'active' : ''}`} onClick={() => setDiff(0, setValue)}>
                              <img src="/img/Smile-1.png" width="40%" />
                              <p style={{ marginTop : '10px' }}>Возможно купит</p>
                          </label>
                          <label className={`btn btn-default ${diff > 0 ? 'active' : ''}`} onClick={() => setDiff(1, setValue)}>
                              <img src="/img/Smile-2.png" width="40%" />
                              <p style={{ marginTop : '10px' }}>Точно купит</p>
                          </label>
                      </div>
                  </div>
              </div>
          )
      }
      else if(status == 4){
          return (
              <div>
                  <StatusField divclass="col-md-4" label="Дата" name="date" component={DatePickerComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-4" label="Час" name="hour" component="select" options={['09', '10', '11', '12', '13', '14', '15', '16', '17', '18']} />
                  <StatusField divclass="col-md-4" label="Минута" name="minute" component="select" options={['00', '10', '20', '30', '40', '50']} />
                  <StatusField divclass="col-md-12" label="Клиент" name="client" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-12" label="Телефон" name="phone" component={FieldComponent} type="input" validate={required}/>
                  <StatusField divclass="col-md-12" label="Описание" name="text" component={FieldComponent} type="textarea" validate={required}/>
              </div>
          )
      }
      else{
          return(
              <StatusField divclass="col-md-12" label="Комментарий" name="comment" component={FieldComponent} type="input"/>
          )
      }
  
  }
  