Add requeue action for printer jobs
This commit is contained in:
parent
3a25a50d8d
commit
754099999e
5 changed files with 15 additions and 1 deletions
|
@ -30,6 +30,14 @@ class PrinterJobsController < ApplicationController
|
||||||
@job = PrinterJob.find(params[:id])
|
@job = PrinterJob.find(params[:id])
|
||||||
end
|
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
|
def document
|
||||||
job = PrinterJob.find(params[:id])
|
job = PrinterJob.find(params[:id])
|
||||||
send_order_pdf job.order, job.document
|
send_order_pdf job.order, job.document
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
%th= heading_helper(PrinterJob, :document)
|
%th= heading_helper(PrinterJob, :document)
|
||||||
%th= heading_helper(PrinterJob, :last_update_state)
|
%th= heading_helper(PrinterJob, :last_update_state)
|
||||||
%th= heading_helper(PrinterJob, :finished_at)
|
%th= heading_helper(PrinterJob, :finished_at)
|
||||||
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- @finished_jobs.each do |j|
|
- @finished_jobs.each do |j|
|
||||||
%tr
|
%tr
|
||||||
|
@ -20,3 +21,4 @@
|
||||||
%td= link_to j.document, document_printer_job_path(j)
|
%td= link_to j.document, document_printer_job_path(j)
|
||||||
%td= j.last_update_state
|
%td= j.last_update_state
|
||||||
%td= format_time j.finished_at
|
%td= format_time j.finished_at
|
||||||
|
%td= link_to t('.requeue'), requeue_printer_job_path(j), method: :post, class: 'btn btn-mini'
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
- title t('.title', id: @job.id)
|
- title t('.title', id: @job.id)
|
||||||
|
|
||||||
|
- content_for :actionbar do
|
||||||
|
= link_to t('.requeue'), requeue_printer_job_path(@job), method: :post, class: 'btn'
|
||||||
|
|
||||||
%p
|
%p
|
||||||
%b= heading_helper(PrinterJob, :created_by) + ':'
|
%b= heading_helper(PrinterJob, :created_by) + ':'
|
||||||
= show_user @job.created_by
|
= show_user @job.created_by
|
||||||
|
|
|
@ -26,7 +26,7 @@ en:
|
||||||
finished: Finished
|
finished: Finished
|
||||||
pending: Pending
|
pending: Pending
|
||||||
queued: Waiting for order to close
|
queued: Waiting for order to close
|
||||||
|
requeued: Requeued
|
||||||
title: Printer jobs
|
title: Printer jobs
|
||||||
show:
|
show:
|
||||||
title: Printer job %{id}
|
title: Printer job %{id}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :printer_jobs, only: [:index, :create, :show, :destroy] do
|
resources :printer_jobs, only: [:index, :create, :show, :destroy] do
|
||||||
|
post :requeue, on: :member
|
||||||
get :document, on: :member
|
get :document, on: :member
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue