smartkiosk-server 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +32 -0
- data/.rspec +1 -0
- data/Capfile +4 -0
- data/Gemfile +71 -0
- data/Gemfile.lock +439 -0
- data/Guardfile +25 -0
- data/LICENSE +287 -0
- data/README.md +13 -0
- data/Rakefile +5 -0
- data/app/acquirers/cards_mkb_acquirer.rb +87 -0
- data/app/acquirers/cash_acquirer.rb +22 -0
- data/app/admin/agents.rb +108 -0
- data/app/admin/collections.rb +62 -0
- data/app/admin/commissions.rb +87 -0
- data/app/admin/gateways.rb +183 -0
- data/app/admin/limits.rb +82 -0
- data/app/admin/payments.rb +246 -0
- data/app/admin/provider_groups.rb +60 -0
- data/app/admin/provider_profiles.rb +11 -0
- data/app/admin/provider_receipt_templates.rb +82 -0
- data/app/admin/providers.rb +201 -0
- data/app/admin/rebates.rb +83 -0
- data/app/admin/report_results.rb +66 -0
- data/app/admin/report_templates.rb +209 -0
- data/app/admin/reports.rb +158 -0
- data/app/admin/revisions.rb +120 -0
- data/app/admin/system_receipt_templates.rb +76 -0
- data/app/admin/terminal_builds.rb +39 -0
- data/app/admin/terminal_profiles.rb +123 -0
- data/app/admin/terminals.rb +388 -0
- data/app/admin/users.rb +117 -0
- data/app/admin/versions.rb +131 -0
- data/app/admin/welcome.rb +64 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.eot +0 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.svg +6386 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.ttf +0 -0
- data/app/assets/fonts/PT_Sans-Web-Bold.woff +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.eot +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.svg +5650 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.ttf +0 -0
- data/app/assets/fonts/PT_Sans-Web-Regular.woff +0 -0
- data/app/assets/images/chosen-sprite.png +0 -0
- data/app/assets/javascripts/active_admin/chosen.js.erb.coffee +12 -0
- data/app/assets/javascripts/active_admin/qtip.js.coffee +22 -0
- data/app/assets/javascripts/active_admin/sortable_forms.js.coffee +14 -0
- data/app/assets/javascripts/active_admin.js.coffee +9 -0
- data/app/assets/javascripts/application.js +15 -0
- data/app/assets/javascripts/report_templates.js.coffee +10 -0
- data/app/assets/javascripts/terminals.js.coffee +12 -0
- data/app/assets/stylesheets/active_admin/PIE.css.scss +18 -0
- data/app/assets/stylesheets/active_admin/filter_numeric_range.css.scss +14 -0
- data/app/assets/stylesheets/active_admin/selectable_check_boxes.css.scss +12 -0
- data/app/assets/stylesheets/active_admin/sortable_forms.css.scss +11 -0
- data/app/assets/stylesheets/active_admin.css.scss +705 -0
- data/app/assets/stylesheets/fonts.css.scss +14 -0
- data/app/assets/stylesheets/provider_groups.css.scss +12 -0
- data/app/assets/stylesheets/provider_receipt_templates.css.scss +12 -0
- data/app/assets/stylesheets/terminals.css.scss +9 -0
- data/app/controllers/application_controller.rb +12 -0
- data/app/controllers/collections_controller.rb +10 -0
- data/app/controllers/payments_controller.rb +73 -0
- data/app/controllers/system_receipt_templates_controller.rb +10 -0
- data/app/controllers/terminal_builds_controller.rb +5 -0
- data/app/controllers/terminal_orders_controller.rb +25 -0
- data/app/controllers/terminal_pings_controller.rb +45 -0
- data/app/controllers/welcome_controller.rb +5 -0
- data/app/helpers/active_admin/report_templates_helper.rb +56 -0
- data/app/helpers/active_admin/views_helper.rb +20 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/ability.rb +30 -0
- data/app/models/agent.rb +24 -0
- data/app/models/collection.rb +65 -0
- data/app/models/commission.rb +77 -0
- data/app/models/commission_section.rb +75 -0
- data/app/models/gateway.rb +99 -0
- data/app/models/gateway_attachment.rb +9 -0
- data/app/models/gateway_setting.rb +7 -0
- data/app/models/gateway_switch.rb +7 -0
- data/app/models/limit.rb +77 -0
- data/app/models/limit_section.rb +58 -0
- data/app/models/payment.rb +322 -0
- data/app/models/provider.rb +59 -0
- data/app/models/provider_field.rb +7 -0
- data/app/models/provider_gateway.rb +47 -0
- data/app/models/provider_group.rb +45 -0
- data/app/models/provider_profile.rb +9 -0
- data/app/models/provider_rebate.rb +69 -0
- data/app/models/provider_receipt_template.rb +85 -0
- data/app/models/rebate.rb +84 -0
- data/app/models/report.rb +71 -0
- data/app/models/report_result.rb +11 -0
- data/app/models/report_template.rb +56 -0
- data/app/models/revision.rb +104 -0
- data/app/models/role.rb +48 -0
- data/app/models/system_receipt_template.rb +13 -0
- data/app/models/terminal.rb +126 -0
- data/app/models/terminal_build.rb +62 -0
- data/app/models/terminal_order.rb +42 -0
- data/app/models/terminal_ping.rb +120 -0
- data/app/models/terminal_profile.rb +51 -0
- data/app/models/terminal_profile_promotion.rb +18 -0
- data/app/models/terminal_profile_provider.rb +11 -0
- data/app/models/terminal_profile_provider_group.rb +19 -0
- data/app/models/user.rb +38 -0
- data/app/models/user_role.rb +45 -0
- data/app/reports/agents_report.rb +81 -0
- data/app/reports/collections_report.rb +151 -0
- data/app/reports/payments_report.rb +189 -0
- data/app/reports/terminals_report.rb +123 -0
- data/app/uploaders/file_uploader.rb +53 -0
- data/app/uploaders/icon_uploader.rb +15 -0
- data/app/uploaders/zip_uploader.rb +53 -0
- data/app/views/admin/gateways/providers.html.arb +10 -0
- data/app/views/admin/revisions/payments.html.arb +28 -0
- data/app/views/admin/terminal_profiles/_tree.html.haml +35 -0
- data/app/views/admin/terminal_profiles/sort.html.haml +21 -0
- data/app/views/admin/terminals/pings.html.arb +55 -0
- data/app/views/admin/terminals/upgrade_build.html.arb +30 -0
- data/app/views/layouts/application.html.erb +1 -0
- data/app/views/welcome/index.html.erb +25 -0
- data/app/workers/pay_worker.rb +11 -0
- data/app/workers/report_worker.rb +7 -0
- data/app/workers/revise_worker.rb +7 -0
- data/config/acquiring.yml +13 -0
- data/config/application.rb +75 -0
- data/config/boot.rb +6 -0
- data/config/database.yml +17 -0
- data/config/deploy/roundlake-passenger.rb +3 -0
- data/config/deploy/roundlake-trinidad.rb +3 -0
- data/config/deploy.rb +37 -0
- data/config/environment.rb +5 -0
- data/config/environments/development.rb +39 -0
- data/config/environments/production.rb +67 -0
- data/config/environments/test.rb +37 -0
- data/config/initializers/active_admin.rb +31 -0
- data/config/initializers/backtrace_silencers.rb +7 -0
- data/config/initializers/devise.rb +232 -0
- data/config/initializers/inflections.rb +15 -0
- data/config/initializers/mime_types.rb +5 -0
- data/config/initializers/money.rb +6 -0
- data/config/initializers/redis.rb +4 -0
- data/config/initializers/secret_token.rb +7 -0
- data/config/initializers/session_store.rb +8 -0
- data/config/initializers/setup_rack.rb +1 -0
- data/config/initializers/wrap_parameters.rb +14 -0
- data/config/locales/active_admin.ru.yml +71 -0
- data/config/locales/activerecord.ru.yml +645 -0
- data/config/locales/devise.ru.yml +57 -0
- data/config/locales/ru.yml +33 -0
- data/config/locales/smartkiosk.gateways.ru.yml +241 -0
- data/config/locales/smartkiosk.hardware.ru.yml +38 -0
- data/config/locales/smartkiosk.reports.ru.yml +56 -0
- data/config/locales/smartkiosk.ru.yml +163 -0
- data/config/nginx.conf +9 -0
- data/config/redis.yml +9 -0
- data/config/routes.rb +48 -0
- data/config/schedule.rb +13 -0
- data/config/sidekiq.yml +5 -0
- data/config/trinidad.yml +6 -0
- data/config.ru +4 -0
- data/db/migrate/20120825083035_create_terminals.rb +47 -0
- data/db/migrate/20120825083305_create_payments.rb +51 -0
- data/db/migrate/20120827062618_devise_create_users.rb +50 -0
- data/db/migrate/20120827132621_create_admin_notes.rb +17 -0
- data/db/migrate/20120827132622_move_admin_notes_to_comments.rb +25 -0
- data/db/migrate/20120903193346_create_providers.rb +24 -0
- data/db/migrate/20120922075345_create_collections.rb +26 -0
- data/db/migrate/20120922080440_create_agents.rb +29 -0
- data/db/migrate/20120922081104_create_commissions.rb +10 -0
- data/db/migrate/20120927035841_create_gateways.rb +13 -0
- data/db/migrate/20120927040626_create_provider_gateways.rb +13 -0
- data/db/migrate/20120927091849_create_limits.rb +10 -0
- data/db/migrate/20120927164647_create_roles.rb +14 -0
- data/db/migrate/20121003131522_create_report_templates.rb +18 -0
- data/db/migrate/20121007135652_create_reports.rb +13 -0
- data/db/migrate/20121008073905_create_report_results.rb +10 -0
- data/db/migrate/20121017114538_create_gateway_settings.rb +12 -0
- data/db/migrate/20121017114556_create_gateway_attachments.rb +10 -0
- data/db/migrate/20121019132606_create_revisions.rb +19 -0
- data/db/migrate/20121023073501_create_gateway_switches.rb +10 -0
- data/db/migrate/20121112142743_create_terminal_orders.rb +13 -0
- data/db/migrate/20121118191553_create_versions.rb +19 -0
- data/db/migrate/20121125093414_create_system_receipt_templates.rb +9 -0
- data/db/migrate/20121127192257_create_terminal_builds.rb +10 -0
- data/db/migrate/20121212053441_create_rebates.rb +15 -0
- data/db/migrate/20121216143855_create_provider_receipt_templates.rb +9 -0
- data/db/migrate/20130101091100_create_terminal_profiles.rb +13 -0
- data/db/migrate/20130101091734_create_provider_rebates.rb +21 -0
- data/db/migrate/20130102164447_create_limit_sections.rb +14 -0
- data/db/migrate/20130102164503_create_commission_sections.rb +17 -0
- data/db/migrate/20130102171743_create_provider_profiles.rb +10 -0
- data/db/migrate/20130103152507_create_provider_fields.rb +17 -0
- data/db/migrate/20130103154526_create_provider_groups.rb +10 -0
- data/db/migrate/20130104063628_create_terminal_profile_providers.rb +11 -0
- data/db/migrate/20130104090957_create_terminal_profile_provider_groups.rb +11 -0
- data/db/migrate/20130108091644_create_terminal_profile_promotions.rb +10 -0
- data/db/schema.rb +489 -0
- data/db/seeds/receipt_templates/payment.txt +19 -0
- data/db/seeds/receipt_templates/system/balance.txt +13 -0
- data/db/seeds/receipt_templates/system/collection.txt +17 -0
- data/db/seeds/receipt_templates/system/touchtest.txt +15 -0
- data/db/seeds.rb +18 -0
- data/doc/README_FOR_APP +2 -0
- data/init.rb +1 -0
- data/lib/active_admin/cancan_integration.rb +81 -0
- data/lib/active_admin/form_builder_fix.rb +76 -0
- data/lib/active_admin/inputs/filter_date_range_input_fix.rb +24 -0
- data/lib/active_admin/inputs/filter_multiple_select_input.rb +18 -0
- data/lib/active_admin/inputs/filter_numeric_range_input.rb +31 -0
- data/lib/active_admin/resource_controller_fix.rb +23 -0
- data/lib/active_admin/views/pages/base_fix.rb +13 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/blueprints.rb +79 -0
- data/lib/date_expander.rb +38 -0
- data/lib/dav4rack/build_resource.rb +59 -0
- data/lib/formtastic/inputs/selectable_check_boxes.rb +39 -0
- data/lib/paper_trail/version_fix.rb +3 -0
- data/lib/report_builder.rb +88 -0
- data/lib/seeder.rb +103 -0
- data/lib/smartkiosk/server/version.rb +5 -0
- data/lib/smartkiosk/server.rb +35 -0
- data/lib/string_file.rb +12 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/db.rake +27 -0
- data/lib/tasks/dump.rake +53 -0
- data/lib/tasks/matrioshka.rake +16 -0
- data/log/.gitkeep +0 -0
- data/log/gateways/.gitkeep +0 -0
- data/public/404.html +26 -0
- data/public/422.html +26 -0
- data/public/500.html +25 -0
- data/public/robots.txt +5 -0
- data/script/rails +6 -0
- data/smartkiosk-server.gemspec +23 -0
- data/spec/controllers/collections_controller_spec.rb +32 -0
- data/spec/controllers/payments_controller_spec.rb +123 -0
- data/spec/controllers/system_receipt_templates_controller_spec.rb +5 -0
- data/spec/controllers/terminal_builds_controller_spec.rb +5 -0
- data/spec/controllers/terminal_orders_controller_spec.rb +32 -0
- data/spec/controllers/terminal_pings_controller_spec.rb +31 -0
- data/spec/spec_helper.rb +66 -0
- data/vendor/assets/javascripts/.gitkeep +0 -0
- data/vendor/assets/javascripts/chosen.jquery.js +1026 -0
- data/vendor/assets/javascripts/datepicker-ru.jquery.js +21 -0
- data/vendor/assets/javascripts/nestedSortable.jquery.js +429 -0
- data/vendor/assets/javascripts/qtip.jquery.js +3403 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/chosen.jquery.css +397 -0
- data/vendor/assets/stylesheets/modules/PIE.htc +96 -0
- data/vendor/assets/stylesheets/qtip.jquery.css.scss +604 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +333 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
ActiveAdmin.register Report do
|
2
|
+
actions :new, :create, :index, :show, :destroy
|
3
|
+
|
4
|
+
menu :parent => I18n.t('activerecord.models.report.other'),
|
5
|
+
:label => I18n.t('smartkiosk.admin.menu.manage'),
|
6
|
+
:priority => 1,
|
7
|
+
:if => proc { can? :index, Report }
|
8
|
+
|
9
|
+
controller do
|
10
|
+
before_filter :only => :create do
|
11
|
+
params[:report][:user_id] = current_user.id
|
12
|
+
end
|
13
|
+
|
14
|
+
def scoped_collection
|
15
|
+
scope = Report.includes(:report_template, :report_results)
|
16
|
+
|
17
|
+
unless current_user.root
|
18
|
+
r = Report.arel_table
|
19
|
+
t = ReportTemplate.arel_table
|
20
|
+
|
21
|
+
scope = scope.where(t[:open].eq(true).or t[:user_id].eq(current_user.id))
|
22
|
+
end
|
23
|
+
|
24
|
+
scope
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
member_action :refresh, :method => :post do
|
29
|
+
report = Report.find(params[:id])
|
30
|
+
report.enqueue!
|
31
|
+
redirect_to [:admin, report]
|
32
|
+
end
|
33
|
+
|
34
|
+
#
|
35
|
+
# INDEX
|
36
|
+
#
|
37
|
+
filter :report_template, :as => 'multiple_select', :input_html => { :class => 'chosen' }
|
38
|
+
filter :user, :as => 'multiple_select', :input_html => { :class => 'chosen' }
|
39
|
+
filter :state, :as => 'multiple_select',
|
40
|
+
:input_html => { :class => 'chosen' },
|
41
|
+
:collection => proc { I18n.t("smartkiosk.reports.states").invert }
|
42
|
+
filter :start
|
43
|
+
filter :finish
|
44
|
+
|
45
|
+
index do
|
46
|
+
column :id, :sortable => :id do |x|
|
47
|
+
link_to x.id, [:admin, x]
|
48
|
+
end
|
49
|
+
column :report_template
|
50
|
+
column :user
|
51
|
+
column :state do |r|
|
52
|
+
condition = :ok
|
53
|
+
condition = :warning if r.state == 'queue'
|
54
|
+
condition = :error if r.state == 'error'
|
55
|
+
status_tag I18n.t("smartkiosk.reports.states.#{r.state}"), condition
|
56
|
+
end
|
57
|
+
column :start
|
58
|
+
column :finish
|
59
|
+
column :created_at
|
60
|
+
default_actions do |r|
|
61
|
+
unless r.report_results.first.blank?
|
62
|
+
link_to I18n.t('smartkiosk.admin.actions.report_results.excel'),
|
63
|
+
excel_admin_report_result_path(r.report_results.first)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# SHOW
|
70
|
+
#
|
71
|
+
action_item :only => [:show], :if => proc { ['done', 'error'].include? report.state } do
|
72
|
+
link_to I18n.t('smartkiosk.admin.actions.reports.refresh'),
|
73
|
+
refresh_admin_report_path(report), :method => :post
|
74
|
+
end
|
75
|
+
|
76
|
+
action_item :only => [:show], :if => proc { !report.report_results.first.blank? } do
|
77
|
+
link_to I18n.t('smartkiosk.admin.actions.report_results.excel'),
|
78
|
+
excel_admin_report_result_path(report.report_results.first)
|
79
|
+
end
|
80
|
+
|
81
|
+
|
82
|
+
show do
|
83
|
+
attributes_table do
|
84
|
+
row :report_template
|
85
|
+
row :user
|
86
|
+
row :state do |r|
|
87
|
+
condition = :ok
|
88
|
+
condition = :warning if r.state == 'queue'
|
89
|
+
condition = :error if r.state == 'error'
|
90
|
+
status_tag I18n.t("smartkiosk.reports.states.#{r.state}"), condition
|
91
|
+
end
|
92
|
+
row :start
|
93
|
+
row :finish
|
94
|
+
row :created_at
|
95
|
+
end
|
96
|
+
|
97
|
+
if report.report_results.count > 0
|
98
|
+
panel I18n.t('activerecord.models.report_result.other') do
|
99
|
+
table_for(report.report_results, :i18n => ReportResult) do |t|
|
100
|
+
t.column :created_at do |rr|
|
101
|
+
link_to I18n.l(rr.created_at, :format => :short), admin_report_result_path(rr)
|
102
|
+
end
|
103
|
+
t.column :rows
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
if report.state == 'done'
|
109
|
+
result = report.report_results.first
|
110
|
+
|
111
|
+
panel "#{I18n.t 'smartkiosk.admin.panels.reports.last_result'} (#{result.rows})" do
|
112
|
+
result = result.data
|
113
|
+
unless result.blank?
|
114
|
+
fields = result.first.keys
|
115
|
+
table do
|
116
|
+
tr do
|
117
|
+
fields.each do |field|
|
118
|
+
data = field.split('.')
|
119
|
+
|
120
|
+
if data.first == 'calculations'
|
121
|
+
field = I18n.t "smartkiosk.reports.data.#{report.report_template.kind}.calculations.#{data.last}"
|
122
|
+
else
|
123
|
+
field = localize_report_fields(field)[0]
|
124
|
+
end
|
125
|
+
|
126
|
+
th field
|
127
|
+
end
|
128
|
+
end
|
129
|
+
result.each do |row|
|
130
|
+
tr do
|
131
|
+
fields.each do |field|
|
132
|
+
td row[field]
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
panel 'SQL' do
|
142
|
+
para report.report_builder.query
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# FORM
|
148
|
+
#
|
149
|
+
form do |f|
|
150
|
+
f.inputs do
|
151
|
+
f.input :report_template, :input_html => { :class => 'chosen' }
|
152
|
+
f.input :start, :as => :datepicker
|
153
|
+
f.input :finish, :as => :datepicker
|
154
|
+
end
|
155
|
+
|
156
|
+
f.actions
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
ActiveAdmin.register Revision do
|
2
|
+
actions :index, :show, :new, :create, :destroy
|
3
|
+
|
4
|
+
menu :parent => I18n.t('activerecord.models.gateway.other'),
|
5
|
+
:if => proc { can? :index, Revision }
|
6
|
+
|
7
|
+
member_action :payments, :title => I18n.t('smartkiosk.admin.actions.revisions.payments') do
|
8
|
+
@revision = Revision.find(params[:id])
|
9
|
+
@payments = @revision.payments.page(params[:page]).per(100)
|
10
|
+
end
|
11
|
+
|
12
|
+
member_action :moderate do
|
13
|
+
@revision = Revision.find(params[:id])
|
14
|
+
@revision.moderate!
|
15
|
+
redirect_to [:admin, @revision]
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# INDEX
|
20
|
+
#
|
21
|
+
batch_action I18n.t('smartkiosk.admin.actions.revisions.approve') do |selection|
|
22
|
+
Revision.find(selection).each{|r| r.moderate!}
|
23
|
+
redirect_to :back
|
24
|
+
end
|
25
|
+
|
26
|
+
scope I18n.t('active_admin.all'), :all
|
27
|
+
scope I18n.t('activerecord.scopes.revision.unmoderated'), :unmoderated
|
28
|
+
scope I18n.t('activerecord.scopes.revision.error'), :error
|
29
|
+
|
30
|
+
filter :id
|
31
|
+
filter :moderated, :as => 'select', :input_html => { :class => 'chosen' }
|
32
|
+
filter :gateway, :as => 'multiple_select', :input_html => { :class => 'chosen' }
|
33
|
+
filter :date
|
34
|
+
filter :state, :as => 'multiple_select', :collection => proc { I18n.t('smartkiosk.revision_states').invert }, :input_html => { :class => 'chosen' }
|
35
|
+
filter :payments_count, :as => 'numeric_range'
|
36
|
+
filter :paid_sum, :as => 'numeric_range'
|
37
|
+
filter :enrolled_sum, :as => 'numeric_range'
|
38
|
+
filter :commission_sum, :as => 'numeric_range'
|
39
|
+
|
40
|
+
index do
|
41
|
+
selectable_column
|
42
|
+
column :id, :sortable => :id do |x|
|
43
|
+
link_to x.id, [:admin, x]
|
44
|
+
end
|
45
|
+
column :gateway
|
46
|
+
column :date
|
47
|
+
column :state do |x|
|
48
|
+
type = 'warning'
|
49
|
+
type = 'error' if x.state == 'error'
|
50
|
+
type = 'ok' if x.state == 'done'
|
51
|
+
type = nil if x.state == 'new'
|
52
|
+
|
53
|
+
status_tag I18n.t("smartkiosk.revision_states.#{x.state}"), type
|
54
|
+
end
|
55
|
+
column :moderated do |x|
|
56
|
+
status_boolean(self, x.moderated?)
|
57
|
+
end
|
58
|
+
column :payments_count
|
59
|
+
column :paid_sum
|
60
|
+
column :enrolled_sum
|
61
|
+
default_actions
|
62
|
+
end
|
63
|
+
|
64
|
+
#
|
65
|
+
# SHOW
|
66
|
+
#
|
67
|
+
action_item :only => [:show] do
|
68
|
+
link_to I18n.t('smartkiosk.admin.actions.revisions.payments'),
|
69
|
+
payments_admin_revision_path(revision)
|
70
|
+
end
|
71
|
+
|
72
|
+
action_item :only => [:show], :if => proc{!revision.moderated?} do
|
73
|
+
link_to I18n.t('smartkiosk.admin.actions.revisions.approve'),
|
74
|
+
moderate_admin_revision_path(revision)
|
75
|
+
end
|
76
|
+
|
77
|
+
show do
|
78
|
+
attributes_table do
|
79
|
+
row :id
|
80
|
+
row :gateway
|
81
|
+
row :date
|
82
|
+
row :state do |x|
|
83
|
+
type = 'warning'
|
84
|
+
type = 'error' if x.state == 'error'
|
85
|
+
type = 'ok' if x.state == 'done'
|
86
|
+
type = nil if x.state == 'new'
|
87
|
+
|
88
|
+
status_tag I18n.t("smartkiosk.revision_states.#{x.state}"), type
|
89
|
+
end
|
90
|
+
row :moderated do |x|
|
91
|
+
status_boolean(self, x.moderated?)
|
92
|
+
end
|
93
|
+
row :payments_count
|
94
|
+
row :paid_sum
|
95
|
+
row :enrolled_sum
|
96
|
+
row :commission_sum
|
97
|
+
row :error do |x|
|
98
|
+
unless x.error.blank?
|
99
|
+
I18n.t("smartkiosk.gateways.#{x.gateway.keyword}.errors")[x.error]
|
100
|
+
end
|
101
|
+
end
|
102
|
+
row :data do |x|
|
103
|
+
link_to(File.basename(x.data.path), x.data.url)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
active_admin_comments
|
108
|
+
end
|
109
|
+
|
110
|
+
#
|
111
|
+
# FORM
|
112
|
+
#
|
113
|
+
form do |f|
|
114
|
+
f.inputs do
|
115
|
+
f.input :gateway, :input_html => {:class => 'chosen'}
|
116
|
+
f.input :date, :as => :datepicker
|
117
|
+
end
|
118
|
+
f.actions
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
ActiveAdmin.register SystemReceiptTemplate do
|
2
|
+
config.batch_actions = false
|
3
|
+
|
4
|
+
actions :index, :show, :edit
|
5
|
+
|
6
|
+
menu :parent => I18n.t('activerecord.models.terminal.other'),
|
7
|
+
:priority => 30,
|
8
|
+
:if => proc { can? :index, SystemReceiptTemplate }
|
9
|
+
|
10
|
+
#
|
11
|
+
# INDEX
|
12
|
+
#
|
13
|
+
filter :keyword, :as => 'multiple_select',
|
14
|
+
:collection => proc { I18n.t('smartkiosk.system_receipt_templates').invert },
|
15
|
+
:input_html => { :class => 'chosen' }
|
16
|
+
filter :updated_at
|
17
|
+
|
18
|
+
index do
|
19
|
+
column :keyword do |x|
|
20
|
+
x.title
|
21
|
+
end
|
22
|
+
column :updated_at
|
23
|
+
column '' do |resource|
|
24
|
+
links = []
|
25
|
+
|
26
|
+
links << link_to(
|
27
|
+
I18n.t('active_admin.view'), resource_path(resource),
|
28
|
+
:class => 'member_link view_link'
|
29
|
+
)
|
30
|
+
|
31
|
+
links << link_to(
|
32
|
+
I18n.t('active_admin.edit'), edit_resource_path(resource),
|
33
|
+
:class => 'member_link view_link'
|
34
|
+
)
|
35
|
+
|
36
|
+
if can?(:destroy, resource)
|
37
|
+
links << link_to(
|
38
|
+
I18n.t('active_admin.delete'), resource_path(resource),
|
39
|
+
:class => 'member_link view_link',
|
40
|
+
:method => :delete
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
links.join(' ').html_safe
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
#
|
49
|
+
# SHOW
|
50
|
+
#
|
51
|
+
show do |rt|
|
52
|
+
attributes_table do
|
53
|
+
row :keyword do
|
54
|
+
rt.title
|
55
|
+
end
|
56
|
+
row :template do
|
57
|
+
pre rt.template
|
58
|
+
end
|
59
|
+
row :updated_at
|
60
|
+
end
|
61
|
+
|
62
|
+
active_admin_comments
|
63
|
+
end
|
64
|
+
|
65
|
+
#
|
66
|
+
# FORM
|
67
|
+
#
|
68
|
+
form do |f|
|
69
|
+
f.inputs do
|
70
|
+
f.input :template, :input_html => {
|
71
|
+
:style => 'font-family: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace'
|
72
|
+
}
|
73
|
+
end
|
74
|
+
f.actions
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
ActiveAdmin.register TerminalBuild do
|
2
|
+
|
3
|
+
menu :parent => I18n.t('activerecord.models.terminal.other'),
|
4
|
+
:priority => 21,
|
5
|
+
:if => proc { can? :index, TerminalBuild }
|
6
|
+
|
7
|
+
index do
|
8
|
+
selectable_column
|
9
|
+
column :id
|
10
|
+
column :version
|
11
|
+
column :source do |tb|
|
12
|
+
link_to File.basename(tb.source.path), tb.source.url
|
13
|
+
end
|
14
|
+
column :created_at
|
15
|
+
column :updated_at
|
16
|
+
default_actions
|
17
|
+
end
|
18
|
+
|
19
|
+
show do
|
20
|
+
attributes_table do
|
21
|
+
row :id
|
22
|
+
row :version
|
23
|
+
row :source do |tb|
|
24
|
+
link_to File.basename(tb.source.path), tb.source.url
|
25
|
+
end
|
26
|
+
row :created_at
|
27
|
+
row :updated_at
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
form do |f|
|
32
|
+
f.semantic_errors
|
33
|
+
f.inputs do
|
34
|
+
f.input :source
|
35
|
+
end
|
36
|
+
f.actions
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
ActiveAdmin.register TerminalProfile do
|
2
|
+
|
3
|
+
menu :parent => I18n.t('activerecord.models.terminal.other'),
|
4
|
+
:priority => 2,
|
5
|
+
:if => proc { can? :index, TerminalProfile }
|
6
|
+
|
7
|
+
controller do
|
8
|
+
before_filter(:only => [:create, :update]) do
|
9
|
+
@groups = {}
|
10
|
+
@providers = {}
|
11
|
+
|
12
|
+
if x = params[:terminal_profile_provider_groups]
|
13
|
+
x.each_with_index do |value, i|
|
14
|
+
@groups[value.delete(:provider_group_id)] = value
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
if x = params[:terminal_profile_providers]
|
19
|
+
x.each_with_index do |value, i|
|
20
|
+
@providers[value.delete(:provider_id)] = value
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
after_filter(:only => [:create, :update]) do
|
26
|
+
# GROUPS
|
27
|
+
current = @terminal_profile.terminal_profile_provider_groups
|
28
|
+
|
29
|
+
current.each do |x|
|
30
|
+
attributes = @groups.delete(x.provider_group_id.to_s)
|
31
|
+
|
32
|
+
if attributes.blank?
|
33
|
+
x.destroy
|
34
|
+
else
|
35
|
+
x.update_attributes(attributes)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
excludes = ProviderGroup.select(:id).where(:id => @groups.keys).map{|x| x.id.to_s}
|
40
|
+
excludes = @groups.keys - excludes
|
41
|
+
|
42
|
+
@groups.each do |provider_group_id, attributes|
|
43
|
+
TerminalProfileProviderGroup.create! attributes.merge(
|
44
|
+
:terminal_profile => @terminal_profile,
|
45
|
+
:provider_group_id => provider_group_id
|
46
|
+
) unless excludes.include?(provider_group_id)
|
47
|
+
end
|
48
|
+
|
49
|
+
# PROVIDERS
|
50
|
+
current = @terminal_profile.terminal_profile_providers
|
51
|
+
|
52
|
+
current.each do |x|
|
53
|
+
attributes = @providers.delete(x.provider_id.to_s)
|
54
|
+
|
55
|
+
if attributes.blank?
|
56
|
+
x.destroy
|
57
|
+
else
|
58
|
+
x.update_attributes(attributes)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
excludes = Provider.select(:id).where(:id => @providers.keys).map{|x| x.id.to_s}
|
63
|
+
excludes = @providers.keys - excludes
|
64
|
+
|
65
|
+
@providers.each do |provider_id, attributes|
|
66
|
+
TerminalProfileProvider.create! attributes.merge(
|
67
|
+
:terminal_profile => @terminal_profile,
|
68
|
+
:provider_id => provider_id
|
69
|
+
) unless Provider.find_by_id(provider_id).blank?
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
member_action :sort, :title => I18n.t('smartkiosk.admin.actions.terminal_profiles.sort')
|
75
|
+
|
76
|
+
#
|
77
|
+
# SHOW
|
78
|
+
#
|
79
|
+
action_item :only => [:show, :edit] do
|
80
|
+
link_to I18n.t('smartkiosk.admin.actions.terminal_profiles.sort'),
|
81
|
+
sort_admin_terminal_profile_path(terminal_profile)
|
82
|
+
end
|
83
|
+
|
84
|
+
show do
|
85
|
+
attributes_table do
|
86
|
+
row :title
|
87
|
+
row :support_phone
|
88
|
+
row :logo do
|
89
|
+
image_tag(terminal_profile.logo) unless terminal_profile.logo.blank?
|
90
|
+
end
|
91
|
+
row :created_at
|
92
|
+
row :updated_at
|
93
|
+
end
|
94
|
+
|
95
|
+
active_admin_comments
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# FORM
|
100
|
+
#
|
101
|
+
form :html => { :enctype => "multipart/form-data" } do
|
102
|
+
active_admin_form_for [:admin, terminal_profile] do |f|
|
103
|
+
f.inputs do
|
104
|
+
f.input :title
|
105
|
+
f.input :support_phone
|
106
|
+
f.input :logo, :hint => (f.template.image_tag(terminal_profile.logo).html_safe unless terminal_profile.logo.blank?)
|
107
|
+
end
|
108
|
+
|
109
|
+
f.inputs do
|
110
|
+
f.has_many :terminal_profile_promotions, :sortable => :priority do |ftpp|
|
111
|
+
ftpp.input :provider, :collection => Provider.rmap, :input_html => { :class => 'chosen' }
|
112
|
+
ftpp.input :priority, :as => :hidden
|
113
|
+
unless ftpp.object.new_record?
|
114
|
+
ftpp.input :_destroy, :as => :boolean, :label => I18n.t('active_admin.delete')
|
115
|
+
end
|
116
|
+
ftpp.form_buffers.last
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
f.actions
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|