Search in sources :

Example 31 with OrganizacaoDTO

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

the class MainPlanejamentoController method saveAnalise.

@RequestMapping("/save_analise_ajax")
public String saveAnalise(Model model, @Valid AnaliseForm analiseForm, BindingResult bindingResult, WebRequest request) {
    if (bindingResult.hasErrors()) {
        StripItemPlanejamentoDTO strip = planningService.findStripItemPlanejamento(analiseForm.getItemPlanejamentoId(), analiseForm.getOrganizacaoId());
        OrganizacaoDTO responsavel = organizationalService.findOrganizacao(analiseForm.getResponsavelId());
        model.addAttribute("responsavel", responsavel);
        model.addAttribute("strip", strip);
        return "planejamento/analise_ajax";
    }
    AnaliseDTO dto = new AnaliseDTO();
    dto.setQuantidade(analiseForm.getQuantidade());
    dto.setFundamentacao(analiseForm.getFundamentacao());
    dto.setItemPlanejamento(planningService.findItemPlanejamento(analiseForm.getItemPlanejamentoId()));
    dto.setOrganizacao(organizationalService.findOrganizacao(analiseForm.getOrganizacaoId()));
    dto.setResponsavel(organizationalService.findOrganizacao(analiseForm.getResponsavelId()));
    if (analiseForm.getId() > 0) {
        try {
            dto.setId(analiseForm.getId());
            planningService.updateAnalise(dto);
            model.addAttribute("message", "AnĂ¡lise atualizada com sucesso.");
        } catch (CoreException e) {
            model.addAttribute("errMessage", e.getMessage());
        }
    } else {
        try {
            planningService.createAnalise(dto);
            model.addAttribute("message", "AnĂ¡lise criada com sucesso.");
        } catch (CoreException e) {
            model.addAttribute("errMessage", e.getMessage());
        }
    }
    return "planejamento/analise_ajax";
}
Also used : CoreException(com.tomasio.projects.trainning.exeption.CoreException) StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 32 with OrganizacaoDTO

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

the class MainPlanejamentoController method editTurma.

