phcdevworks_accounts_stripe 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d712843541988e1cf6d5662452ce468800d5b2c9ed9b0042aaa604229abc33b
4
- data.tar.gz: 8ddbe4ee2dcfcce7116cc3434f92cf89befa1d4e19934035bb1c8f2e39032218
3
+ metadata.gz: 82d2d39bb0348290ee38b13dc52ccd9d7f04b60036221c9fd0aa2e5e103f6bfd
4
+ data.tar.gz: 80e34a15c18d1e803600fb217334da814b684bf14b63b58a8dfeec76ff6cbc24
5
5
  SHA512:
6
- metadata.gz: 6d7a66c0ac3a7eb6d4baaa92651c61b56aa55811ad1455e484014dc518222038eeadb8174b6d8af687e929a0be6144d3f89037056676d682c5e712a12b60dccb
7
- data.tar.gz: 9ff61ec8fa79f3267122594467eb637a32138c1868ed1dd0efcf238559ec38c1ef67dd1adeceb9b8ab5bc70d4b53a1ac704c8e64f55349f6050dc771446b8fbe
6
+ metadata.gz: f04a57394cbb17bb44310e2601ac01ca3b02e99cefee26ececd5f345f857f4ebe27f2b2813edf9af9926119d9124d8ba394ff0d19eca028e2745313986d69cd4
7
+ data.tar.gz: 36908e9861afa97086eff3902b1ec0f58b7ff1c84dbeca9da58898c244e427e8867edda756786e567bddd7a228b7aea6b413590517177040d7736e8b1ee7c8f5
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the admin/invoices controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: https://sass-lang.com/
@@ -0,0 +1,17 @@
1
+ require_dependency "phcdevworks_accounts_stripe/application_controller"
2
+
3
+ module PhcdevworksAccountsStripe
4
+ class Admin::InvoicesController < ApplicationController
5
+
6
+ # Filters
7
+ before_action :authenticate_user!
8
+ include PhcdevworksCore::PhcdevworksPluginsHelper
9
+ before_action :phcdevworks_accounts_admin_only
10
+
11
+ # Customers - List
12
+ def admin_invoice_list
13
+ @admin_invoice_list = Stripe::Invoice.list({limit: 100})
14
+ end
15
+
16
+ end
17
+ end
@@ -7,7 +7,7 @@ module PhcdevworksAccountsStripe
7
7
  before_action :authenticate_user!
8
8
 
9
9
  def user_invoice_list
10
- @user_invoice_list = Stripe::Invoice.list({customer: current_user.stripe_customer_id})
10
+ @user_invoice_list = Stripe::Invoice.list({customer: current_user.payments_customer_id})
11
11
  end
12
12
 
13
13
  def user_invoice_item
@@ -7,7 +7,7 @@ module PhcdevworksAccountsStripe
7
7
  before_action :authenticate_user!
8
8
 
9
9
  def user_subscription_item
10
- @user_subscription_item = Stripe::Subscription.list({customer: current_user.stripe_customer_id})
10
+ @user_subscription_item = Stripe::Subscription.list({customer: current_user.payments_customer_id})
11
11
 
12
12
  end
13
13
 
@@ -0,0 +1,4 @@
1
+ module PhcdevworksAccountsStripe
2
+ module Admin::InvoicesHelper
3
+ end
4
+ end
@@ -277,14 +277,49 @@
277
277
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Core Modules -->
278
278
  <% end %>
279
279
 
280
- <li class="nav-header">Administration</li>
281
280
  <% if current_user && current_user.admin? %>
