1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-17 06:52:27 +01:00

invoices interface for managers

This commit is contained in:
Sylvain 2020-04-28 16:49:05 +02:00
parent 6a8746b110
commit abcf17d1e6
3 changed files with 16 additions and 5 deletions

View File

@ -11,7 +11,7 @@
</section>
</div>
<div class="col-xs-12 col-sm-12 col-md-3">
<section class="heading-actions wrapper">
<section class="heading-actions wrapper" ng-show="isAuthorized('admin')">
<a class="btn btn-default rounded m-t-sm export-accounting-button" ng-click="toggleExportModal()"><i class="fa fa-book"></i></a>
<iframe name="export-frame" height="0" width="0" class="none" id="accounting-export-frame"></iframe>
<a class="btn btn-lg btn-default rounded m-t-sm text-sm close-accounting-periods-button" ng-click="closeAnAccountingPeriod()"><i class="fa fa-calendar-check-o"></i> {{ 'app.admin.invoices.accounting_periods' | translate }}</a>
@ -28,7 +28,7 @@
ui-tour-scroll-parent-id="content-main"
post-render="setupInvoicesTour">
<div class="row">
<div class="col-md-12">
<div class="col-md-12" ng-show="isAuthorized('admin')">
<uib-tabset justified="true" active="tabs.active">
<uib-tab heading="{{ 'app.admin.invoices.invoices_list' | translate }}" ng-hide="fablabWithoutInvoices" index="0">
<ng-include src="'<%= asset_path "admin/invoices/list.html" %>'"></ng-include>
@ -43,6 +43,10 @@
</uib-tab>
</uib-tabset>
</div>
<div class="col-md-12" ng-show="isAuthorized('manager')">
<ng-include src="'<%= asset_path "admin/invoices/list.html" %>'"></ng-include>
</div>
</div>
</section>

View File

@ -2,9 +2,13 @@
# Check the access policies for API::AccountingPeriodsController
class AccountingPeriodPolicy < ApplicationPolicy
%w[index show create last_closing_end download_archive].each do |action|
%w[index show create download_archive].each do |action|
define_method "#{action}?" do
user.admin?
end
end
def last_closing_end?
user.admin? || user.manager?
end
end

View File

@ -1,14 +1,17 @@
# frozen_string_literal: true
# Check the access policies for API::InvoicesController
class InvoicePolicy < ApplicationPolicy
def index?
user.admin?
end
def download?
user.admin? or (record.invoicing_profile.user_id == user.id)
user.admin? || user.manager? || (record.invoicing_profile.user_id == user.id)
end
def create?
user.admin?
user.admin? || user.manager?
end
def list?