From 02408ae885e78ca74b425dc1353c91d3dbbc03f1 Mon Sep 17 00:00:00 2001 From: aignatov-bio <47317017+aignatov-bio@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:24:46 +0200 Subject: [PATCH] Add printing status modal [SCI-5910] (#3454) --- .../repository/print_progress_modal.scss | 60 +++++++++++++++++++ app/controllers/repositories_controller.rb | 6 ++ .../_print_progress_modal.html.erb | 38 ++++++++++++ app/views/repositories/show.html.erb | 2 + config/locales/en.yml | 11 ++++ 5 files changed, 117 insertions(+) create mode 100644 app/assets/stylesheets/repository/print_progress_modal.scss create mode 100644 app/views/repositories/_print_progress_modal.html.erb diff --git a/app/assets/stylesheets/repository/print_progress_modal.scss b/app/assets/stylesheets/repository/print_progress_modal.scss new file mode 100644 index 000000000..99670fde0 --- /dev/null +++ b/app/assets/stylesheets/repository/print_progress_modal.scss @@ -0,0 +1,60 @@ +.label-printing-progress-modal { + background: $color-white; + bottom: 1em; + box-shadow: $modal-shadow; + min-width: 300px; + position: fixed; + right: 1em; + z-index: 9999; + + .modal-header { + align-items: center; + display: flex; + padding: .5em; + + .title { + @include font-h3; + } + + .printer-status { + border: $border-default; + color: $color-silver-chalice; + margin-left: .5em; + margin-right: auto; + padding: .25em; + + &[data-status="ready"] { + background: $brand-success; + border-color: $brand-success; + color: $color-white; + } + + &[data-status="out_of_labels"] { + background: $brand-warning; + border-color: $brand-warning; + color: $color-white; + } + } + } + + .modal-body { + .printing-items { + .id-label { + margin-left: .5em; + opacity: .5; + } + } + + .printing-status { + color: $brand-primary; + + &[data-status="done"] { + color: $brand-success; + } + + &[data-status="waiting_labels"] { + color: $brand-danger; + } + } + } +} diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index c23c347f1..6857e006d 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -49,6 +49,12 @@ class RepositoriesController < ApplicationController @display_delete_button = can_delete_repository_rows?(@repository) @display_duplicate_button = can_create_repository_rows?(@repository) @snapshot_provisioning = @repository.repository_snapshots.provisioning.any? + @printing = { + printer_name: 'Fluics label printer', + printer_status: :out_of_labels, + items: RepositoryRow.all, + printing_status: :waiting_labels + } end def table_toolbar diff --git a/app/views/repositories/_print_progress_modal.html.erb b/app/views/repositories/_print_progress_modal.html.erb new file mode 100644 index 000000000..3909b882e --- /dev/null +++ b/app/views/repositories/_print_progress_modal.html.erb @@ -0,0 +1,38 @@ +