281
+ <li class="nav-header">Administration</li>
282
+ <% if defined?phcdevworks_accounts_stripe %>
283
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
284
+ <li class="has-sub">
285
+ <a href="javascript:;">
286
+ <b class="caret"></b>
287
+ <i class="fab fa-cc-visa"></i>
288
+ <span>Accounting</span>
289
+ </a>
290
+ <ul class="sub-menu">
291
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Invoices", phcdevworks_accounts_stripe.admin_invoices_path) %></li>
292
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Subscriptions", phcdevworks_accounts_stripe.admin_subscriptions_path) %></li>
293
+ </ul>
294
+ </li>
295
+ <li class="has-sub">
296
+ <a href="javascript:;">
297
+ <b class="caret"></b>
298
+ <i class="fad fa-money-check-alt"></i>
299
+ <span>Services</span>
300
+ </a>
301
+ <ul class="sub-menu">
302
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_products_list") %>"><%= link_to("Product List", phcdevworks_accounts_stripe.admin_products_path) %></li>
303
+ </ul>
304
+ </li>
305
+ <li class="has-sub">
306
+ <a href="javascript:;">
307
+ <b class="caret"></b>
308
+ <i class="fad fa-users"></i>
309
+ <span>Customers</span>
310
+ </a>
311
+ <ul class="sub-menu">
312
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/customers#admin_customer_list") %>"><%= link_to("Customer List", phcdevworks_accounts_stripe.admin_customers_path) %></li>
313
+ </ul>
314
+ </li>
315
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
316
+ <% end %>
282
317
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts Admin Options -->
283
318
  <li class="has-sub">
284
319
  <a href="javascript:;">
285
320
  <b class="caret"></b>
286
- <i class="fad fa-user"></i>
287
- <span>User Auth</span>
321
+ <i class="fad fa-user-lock"></i>
322
+ <span>User Logins</span>
288
323
  </a>
289
324
  <ul class="sub-menu">
290
325
  <li class="<%= phc_menu_active_controller("phcdevworks_accounts/admin/users") %>"><%= link_to "User List", phcdevworks_accounts.admin_users_all_path %></li>
@@ -294,13 +329,40 @@
294
329
  <% end %>
295
330
 
296
331
  <li class="nav-header">Your Account</li>
332
+ <% if defined?phcdevworks_accounts_stripe && current_user %>
333
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
334
+ <li class="has-sub">
335
+ <a href="javascript:;">
336
+ <b class="caret"></b>
337
+ <i class="fad fa-money-check-alt"></i>
338
+ <span>Your Subscription</span>
339
+ </a>
340
+ <ul class="sub-menu">
341
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/subscriptions#admin_subscription_list") %>"><%= link_to("Your Subscription", phcdevworks_accounts_stripe.user_subscription_path) %></li>
342
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/admin/products#admin_product_list") %>"><%= link_to("Switch Subscriptions", phcdevworks_accounts_stripe.user_subscription_path) %></li>
343
+ </ul>
344
+ </li>
345
+ <li class="has-sub">
346
+ <a href="javascript:;">
347
+ <b class="caret"></b>
348
+ <i class="fad fa-file-invoice"></i>
349
+ <span>Your Invoices</span>
350
+ </a>
351
+ <ul class="sub-menu">
352
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Current Invoice", phcdevworks_accounts_stripe.user_invoices_path) %></li>
353
+ <li class="<%= phc_menu_active_controller("phcdevworks_accounts_stripe/user/invoices#admin_customer_list") %>"><%= link_to("Past Invoices", phcdevworks_accounts_stripe.admin_customers_path) %></li>
354
+ </ul>
355
+ </li>
356
+ <!-- -PHC- Sidebar - Sidebar Navigation - PHCDevworks Accounts Stripe -->
357
+ <% end %>
358
+
297
359
  <% if current_user %>
298
360
  <!-- -PHC- Sidebar - Sidebar Navigation - PHCAccounts User Options -->
299
361
  <li class="has-sub">
300
362
  <a href="javascript:;">
301
363
  <b class="caret"></b>
302
364
  <i class="fad fa-user"></i>
303
- <span>Accounts Settings</span>
365
+ <span>Login Settings</span>
304
366
  </a>
305
367
  <ul class="sub-menu">
306
368
  <li class="<%= phc_menu_active_controller("phcdevworks_accounts/user/edit") %>"><%= link_to "Settings", phcdevworks_accounts.edit_user_registration_path %></li>
