@RequestMapping(method = {RequestMethod.GET})
  public String find(Model model, RedirectAttributes redirectAttributes) {
    List<TicketsInvoice> ticketsInvoices = ticketsInvoiceService.findAll();

    handleFlashMessages(redirectAttributes, model);

    model.addAttribute("ticketsInvoices", ticketsInvoices);
    return "ticketsInvoice/find";
  }
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  public String findOne(@PathVariable("id") int id, Model model) {
    TicketsInvoice ticketsInvoice = ticketsInvoiceService.find(id);
    if (ticketsInvoice == null) throw new ResourceNotFoundException();

    List<Employee> employees =
        employeeService.findAll(Employee.EmployeePosition.MAIN_CASIER.getId());

    model.addAttribute("employees", employees);
    model.addAttribute("ticketsInvoice", ticketsInvoice);
    return "ticketsInvoice/edit";
  }
  @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/{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";
  }