referral_box 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fac7d8a6f463c2865727f8bf22948c6b0e0a08c0d175ec2363830a4a945f7d54
4
- data.tar.gz: 480387065452d06a209266a0c343547dc8afdd6b8ef0a1e5dc067aa369a8a468
3
+ metadata.gz: b232d0c39b152774ce3e521e1bfd5b49e12f4403b913391fdbdc0ef91684c07a
4
+ data.tar.gz: 8623def044d02bcfe7aaac01382c25bcac0a78fc87c9cda64f24cba20825cd4f
5
5
  SHA512:
6
- metadata.gz: a4b5a4802501eb7e8bdf978714f8f5db9d257237af58df871fdac6c8891f863deb477aaa3eced623b4d1feaff4d59f29f1bf9f6b099ac0f49c97055e0b852293
7
- data.tar.gz: c183bf6d8f5e9be4d7dde3ecf8a0d276ac0086eeeebad093ced8b37f9433639f6aee041003088b51aecf3d1660a79f568b80690e70fe6c496f33b3f4bf5bbaff
6
+ metadata.gz: 15df1bb9559552c3648c30b667c73649b3af655296eb2206e4519779685d0d56733580d4f7d65395245911c6799985a2d432f74ade66652eea35f7f9c65c0d98
7
+ data.tar.gz: 1831e708802b59d48cfa08611c0fcc444a96307f42d5e3cdd840052b855449d503e978931b6605d35a406cd0f987cb420e91d4bf7a04935c5881338113258f6f
data/CHANGELOG.md CHANGED
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.7] - 2025-01-XX
11
+
12
+ ### Added
13
+ - **Admin Dashboard Views**: Added all missing view templates for the admin dashboard
14
+ - **Dashboard Index**: Overview with statistics, recent transactions, and top users
15
+ - **Users List**: Complete user management with points, tiers, and referral codes
16
+ - **User Details**: Individual user profiles with transaction history
17
+ - **Transactions**: Full transaction history with filtering and pagination
18
+ - **Referrals**: Referral tracking with device and browser analytics
19
+ - **Analytics**: Comprehensive analytics with device breakdown and daily trends
20
+
21
+ ### Fixed
22
+ - **Missing Templates**: Resolved "ActionController::MissingExactTemplate" error
23
+ - **Dashboard Navigation**: All dashboard sections now have proper views
24
+
10
25
  ## [0.1.5] - 2025-01-XX
11
26
 
12
27
  ### Fixed
@@ -0,0 +1,99 @@
1
+ <div class="card">
2
+ <h2>📈 Referral Analytics</h2>
3
+
4
+ <div class="stats-grid">
5
+ <div class="stat-card">
6
+ <div class="stat-number"><%= @total_clicks %></div>
7
+ <div class="stat-label">Total Clicks</div>
8
+ </div>
9
+
10
+ <div class="stat-card">
11
+ <div class="stat-number"><%= @total_conversions %></div>
12
+ <div class="stat-label">Total Conversions</div>
13
+ </div>
14
+
15
+ <div class="stat-card">
16
+ <div class="stat-number"><%= number_to_percentage(@conversion_rate, precision: 1) %></div>
17
+ <div class="stat-label">Conversion Rate</div>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="card">
23
+ <h2>📱 Device Breakdown</h2>
24
+
25
+ <% if @referrals_by_device.any? %>
26
+ <table class="table">
27
+ <thead>
28
+ <tr>
29
+ <th>Device Type</th>
30
+ <th>Count</th>
31
+ <th>Percentage</th>
32
+ </tr>
33
+ </thead>
34
+ <tbody>
35
+ <% @referrals_by_device.each do |device, count| %>
36
+ <tr>
37
+ <td><%= device.titleize %></td>
38
+ <td><%= count %></td>
39
+ <td><%= number_to_percentage((count.to_f / @total_clicks) * 100, precision: 1) %></td>
40
+ </tr>
41
+ <% end %>
42
+ </tbody>
43
+ </table>
44
+ <% else %>
45
+ <p>No device data available.</p>
46
+ <% end %>
47
+ </div>
48
+
49
+ <div class="card">
50
+ <h2>🌐 Browser Breakdown</h2>
51
+
52
+ <% if @referrals_by_browser.any? %>
53
+ <table class="table">
54
+ <thead>
55
+ <tr>
56
+ <th>Browser</th>
57
+ <th>Count</th>
58
+ <th>Percentage</th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ <% @referrals_by_browser.each do |browser, count| %>
63
+ <tr>
64
+ <td><%= browser %></td>
65
+ <td><%= count %></td>
66
+ <td><%= number_to_percentage((count.to_f / @total_clicks) * 100, precision: 1) %></td>
67
+ </tr>
68
+ <% end %>
69
+ </tbody>
70
+ </table>
71
+ <% else %>
72
+ <p>No browser data available.</p>
73
+ <% end %>
74
+ </div>
75
+
76
+ <div class="card">
77
+ <h2>📅 Daily Click Trends (Last 30 Days)</h2>
78
+
79
+ <% if @daily_clicks.any? %>
80
+ <table class="table">
81
+ <thead>
82
+ <tr>
83
+ <th>Date</th>
84
+ <th>Clicks</th>
85
+ </tr>
86
+ </thead>
87
+ <tbody>
88
+ <% @daily_clicks.each do |date, count| %>
89
+ <tr>
90
+ <td><%= Date.parse(date).strftime("%b %d, %Y") %></td>
91
+ <td><%= count %></td>
92
+ </tr>
93
+ <% end %>
94
+ </tbody>
95
+ </table>
96
+ <% else %>
97
+ <p>No daily click data available.</p>
98
+ <% end %>
99
+ </div>
@@ -0,0 +1,98 @@
1
+ <div class="card">
2
+ <h2>📊 Dashboard Overview</h2>
3
+
4
+ <div class="stats-grid">
5
+ <div class="stat-card">
6
+ <div class="stat-number"><%= @total_users %></div>
7
+ <div class="stat-label">Total Users</div>
8
+ </div>
9
+
10
+ <div class="stat-card">
11
+ <div class="stat-number"><%= @total_transactions %></div>
12
+ <div class="stat-label">Total Transactions</div>
13
+ </div>
14
+
15
+ <div class="stat-card">
16
+ <div class="stat-number"><%= @total_referrals %></div>
17
+ <div class="stat-label">Total Referrals</div>
18
+ </div>
19
+
20
+ <div class="stat-card">
21
+ <div class="stat-number"><%= number_to_percentage(@conversion_rate, precision: 1) %></div>
22
+ <div class="stat-label">Conversion Rate</div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+
27
+ <div class="card">
28
+ <h2>🔄 Recent Transactions</h2>
29
+
30
+ <% if @recent_transactions.any? %>
31
+ <table class="table">
32
+ <thead>
33
+ <tr>
34
+ <th>User</th>
35
+ <th>Type</th>
36
+ <th>Points</th>
37
+ <th>Description</th>
38
+ <th>Date</th>
39
+ </tr>
40
+ </thead>
41
+ <tbody>
42
+ <% @recent_transactions.each do |transaction| %>
43
+ <tr>
44
+ <td><%= transaction.user&.email || transaction.user&.name || "Unknown" %></td>
45
+ <td>
46
+ <span class="badge <%= transaction.transaction_type %>">
47
+ <%= transaction.transaction_type.titleize %>
48
+ </span>
49
+ </td>
50
+ <td><%= transaction.points %></td>
51
+ <td><%= transaction.description %></td>
52
+ <td><%= transaction.created_at.strftime("%b %d, %Y") %></td>
53
+ </tr>
54
+ <% end %>
55
+ </tbody>
56
+ </table>
57
+ <% else %>
58
+ <p>No transactions yet.</p>
59
+ <% end %>
60
+ </div>
61
+
62
+ <div class="card">
63
+ <h2>🏆 Top Users by Points</h2>
64
+
65
+ <% if @top_users.any? %>
66
+ <table class="table">
67
+ <thead>
68
+ <tr>
69
+ <th>User</th>
70
+ <th>Points</th>
71
+ <th>Tier</th>
72
+ <th>Referrals</th>
73
+ </tr>
74
+ </thead>
75
+ <tbody>
76
+ <% @top_users.each do |user| %>
77
+ <tr>
78
+ <td>
79
+ <%= link_to user.email || user.name || "Unknown", referral_box.user_path(user), class: "btn btn-primary" %>
80
+ </td>
81
+ <td><%= ReferralBox.balance(user) %></td>
82
+ <td>
83
+ <% tier = ReferralBox.tier(user) %>
84
+ <% if tier %>
85
+ <span class="badge <%= tier.downcase %>"><%= tier %></span>
86
+ <% else %>
87
+ <span class="badge">None</span>
88
+ <% end %>
89
+ </td>
90
+ <td><%= user.referrals.count %></td>
91
+ </tr>
92
+ <% end %>
93
+ </tbody>
94
+ </table>
95
+ <% else %>
96
+ <p>No users with points yet.</p>
97
+ <% end %>
98
+ </div>
@@ -0,0 +1,62 @@
1
+ <div class="card">
2
+ <h2>🤝 Referral Tracking</h2>
3
+
4
+ <% if @referrals.any? %>
5
+ <table class="table">
6
+ <thead>
7
+ <tr>
8
+ <th>Referral Code</th>
9
+ <th>Clicked At</th>
10
+ <th>Device</th>
11
+ <th>Browser</th>
12
+ <th>IP Address</th>
13
+ <th>Status</th>
14
+ <th>Signed Up</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @referrals.each do |referral| %>
19
+ <tr>
20
+ <td>
21
+ <code><%= referral.referral_code %></code>
22
+ </td>
23
+ <td><%= referral.clicked_at.strftime("%b %d, %Y at %I:%M") %></td>
24
+ <td>
25
+ <% if referral.device_type.present? %>
26
+ <span class="badge"><%= referral.device_type.titleize %></span>
27
+ <% else %>
28
+ <span class="text-muted">Unknown</span>
29
+ <% end %>
30
+ </td>
31
+ <td>
32
+ <% if referral.browser.present? %>
33
+ <%= referral.browser %>
34
+ <% else %>
35
+ <span class="text-muted">Unknown</span>
36
+ <% end %>
37
+ </td>
38
+ <td><%= referral.ip_address %></td>
39
+ <td>
40
+ <% if referral.converted? %>
41
+ <span class="badge earn">Converted</span>
42
+ <% else %>
43
+ <span class="badge">Clicked</span>
44
+ <% end %>
45
+ </td>
46
+ <td>
47
+ <% if referral.signed_up_at %>
48
+ <%= referral.signed_up_at.strftime("%b %d, %Y") %>
49
+ <% else %>
50
+ <span class="text-muted">Not signed up</span>
51
+ <% end %>
52
+ </td>
53
+ </tr>
54
+ <% end %>
55
+ </tbody>
56
+ </table>
57
+
58
+ <%= referral_box_paginate(@referrals) %>
59
+ <% else %>
60
+ <p>No referral tracking data found.</p>
61
+ <% end %>
62
+ </div>
@@ -0,0 +1,54 @@
1
+ <div class="card">
2
+ <h2>💳 All Transactions</h2>
3
+
4
+ <% if @transactions.any? %>
5
+ <table class="table">
6
+ <thead>
7
+ <tr>
8
+ <th>User</th>
9
+ <th>Type</th>
10
+ <th>Points</th>
11
+ <th>Description</th>
12
+ <th>Date</th>
13
+ <th>Expires</th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @transactions.each do |transaction| %>
18
+ <tr>
19
+ <td>
20
+ <% if transaction.user %>
21
+ <%= link_to transaction.user.email || transaction.user.name || "Unknown", referral_box.user_path(transaction.user), class: "btn btn-primary" %>
22
+ <% else %>
23
+ <span class="text-muted">Unknown User</span>
24
+ <% end %>
25
+ </td>
26
+ <td>
27
+ <span class="badge <%= transaction.transaction_type %>">
28
+ <%= transaction.transaction_type.titleize %>
29
+ </span>
30
+ </td>
31
+ <td><%= transaction.points %></td>
32
+ <td><%= transaction.description %></td>
33
+ <td><%= transaction.created_at.strftime("%b %d, %Y at %I:%M") %></td>
34
+ <td>
35
+ <% if transaction.expires_at %>
36
+ <% if transaction.expired? %>
37
+ <span class="text-danger">Expired</span>
38
+ <% else %>
39
+ <%= transaction.expires_at.strftime("%b %d, %Y") %>
40
+ <% end %>
41
+ <% else %>
42
+ <span class="text-muted">Never</span>
43
+ <% end %>
44
+ </td>
45
+ </tr>
46
+ <% end %>
47
+ </tbody>
48
+ </table>
49
+
50
+ <%= referral_box_paginate(@transactions) %>
51
+ <% else %>
52
+ <p>No transactions found.</p>
53
+ <% end %>
54
+ </div>
@@ -0,0 +1,112 @@
1
+ <div class="card">
2
+ <h2>👤 User Details: <%= @user.email || @user.name || "Unknown" %></h2>
3
+
4
+ <div class="stats-grid">
5
+ <div class="stat-card">
6
+ <div class="stat-number"><%= @balance %></div>
7
+ <div class="stat-label">Points Balance</div>
8
+ </div>
9
+
10
+ <div class="stat-card">
11
+ <div class="stat-number">
12
+ <% if @tier %>
13
+ <span class="badge <%= @tier.downcase %>"><%= @tier %></span>
14
+ <% else %>
15
+ <span class="badge">None</span>
16
+ <% end %>
17
+ </div>
18
+ <div class="stat-label">Current Tier</div>
19
+ </div>
20
+
21
+ <div class="stat-card">
22
+ <div class="stat-number"><%= @user.referrals.count %></div>
23
+ <div class="stat-label">Total Referrals</div>
24
+ </div>
25
+
26
+ <div class="stat-card">
27
+ <div class="stat-number"><%= @transactions.count %></div>
28
+ <div class="stat-label">Total Transactions</div>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="user-info">
33
+ <h3>User Information</h3>
34
+ <table class="table">
35
+ <tr>
36
+ <td><strong>Email:</strong></td>
37
+ <td><%= @user.email %></td>
38
+ </tr>
39
+ <tr>
40
+ <td><strong>Name:</strong></td>
41
+ <td><%= @user.name %></td>
42
+ </tr>
43
+ <tr>
44
+ <td><strong>Referral Code:</strong></td>
45
+ <td>
46
+ <% if @user.respond_to?(:referral_code) && @user.referral_code.present? %>
47
+ <code><%= @user.referral_code %></code>
48
+ <% else %>
49
+ <span class="text-muted">Not generated</span>
50
+ <% end %>
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <td><strong>Referrer:</strong></td>
55
+ <td>
56
+ <% if @user.referrer %>
57
+ <%= @user.referrer.email || @user.referrer.name || "Unknown" %>
58
+ <% else %>
59
+ <span class="text-muted">No referrer</span>
60
+ <% end %>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td><strong>Joined:</strong></td>
65
+ <td><%= @user.created_at.strftime("%B %d, %Y at %I:%M %p") %></td>
66
+ </tr>
67
+ </table>
68
+ </div>
69
+ </div>
70
+
71
+ <div class="card">
72
+ <h2>📊 Transaction History</h2>
73
+
74
+ <% if @transactions.any? %>
75
+ <table class="table">
76
+ <thead>
77
+ <tr>
78
+ <th>Type</th>
79
+ <th>Points</th>
80
+ <th>Description</th>
81
+ <th>Date</th>
82
+ <th>Expires</th>
83
+ </tr>
84
+ </thead>
85
+ <tbody>
86
+ <% @transactions.each do |transaction| %>
87
+ <tr>
88
+ <td>
89
+ <span class="badge <%= transaction.transaction_type %>">
90
+ <%= transaction.transaction_type.titleize %>
91
+ </span>
92
+ </td>
93
+ <td><%= transaction.points %></td>
94
+ <td><%= transaction.description %></td>
95
+ <td><%= transaction.created_at.strftime("%b %d, %Y") %></td>
96
+ <td>
97
+ <% if transaction.expires_at %>
98
+ <%= transaction.expires_at.strftime("%b %d, %Y") %>
99
+ <% else %>
100
+ <span class="text-muted">Never</span>
101
+ <% end %>
102
+ </td>
103
+ </tr>
104
+ <% end %>
105
+ </tbody>
106
+ </table>
107
+
108
+ <%= referral_box_paginate(@transactions) %>
109
+ <% else %>
110
+ <p>No transactions found for this user.</p>
111
+ <% end %>
112
+ </div>
@@ -0,0 +1,55 @@
1
+ <div class="card">
2
+ <h2>👥 All Users</h2>
3
+
4
+ <% if @users.any? %>
5
+ <table class="table">
6
+ <thead>
7
+ <tr>
8
+ <th>User</th>
9
+ <th>Points Balance</th>
10
+ <th>Tier</th>
11
+ <th>Referral Code</th>
12
+ <th>Referrals</th>
13
+ <th>Joined</th>
14
+ <th>Actions</th>
15
+ </tr>
16
+ </thead>
17
+ <tbody>
18
+ <% @users.each do |user| %>
19
+ <tr>
20
+ <td>
21
+ <strong><%= user.email || user.name || "Unknown" %></strong>
22
+ </td>
23
+ <td>
24
+ <strong><%= ReferralBox.balance(user) %></strong>
25
+ </td>
26
+ <td>
27
+ <% tier = ReferralBox.tier(user) %>
28
+ <% if tier %>
29
+ <span class="badge <%= tier.downcase %>"><%= tier %></span>
30
+ <% else %>
31
+ <span class="badge">None</span>
32
+ <% end %>
33
+ </td>
34
+ <td>
35
+ <% if user.respond_to?(:referral_code) && user.referral_code.present? %>
36
+ <code><%= user.referral_code %></code>
37
+ <% else %>
38
+ <span class="text-muted">Not generated</span>
39
+ <% end %>
40
+ </td>
41
+ <td><%= user.referrals.count %></td>
42
+ <td><%= user.created_at.strftime("%b %d, %Y") %></td>
43
+ <td>
44
+ <%= link_to "View Details", referral_box.user_path(user), class: "btn btn-primary" %>
45
+ </td>
46
+ </tr>
47
+ <% end %>
48
+ </tbody>
49
+ </table>
50
+
51
+ <%= referral_box_paginate(@users) %>
52
+ <% else %>
53
+ <p>No users found.</p>
54
+ <% end %>
55
+ </div>
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReferralBox
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: referral_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kapil Dev Pal
@@ -168,6 +168,12 @@ files:
168
168
  - app/helpers/referral_box/application_helper.rb
169
169
  - app/helpers/referral_box/dashboard_helper.rb
170
170
  - app/views/layouts/referral_box/dashboard.html.erb
171
+ - app/views/referral_box/dashboard/analytics.html.erb
172
+ - app/views/referral_box/dashboard/index.html.erb
173
+ - app/views/referral_box/dashboard/referrals.html.erb
174
+ - app/views/referral_box/dashboard/transactions.html.erb
175
+ - app/views/referral_box/dashboard/user.html.erb
176
+ - app/views/referral_box/dashboard/users.html.erb
171
177
  - config/routes.rb
172
178
  - db/migrate/001_create_referral_box_transactions.rb
173
179
  - db/migrate/002_create_referral_box_referral_logs.rb