@@ -0,0 +1,89 @@
1
+ <!-- PHCTitleSEO Title Variables -->
2
+ <% phc_title "Invoice Manager" %>
3
+ <% phc_title_tagline "Stripe Invoice List" %>
4
+ <% phc_breadcrumb_one "Home" %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- PHCTitleSEO Title Variables -->
7
+
8
+ <!-- Page Bradcrumbs -->
9
+ <ol class="breadcrumb pull-right">
10
+ <li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
11
+ <li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
12
+ </ol>
13
+ <!-- Page Bradcrumbs -->
14
+
15
+ <!-- Page Header -->
16
+ <h2 class="page-header"><%= yield(:phc_title) %></h2>
17
+ <!-- Page Header -->
18
+
19
+ <!-- Page Content -->
20
+ <div class="row">
21
+ <div class="col-lg-12">
22
+
23
+ <!-- Panel -->
24
+ <div class="panel panel-inverse">
25
+
26
+ <!-- Panel - Heading -->
27
+ <div class="panel-heading">
28
+ <h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
29
+ </div>
30
+ <!-- Panel - Heading -->
31
+
32
+ <!-- Panel - Body -->
33
+ <div class="panel-body">
34
+
35
+ <!-- Index - Table -->
36
+ <div class="table-responsive">
37
+ <table class="table table-striped table-bordered">
38
+
39
+ <thead>
40
+ <tr>
41
+ <th>Status</th>
42
+ <th>Account Name</th>
43
+ <th>Invoice Amount</th>
44
+ <th>Invoice Paid</th>
45
+ <th>Invoice Due</th>
46
+ <th>Due Date</th>
47
+ <th>Invoice PDF Download</th>
48
+ <th>Invoice Link</th>
49
+ </tr>
50
+ </thead>
51
+
52
+ <tbody>
53
+ <% @admin_invoice_list.each do |admin_invoice| %>
54
+ <tr>
55
+ <td><%= admin_invoice.status.capitalize %></td>
56
+ <td><%= admin_invoice.account_name %></td>
57
+ <td><%= number_to_currency(admin_invoice.amount_due/100) %></td>
58
+ <td><%= number_to_currency(admin_invoice.amount_paid/100) %></td>
59
+ <td><%= number_to_currency(admin_invoice.amount_remaining/100) %></td>
60
+ <td><%= Time.at(admin_invoice.due_date).to_datetime.strftime("%B %d, %Y") %></td>
61
+ <td>
62
+ <i class="fad fa-external-link"></i>
63
+ <%= link_to admin_invoice.invoice_pdf, target: "_blank" do %>
64
+ Invoice #: <%= admin_invoice.number %>
65
+ <% end %>
66
+ </td>
67
+ <td>
68
+ <i class="fad fa-external-link"></i>
69
+ <%= link_to admin_invoice.hosted_invoice_url, target: "_blank" do %>
70
+ Invoice #: <%= admin_invoice.number %>
71
+ <% end %>
72
+ </td>
73
+ </tr>
74
+ <% end %>
75
+ </tbody>
76
+
77
+ </table>
78
+ </div>
79
+ <!-- Index - Table -->
80
+
81
+ </div>
82
+ <!-- Panel - Body -->
83
+
84
+ </div>
85
+ <!-- Panel -->
86
+
87
+ </div>
88
+ </div>
89
+ <!-- Page Content -->
data/config/routes.rb CHANGED
@@ -7,6 +7,7 @@ PhcdevworksAccountsStripe::Engine.routes.draw do
7
7
 
8
8
  # Admin Routes
9
9
  match "/admin/customers", to: "admin/customers#admin_customer_list", via: "get"
10
+ match "/admin/invoices", to: "admin/invoices#admin_invoice_list", via: "get"
10
11
  match "/admin/products", to: "admin/products#admin_products_list", via: "get"
