﻿import React, { Component, memo, Fragment } from 'react';
import { withRouter } from "react-router-dom";
import Botones from '../../../components/UI/botonera/headerBotones.js';
import CajaTexto from '../../../components/UI/cajaTexto/cajaTexto.jsx';
import CajaTextoBusqueda from '../../../components/UI/cajaTexto/cajaTextoBusqueda.jsx';
import ComboBox from '../../../components/UI/comboBox/combobox.jsx';
import TextArea from '../../../components/UI/textArea/textArea.jsx';
import CajaTextoNumero from '../../../components/UI/cajaTexto/cajaTextoNumero.jsx';
import CheckBox from '../../../components/UI/checkBox/checkBox.jsx';
import DatePicker from '../../../components/UI/dataPicker/dataPicker.jsx';
import Config from '../../../components/Util/constantes.js';

function general(props) {
    //console.log(JSON.stringify(props.Datos.Preliquidar.attributes));
    return (
        <Fragment>
            <div className="col-md-12">
                <div className="content">
                    <div className="content-box">
                        <div className="row">
                            <div className="col-sm-12 col-md-12" >
                                <CajaTextoBusqueda col="4" id="Empleado" type="text" label={props.Datos.Empleado.attributes.label} value={props.Datos.Empleado.value} attributes={props.Datos.Empleado.attributes} onChangeInput={props.onChangeInputEmp} onClick={() => props.handleModalEmp()} onKeyPress={props.onKeyPressEmp} onBlur={props.onBlurEmpl} />
                                <CajaTexto col="6" id="EmpleadoNombre" type="text" label={props.Datos.EmpleadoNombre.attributes.label} value={props.Datos.EmpleadoNombre.value} attributes={props.Datos.EmpleadoNombre.attributes} onChangeInput={() => { }} />
                                <CheckBox id='Preliquidar' col="2" attributes={props.Datos.Preliquidar.attributes} value={props.Datos.Preliquidar.value} label={props.Datos.Preliquidar.attributes.label} onChange={props.handleCheckBox} />
                            </div>                         
                            <div className="col-sm-12 col-md-12" >
                                <ComboBox id="cmbCtaBancaria" col="6" attributes={props.Datos.CtaBancaria.attributes} value={props.selectedOptionCta} label={props.Datos.CtaBancaria.attributes.label} datos={props.listaCtaBancaria} onChange={props.onhandleSelectedOptionCta} />
                                <ComboBox id="cmbTipoLiquidacion" col="6" attributes={props.Datos.TipoLiq.attributes} value={props.selectedOptionTipoLiq} label={props.Datos.TipoLiq.attributes.label} datos={props.listaTipoLiq} onChange={props.onhandleSelectedOptionTipoLiq} />
                            </div>
                            <div className="col-sm-12 col-md-12" >
                                <DatePicker id="FechaIngreso" col="6" value={props.Datos.FechaIngreso.value} attributes={props.Datos.FechaIngreso.attributes} label={props.Datos.FechaIngreso.attributes.label} formatDate={Config.dateformat} handleChange={props.onhandleChangeDate} />
                                <CajaTexto col="6" id="DiaLaborados" type="text" label={props.Datos.DiaLaborados.attributes.label} value={props.onFormato(props.Datos.DiaLaborados.value)} attributes={props.Datos.DiaLaborados.attributes} onChangeInput={() => { }} align='right'/>
                            </div>
                            <div className="col-sm-12 col-md-12" >
                                <CajaTexto col="6" id="MesesLabordos" type="text" label={props.Datos.MesesLabordos.attributes.label} value={props.onFormato(props.Datos.MesesLabordos.value)} attributes={props.Datos.MesesLabordos.attributes} onChangeInput={() => { }} align='right'/>
                                <CajaTexto col="6" id="AnosLaborados" type="text" label={props.Datos.AnosLaborados.attributes.label} value={props.onFormato(props.Datos.AnosLaborados.value)} attributes={props.Datos.AnosLaborados.attributes} onChangeInput={() => { }} align='right'/>
                            </div>

                            <div className="col-sm-12 col-md-12" >
                                <DatePicker id="FechaSalida" col="6" value={props.Datos.FechaSalida.value} attributes={props.Datos.FechaSalida.attributes} label={props.Datos.FechaSalida.attributes.label} formatDate={Config.dateformat} handleChange={props.onhandleChangeDate} minDate={props.Datos.FechaSalida.attributes.minDate} maxDate={props.Datos.FechaSalida.attributes.maxDate}/>
                                <DatePicker id="FechaCese" col="6" value={props.Datos.FechaCese.value} attributes={props.Datos.FechaCese.attributes} label={props.Datos.FechaCese.attributes.label} formatDate={Config.dateformat} handleChange={props.onhandleChangeDate} />
                            </div>
                            <div className="col-sm-12 col-md-12" >
                                <CajaTextoNumero col="6" id="TipoCambio" type="number" label={props.Datos.TipoCambio.attributes.label} value={props.Datos.TipoCambio.value} attributes={props.Datos.TipoCambio.attributes}  onChangeInput={props.onChangeInputDecimal} onBlur={props.onBlurTipoCambio} onFocus={props.onChangeEditar} onFormatear={props.onFormato}/>
                                <CheckBox id='ListaNegra' col="6" attributes={props.Datos.ListaNegra.attributes} value={props.Datos.ListaNegra.value} label={props.Datos.ListaNegra.attributes.label} onChange={props.handleCheckBox} />
                            </div>
                            <div className="col-sm-12 col-md-12" >
                                <CajaTextoBusqueda col="6" id="Beneficiario_Liquidacion" type="text" label={props.Datos.Beneficiario_Liquidacion.attributes.label} value={props.Datos.Beneficiario_Liquidacion.value} attributes={props.Datos.Beneficiario_Liquidacion.attributes} onChangeInput={()=>{}} onClick={() => props.handleModalBen('LIQ')} onKeyPress={()=>{}} onBlur={()=>{}} />
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </Fragment>
    );
};
export default (withRouter(memo(general)));