Add requeue action for printer jobs

This commit is contained in:
Patrick Gansterer 2020-08-12 20:05:57 +02:00
parent 3a25a50d8d
commit 754099999e
5 changed files with 15 additions and 1 deletions

View file

@ -30,6 +30,14 @@ class PrinterJobsController < ApplicationController
@job = PrinterJob.find(params[:id])
end
def requeue
job = PrinterJob.find(params[:id])
job = PrinterJob.create! order: job.order, document: job.document, created_by: current_user
job.add_update! 'requeued'
PrinterChannel.broadcast_unfinished
redirect_to printer_jobs_path, notice: t('.notice')
end
def document
job = PrinterJob.find(params[:id])
send_order_pdf job.order, job.document