mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 02:39:37 +02:00
Add invoices views for admin
This commit is contained in:
parent
68c335da7d
commit
adf321bafa
10 changed files with 67 additions and 16 deletions
|
@ -37,3 +37,5 @@
|
||||||
padding: 10px
|
padding: 10px
|
||||||
font-size: 16px
|
font-size: 16px
|
||||||
|
|
||||||
|
.no-border
|
||||||
|
border: 0 !important
|
||||||
|
|
|
@ -28,9 +28,6 @@ hr
|
||||||
margin-top: 10px !important
|
margin-top: 10px !important
|
||||||
margin-bottom: 10px !important
|
margin-bottom: 10px !important
|
||||||
|
|
||||||
.no-border
|
|
||||||
border: 0 !important
|
|
||||||
|
|
||||||
.navbar li
|
.navbar li
|
||||||
font-weight: bold
|
font-weight: bold
|
||||||
|
|
||||||
|
|
13
app/controllers/admin/invoices_controller.rb
Normal file
13
app/controllers/admin/invoices_controller.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
class Admin::InvoicesController < AdminController
|
||||||
|
load_and_authorize_resource
|
||||||
|
|
||||||
|
def index
|
||||||
|
@q = Invoice.search(params[:q])
|
||||||
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
|
@invoices = @q.result.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
@invoice = Invoice.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,21 +1,10 @@
|
||||||
class Registrar::AccountActivitiesController < RegistrarController
|
class Registrar::AccountActivitiesController < RegistrarController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
|
|
||||||
# before_action :set_invoice, only: [:show]
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
account = current_user.registrar.cash_account
|
account = current_user.registrar.cash_account
|
||||||
@q = account.activities.includes(:invoice).search(params[:q])
|
@q = account.activities.includes(:invoice).search(params[:q])
|
||||||
@q.sorts = 'id desc' if @q.sorts.empty?
|
@q.sorts = 'id desc' if @q.sorts.empty?
|
||||||
@account_activities = @q.result.page(params[:page])
|
@account_activities = @q.result.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_invoice
|
|
||||||
@invoice = Invoice.find(params[:id])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -84,6 +84,7 @@ class Ability
|
||||||
can :manage, LegalDocument
|
can :manage, LegalDocument
|
||||||
can :manage, BankStatement
|
can :manage, BankStatement
|
||||||
can :manage, BankTransaction
|
can :manage, BankTransaction
|
||||||
|
can :manage, Invoice
|
||||||
can :read, ApiLog::EppLog
|
can :read, ApiLog::EppLog
|
||||||
can :read, ApiLog::ReppLog
|
can :read, ApiLog::ReppLog
|
||||||
# can :index, :delayed_job
|
# can :index, :delayed_job
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
- if @bank_transaction.binded?
|
- if @bank_transaction.binded?
|
||||||
%dt= t('binded_invoice')
|
%dt= t('binded_invoice')
|
||||||
%dd= link_to(@bank_transaction.binded_invoice, '#')
|
%dd= link_to(@bank_transaction.binded_invoice, admin_invoice_path(@bank_transaction.binded_invoice))
|
||||||
|
|
||||||
%dt= t('bank_reference')
|
%dt= t('bank_reference')
|
||||||
%dd= @bank_transaction.bank_reference
|
%dd= @bank_transaction.bank_reference
|
||||||
|
|
31
app/views/admin/invoices/index.haml
Normal file
31
app/views/admin/invoices/index.haml
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
.row
|
||||||
|
.col-sm-12
|
||||||
|
%h2.text-center-xs= t('invoices')
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
.table-responsive
|
||||||
|
%table.table.table-hover.table-bordered.table-condensed
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-3'}
|
||||||
|
= sort_link(@q, 'invoice')
|
||||||
|
%th{class: 'col-xs-3'}
|
||||||
|
= sort_link(@q, 'buyer')
|
||||||
|
%th{class: 'col-xs-3'}
|
||||||
|
= sort_link(@q, 'due_date')
|
||||||
|
%th{class: 'col-xs-3'}
|
||||||
|
= sort_link(@q, 'receipt_date')
|
||||||
|
%tbody
|
||||||
|
- @invoices.each do |x|
|
||||||
|
%tr
|
||||||
|
%td= link_to(t('invoice_no', no: x.id), [:admin, x])
|
||||||
|
%td= link_to(x.buyer_name, admin_registrar_path(x.buyer_id))
|
||||||
|
%td= l(x.due_date)
|
||||||
|
- if x.binded?
|
||||||
|
%td= l(x.receipt_date)
|
||||||
|
- else
|
||||||
|
%td.text-danger= t('unpaid')
|
||||||
|
.row
|
||||||
|
.col-md-12
|
||||||
|
= paginate @invoices
|
15
app/views/admin/invoices/show.haml
Normal file
15
app/views/admin/invoices/show.haml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
.row
|
||||||
|
.col-sm-6
|
||||||
|
%h1.text-center-xs
|
||||||
|
= t('invoice_no', no: @invoice.id)
|
||||||
|
.col-sm-6
|
||||||
|
%h1.text-right.text-center-xs
|
||||||
|
= link_to(t('back'), :back, class: 'btn btn-default')
|
||||||
|
%hr
|
||||||
|
.row
|
||||||
|
.col-md-6= render 'registrar/invoices/partials/details'
|
||||||
|
.row
|
||||||
|
.col-md-6= render 'registrar/invoices/partials/seller'
|
||||||
|
.col-md-6= render 'registrar/invoices/partials/buyer'
|
||||||
|
.row
|
||||||
|
.col-md-12= render 'registrar/invoices/partials/items'
|
|
@ -48,6 +48,7 @@
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t('billing')
|
%li.dropdown-header= t('billing')
|
||||||
%li= link_to t('bank_statements'), admin_bank_statements_path
|
%li= link_to t('bank_statements'), admin_bank_statements_path
|
||||||
|
%li= link_to t('invoices'), admin_invoices_path
|
||||||
%li.divider
|
%li.divider
|
||||||
%li.dropdown-header= t('system')
|
%li.dropdown-header= t('system')
|
||||||
%li= link_to t('settings'), admin_settings_path
|
%li= link_to t('settings'), admin_settings_path
|
||||||
|
|
|
@ -93,6 +93,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
resources :bank_transactions
|
resources :bank_transactions
|
||||||
|
|
||||||
|
resources :invoices
|
||||||
|
|
||||||
resources :domains do
|
resources :domains do
|
||||||
resources :domain_versions
|
resources :domain_versions
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue