mirror of
https://github.com/internetee/registry.git
synced 2025-08-11 03:59:33 +02:00
Merge pull request #2430 from internetee/handle-monthly-invoice-status
Added monthly status to invoices
This commit is contained in:
commit
6d80894421
5 changed files with 13 additions and 2 deletions
|
@ -81,18 +81,24 @@ module Admin
|
||||||
payment_order.update(notes: 'Cancelled')
|
payment_order.update(notes: 'Cancelled')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/MethodLength
|
||||||
def filter_by_status
|
def filter_by_status
|
||||||
case params[:status]
|
case params[:status]
|
||||||
when 'Paid'
|
when 'Paid'
|
||||||
Invoice.includes(:account_activity, :buyer).where.not(account_activity: { id: nil })
|
Invoice.includes(:account_activity, :buyer).where.not(account_activity: { id: nil })
|
||||||
when 'Unpaid'
|
when 'Unpaid'
|
||||||
Invoice.includes(:account_activity, :buyer).where(account_activity: { id: nil })
|
Invoice.includes(:account_activity, :buyer).where(account_activity: { id: nil },
|
||||||
|
cancelled_at: nil,
|
||||||
|
monthly_invoice: false)
|
||||||
when 'Cancelled'
|
when 'Cancelled'
|
||||||
Invoice.includes(:account_activity, :buyer).where.not(cancelled_at: nil)
|
Invoice.includes(:account_activity, :buyer).where.not(cancelled_at: nil)
|
||||||
|
when 'Monthly'
|
||||||
|
Invoice.where(monthly_invoice: true, cancelled_at: nil)
|
||||||
else
|
else
|
||||||
Invoice.includes(:account_activity, :buyer)
|
Invoice.includes(:account_activity, :buyer)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/MethodLength
|
||||||
|
|
||||||
def filter_by_receipt_date(invoices)
|
def filter_by_receipt_date(invoices)
|
||||||
date_from_param = params[:q][:receipt_date_gteq] if params[:q][:receipt_date_gteq].present?
|
date_from_param = params[:q][:receipt_date_gteq] if params[:q][:receipt_date_gteq].present?
|
||||||
|
|
|
@ -97,6 +97,7 @@ module Repp
|
||||||
account_activity_id_not_null
|
account_activity_id_not_null
|
||||||
account_activity_id_null cancelled_at_null
|
account_activity_id_null cancelled_at_null
|
||||||
cancelled_at_not_null number_gteq number_lteq
|
cancelled_at_not_null number_gteq number_lteq
|
||||||
|
monthly_invoice_true monthly_invoice_false
|
||||||
total_gteq total_lteq s] + [s: []])
|
total_gteq total_lteq s] + [s: []])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.label t(:status) %>
|
<%= f.label t(:status) %>
|
||||||
<%= select_tag :status, options_for_select(%w(Paid Unpaid Cancelled),params[:status]),
|
<%= select_tag :status, options_for_select(%w(Paid Unpaid Cancelled Monthly),params[:status]),
|
||||||
{ multiple: false, include_blank: true, selected: params[:status], class: 'form-control selectize'} %>
|
{ multiple: false, include_blank: true, selected: params[:status], class: 'form-control selectize'} %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
%td= l invoice.receipt_date
|
%td= l invoice.receipt_date
|
||||||
- elsif invoice.cancelled?
|
- elsif invoice.cancelled?
|
||||||
%td.text-grey= t(:cancelled)
|
%td.text-grey= t(:cancelled)
|
||||||
|
- elsif invoice.monthly_invoice
|
||||||
|
%td= l invoice.issue_date
|
||||||
- else
|
- else
|
||||||
%td.text-danger= t(:unpaid)
|
%td.text-danger= t(:unpaid)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
%dd= l @invoice.receipt_date
|
%dd= l @invoice.receipt_date
|
||||||
- elsif @invoice.cancelled?
|
- elsif @invoice.cancelled?
|
||||||
%dd.text-grey= t(:cancelled)
|
%dd.text-grey= t(:cancelled)
|
||||||
|
- elsif @invoice.monthly_invoice
|
||||||
|
%dd= l @invoice.issue_date
|
||||||
- else
|
- else
|
||||||
%dd{class: 'text-danger'}= t(:unpaid)
|
%dd{class: 'text-danger'}= t(:unpaid)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue