From b66cb5d334cb1d9d99d43d1d635bd7d475e45637 Mon Sep 17 00:00:00 2001 From: Sylvain <sylvain@sbx.pm> Date: Wed, 10 Jun 2020 17:35:54 +0200 Subject: [PATCH] WIP: set invoice_prefix from the UI --- .../controllers/admin/invoices.js.erb | 7 ++++++ app/assets/stylesheets/modules/invoice.scss | 22 +++++++++++++++++++ .../admin/invoices/settings.html.erb | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index 3fb9de5e5..43fee9304 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -53,6 +53,13 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I // Default invoices ordering/sorting $scope.orderInvoice = '-reference'; + // Invoice PDF filename settings (and example) + $scope.file = { + prefix: 'Fablab_demo-facture', + nextId: 40, + date: moment().format('DDMMYYYY') + } + // Invoices parameters $scope.invoice = { logo: null, diff --git a/app/assets/stylesheets/modules/invoice.scss b/app/assets/stylesheets/modules/invoice.scss index 9832248d5..a1c5a5a44 100644 --- a/app/assets/stylesheets/modules/invoice.scss +++ b/app/assets/stylesheets/modules/invoice.scss @@ -8,6 +8,28 @@ color: red; } +.invoice-file { + text-align: center; + line-height: 4em; + margin-top: 2em; + + .fa-file-pdf-o { + font-size: 4em; + vertical-align: middle; + } + + .filename { + font-size: 1.1em; + vertical-align: middle; + margin-left: 1em; + + .prefix:hover { + background-color: $yellow; + overflow-x: hidden; + } + } +} + .invoice-placeholder { width: 80%; max-width: 800px; diff --git a/app/assets/templates/admin/invoices/settings.html.erb b/app/assets/templates/admin/invoices/settings.html.erb index cfc759b46..034498e11 100644 --- a/app/assets/templates/admin/invoices/settings.html.erb +++ b/app/assets/templates/admin/invoices/settings.html.erb @@ -2,6 +2,10 @@ <i class="fa fa-warning m-r"></i> <span translate>{{ 'app.admin.invoices.warning_invoices_disabled' }}</span> </div> +<div class="invoice-file"> + <i class="fa fa-file-pdf-o" aria-hidden="true"></i> + <span class="filename"><span class="prefix">{{file.prefix}}</span>-{{file.nextId}}_{{file.date}}.pdf</span> +</div> <form class="invoice-placeholder"> <div class="invoice-logo"> <img src="data:image/png;base64," data-src="holder.js/100%x100%/text:/font:FontAwesome/icon" bs-holder ng-if="!invoice.logo" class="img-responsive">