Search in sources :

Example 6 with ResponsavelAreaDTO

use of com.tomasio.projects.trainning.dto.ResponsavelAreaDTO in project trainning by fernandotomasio.

the class MainPlanejamentoController method showAjax.

@RequestMapping("/solicitacoes_ajax")
public String showAjax(Model model, WebRequest request) {
    String itemPlanejamentoId = request.getParameter("itemPlanejamentoId");
    ItemPlanejamentoDTO itemPlanejamento = planningService.findItemPlanejamento(Long.parseLong(itemPlanejamentoId));
    StripItemPlanejamentoDTO[] strips = planningService.findAllStripItemPlanejamento(Long.parseLong(itemPlanejamentoId));
    // TurmaPlanejadaDTO[] turmasPlanejadas = planningService.findAllTurmasPlanejadas(itemPlanejamento.getPlanejamento().getId(), null, itemPlanejamento.getCurso().getId(), null);
    ResponsavelAreaDTO[] responsaveisAnalise = planningService.findAllResponsaveisAnalise(itemPlanejamento.getPlanejamento().getId(), itemPlanejamento.getCurso().getArea().getId());
    model.addAttribute("responsaveisAnalise", responsaveisAnalise);
    int totalVagas = 0;
    int totalDisponivel = 0;
    // for (TurmaPlanejadaDTO turmaPlanejada : turmasPlanejadas) {
    // totalVagas += turmaPlanejada.getQuantidadeVagas();
    // totalDisponivel += turmaPlanejada.getVagasDisponiveis();
    // 
    // }
    model.addAttribute("totalVagas", totalVagas);
    model.addAttribute("totalDisponivel", totalDisponivel);
    // HabilitacaoInstrutorDTO[] instrutores = instructorsService.findAllHabilitacoesInstrutores(itemPlanejamento.getCurso().getId(), null, null);
    // int totalInstrutores = instrutores.length;
    int totalSolicitado = 0;
    int totalPlanejado = 0;
    int[] totaisAnalises = new int[responsaveisAnalise.length];
    for (StripItemPlanejamentoDTO strip : strips) {
        totalSolicitado += ((strip.getTreinamentoSolicitado() == null) ? 0 : strip.getTreinamentoSolicitado().getQuantidade());
        totalPlanejado += ((strip.getTreinamentoPlanejado() == null) ? 0 : strip.getTreinamentoPlanejado().getQuantidade());
        int i = 0;
        for (ResponsavelAreaDTO responsavelArea : responsaveisAnalise) {
            if (!(strip.getAnalises() == null)) {
                totaisAnalises[i] += ((strip.getAnalises().get(responsavelArea.getOrganizacao().getId().toString()) == null) ? 0 : strip.getAnalises().get(responsavelArea.getOrganizacao().getId().toString()).getQuantidade());
            } else {
                totaisAnalises[i] += 0;
            }
            i++;
        }
    }
    // FolhaRostoDTO folhaRosto = planningService.findFolhaRosto(itemPlanejamento.getCurso().getCodigo());
    model.addAttribute("strips", strips);
    // model.addAttribute("folhaRosto", folhaRosto);
    model.addAttribute("itemPlanejamento", itemPlanejamento);
    // model.addAttribute("turmasPlanejadas", turmasPlanejadas);
    // model.addAttribute("instrutores", instrutores);
    // model.addAttribute("totalInstrutores", totalInstrutores);
    model.addAttribute("totalSolicitado", totalSolicitado);
    model.addAttribute("totaisAnalises", totaisAnalises);
    model.addAttribute("totalPlanejado", totalPlanejado);
    return "planejamento/solicitacoes_ajax";
}
Also used : StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) ItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO) ResponsavelAreaDTO(com.tomasio.projects.trainning.dto.ResponsavelAreaDTO) StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with ResponsavelAreaDTO

use of com.tomasio.projects.trainning.dto.ResponsavelAreaDTO in project trainning by fernandotomasio.

the class PlanejamentosController method saveResponsavelArea.

@RequestMapping("/save_responsavel_area_ajax")
@ResponseBody
public boolean saveResponsavelArea(Model model, WebRequest request) {
    String planejamentoId = request.getParameter("planejamentoId");
    String areaId = request.getParameter("areaId");
    String organizacaoId = request.getParameter("organizacaoId");
    ResponsavelAreaDTO responsavelArea = new ResponsavelAreaDTO();
    responsavelArea.setPlanejamento(planningService.findPlanejamento(Long.parseLong(planejamentoId)));
    responsavelArea.setArea(trainningService.findArea(Long.parseLong(areaId)));
    responsavelArea.setOrganizacao(organizationalService.findOrganizacao(Long.parseLong(organizacaoId)));
    planningService.createResponsavelArea(responsavelArea);
    return true;
}
Also used : ResponsavelAreaDTO(com.tomasio.projects.trainning.dto.ResponsavelAreaDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

ResponsavelAreaDTO (com.tomasio.projects.trainning.dto.ResponsavelAreaDTO)7 ItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO)5 StripItemPlanejamentoDTO (com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ArrayList (java.util.ArrayList)4 Map (java.util.Map)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 AnaliseDTO (com.tomasio.projects.trainning.dto.AnaliseDTO)2 AreaDTO (com.tomasio.projects.trainning.dto.AreaDTO)2 PlanejamentoDTO (com.tomasio.projects.trainning.dto.PlanejamentoDTO)2 HashMap (java.util.HashMap)2 AcaoDTO (com.tomasio.projects.trainning.dto.AcaoDTO)1 DecisaoDTO (com.tomasio.projects.trainning.dto.DecisaoDTO)1 ItemAtaDTO (com.tomasio.projects.trainning.dto.ItemAtaDTO)1 AtaService (com.tomasio.projects.trainning.interfaces.AtaService)1 PlanningService (com.tomasio.projects.trainning.interfaces.PlanningService)1 TrainningService (com.tomasio.projects.trainning.interfaces.TrainningService)1 OdfTable (org.odftoolkit.odfdom.doc.table.OdfTable)1 OdfTableCell (org.odftoolkit.odfdom.doc.table.OdfTableCell)1