@RequestMapping( value = "/{invoiceId}/control-letters/{controlLetterId}/rows", method = RequestMethod.GET) public String findControlLettersRows( @PathVariable("invoiceId") int invoiceId, @PathVariable("controlLetterId") int controlLetterId, Model model, RedirectAttributes redirectAttributes) { if (!ticketsInvoiceService.invoiceExists(invoiceId)) throw new ResourceNotFoundException(); handleFlashMessages(redirectAttributes, model); List<ControlLetterRow> controlLetterRows = controlLetterRowService.findAll(controlLetterId); model.addAttribute("controlLetterRows", controlLetterRows); model.addAttribute("controlLetterId", controlLetterId); model.addAttribute("invoiceId", invoiceId); return "controlLetterRow/find"; }
@RequestMapping(value = "/{invoiceId}/control-letters/{controlLetterId}/rows/{id}") public String showControlLetterRow( @PathVariable("invoiceId") int invoiceId, @PathVariable("controlLetterId") int controlLetterId, @PathVariable("id") int id, Model model) { ControlLetterRow controlLetterRow = controlLetterRowService.find(id); if (controlLetterRow == null) throw new ResourceNotFoundException(); controlLetterRow.setControlLetterId(controlLetterId); List<Employee> employees = employeeService.findAll(Employee.EmployeePosition.CONDUCTOR.getId()); List<Route> routes = routeService.findAll(); model.addAttribute("routes", routes); model.addAttribute("employees", employees); model.addAttribute("controlLetterRow", controlLetterRow); model.addAttribute("invoiceId", invoiceId); return "controlLetterRow/edit"; }