From 881cc97e8dc7e746202fd60de6965c11cfb9138f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 4 May 2020 10:56:27 +0200 Subject: [PATCH] The invoices list displays the operator in case of offline payment --- CHANGELOG.md | 2 ++ .../controllers/admin/invoices.js.erb | 9 +++++++++ .../templates/admin/invoices/list.html.erb | 19 ++++++++++++------- app/views/api/invoices/list.json.jbuilder | 6 ++++++ config/locales/app.admin.en.yml | 1 + config/locales/app.admin.fr.yml | 1 + 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abcb0b091..c7f692930 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Changelog Fab-manager +- Manager: a new role between the member and the administrator +- The invoices list displays the operator in case of offline payment - Interface to manage partners - Ability to define, per availability, a custom duration for the reservation slots - Corrected the documentation about BOOK_SLOT_AT_SAME_TIME diff --git a/app/assets/javascripts/controllers/admin/invoices.js.erb b/app/assets/javascripts/controllers/admin/invoices.js.erb index 9435017a5..a2c7236df 100644 --- a/app/assets/javascripts/controllers/admin/invoices.js.erb +++ b/app/assets/javascripts/controllers/admin/invoices.js.erb @@ -575,6 +575,15 @@ Application.Controllers.controller('InvoicesController', ['$scope', '$state', 'I ); } + /** + * Return the name of the operator that creates the invoice + */ + $scope.operatorName = function(invoice) { + if (!invoice.operator) return ''; + + return `${invoice.operator.first_name} ${invoice.operator.last_name}`; + } + /** * Setup the feature-tour for the admin/invoices page. * This is intended as a contextual help (when pressing F1) diff --git a/app/assets/templates/admin/invoices/list.html.erb b/app/assets/templates/admin/invoices/list.html.erb index 1447f2a87..cc3590447 100644 --- a/app/assets/templates/admin/invoices/list.html.erb +++ b/app/assets/templates/admin/invoices/list.html.erb @@ -36,12 +36,12 @@ - - + + - + - + @@ -50,9 +50,14 @@ - diff --git a/app/views/api/invoices/list.json.jbuilder b/app/views/api/invoices/list.json.jbuilder index 60c9af411..d2b2f72dd 100644 --- a/app/views/api/invoices/list.json.jbuilder +++ b/app/views/api/invoices/list.json.jbuilder @@ -16,4 +16,10 @@ json.array!(@invoices) do |invoice| json.date invoice.is_a?(Avoir) ? invoice.avoir_date : invoice.created_at json.prevent_refund invoice.prevent_refund? json.chained_footprint invoice.check_footprint + if invoice.operator_profile + json.operator do + json.id invoice.operator_profile.user_id + json.extract! invoice.operator_profile, :first_name, :last_name + end + end end diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 2eaff74a0..e6f35a003 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -374,6 +374,7 @@ en: accounting_periods: "Accounting periods" invoices_list: "Invoices list" filter_invoices: "Filter invoices" + operator_: "Operator:" invoice_num_: "Invoice #:" customer_: "Customer:" date_: "Date:" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index f5742c41f..a06111e0e 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -374,6 +374,7 @@ fr: accounting_periods: "Périodes comptables" invoices_list: "Liste des factures" filter_invoices: "Filtrer les factures" + operator_: "Opérateur :" invoice_num_: "Facture n° :" customer_: "Client :" date_: "Date :"
{{ 'app.admin.invoices.invoice_num' | translate }} {{ 'app.admin.invoices.invoice_num' | translate }} {{ 'app.admin.invoices.date' | translate }} {{ 'app.admin.invoices.date' | translate }} {{ 'app.admin.invoices.price' | translate }} {{ 'app.admin.invoices.price' | translate }} {{ 'app.admin.invoices.customer' | translate }}
- - + + + + + + + + {{ invoice.reference }} {{ invoice.date | amDateFormat:'L LTS' }}