# \<p:schedule> con filtros autocomplete

![](/files/-LnItm1H2AsQn5jIwClO)

Pagina

```markup
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<ui:composition template="/layout/template.xhtml" 
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:b="http://bootsfaces.net/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:jmoordbjsf="http://jmoordbjsf.com/taglib"
                xmlns:e="http://xmlns.jcp.org/jsf/composite/extensions">
    <ui:define name="content">


        <style>
            .thumbnail { max-width: 100%; }
            img.thumbnail:hover, img.thumbnail:focus {
                border: 1px solid;
                border-color: #428BCA;
            } 

        </style>

        <jmoordbjsf:cssschedule/>  
        <jmoordbjsf:jsschedule/>

        <b:form id="form"  prependId="false"  rendered="#{p:ifGranted('SECRETARIO ADMINISTRATIVO')}" onkeypress="if (event.keyCode == 13) {
                    return false;
                }">

            <b:growl  id="msgs"/>

            <b:panel collapsible="false" title="#{msg['titlelist.calendariosolicitudes']}" id="content"   look="primary" > 
                <!--<b:panelGrid colSpans="2,10" size="xs">--> 
                <b:row>
                    <b:column span="1">
                        <p:outputLabel value="#{msg['field.idestatus']}"/>
                    </b:column>

                    <b:column span="4">


                        <jmoordbjsf:autocomplete converter="#{estatusConverter}"
                                                 dropdown="true"
                                                 minQueryLength="0"
                                                 completeMethod="#{secretarioAdministrativoController.estatusServices.complete}"
                                                 labeltip1="#{msg['field.estatus']} #{p.idestatus}" 
                                                 listener="#{secretarioAdministrativoController.handleAutocompleteEstatusForSchedule}"
                                                 value="#{secretarioAdministrativoController.estatusSearch}"
                                                 itemLabel=" #{p.idestatus}"
                                                 field="idestatus"
                                                 update=" :form:schedule"/>

                    </b:column>

                    <b:column span="1">
                        <p:outputLabel value="#{msg['field.tipo']}"/>

                    </b:column>

                    <b:column span="4">
                        <jmoordbjsf:autocomplete converter="#{tiposolicitudConverter}"
                                                 completeMethod="#{secretarioAdministrativoController.tiposolicitudServices.complete}" 
                                                 labeltip1="#{msg['field.tiposolicitud']} #{p.idtiposolicitud}"  
                                                 listener="#{secretarioAdministrativoController.handleAutocompleteTipoSolicitudForSchedule}"
                                                 value="#{secretarioAdministrativoController.tiposolicitudSearch}"
                                                 itemLabel=" #{p.idtiposolicitud}"
                                                 dropdown="true"
                                                 minQueryLength="0"
                                                 field="idtiposolicitud"
                                                 update=" :form:schedule"/>
                    </b:column>

                    <b:column span="1"> 
                        <p:commandButton value="#{app['button.print']}" type="button" icon="pi pi-print" style="display:block;margin-bottom: 20px">
                            <p:printer target="schedule" />
                        </p:commandButton>
                    </b:column>
                </b:row>
             
                <b:row>
                    <b:column span="1"> <p:outputLabel value="#{msg['field.solicitadopor']}"/></b:column>

                    <b:column span="4">
                    <jmoordbjsf:autocomplete converter="#{usuarioConverter}"
                                             completeMethod="#{secretarioAdministrativoController.usuarioServices.complete}"
                                             labeltip1="#{msg['field.username']} #{p.username}"
                                             labeltip2="#{msg['field.nombre']} #{p.nombre}"   
                                             listener="#{secretarioAdministrativoController.handleSelectPorSolicitado}"
                                             value="#{secretarioAdministrativoController.solicita}"
                                             itemLabel=" #{p.nombre}"
                                             field="nombre"
                                             dropdown="true"
                                             minQueryLength="0"
                                             update=":form:schedule"
                                             size="25"
                                             />
</b:column>
                    <b:column span="2"><p:outputLabel value="#{msg['field.responsable']}"/></b:column>

                    <b:column span="4">
                        <jmoordbjsf:autocomplete converter="#{usuarioConverter}"
                                                 completeMethod="#{secretarioAdministrativoController.usuarioServices.complete}"
                                                 labeltip1="#{msg['field.username']} #{p.username}"
                                                 labeltip2="#{msg['field.nombre']} #{p.nombre}"   
                                                 listener="#{secretarioAdministrativoController.handleSelectPorResponsable}"
                                                 value="#{secretarioAdministrativoController.responsable}"
                                                 itemLabel=" #{p.nombre}"
                                                 field="nombre"
                                                 dropdown="true"
                                                 minQueryLength="0"
                                                 update=":form:schedule"
                                                 size="25"
                                                 />
                    </b:column>

                </b:row>

                <p:schedule id="schedule"  
                            rightHeaderTemplate="month,agendaWeek,agendaDay,basicDay"
                            value="#{secretarioAdministrativoController.eventModel}"
                            widgetVar="myschedule" timeZone="GMT-5" locale="es">
                    <p:ajax  event="eventSelect"  listener="#{secretarioAdministrativoController.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show();" />

                </p:schedule>

                <b:panel collapsible="false" id="colores" autoUpdate="true" >
                    <b:row >

                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.solicitado']} #{secretarioAdministrativoController.totalSolicitado}" style="color:orange"/>
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.aprobado']} #{secretarioAdministrativoController.totalAprobado}" style="color:green"/>
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.rechazadocancelado']} #{secretarioAdministrativoController.totalRechazadoCancelado}" style="color:red"/>
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.viaje']} #{secretarioAdministrativoController.totalViajes}" style="color:blue"/>

                        </b:column>

                    </b:row>
                    <b:row >
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.vistobueno']}" />
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.pendiente']} #{secretarioAdministrativoController.totalPendienteVistoBueno}" style="color:orange"/>
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.aprobado']} #{secretarioAdministrativoController.totalAprobadoVistoBueno}" style="color:green"/>
                        </b:column>
                        <b:column span="3">
                            <p:outputLabel value="#{msg['label.noaprobado']} #{secretarioAdministrativoController.totalNoAprobadoVistoBueno}" style="color:red"/>
                        </b:column>

                    </b:row>




                </b:panel>
            </b:panel>




            <p:dialog widgetVar="eventDialog" header="#{msg['dialogo.solicitud']}" 
                      width="650" height="450"
                      styleClass="customDialog"

                      responsive="true"

                      showEffect="clip" hideEffect="clip">
                <b:panelGrid id="eventDetails" colSpans="2,10" size="xs" > 
                    <p:outputLabel  value="#{msg['field.idsolicitud']}" />
                    <p:outputLabel  value="#{secretarioAdministrativoController.solicitud.idsolicitud}" id="idsolicitud"   />

                    <p:outputLabel  value="#{msg['field.solicitadopor']}" />
                    <p:outputLabel  value="#{secretarioAdministrativoController.solicitud.usuario.get(0).nombre}" id="solicitadopor"   />

                    <p:outputLabel  value="#{msg['field.responsable']}" />
                    <p:outputLabel  value="#{secretarioAdministrativoController.solicitud.usuario.get(1).nombre}" id="responsable"   />

                    <p:outputLabel value="#{msg['field.idestatus']}" />
                    <p:outputLabel value="#{secretarioAdministrativoController.solicitud.estatus.idestatus}" />



                    <p:outputLabel value="#{msg['field.vistobueno']}" />
                    <p:outputLabel value="#{secretarioAdministrativoController.columnNameVistoBueno()}"  />


                    <p:outputLabel  value="#{msg['field.fechapartida']}" />
                    <p:fieldset >
                        <p:calendar  disabled="true"  size="8"                                  
                                     style="background-color: grey;"
                                     pattern="dd/MM/yyyy" value="#{secretarioAdministrativoController.solicitud.fechahorapartida}"  />

                        <p:outputLabel  value="#{msg['field.horapartida']}" />        
                        <p:calendar  disabled="true"    
                                     size="8" 
                                     pattern="HH:mm:ss a" value="#{secretarioAdministrativoController.solicitud.fechahorapartida}"  />


                    </p:fieldset>


                    <p:outputLabel  value="#{msg['field.lugarpartida']}" />

                    <p:outputLabel value="#{secretarioAdministrativoController.solicitud.lugarpartida}" id="lugarpartida"   />
                    <p:outputLabel  value="#{msg['field.lugarllegada']}" />

                    <p:outputLabel value="#{secretarioAdministrativoController.solicitud.lugarllegada}" id="lugarllegada"   />


                    <p:outputLabel  value="#{msg['field.fecharegreso']}" />
                    <p:fieldset >

                        <p:calendar  disabled="true"  size="8"                                  
                                     style="background-color: grey;"
                                     pattern="dd/MM/yyyy" value="#{secretarioAdministrativoController.solicitud.fechahoraregreso}"  />



                        <p:outputLabel  value="#{msg['field.horaregreso']}" />
                        <p:calendar  disabled="true"    
                                     size="8" 
                                     pattern="HH:mm:ss a" value="#{secretarioAdministrativoController.solicitud.fechahoraregreso}"  />


                    </p:fieldset>

                    <p:outputLabel  value="#{msg['field.numerodevehiculos']}" />
                    <p:outputLabel  value="#{secretarioAdministrativoController.solicitud.numerodevehiculos}" />
                    <p:outputLabel  value="#{msg['field.pasajeros']}" />
                    <p:outputLabel  value="#{secretarioAdministrativoController.solicitud.pasajeros}" />


                    <p:outputLabel  value="#{msg['field.numerogrupos']}" />
                    <p:chips id="numerogrupo" disabled="true" value="#{secretarioAdministrativoController.solicitud.numerogrupo}" title="#{msg['field.chips']}" />
                    <p:outputLabel value="#{msg['field.idtipogira']}"/>
                    <jmoordbjsf:autocomplete converter="#{tipogiraConverter}"
                                             completeMethod="#{secretarioAdministrativoController.tipogiraServices.complete}" 
                                             labeltip1="#{msg['field.tipogira']} #{p.idtipogira}"  
                                             listener="#{secretarioAdministrativoController.handleSelect}"
                                             value="#{secretarioAdministrativoController.solicitud.tipogira}"
                                             itemLabel=" #{p.idtipogira}"
                                             field="idtipogira"
                                             dropdown="true"
                                             fromstart="true"
                                             minQueryLength="0"
                                             disabled="true"
                                             update=""/>

                    <p:outputLabel  value="#{msg['field.objetivo']}" />
                    <b:inputTextarea disabled="true" rows="2" span="8"  value="#{secretarioAdministrativoController.solicitud.objetivo}" id="objetivo"   />



                    <p:outputLabel  value="#{msg['field.lugares']}" />
                    <p:chips disabled="true" value="#{secretarioAdministrativoController.solicitud.lugares}" id="lugares"  title="#{msg['field.chips']}" />


                </b:panelGrid>
            </p:dialog>
        </b:form>

        <jmoordbjsf:denegado renderedcondition="#{!p:ifGranted('SECRETARIO ADMINISTRATIVO')}"/>
    </ui:define>
</ui:composition>

```

