Como fazer subselect/subquery usando Criteria

Alguém pode me ajudar a encontrar o problema dessa consulta :

CriteriaBuilder builder = em.getCriteriaBuilder();     CriteriaQuery<Solicitacao> query = builder.createQuery(Solicitacao.class);     Root<Solicitacao> root = query.from(Solicitacao.class);     Subquery<Long> subquery = query.subquery(Long.class);     Root<Envolvido> subRoot = subquery.from(Envolvido.class);     subquery.select(subRoot.get(Envolvido_.solicitacao.getName()));     subquery.where(builder.equal(subRoot.get(Envolvido_.isenIdp), isenIdp));     subquery.where(builder.equal(subRoot.get(Envolvido_.isenIds), isenIds));     query.where(builder.in(subquery));     TypedQuery typedQuery = em.createQuery(query);     return solicitacaoResourceBean.initializeAll(typedQuery.getResultList()); 

Eu estou tentando fazer um subselect, eu consegui criar esse subselect com SQL, ele seria assim :

SELECT * FROM SOLICITACAO S WHERE S.SLCTC_ID IN (SELECT E.SLCTC_ID FROM ENVOLVIDO E WHERE E.ENV_ISEN_IDP = 61 AND E.ENV_ISEN_IDS = 1); 

O Stack do erro :

    Hibernate:      select         solicitaca0_.slctc_id as slctc_id1_59_,         solicitaca0_.core_status as core_status2_59_,         solicitaca0_.log_id as log_id10_59_,         solicitaca0_.slctc_apelido as slctc_apelido3_59_,         solicitaca0_.slctc_codigo as slctc_codigo4_59_,         solicitaca0_.slctc_dt_criacao as slctc_dt_criacao5_59_,         solicitaca0_.end_id as end_id11_59_,         solicitaca0_.slctc_justificativa_finaliza as slctc_justificativ6_59_,         solicitaca0_.ntrinc_id as ntrinc_id12_59_,         solicitaca0_.slctc_prioridade as slctc_prioridade13_59_,         solicitaca0_.slctc_regulador as slctc_regulador14_59_,         solicitaca0_.slctnt_id as slctnt_id15_59_,         solicitaca0_.slctc_status as slctc_status7_59_,         solicitaca0_.slctc_tarm as slctc_tarm16_59_,         solicitaca0_.slctc_tipo as slctc_tipo8_59_,         solicitaca0_.slctc_tipo_regulacao as slctc_tipo_regulac9_59_,         solicitaca0_.slctc_unidade_origem as slctc_unidade_ori17_59_      from         Solicitacao solicitaca0_      where         (             select                 envolvido1_.slctc_id              from                 Envolvido envolvido1_,                 Solicitacao solicitaca2_              where                 envolvido1_.slctc_id=solicitaca2_.slctc_id                  and envolvido1_.env_isen_ids=?         ) in (          ) 17-abr-2019 18:31:38,612 TRACE [BasicBinder] binding parameter [1] as [INTEGER] - [null] 17-abr-2019 18:31:38,616 ERROR [ExceptionInterceptor] br.com.caelum.vraptor.interceptor.ApplicationLogicException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet br.com.caelum.vraptor.interceptor.ApplicationLogicException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet     at br.com.caelum.vraptor.observer.ExecuteMethod.throwIfNotValidationException(ExecuteMethod.java:109)     at br.com.caelum.vraptor.observer.ExecuteMethod.execute(ExecuteMethod.java:96)     at sun.reflect.GeneratedMethodAccessor130.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)     at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)     at org.jboss.weld.injection.MethodInvocationStrategy$  SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)     at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:299)     at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:277)     at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:255)     at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:269)     at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:258)     at org.jboss.weld.event.EventImpl.fire(EventImpl.java:92)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:78)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:60)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.consulfarmasaude.samu.core.interceptors.LogInterceptor.intercept(LogInterceptor.java:22)     at br.com.consulfarmasaude.samu.core.interceptors.LogInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.consulfarmasaude.samu.core.interceptors.LoginInterceptor.intercept(LoginInterceptor.java:34)     at br.com.consulfarmasaude.samu.core.interceptors.LoginInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.core.DefaultInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.consulfarmasaude.samu.core.interceptors.EntityManagerInterceptor.intercept(EntityManagerInterceptor.java:29)     at br.com.consulfarmasaude.samu.core.interceptors.EntityManagerInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)     at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)     at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:49)     at br.com.caelum.vraptor.interceptor.StepInvoker.tryToInvoke(StepInvoker.java:40)     at br.com.caelum.vraptor.interceptor.StepInvoker$  Proxy$  _$  $  _WeldClientProxy.tryToInvoke(Unknown Source)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:75)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor$  Proxy$  _$  $  _WeldClientProxy.executeAround(Unknown Source)     at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:85)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.consulfarmasaude.samu.core.interceptors.PerfilInterceptor.intercept(PerfilInterceptor.java:32)     at br.com.consulfarmasaude.samu.core.interceptors.PerfilInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.core.DefaultInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:77)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor$  Proxy$  _$  $  _WeldClientProxy.executeAround(Unknown Source)     at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:85)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.interceptor.FlashInterceptor.intercept(FlashInterceptor.java:98)     at br.com.caelum.vraptor.interceptor.FlashInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.core.DefaultInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack.next(DefaultSimpleInterceptorStack.java:49)     at br.com.caelum.vraptor.interceptor.DefaultSimpleInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.next(Unknown Source)     at br.com.consulfarmasaude.samu.core.exception.ExceptionInterceptor.intercept(ExceptionInterceptor.java:25)     at br.com.consulfarmasaude.samu.core.exception.ExceptionInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at sun.reflect.GeneratedMethodAccessor114.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)     at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)     at br.com.caelum.vraptor.interceptor.StepInvoker.invokeMethod(StepInvoker.java:49)     at br.com.caelum.vraptor.interceptor.StepInvoker.tryToInvoke(StepInvoker.java:40)     at br.com.caelum.vraptor.interceptor.StepInvoker$  Proxy$  _$  $  _WeldClientProxy.tryToInvoke(Unknown Source)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor.executeAround(InterceptorExecutor.java:75)     at br.com.caelum.vraptor.interceptor.InterceptorExecutor$  Proxy$  _$  $  _WeldClientProxy.executeAround(Unknown Source)     at br.com.caelum.vraptor.interceptor.AspectStyleInterceptorHandler.execute(AspectStyleInterceptorHandler.java:85)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.interceptor.ExceptionHandlerInterceptor.intercept(ExceptionHandlerInterceptor.java:75)     at br.com.caelum.vraptor.interceptor.ExceptionHandlerInterceptor$  Proxy$  _$  $  _WeldClientProxy.intercept(Unknown Source)     at br.com.caelum.vraptor.core.ToInstantiateInterceptorHandler.execute(ToInstantiateInterceptorHandler.java:58)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.next(DefaultInterceptorStack.java:83)     at br.com.caelum.vraptor.core.DefaultInterceptorStack.start(DefaultInterceptorStack.java:93)     at br.com.caelum.vraptor.core.DefaultInterceptorStack$  Proxy$  _$  $  _WeldClientProxy.start(Unknown Source)     at br.com.caelum.vraptor.observer.RequestHandlerObserver.handle(RequestHandlerObserver.java:93)     at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)     at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)     at org.jboss.weld.injection.MethodInvocationStrategy$  SimpleMethodInvocationStrategy.invoke(MethodInvocationStrategy.java:129)     at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:299)     at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:277)     at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:255)     at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:269)     at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:258)     at org.jboss.weld.event.EventImpl.fire(EventImpl.java:92)     at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:123)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)     at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:239)     at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:215)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)     at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)     at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:660)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)     at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)     at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)     at org.apache.coyote.AbstractProtocol$  ConnectionHandler.process(AbstractProtocol.java:806)     at org.apache.tomcat.util.net.NioEndpoint$  SocketProcessor.doRun(NioEndpoint.java:1498)     at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)     at java.util.concurrent.ThreadPoolExecutor$  Worker.run(ThreadPoolExecutor.java:617)     at org.apache.tomcat.util.threads.TaskThread$  WrappingRunnable.run(TaskThread.java:61)     at java.lang.Thread.run(Thread.java:745) Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)     at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)     at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:458)     at org.hibernate.jpa.criteria.compile.CriteriaQueryTypeQueryAdapter.getResultList(CriteriaQueryTypeQueryAdapter.java:67)     at br.com.consulfarmasaude.samu.solicitacao.SolicitacaoDAO.loadByEnvolvidos(SolicitacaoDAO.java:177)     at br.com.consulfarmasaude.samu.solicitacao.SolicitacaoBean.listarHistoricoPorEnvolvido(SolicitacaoBean.java:361)     at br.com.consulfarmasaude.samu.solicitacao.SolicitacaoController.listarPorEnvolvidos(SolicitacaoController.java:76)     at br.com.consulfarmasaude.samu.solicitacao.SolicitacaoController$  Proxy$  _$  $  _WeldClientProxy.listarPorEnvolvidos(Unknown Source)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at net.vidageek.mirror.provider.java.PureJavaMethodReflectionProvider.invoke(PureJavaMethodReflectionProvider.java:38)     at net.vidageek.mirror.invoke.MethodHandlerByMethod.withArgs(MethodHandlerByMethod.java:54)     at br.com.caelum.vraptor.observer.ExecuteMethod.execute(ExecuteMethod.java:87)     ... 115 more Caused by: org.hibernate.exception.SQLGrammarException: could not extract ResultSet     at org.hibernate.exception.internal.SQLExceptionTypeDelegate.convert(SQLExceptionTypeDelegate.java:80)     at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)     at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:126)     at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:112)     at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:91)     at org.hibernate.loader.Loader.getResultSet(Loader.java:2065)     at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1862)     at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1838)     at org.hibernate.loader.Loader.doQuery(Loader.java:909)     at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354)     at org.hibernate.loader.Loader.doList(Loader.java:2553)     at org.hibernate.loader.Loader.doList(Loader.java:2539)     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2369)     at org.hibernate.loader.Loader.list(Loader.java:2364)     at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496)     at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387)     at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:231)     at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1264)     at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103)     at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:573)     at org.hibernate.jpa.internal.QueryImpl.getResultList(QueryImpl.java:449)     ... 127 more Caused by: java.sql.SQLSyntaxErrorException: ORA-00936: expressão não encontrada      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:450)     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)     at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1059)     at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:522)     at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:257)     at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:587)     at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:225)     at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:53)     at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:774)     at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:925)     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1111)     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4798)     at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:4845)     at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1501)     at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:107)     at org.apache.tomcat.dbcp.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:107)     at sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:483)     at net.bull.javamelody.JdbcWrapper.doExecute(JdbcWrapper.java:412)     at net.bull.javamelody.JdbcWrapper$  StatementInvocationHandler.invoke(JdbcWrapper.java:137)     at net.bull.javamelody.JdbcWrapper$  DelegatingInvocationHandler.invoke(JdbcWrapper.java:294)     at com.sun.proxy.$  Proxy128.executeQuery(Unknown Source)     at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:82)     ... 143 more``` 

Subtrair valor usando JS

Até o momento meu código estava usando uma soma dos valores

Exemplo:

	               const inputs = [...document.querySelectorAll("input[class='serv']")]; 	               const res = document.getElementById("resultado"); 	               const total = res.querySelector('[name="total"]'); 	               const serv= res.querySelector('[name="serv"]'); 	                	               inputs.forEach(x => x.addEventListener("change", () => {	 	                total.value = inputs.filter(el => el.checked).reduce((sum, el) => sum + Number(el.value), 0); 	                serv.value = inputs.filter(el => el.checked).map(el => el.name).join(','); 	               }));
<div id="resultado" class="col">     <div class="input-group">        <div class="input-group-prepend">           <span class="input-group-text bg-primary text-white">Serviços</span>        </div>        <input type="text" class="input-group-text" placeholder="0,00" name="total" value="" readonly="readonly">        <input type="hidden" name="serv" value="">     </div>  </div>  <div class="form-group">     <label for="">Desconto: </label>     <select class="form-control form-control-sm" name="desconto">        <option value=""></option>        <option value="5%">Desconto Pai e Filho</option>        <option value="10%">Amigo da Hora</option>        <option value="15%">Familia</option>     </select>  </div>  <br>                             <div class="row">                               <table class="table">                                  <tbody>                                     <tr>                                        <td><input type=checkbox class='serv' name="" value="10"> Serviço</td>                                        <td>10</td>                                     </tr>                                     <tr>                                        <td><input type=checkbox class='serv' name="" value="15"> outro Serviço</td>                                        <td>15</td>                                     </tr>                                  </tbody>                               </table>                            </div>

eu gostaria de saber como incluir um desconto quando for selecionado.

Angular 7 child routes import component usando modules


Estou tentando setar algumas rotas filhas na minha aplicação angular 7 porém elas não funcionam, tenho o seguinte cenário:

Possuo um base-home.component e um home.component, encapsulei os dois components em modules específicos de cada um, base-home.module e home.module, importei os dois módulos no app.module, e setei no app-routing.module umas rota '/' que chama o base-home.component, e uma rota filha '/home' que chama o home.component, porém ele não carrega a página, porém se eu importar os components direto no app.module em vez de importar os modules eles funciona, segue como estão os arquivos:

// app.module.ts  import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core';  import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component';  import { HomeModule } from './home/home.module'; import { BaseHomeModule } from './base-home/base-home.module';  @NgModule({   declarations: [     AppComponent   ],   imports: [     BrowserModule,     CommonModule,     AppRoutingModule,     BaseHomeModule,     HomeModule   ],   providers: [],   bootstrap: [AppComponent] }) export class AppModule { }  
// app-routing.module.ts  import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router';  import { HomeComponent } from './home/home.component'; import { BaseHomeComponent } from './base-home/base-home.component';  const routes: Routes = [   {     path: '',     component: BaseHomeComponent,     children: [       {         path: 'home',         component: HomeComponent        }     ]   } ];  @NgModule({   imports: [RouterModule.forRoot(routes)],   exports: [RouterModule] }) export class AppRoutingModule { }  
// base-home.module.ts  import { NgModule } from '@angular/core';  import { BaseHomeComponent } from './base-home.component';  @NgModule({   declarations: [       BaseHomeComponent   ],   exports: [       BaseHomeComponent     ] }) export class BaseHomeModule {}  
// home.module.ts  import { NgModule } from '@angular/core';  import { HomeComponent } from './home.component';  @NgModule({   declarations: [       HomeComponent   ],   exports: [       HomeComponent     ] }) export class HomeModule { }  

Dessa maneira acima ele não funciona, mas se eu importar o base-home.component direto no no app.module ele funciona, dessa forma:

// app.module.ts  import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core';  import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component';  import { HomeModule } from './home/home.module'; import { BaseHomeComponent } from './base-home/base-home.component';  @NgModule({   declarations: [     AppComponent,     BaseHomeComponent   ],   imports: [     BrowserModule,     CommonModule,     AppRoutingModule,     HomeModule   ],   providers: [],   bootstrap: [AppComponent] }) export class AppModule { }  

Alguém sabe como eu posso fazer as child routes funcionar importando apenas os modules com os components encapsulados sem precisar importar o component direto no app-module ?

C# problemas em carregar Data Grid usando DateTime

Boa noite. tenho um dataGrid o qual carrego usando Entity Framework, porem no dataGrid minha data aparece “MM/dd/yyyy”, quero retirar a hora e formatar a data para “dd/mm/yyyy”, e no campo validade quero retirar apenas a hora

parte do código que gera o dataGrid

using (ConsultorioContext ctx = new ConsultorioContext()) { var lista = ctx.Produtos.ToList(); return lista; }

Imagem da tela/ grid

já tentei modificar o banco porem continuo com o mesmo problema,

Usando Nlog para criar arquivo de Log. Apos criar pacotes de bootstrapper e usá-lo para instalar em minha maquina arquivo de log não é gerado

Meu arquivo NLog.config:

<?xml version="1.0" encoding="utf-8" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"       throwExceptions="true">    <targets>     <target name="logfile" xsi:type="File" fileName="$  {basedir}/log.txt" />     <target name="logconsole" xsi:type="Console" />   </targets>    <rules>     <logger name="*" minlevel="Info" writeTo="logconsole" />     <logger name="*" minlevel="Debug" writeTo="logfile" />   </rules> </nlog>

OBS 1: Ja testei variações desse arquivo e não há resultados.

OBS 2: Executando o aplicativo pelo visual studio o log funciona adequadamente.

Minhas configurações estão

Ação de Copilação : Conteúdo

Copiar para o diretório : Copiar sempre

URL estruturada para custom post type usando taxonomy

Estou criando um site onde ele lista cursos e suas unidades, a URL tem que vir a seguinte

Ao clicar em Maceió
www.example.com.br/unidade/maceio/curso-de-mecanica

Ao clicar em Guarulhos
www.example.com.br/unidade/guarulhos/curso-de-mecanica

Os cursos são posts, e as unidades(como Guarulhos e Maceió são taxonomies).

O código que eu estou usando é esse abaixo

// function post type um //  function custom_post_type1() {  register_taxonomy(     'categorias',     'curso',      array(         'rewrite' => array( 'slug' => 'unidade', 'with_front' => false ),          'label' => "Unidade"     ) );  // Set UI labels for Custom Post Type     $  labels = array(         'name'                => _x( 'Curso', 'Post Type General Name', 'twentythirteen' ),         'singular_name'       => _x( 'Curso', 'Post Type Singular Name', 'twentythirteen' ),         'menu_name'           => __( 'Curso', 'twentythirteen' ),         'parent_item_colon'   => __( 'Curso Relacionado', 'twentythirteen' ),         'all_items'           => __( 'Todos os Curso', 'twentythirteen' ),         'view_item'           => __( 'Ver Curso', 'twentythirteen' ),         'add_new_item'        => __( 'Adicionar novo Curso', 'twentythirteen' ),         'add_new'             => __( 'Adicionar novo', 'twentythirteen' ),         'edit_item'           => __( 'Editar Curso', 'twentythirteen' ),         'update_item'         => __( 'Atualizar Curso', 'twentythirteen' ),         'search_items'        => __( 'Buscar por Curso', 'twentythirteen' ),         'not_found'           => __( 'Nenhum Curso encontrado', 'twentythirteen' ),         'not_found_in_trash'  => __( 'Nenhum Curso encontrado na lixeira', 'twentythirteen' ),     );  // Set other options for Custom Post Type      $  args = array(         'label'               => __( 'curso', 'twentythirteen' ),         'description'         => __( 'curso news and reviews', 'twentythirteen' ),         'rewrite' => true,         'labels'              => $  labels,         // Features this CPT supports in Post Editor         'supports'            => array( 'title', 'editor', 'excerpt', 'thumbnail', 'custom-fields', ),         // You can associate this CPT with a taxonomy or custom taxonomy.          /* A hierarchical CPT is like Pages and can have         * Parent and child items. A non-hierarchical CPT         * is like Posts.         */           'hierarchical'        => false,         'menu_icon' => '',         'public'              => true,         'show_ui'             => true,         'show_in_menu'        => true,         'show_in_nav_menus'   => true,         'show_in_admin_bar'   => true,         'menu_position'       => 5,         'can_export'          => true,         'exclude_from_search' => false,         'publicly_queryable'  => true,         'capability_type'     => 'page',         'public' => true,         'rewrite' => array( 'slug' => 'unidade/%categorias%', 'with_front' => false ),         'has_archive' => 'shows',     );      // Registering your Custom Post Type     register_post_type( 'curso', $  args);  }     function wpa_show_permalinks( $  post_link, $  post ){     if ( is_object( $  post ) && $  post->post_type == 'curso' ){         $  terms = wp_get_object_terms( $  post->ID, 'categorias' );         if( $  terms ){             return str_replace( '%categorias%' , $  terms[0]->slug , $  post_link );         }     }     return $  post_link; } add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 ); 

Ele até me retorna bem de certo modo, mas ao clicar em Maceió, ele me traz a seguinte URL www.example.com.br/unidade/guarulhos/curso-de-mecanica

Aliás, em todos que forem clicados, ele irá exibir Guarulhos, pois ela foi a primeira taxonomia a ser atrelada ao post.

Conseguem vem algum erro?

Gostaria de saber como listar dados em tabelas diferentes do bootstrap usando Codeigniter

Esta é a view com nome de dashboard.php

<main role="main" class="col-md-10 ml-sm-auto col-lg-10 px-4"> <div style="top:-5px" class="col-md-12 d-flex justify-content-between flex-wrap align-items-center pt-3 pb-2 mb-3 border-bottom">     <h1 class="h2">Dashboard</h1> </div> <div class="row">     <div class="col-md-6">         <table class="table table-bordered">             <thead class="thead-light">                 <tr style="text-align:center; font-size:12pt">                     <th style="background:#585858; color:white" colspan="2">Regs para Remover Hoje:</th>                     <th style="background:#585858; color:white"><?php $  matricula = date ("d-m-Y");echo"<input style='background:#585858; color:white; border:none; text-align:center' type='text' value='$  matricula'";?> </th>                         <tr style="text-align:center; font-size:12pt">                             <th style="padding:5px">ID</th>                             <th style="padding:5px;">Nome</th>                             <th style="padding:5px">ID Unico do TS</th>                         </tr>                 </tr>             </thead>             <?php foreach($  cadastros as $  cad){?>                 <tr style="text-align:center; font-size:12pt">                     <td style="padding:5px"><?= $  cad->id; ?></td>                     <td style="padding:5px; text-align:left"><?= $  cad->nick; ?></td>                     <td style="padding:5px"><?= $  cad->id_unico; ?></td>                 </tr>             <?php }?>         </table>     </div>     <div class="col-md-6">         <table class="table table-bordered">             <thead class="thead-light">                 <tr style="text-align:center; font-size:12pt">                     <th style="background:#585858; color:white" colspan="3">Registros não Removidos</th>                         <tr style="text-align:center; font-size:12pt">                             <th style="padding:5px">ID</th>                             <th style="padding:5px;">Nome</th>                             <th style="padding:5px">ID Unico do TS</th>                         </tr>                 </tr>             </thead>             <?php foreach($  cadastros as $  cad){?>                 <tr style="text-align:center; font-size:12pt">                     <td style="padding:5px"><?= $  cad->id; ?></td>                     <td style="padding:5px; text-align:left"><?= $  cad->nick; ?></td>                     <td style="padding:5px"><?= $  cad->id_unico; ?></td>                 </tr>             <?php }?>         </table>     </div> </div> 

E esse é o controller com nome de estatisticas.php

public function index($  indice=null) {     $  this->verificar_sessao();     $  this->db->select('*');     $  this->db->where('data_vencimento =', date('Y-m-d'));     $  dados['cadastros'] = $  this->db->get('cadastro')->result();     $  this->load->view('includes/html_header');     $  this->load->view('includes/menu');      $  this->load->view('dashboard',$  dados);     $  this->load->view('includes/html_footer'); } 

Aee fica assim https://i.imgur.com/SpKPiy7.png

gostaria de saber se tem como a primeira tabela eu listar os registos igual a data ali acima 07/04/2019, como ja esta e na segunda tabela lista somente registros anterior a essa data 07/04/2019.

Validação de Formulário usando Jquery com array nos input names

Boa noite,

Estou fazendo o seguinte formulário para o cadastro de dados no banco, para inserir no banco estou utilizando array nos input names do formulário. Formulário de cadastro

<form method="post" id="validar" action="?classe=Clientes&acao=create">   <div class="form-group">     <label for="nome_cliente">Nome</label>     <input type="text" class="form-control" id="nome_cliente" placeholder="Digite o Nome" name="clientes[nome_cliente]">   </div>   <div class="form-group">     <label for="email_cliente">Email</label>     <input type="email_cliente" class="form-control" id="email_cliente" placeholder="Digite o E-mail" name="clientes[email_cliente]">    </div>   <div class="form-group">     <label for="telefone_cliente">Telefone</label>     <input type="text" class="form-control" id="telefone_cliente" placeholder="Digite o Telefone" name="clientes[telefone_cliente]">   </div>   <div class="form-group">     <label for="senha_cliente">Senha</label>     <input type="password" class="form-control" id="senha_cliente" placeholder="Digite a Senha" name="clientes[senha_cliente]">   </div>   <div class="form-group">     <label for="data_nasc_cliente">Data de Nascimento</label>     <input type="date" class="form-control" id="data_nasc_cliente" placeholder="Digite a Data de Nascimento" name="clientes[data_nasc_cliente]">   </div>   <button type="submit" class="btn btn-success">Cadastrar</button> </form>

e estou precisando fazer uma validação nos campos usando jquery validate, só que pra utilizar o jquery validate ele pega o name do input para validar.

<script>     $  ("#validar").validate({         rules:{             clientes['nome_cliente']:{                 required:true,                 minlength:3             }                                      },         messages:{             clientes['nome_cliente']:{                 required:"Por favor, informe seu nome",                 minlength:"O nome deve ter pelo menos 3 caracteres"             }         }         }); </script> 

tentei de várias formas, porém não consegui em nenhuma delas fazer a validação com o array no name.