@RequestMapping(value = "/{id}/control-letters", method = RequestMethod.GET) public String showControlLetters( @PathVariable("id") int id, Model model, final RedirectAttributes redirectAttributes) { if (!ticketsInvoiceService.invoiceExists(id)) throw new ResourceNotFoundException(); List<ControlLetter> controlLetters = controlLetterService.findAll(id); handleFlashMessages(redirectAttributes, model); model.addAttribute("ticketsInvoiceId", id); model.addAttribute("controlLetters", controlLetters); return "controlLetter/find"; }
@RequestMapping(value = "/{invoiceId}/control-letters/{id}") public String showControlLetter( @PathVariable("invoiceId") int invoiceId, @PathVariable("id") int id, Model model) { ControlLetter controlLetter = controlLetterService.find(id); if (controlLetter == null) throw new ResourceNotFoundException(); controlLetter.setIncomeId(invoiceId); List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CASIER.getId()); model.addAttribute("employees", employees); model.addAttribute("controlLetter", controlLetter); return "controlLetter/edit"; }