Add a printer job queue via the printer plugin
This commit is contained in:
parent
63e1541aa3
commit
c955a6ee40
24 changed files with 561 additions and 1 deletions
22
plugins/printer/app/views/printer_jobs/_jobs.html.haml
Normal file
22
plugins/printer/app/views/printer_jobs/_jobs.html.haml
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
.pull-right
|
||||
- if @finished_jobs.total_pages > 1
|
||||
.btn-group= items_per_page wrap: false
|
||||
= pagination_links_remote @finished_jobs
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper(PrinterJob, :id)
|
||||
%th= heading_helper(PrinterJob, :order)
|
||||
%th= heading_helper(PrinterJob, :pickup)
|
||||
%th= heading_helper(PrinterJob, :document)
|
||||
%th= heading_helper(PrinterJob, :last_update_state)
|
||||
%th= heading_helper(PrinterJob, :finished_at)
|
||||
%tbody
|
||||
- @finished_jobs.each do |j|
|
||||
%tr
|
||||
%td= link_to j.id, j
|
||||
%td= link_to j.order.supplier.name, j.order
|
||||
%td= format_date j.order.pickup
|
||||
%td= link_to j.document, document_printer_job_path(j)
|
||||
%td= j.last_update_state
|
||||
%td= format_time j.finished_at
|
||||
47
plugins/printer/app/views/printer_jobs/index.html.haml
Normal file
47
plugins/printer/app/views/printer_jobs/index.html.haml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
- title t('.title')
|
||||
|
||||
- unless @pending_jobs.empty? && @queued_jobs.empty?
|
||||
.well
|
||||
%h2
|
||||
- if @pending_jobs.any?
|
||||
=t '.pending'
|
||||
- else
|
||||
=t '.queued'
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper(PrinterJob, :id)
|
||||
%th= heading_helper(PrinterJob, :order)
|
||||
%th= heading_helper(PrinterJob, :pickup)
|
||||
%th= heading_helper(PrinterJob, :document)
|
||||
%th= heading_helper(PrinterJob, :last_update_at)
|
||||
%th= heading_helper(PrinterJob, :last_update_state)
|
||||
%th
|
||||
%tbody
|
||||
- @pending_jobs.each do |j|
|
||||
%tr
|
||||
%td= link_to j.id, j
|
||||
%td= link_to j.order.supplier.name, j.order
|
||||
%td= format_date j.order.pickup
|
||||
%td= link_to j.document, document_printer_job_path(j)
|
||||
%td= format_time j.last_update_at
|
||||
%td= j.last_update_state
|
||||
%td= link_to t('ui.delete'), j, method: :delete, data: {:confirm => t('ui.confirm_delete', name: j.id)},
|
||||
class: 'btn btn-mini btn-danger'
|
||||
- if @pending_jobs.any?
|
||||
%tr
|
||||
%td{colspan: 7}
|
||||
%h2= t '.queued'
|
||||
- @queued_jobs.each do |j|
|
||||
%tr
|
||||
%td= link_to j.id, j
|
||||
%td= link_to j.order.supplier.name, j.order
|
||||
%td= format_date j.order.pickup
|
||||
%td= link_to j.document, document_printer_job_path(j)
|
||||
%td= format_time j.last_update_at
|
||||
%td= j.last_update_state
|
||||
%td= link_to t('ui.delete'), j, method: :delete, data: {:confirm => t('ui.confirm_delete', name: j.id)},
|
||||
class: 'btn btn-mini btn-danger'
|
||||
|
||||
%h2= t '.finished'
|
||||
#jobsTable= render 'jobs'
|
||||
1
plugins/printer/app/views/printer_jobs/index.js.haml
Normal file
1
plugins/printer/app/views/printer_jobs/index.js.haml
Normal file
|
|
@ -0,0 +1 @@
|
|||
$('#jobsTable').html('#{j(render('jobs'))}');
|
||||
36
plugins/printer/app/views/printer_jobs/show.html.haml
Normal file
36
plugins/printer/app/views/printer_jobs/show.html.haml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
- title t('.title', id: @job.id)
|
||||
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :created_by) + ':'
|
||||
= show_user @job.created_by
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :order) + ':'
|
||||
= @job.order.supplier.name
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :pickup) + ':'
|
||||
= @job.order.pickup
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :document) + ':'
|
||||
= @job.document
|
||||
- if @job.finished_at
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :finished_at) + ':'
|
||||
= format_time @job.finished_at
|
||||
- if @job.finished_by
|
||||
%p
|
||||
%b= heading_helper(PrinterJob, :finished_by) + ':'
|
||||
= show_user @job.finished_by
|
||||
|
||||
|
||||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th= heading_helper(PrinterJobUpdate, :created_at)
|
||||
%th= heading_helper(PrinterJobUpdate, :state)
|
||||
%th= heading_helper(PrinterJobUpdate, :message)
|
||||
%tbody
|
||||
- @job.printer_job_updates.each do |u|
|
||||
%tr
|
||||
%td= format_time u.created_at
|
||||
%td= u.state
|
||||
%td= u.message
|
||||
Loading…
Add table
Add a link
Reference in a new issue