CONTROLLER

Evento al seleccionar un autocomplete

```java
 public String handleAutocompleteEstatusForSchedule(SelectEvent event) {
        try {
            Document doc = new Document("activo","si").append("estatus.idestatus", estatusSearch.getIdestatus());
            cargarSchedule(doc);
            
        } catch (Exception e) {
            errorServices.errorMessage(nameOfClass(), nameOfMethod(), e.getLocalizedMessage());
        }
        return "";
    }
```

cargarSchedule

```java
 public void cargarSchedule(Document...doc) {
        try {
              Document docSearch= new Document();
                if (doc.length != 0) {
                docSearch = doc[0];

            } else {
                docSearch= new Document("activo","si");
            }
            totalAprobado = 0;
            totalSolicitado = 0;
            totalRechazadoCancelado = 0;
            totalViajes = 0;

            totalPendienteVistoBueno = 0;
            totalAprobadoVistoBueno = 0;
            totalNoAprobadoVistoBueno = 0;

            Usuario jmoordb_user = (Usuario) JmoordbContext.get("jmoordb_user");
            String descripcion = jmoordb_user.getUnidad().getIdunidad();
            List<Solicitud> list = new ArrayList<>();

       
       
//                list = solicitudRepository.findBy("activo","si", new Document("idsolicitud", -1));
                list = solicitudRepository.findBy(docSearch, new Document("idsolicitud", -1));

            eventModel = new DefaultScheduleModel();
            if (!list.isEmpty()) {
                list.forEach((a) -> {
                    String nameOfCarrera = "";
                    String nameOfViajes = "";
                    String viajest = "";
                    nameOfCarrera = a.getCarrera().stream().map((c) -> c.getDescripcion() + "").reduce(nameOfCarrera, String::concat);
                    String tipoVehiculo = "{ ";
                    tipoVehiculo = a.getTipovehiculo().stream().map((t) -> t.getIdtipovehiculo() + " ").reduce(tipoVehiculo, String::concat);
                    tipoVehiculo += " }";
                    String tema = "schedule-blue";
                    switch (a.getEstatus().getIdestatus()) {
                        case "SOLICITADO":
                            totalSolicitado++;
                            tema = "schedule-orange";
                            break;
                        case "APROBADO":
                            totalAprobado++;
                            viajest = "{";
                            viajest = a.getViaje().stream().map((t) -> t.getIdviaje() + " ").reduce(viajest, String::concat);
                            viajest = "}";

                            tema = "schedule-green";
                            break;
                        case "RECHAZADO":
                            totalRechazadoCancelado++;
                            tema = "schedule-red";
                            break;
                        case "CANCELADO":
                            totalRechazadoCancelado++;
                            tema = "schedule-red";
                            break;
                    }

                    switch (a.getVistoBueno().getAprobado().trim()) {
                        case "no":
                            totalNoAprobadoVistoBueno++;
                            break;
                        case "si":
                            totalAprobadoVistoBueno++;
                            break;
                        case "pe":
                            totalPendienteVistoBueno++;
                            break;
                    }

                    String texto = nameOfCarrera + " " + viajest;
//                    eventModel.addEvent(
                    //                            new DefaultScheduleEvent("# " + a.getIdsolicitud() + " Mision:" + a.getMision() + " Responsable: " + a.getUsuario().get(1).getNombre() + " " + a.getEstatus().getIdestatus(), a.getFechahorapartida(), a.getFechahoraregreso())
                    //                    );
                    eventModel
                            .addEvent(
                                    new DefaultScheduleEvent("# " + a.getIdsolicitud() + " : (" + a.getEstatus().getIdestatus().substring(0, 1) + ")  " + "  {" + a.getVistoBueno().getAprobado().substring(0, 1).toUpperCase() + "}  " + a.getObjetivo() + " "
                                            + texto,
                                            a.getFechahorapartida(), a.getFechahoraregreso(), tema)
                            //                            new DefaultScheduleEvent("# " + a.getIdsolicitud() + " : (" + a.getEstatus().getIdestatus().substring(0, 1) + ") Mision: " + a.getObjetivo()+ " Responsable: " + a.getUsuario().get(1).getNombre() + " "
                            //                                    + texto,
                            //                                    a.getFechahorapartida(), a.getFechahoraregreso(), tema)
                            //                  
                            );
                });
            }

        } catch (Exception e) {
            errorServices.errorMessage(nameOfClass(), nameOfMethod(), e.getLocalizedMessage());
        }
    }// </editor-fold>

```