@RequestMapping("/edit_turma")
public String editTurma(Model model, WebRequest request) {
    Long turmaPlanejadaId = Long.parseLong(request.getParameter("turmaPlanejadaId"));
    TurmaPlanejadaDTO dto = (TurmaPlanejadaDTO) planningService.findTurma(turmaPlanejadaId);
    TurmaPlanejadaForm turma = new TurmaPlanejadaForm();
    OrganizacaoDTO[] organizacoes = organizationalService.findAllOrganizacoes();
    model.addAttribute("organizacoes", organizacoes);
    model.addAttribute("itemPlanejamentoId", dto.getItemPlanejamento().getId());
    turma.setCursoId(dto.getCurso().getId());
    turma.setId(dto.getId());
    turma.setItemPlanejamentoId(dto.getItemPlanejamento().getId());
    turma.setNumeroTurma(dto.getNumeroTurma());
    turma.setQuantidadeVagas(dto.getQuantidadeVagas());
    if (dto.getResponsavelId() != null) {
        turma.setResponsavelId(dto.getResponsavelId());
    }
    FaseDTO[] fases = dto.getFases();
    if (fases == null || fases.length == 0) {
        fases = new FaseDTO[1];
        fases[0] = new FaseDTO();
    }
    model.addAttribute("fases", fases);
    model.addAttribute("itemPlanejamento", dto.getItemPlanejamento());
    model.addAttribute(turma);
    return "planejamento/turma_form";
}
Also used : TurmaPlanejadaForm(com.tomasio.projects.trainning.form.TurmaPlanejadaForm) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) TurmaPlanejadaDTO(com.tomasio.projects.trainning.dto.TurmaPlanejadaDTO) FaseDTO(com.tomasio.projects.trainning.dto.FaseDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 33 with OrganizacaoDTO

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

the class MainPlanejamentoController method newTurmaPlanejada.

// 
// @RequestMapping("/form_solicitacao")
// public String editSolicitacao(Model model) {
// 
// return "form_solicitacao";
// }
// 
// @RequestMapping("/form_instrutor")
// public String editInstrutor(Model model) {
// 
// return "form_instrutor";
// }
// 
// @RequestMapping("/form_turma")
// public String editTurma(Model model) {
// 
// return "form_turma";
// }
@RequestMapping("/new_turma")
public String newTurmaPlanejada(Model model, WebRequest request, @ModelAttribute("planejamento") PlanejamentoDTO planejamento) {
    String itemPlanejamentoId = request.getParameter("itemPlanejamentoId");
    ItemPlanejamentoDTO itemPlanejamento = planningService.findItemPlanejamento(Long.parseLong(itemPlanejamentoId));
    ItemPlanejamentoDTO[] itensPlanejamento = planningService.findAllItensPlanejamentoByPlanejamentoId(planejamento.getId());
    OrganizacaoDTO[] organizacoes = organizationalService.findAllOrganizacoes();
    model.addAttribute("organizacoes", organizacoes);
    model.addAttribute("itensPlanejamento", itensPlanejamento);
    TurmaPlanejadaForm turmaPlanejada = new TurmaPlanejadaForm();
    turmaPlanejada.setItemPlanejamentoId(Long.parseLong(itemPlanejamentoId));
    model.addAttribute("itemPlanejamento", itemPlanejamento);
    model.addAttribute("itemPlanejamentoId", itemPlanejamentoId);
    model.addAttribute(turmaPlanejada);
    FaseDTO[] fases = new FaseDTO[1];
    fases[0] = new FaseDTO();
    model.addAttribute("fases", fases);
    return "planejamento/turma_form";
}
Also used : StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) ItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.ItemPlanejamentoDTO) TurmaPlanejadaForm(com.tomasio.projects.trainning.form.TurmaPlanejadaForm) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) FaseDTO(com.tomasio.projects.trainning.dto.FaseDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 34 with OrganizacaoDTO

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

the class MainPlanejamentoController method analiseAjax.

@RequestMapping("/analise_ajax")
public String analiseAjax(Model model, WebRequest request) {
    String itemPlanejamentoId = request.getParameter("itemPlanejamentoId");
    String organizacaoId = request.getParameter("organizacaoId");
    String responsavelId = request.getParameter("responsavelId");
    StripItemPlanejamentoDTO strip = planningService.findStripItemPlanejamento(Long.parseLong(itemPlanejamentoId), Long.parseLong(organizacaoId));
    OrganizacaoDTO responsavel = organizationalService.findOrganizacao(Long.parseLong(responsavelId));
    AnaliseDTO analiseResponsavel;
    Map<String, AnaliseDTO> analises = strip.getAnalises();
    if (analises == null) {
        analiseResponsavel = null;
    } else {
        analiseResponsavel = analises.get(responsavelId);
    }
    AnaliseForm analiseForm = new AnaliseForm();
    if (null == analiseResponsavel) {
        analiseForm.setItemPlanejamentoId(Long.parseLong(itemPlanejamentoId));
        analiseForm.setOrganizacaoId(Long.parseLong(organizacaoId));
        analiseForm.setResponsavelId(Long.parseLong(responsavelId));
    } else {
        analiseForm.setId(analiseResponsavel.getId());
        analiseForm.setItemPlanejamentoId(Long.parseLong(itemPlanejamentoId));
        analiseForm.setOrganizacaoId(Long.parseLong(organizacaoId));
        analiseForm.setResponsavelId(Long.parseLong(responsavelId));
        analiseForm.setQuantidade(analiseResponsavel.getQuantidade());
        analiseForm.setFundamentacao(analiseResponsavel.getFundamentacao());
    }
    model.addAttribute("responsavel", responsavel);
    model.addAttribute("strip", strip);
    model.addAttribute(analiseForm);
    return "planejamento/analise_ajax";
}
Also used : StripItemPlanejamentoDTO(com.tomasio.projects.trainning.dto.StripItemPlanejamentoDTO) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) AnaliseDTO(com.tomasio.projects.trainning.dto.AnaliseDTO) AnaliseForm(com.tomasio.projects.trainning.form.AnaliseForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 35 with OrganizacaoDTO

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

the class OrganizacoesController method newOrganizacao.

@RequestMapping("new")
public String newOrganizacao(Model model, WebRequest request) {
    OrganizacaoDTO[] organizacoes = organizationalService.findAllOrganizacoesFAB();
    OrganizacaoForm organizacaoForm = new OrganizacaoForm();
    model.addAttribute("organizacoes", organizacoes);
    model.addAttribute(organizacaoForm);
    model.addAttribute("tipo", "EXTERNO");
    model.addAttribute("selectableEstados", initializeSelectableEstados());
    model.addAttribute("selectableCidades", initializeSelectableCidades());
    return "organizacoes/form";
}
Also used : OrganizacaoForm(com.tomasio.projects.trainning.form.OrganizacaoForm) OrganizacaoDTO(com.tomasio.projects.trainning.dto.OrganizacaoDTO) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

OrganizacaoDTO (com.tomasio.projects.trainning.dto.OrganizacaoDTO)150 CoreException (com.tomasio.projects.trainning.exeption.CoreException)54 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)52 ArrayList (java.util.ArrayList)41 HashMap (java.util.HashMap)39 TurmaEfetivaDTO (com.tomasio.projects.trainning.dto.TurmaEfetivaDTO)37 DAOException (com.tomasio.projects.trainning.exception.DAOException)37 Organizacao (com.tomasio.projects.trainning.model.Organizacao)35 Map (java.util.Map)35 Transactional (org.springframework.transaction.annotation.Transactional)35 PessoaDTO (com.tomasio.projects.trainning.dto.PessoaDTO)33 Date (java.util.Date)23 SimpleDateFormat (java.text.SimpleDateFormat)21 List (java.util.List)18 IndicacaoAlunoDTO (com.tomasio.projects.trainning.dto.IndicacaoAlunoDTO)17 FaseDTO (com.tomasio.projects.trainning.dto.FaseDTO)14 MatriculaDTO (com.tomasio.projects.trainning.dto.MatriculaDTO)14 CancelamentoMatriculaDTO (com.tomasio.projects.trainning.dto.CancelamentoMatriculaDTO)12 CustoDTO (com.tomasio.projects.trainning.dto.CustoDTO)12 IndicacaoDTO (com.tomasio.projects.trainning.dto.IndicacaoDTO)12