-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
32 changed files
with
6,716 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register Billing::PackageCounter, as: 'Package Counters' do | ||
menu parent: 'Billing', label: 'Package Counters', priority: 11 | ||
|
||
actions :index, :show | ||
|
||
acts_as_export :id, | ||
[:account_name, proc { |row| row.account.try(:name) }], | ||
[:service_name, proc { |row| row.service.try(:name) }], | ||
:prefix, | ||
:exclude, | ||
:duration | ||
|
||
includes :account, :service | ||
|
||
filter :id | ||
account_filter :account_id_eq | ||
filter :service | ||
filter :prefix | ||
filter :duration | ||
filter :exclude | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
actions | ||
column :account | ||
column :service | ||
column :prefix | ||
column :exclude | ||
column :duration | ||
end | ||
|
||
show do | ||
attributes_table do | ||
row :id | ||
row :account | ||
row :service | ||
row :prefix | ||
row :exclude | ||
row :duration | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# frozen_string_literal: true | ||
|
||
# == Schema Information | ||
# | ||
# Table name: billing.package_counters | ||
# | ||
# id :bigint(8) not null, primary key | ||
# duration :integer(4) default(0), not null | ||
# exclude :boolean default(FALSE), not null | ||
# prefix :string not null | ||
# account_id :integer(4) not null | ||
# service_id :bigint(8) | ||
# | ||
# Indexes | ||
# | ||
# package_counters_account_id_idx (account_id) | ||
# package_counters_prefix_idx (((prefix)::prefix_range)) USING gist | ||
# package_counters_service_id_idx (service_id) | ||
# | ||
# Foreign Keys | ||
# | ||
# package_counters_account_id_fkey (account_id => accounts.id) | ||
# | ||
class Billing::PackageCounter < ApplicationRecord | ||
self.table_name = 'billing.package_counters' | ||
|
||
belongs_to :account, class_name: 'Account' | ||
belongs_to :service, class_name: 'Billing::Service', optional: true | ||
|
||
validates :duration, presence: true | ||
|
||
def display_name | ||
"PC##{id}" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# frozen_string_literal: true | ||
|
||
module Billing | ||
class PackageCounterPolicy < ::RolePolicy | ||
section 'Billing/PackageCounter' | ||
class Scope < ::RolePolicy::Scope | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.