Init

```java
 @PostConstruct
    public void init() {
        try {

            eventModel = new DefaultScheduleModel();
            // eventModel.addEvent(new DefaultScheduleEvent("Champions League Match", DateUtil.fechaHoraActual(), DateUtil.fechaHoraActual()));

            diasList = new ArrayList<String>();
            diasList.add("Dia/ Dias Consecutivo");
            diasList.add("Lunes");
            diasList.add("Martes");
            diasList.add("Miercoles");
            diasList.add("Jueves");
            diasList.add("Viernes");
            diasList.add("Sabado");
            diasList.add("Domingo");

            //autoincrementablebRepository.setDatabase("transporte");
            /*
            configurar el ambiente del contsolicitudler
             */
            HashMap parameters = new HashMap();
            Usuario jmoordb_user = (Usuario) JmoordbContext.get("jmoordb_user");
            //    parameters.put("P_EMPRESA", jmoordb_user.getEmpresa().getDescripcion());

            JmoordbControllerEnvironment jmc = new JmoordbControllerEnvironment.Builder()
                    .withController(this)
                    .withRepository(solicitudRepository)
                    .withEntity(solicitud)
                    .withService(solicitudServices)
                    .withNameFieldOfPage("page")
                    .withNameFieldOfRowPage("rowPage")
                    .withTypeKey("primary")
                    .withSearchLowerCase(false)
                    .withPathReportDetail("/resources/reportes/secretarioadministrativo/details.jasper")
                    .withPathReportAll("/resources/reportes/secretarioadministrativo/all.jasper")
                    .withparameters(parameters)
                    .withResetInSave(false)
                    .build();

            start();
            sugerenciaList = sugerenciaRepository.findBy("activo", "si");
            sugerenciaDataModel = new SugerenciaDataModel(sugerenciaList);
            cargarSchedule();

            String action = "gonew";
            if (JmoordbContext.get("secretarioadministrativo") != null) {
                action = JmoordbContext.get("secretarioadministrativo").toString();
            }

            if (action == null || action.equals("gonew") || action.equals("new") || action.equals("golist")) {
                inicializar();

            }
            if (action.equals("view")) {
                view();
            }

        } catch (Exception e) {
            errorServices.errorMessage(nameOfClass(), nameOfMethod(), e.getLocalizedMessage());
        }
    }// </editor-fold>

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://avbravo-2.gitbook.io/trucosjakartaee/overview/primefaces/schedule/less-than-p-schedule-greater-than-con-filtros-autocomplete.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
