import React, { memo } from 'react'
import { withRouter } from "react-router-dom";

import Botones from '../../components/UI/botonera/headerBotones';
import ComboBox from '../../components/UI/comboBox/combobox.jsx';
import TablaFiltro from '../../components/UI/tablaFiltro/tablaFiltroSort.jsx';
import { faReply, faSave, } from '@fortawesome/free-solid-svg-icons'


const cambioMasivoJefaturaInt = (props) => {

    const botones = [
        {
            name: "btnHomeC",
            clase: "btn btn-sm pull-right flipInX animated",
            evento: () => props.volverAtras(),
            leyenda: "",
            iclase: faReply,
            tooltip: "Volver"
        },
        {
            name: "btnAprobar",
            clase: "btn btn-sm pull-right flipInX animated",
            evento: () => {
                const apruebe = async () => {
                    await props.handleGuardar();
                }
                apruebe();
            },
            leyenda: "",
            iclase: faSave,
            tooltip: "Guardar"
        },
    ]

    return (
        <>
            <div className="col-md-12">
                <div className='row'>
                    <div className="col-md-6">
                        <h1>{props.Titulo}</h1>
                    </div>
                    <div className="col-md-6 text-right">
                        <div className="acciones">
                            <Botones
                                botones={botones}
                            />
                        </div>
                    </div>
                </div>
                <div className="content">
                    <div className="content-box box-primary">
                        <div className="row">
                            <div className="col-sm-12 col-md-12">
                                <ComboBox id="cmbarea" col="6" attributes={props.Datos.Area.attributes} value={props.selectedOptionArea} label={props.Datos.Area.attributes.label} datos={props.listaArea} onChange={props.onhandleSelectedOptionArea} />
                                <ComboBox id="cmbdepto" col="6" attributes={props.Datos.Depto.attributes} value={props.selectedOptionDepto} label={props.Datos.Depto.attributes.label} datos={props.listaDeptoFiltro} onChange={props.onhandleSelectedOptionDepto} />
                            </div>
                        </div>
                        <div className='row'>
                            <div className="col-md-12 text-center">
                                <h2>Cambiar a</h2>
                            </div>
                        </div>
                        <div className="row">
                            <div className="col-sm-12 col-md-12">
                                <ComboBox id="JefeDirecto" col="6" attributes={props.Datos.JefeDirecto.attributes} value={props.jefeDirecto1} label={props.Datos.JefeDirecto.attributes.label} datos={props.lstjefeDirecto1} onChange={props.onhandleSelectedOptionJefeDirect} />
                                <ComboBox id="JefeDirectoTo" col="6" attributes={props.Datos.JefeDirectoTo.attributes} value={props.jefeDirecto1To} label={props.Datos.JefeDirectoTo.attributes.label} datos={props.lstjefeDirecto1To} onChange={props.onhandleSelectedOptionJefeDirectTo} />
                            </div>
                        </div>
                        <div className="row">
                            <div className="col-sm-12 col-md-12">
                                <ComboBox id="AprobacionGestionJefatura" col="6" attributes={props.Datos.AprobacionGestionJefatura.attributes} value={props.reportaAprobadorGesJef1} label={props.Datos.AprobacionGestionJefatura.attributes.label} datos={props.lstReportaAprobadorGesJef1} onChange={props.onhandleSelectedOptionAprobacionGestionJefatura} />
                                <ComboBox id="AprobacionGestionJefaturaTo" col="6" attributes={props.Datos.AprobacionGestionJefaturaTo.attributes} value={props.reportaAprobadorGesJef1To} label={props.Datos.AprobacionGestionJefaturaTo.attributes.label} datos={props.lstReportaAprobadorGesJef1To} onChange={props.onhandleSelectedOptionAprobacionGestionJefaturaTo} />
                            </div>
                        </div>
                        <div className="row">
                            <div className="col-sm-12 col-md-12">
                                <ComboBox id="JefeDirecto2" col="6" attributes={props.Datos.JefeDirecto2.attributes} value={props.jefeDirecto2} label={props.Datos.JefeDirecto2.attributes.label} datos={props.lstjefeDirecto2} onChange={props.onhandleSelectedOptionJefeDirect2} />
                                <ComboBox id="JefeDirecto2To" col="6" attributes={props.Datos.JefeDirecto2To.attributes} value={props.jefeDirecto2To} label={props.Datos.JefeDirecto2To.attributes.label} datos={props.lstjefeDirecto2To} onChange={props.onhandleSelectedOptionJefeDirect2To} />
                            </div>
                        </div>
                        <div className="row">
                            <div className="col-sm-12 col-md-12">
                                <ComboBox id="AprobacionGestionJefatura2" col="6" attributes={props.Datos.AprobacionGestionJefatura2.attributes} value={props.reportaAprobadorGesJef2} label={props.Datos.AprobacionGestionJefatura2.attributes.label} datos={props.lstReportaAprobadorGesJef2} onChange={props.onhandleSelectedOptionAprobacionGestionJefatura2} />
                                <ComboBox id="AprobacionGestionJefatura2To" col="6" attributes={props.Datos.AprobacionGestionJefatura2To.attributes} value={props.reportaAprobadorGesJef2To} label={props.Datos.AprobacionGestionJefatura2To.attributes.label} datos={props.lstReportaAprobadorGesJef2To} onChange={props.onhandleSelectedOptionAprobacionGestionJefatura2To} />
                            </div>
                        </div>
                        <div className='row'>
                            <div className="col-sm-12 col-md-12 table table-responsive">
                                <TablaFiltro
                                    columnas={props.columnas}
                                    datos={props.lstEmpleados}
                                    keyField={'Empleado'}
                                    modo={props.cellEdit}
                                    rowEvents={props.rowEventsDist}
                                    ingresarDetalle={props.ingresarDetalle}
                                    eliminarDetalle={() => { }}
                                    busqueda={true}
                                    selectRow={props.selectRow}
                                    nombreCSV={props.nombreCSV}
                                />
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </>
    )
}

export default withRouter(memo(cambioMasivoJefaturaInt))

