From b940ae03271e8d304a10fe3764db87755119a3ae Mon Sep 17 00:00:00 2001 From: Sylvain Date: Mon, 11 Mar 2019 16:11:49 +0100 Subject: [PATCH] display complete info set on accounting archives --- app/assets/stylesheets/modules/invoice.scss | 35 ++++++++++++------- .../templates/admin/invoices/_period.html.erb | 18 ++++++++++ .../admin/invoices/closePeriodModal.html.erb | 10 +++--- app/models/accounting_period.rb | 8 +++-- .../accounting_periods/index.json.jbuilder | 5 ++- config/locales/app.admin.en.yml | 3 ++ config/locales/app.admin.es.yml | 3 ++ config/locales/app.admin.fr.yml | 3 ++ config/locales/app.admin.pt.yml | 3 ++ 9 files changed, 68 insertions(+), 20 deletions(-) create mode 100644 app/assets/templates/admin/invoices/_period.html.erb diff --git a/app/assets/stylesheets/modules/invoice.scss b/app/assets/stylesheets/modules/invoice.scss index 4b3aebc9b..c76350dd9 100644 --- a/app/assets/stylesheets/modules/invoice.scss +++ b/app/assets/stylesheets/modules/invoice.scss @@ -213,10 +213,6 @@ table.closings-table { border-bottom: 0; } - thead th.download-archive { - display: none; - } - tr:after { /* clearing float */ content: ' '; display: block; @@ -231,19 +227,29 @@ table.closings-table { } tbody td, thead th { - width: 24%; /* 24% is less than (100% / 4 cols) = 25% */ + width: 32%; /* 32% is less than (100% / 3 cols) = 33.33% */ float: left; } - tbody td.download-archive { - position: absolute; - right: 10px; - width: 32px; - height: 32px; - cursor: pointer; + tbody .actions { + padding-left: 2em; + + & > span { + margin-left: 2em; + cursor: pointer; + } } - tbody td.download-archive:hover { + tbody .show-more { + color: #00b3ee; + } + + tbody .download-archive { + width: 32px; + height: 32px; + } + + tbody .download-archive:hover { i { display: none; } @@ -253,3 +259,8 @@ table.closings-table { } } } + + +.period-info-title { + font-weight: bold; +} diff --git a/app/assets/templates/admin/invoices/_period.html.erb b/app/assets/templates/admin/invoices/_period.html.erb new file mode 100644 index 000000000..907eb9d4a --- /dev/null +++ b/app/assets/templates/admin/invoices/_period.html.erb @@ -0,0 +1,18 @@ + diff --git a/app/assets/templates/admin/invoices/closePeriodModal.html.erb b/app/assets/templates/admin/invoices/closePeriodModal.html.erb index 7cf14030a..70ddd712f 100644 --- a/app/assets/templates/admin/invoices/closePeriodModal.html.erb +++ b/app/assets/templates/admin/invoices/closePeriodModal.html.erb @@ -56,17 +56,17 @@ {{ 'invoices.start_date' }} {{ 'invoices.end_date' }} - {{ 'invoices.closed_at' }} - + {{period.start_at | amDateFormat:'L'}} {{period.end_at | amDateFormat:'L'}} - {{period.closed_at | amDateFormat:'L'}} - {{period.user_name}} - + + + + diff --git a/app/models/accounting_period.rb b/app/models/accounting_period.rb index 4b6d7ac57..8df85b8c2 100644 --- a/app/models/accounting_period.rb +++ b/app/models/accounting_period.rb @@ -32,6 +32,10 @@ class AccountingPeriod < ActiveRecord::Base "#{dir}/#{start_at.iso8601}_#{end_at.iso8601}.json" end + def check_footprint + footprint == compute_footprint + end + private def to_json_archive(invoices) @@ -71,8 +75,8 @@ class AccountingPeriod < ActiveRecord::Base end def compute_footprint - columns = Invoice.columns.map(&:name) - .delete_if { |c| %w[footprint updated_at].include? c } + columns = AccountingPeriod.columns.map(&:name) + .delete_if { |c| %w[footprint updated_at].include? c } sha256 = Digest::SHA256.new sha256.hexdigest "#{columns.map { |c| self[c] }.join}#{previous_period ? previous_period.footprint : ''}" diff --git a/app/views/api/accounting_periods/index.json.jbuilder b/app/views/api/accounting_periods/index.json.jbuilder index 84588d2f9..3980cc0dd 100644 --- a/app/views/api/accounting_periods/index.json.jbuilder +++ b/app/views/api/accounting_periods/index.json.jbuilder @@ -1,6 +1,9 @@ # frozen_string_literal: true json.array!(@accounting_periods) do |ap| - json.extract! ap, :id, :start_at, :end_at, :closed_at, :closed_by, :created_at + json.extract! ap, :id, :start_at, :end_at, :closed_at, :closed_by, :footprint, :created_at + json.period_total ap.period_total / 100.0 + json.perpetual_total ap.perpetual_total / 100.0 + json.chained_footprint ap.check_footprint json.user_name "#{ap.first_name} #{ap.last_name}" end diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 531fcc6d3..9d0364f59 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -416,6 +416,9 @@ en: end_date: "To" closed_at: "Closed at" closed_by: "By" + period_total: "Period total" + perpetual_total: "Perpetual total" + integrity: "Integrity check" confirmation_required: "Confirmation required" confirm_close_START_END: "Do you really want to close the accounting period between {{START}} and {{END}}? Any subsequent changes will be impossible. This operation will take some time to complete" period_START_END_closed_success: "The accounting period from {{START}} to {{END}} has been successfully closed" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index aafe8ac5e..69b929cbb 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -416,6 +416,9 @@ es: end_date: "To" # translation_missing closed_at: "Closed at" # translation_missing closed_by: "By" # translation_missing + period_total: "Period total" # translation_missing + perpetual_total: "Perpetual total" # translation_missing + integrity: "Verificación de integridad" confirmation_required: "Confirmation required" # translation_missing confirm_close_START_END: "Do you really want to close the accounting period between {{START}} and {{END}}? Any subsequent changes will be impossible. This operation will take some time to complete" # translation_missing period_START_END_closed_success: "The accounting period from {{START}} to {{END}} has been successfully closed" # translation_missing diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index e8fe4e5e8..7126cdcaa 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -416,6 +416,9 @@ fr: end_date: "Au" closed_at: "Clôturé le" closed_by: "Par" + period_total: "Total de la période" + perpetual_total: "Total perpétuel" + integrity: "Contrôle d'intégrité" confirmation_required: "Confirmation requise" confirm_close_START_END: "Êtes-vous sur de vouloir clôturer la période comptable du {{START}} au {{END}} ? Toute modification ultérieure sera impossible. Cette opération va prendre un certain temps." period_START_END_closed_success: "La période comptable du {{START}} au {{END}} a bien été clôturée" diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index 04ea8498c..14f094bf4 100755 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -416,6 +416,9 @@ pt: end_date: "To" # translation_missing closed_at: "Closed at" # translation_missing closed_by: "By" # translation_missing + period_total: "Period total" # translation_missing + perpetual_total: "Perpetual total" # translation_missing + integrity: "Verificação de integridade" confirmation_required: "Confirmation required" # translation_missing confirm_close_START_END: "Do you really want to close the accounting period between {{START}} and {{END}}? Any subsequent changes will be impossible. This operation will take some time to complete." # translation_missing period_START_END_closed_success: "The accounting period from {{START}} to {{END}} has been successfully closed" # translation_missing