11
12
  match "/admin/subscriptions", to: "admin/subscriptions#admin_subscription_list", via: "get"
12
13
 
@@ -1,3 +1,3 @@
1
1
  module PhcdevworksAccountsStripe
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phcdevworks_accounts_stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - PHCDevworks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-07 00:00:00.000000000 Z
11
+ date: 2021-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -240,14 +240,14 @@ dependencies:
240
240
  requirements:
241
241
  - - "~>"
242
242
  - !ruby/object:Gem::Version
243
- version: '3.1'
243
+ version: '3.2'
244
244
  type: :runtime
245
245
  prerelease: false
246
246
  version_requirements: !ruby/object:Gem::Requirement
247
247
  requirements:
248
248
  - - "~>"
249
249
  - !ruby/object:Gem::Version
250
- version: '3.1'
250
+ version: '3.2'
251
251
  - !ruby/object:Gem::Dependency
252
252
  name: factory_bot_rails
253
253
  requirement: !ruby/object:Gem::Requirement
@@ -329,7 +329,9 @@ files:
329
329
  - README.md
330
330
  - Rakefile
331
331
  - app/assets/config/phcdevworks_accounts_stripe_manifest.js
332
+ - app/assets/javascripts/phcdevworks_accounts_stripe/admin/invoices.coffee
332
333
  - app/assets/stylesheets/phcdevworks_accounts_stripe/admin/customers.css
334
+ - app/assets/stylesheets/phcdevworks_accounts_stripe/admin/invoices.scss
333
335
  - app/assets/stylesheets/phcdevworks_accounts_stripe/admin/plans.css
334
336
  - app/assets/stylesheets/phcdevworks_accounts_stripe/admin/subscriptions.css
335
337
  - app/assets/stylesheets/phcdevworks_accounts_stripe/application.css
@@ -337,6 +339,7 @@ files:
337
339
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/plan.css
338
340
  - app/assets/stylesheets/phcdevworks_accounts_stripe/user/subscription.css
339
341
  - app/controllers/phcdevworks_accounts_stripe/admin/customers_controller.rb
342
+ - app/controllers/phcdevworks_accounts_stripe/admin/invoices_controller.rb
340
343
  - app/controllers/phcdevworks_accounts_stripe/admin/products_controller.rb
341
344
  - app/controllers/phcdevworks_accounts_stripe/admin/subscriptions_controller.rb
342
345
  - app/controllers/phcdevworks_accounts_stripe/application_controller.rb
@@ -344,6 +347,7 @@ files:
344
347
  - app/controllers/phcdevworks_accounts_stripe/user/product_controller.rb
345
348
  - app/controllers/phcdevworks_accounts_stripe/user/subscription_controller.rb
346
349
  - app/helpers/phcdevworks_accounts_stripe/admin/customers_helper.rb
350
+ - app/helpers/phcdevworks_accounts_stripe/admin/invoices_helper.rb
347
351
  - app/helpers/phcdevworks_accounts_stripe/admin/plans_helper.rb
348
352
  - app/helpers/phcdevworks_accounts_stripe/admin/subscriptions_helper.rb
349
353
  - app/helpers/phcdevworks_accounts_stripe/application_helper.rb
@@ -358,6 +362,7 @@ files:
358
362
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/navigation/_top_menu.html.erb
359
363
  - app/views/layouts/phcdevworks_accounts_stripe/components/backend/sidebars/_side_menu.html.erb
360
364
  - app/views/phcdevworks_accounts_stripe/admin/customers/admin_customer_list.html.erb
365
+ - app/views/phcdevworks_accounts_stripe/admin/invoices/admin_invoice_list.html.erb
361
366
  - app/views/phcdevworks_accounts_stripe/admin/products/admin_products_list.html.erb
362
367
  - app/views/phcdevworks_accounts_stripe/admin/subscriptions/admin_subscription_list.html.erb
363
368
  - app/views/phcdevworks_accounts_stripe/user/invoices/user_invoice_item.html.erb