PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.1.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.1.2
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
easy-invoice / templates / main-template.php

main-template.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.1.2, at templates/main-template.php

433 lines 26.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $current_page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'easy-invoice';
3
4 // Function to check if current page is a subpage of a main menu
5 function is_subpage_of($current_page, $main_page) {
6 // Check if current page starts with the main page slug
7 $current_page = $current_page ?? '';
8 $main_page = $main_page ?? '';
9 return strpos($current_page, $main_page) === 0;
10 }
11
12 // Function to get the active menu class
13 function get_menu_class($current_page, $menu_page, $is_active = false) {
14 if ($is_active) {
15 return 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600';
16 }
17 return 'text-gray-600 hover:bg-gray-50 hover:text-gray-900';
18 }
19
20 // Function to get the active icon class
21 function get_icon_class($current_page, $menu_page, $is_active = false) {
22 if ($is_active) {
23 return 'text-indigo-600';
24 }
25 return 'text-gray-400 group-hover:text-gray-500';
26 }
27
28 // Determine which menu should be active
29 $is_dashboard_active = $current_page === 'easy-invoice';
30 $is_invoices_active = in_array($current_page, [
31 'easy-invoice-all', // All invoices
32 'easy-invoice-builder', // Invoice builder
33 'easy-invoice-preview' // Invoice preview
34 ]);
35 $is_quotes_active = in_array($current_page, [
36 'easy-quote-all', // All quotes
37 'easy-invoice-quote-builder', // Quote builder
38 'easy-quote-preview' // Quote preview
39 ]);
40 $is_payments_active = in_array($current_page, [
41 'easy-invoice-payments', // All payments
42 'easy-invoice-payment-new' // Add new payment
43 ]);
44 $is_clients_active = in_array($current_page, [
45 'easy-invoice-clients', // All clients
46 'easy-invoice-client-edit', // Edit client
47 'easy-invoice-client-view' // View client
48 ]);
49 $is_reports_active = $current_page === 'easy-invoice-reports';
50 $is_settings_active = in_array($current_page, [
51 'easy-invoice-settings', // Main settings
52 'easy-invoice-email-settings', // Email settings
53 'easy-invoice-email-settings-general',
54 'easy-invoice-email-settings-invoice',
55 'easy-invoice-email-settings-quote',
56 'easy-invoice-email-settings-payment',
57 'easy-invoice-email-settings-payment-reminder',
58 'easy-invoice-pro-settings', // Pro settings
59 'easy-invoice-pro-translations' // Pro translations
60 ]);
61 ?>
62
63 <!-- Sidebar -->
64 <div class="fixed inset-y-0 left-0 w-64 bg-white shadow-lg border-r border-gray-200">
65 <!-- Logo and Back Button -->
66 <div class="flex flex-col items-center justify-center h-24 px-4 pt-3 pb-2 border-b border-gray-200">
67 <div class="flex items-center space-x-2 mb-2">
68 <div class="flex items-center justify-center w-8 h-8 bg-indigo-600 rounded">
69 <!-- Invoice Logo SVG -->
70 <svg class="h-5 w-5 text-white" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
71 <path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
72 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
73 <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
74 <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
75 <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
76 </svg>
77 </div>
78 <span class="text-lg font-semibold text-gray-900"><?php esc_html_e('Easy Invoice', 'easy-invoice'); ?></span>
79 </div>
80 <a href="<?php echo admin_url(); ?>" target="_blank" class="inline-flex items-center text-xs text-gray-500 hover:text-gray-700 transition-colors duration-200">
81 <svg class="w-3 h-3 mr-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
82 <path d="M19 12H5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
83 <path d="M12 19L5 12L12 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
84 </svg>
85 Back to WordPress
86 </a>
87
88 <!-- Version Information -->
89 <div class="mt-2 mb-2 flex items-center justify-center space-x-2">
90 <!-- Free Version Badge -->
91 <span class="inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-200">
92 <svg class="w-2.5 h-2.5 mr-1 text-gray-500" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
93 <path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
94 <path d="M2 17L12 22L22 17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
95 <path d="M2 12L12 17L22 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
96 </svg>
97 v<?php echo esc_html(EASY_INVOICE_VERSION); ?>
98 </span>
99
100 <?php if (defined('EASY_INVOICE_PRO_VERSION') && function_exists('is_plugin_active') && is_plugin_active('easy-invoice-pro/easy-invoice-pro.php')): ?>
101 <!-- Pro Version Badge -->
102 <span class="inline-flex items-center px-1.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-200">
103 <svg class="w-2.5 h-2.5 mr-1 text-green-500" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
104 <path d="M9 12L11 14L15 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
105 <path d="M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
106 </svg>
107 Pro v<?php echo esc_html(EASY_INVOICE_PRO_VERSION); ?>
108 </span>
109 <?php endif; ?>
110 </div>
111 </div>
112
113 <!-- Navigation Links -->
114 <nav class="mt-6 px-3 space-y-2">
115 <!-- Dashboard -->
116 <a href="<?php echo admin_url('admin.php?page=easy-invoice'); ?>"
117 class="<?php echo $is_dashboard_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
118 <svg class="<?php echo $is_dashboard_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
119 <path d="M3 13H9V19H3V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
120 <path d="M9 13H15V19H9V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
121 <path d="M15 13H21V19H15V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
122 <path d="M3 5H9V11H3V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
123 <path d="M9 5H15V11H9V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
124 <path d="M15 5H21V11H15V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
125 </svg>
126 Dashboard
127 </a>
128
129 <!-- Invoices -->
130 <a href="<?php echo admin_url('admin.php?page=easy-invoice-all'); ?>"
131 class="<?php echo $is_invoices_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
132 <svg class="<?php echo $is_invoices_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
133 <path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
134 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
135 <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
136 <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
137 <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
138 </svg>
139 Invoices
140 </a>
141
142 <!-- Quotes -->
143 <a href="<?php echo admin_url('admin.php?page=easy-quote-all'); ?>"
144 class="<?php echo $is_quotes_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
145 <svg class="<?php echo $is_quotes_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
146 <path d="M14 2H6C4.9 2 4 2.9 4 4V20C4 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
147 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
148 <path d="M9 9H15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
149 <path d="M9 13H15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
150 <path d="M9 17H13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
151 </svg>
152 Quotes
153 </a>
154
155 <!-- Payments -->
156 <a href="<?php echo admin_url('admin.php?page=easy-invoice-payments'); ?>"
157 class="<?php echo $is_payments_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
158 <svg class="<?php echo $is_payments_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
159 <rect x="1" y="4" width="22" height="16" rx="2" ry="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
160 <line x1="1" y1="10" x2="23" y2="10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
161 </svg>
162 Payments
163 </a>
164
165 <!-- Clients -->
166 <a href="<?php echo admin_url('admin.php?page=easy-invoice-clients'); ?>"
167 class="<?php echo $is_clients_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
168 <svg class="<?php echo $is_clients_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
169 <path d="M17 21V19C17 17.9391 16.5786 16.9217 15.8284 16.1716C15.0783 15.4214 14.0609 15 13 15H5C3.93913 15 2.92172 15.4214 2.17157 16.1716C1.42143 16.9217 1 17.9391 1 19V21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
170 <circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
171 <path d="M23 21V19C23 18.1137 22.6485 17.2628 22.0237 16.6425C21.3989 16.0221 20.5471 15.6722 19.66 15.6722C18.7729 15.6722 17.9211 16.0221 17.2963 16.6425C16.6715 17.2628 16.32 18.1137 16.32 19V21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
172 <path d="M16.32 11.6722C18.36 11.6722 20 10.0322 20 7.99219C20 5.95219 18.36 4.31219 16.32 4.31219" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
173 </svg>
174 Clients
175 </a>
176
177 <!-- Reports -->
178 <?php if (!easy_invoice_has_pro()): ?>
179 <a href="#" id="reports-menu-link"
180 class="text-gray-600 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
181 <svg class="text-gray-400 group-hover:text-gray-500 mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
182 <path d="M18 20V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
183 <path d="M12 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
184 <path d="M6 20V14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
185 </svg>
186 Reports
187 <span class="ml-auto inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-600 text-white shadow-sm">
188 <svg class="w-4 h-4 mr-1 text-white" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
189 <path d="M12 8L15 13.2L18 10.5L17.3 14H6.7L6 10.5L9 13.2L12 8M12 4L8.5 10L3 5L5 16H19L21 5L15.5 10L12 4Z"/>
190 </svg>
191 Pro
192 </span>
193 </a>
194 <?php else: ?>
195 <a href="<?php echo admin_url('admin.php?page=easy-invoice-reports'); ?>"
196 class="<?php echo $is_reports_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
197 <svg class="<?php echo $is_reports_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
198 <path d="M18 20V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
199 <path d="M12 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
200 <path d="M6 20V14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
201 </svg>
202 Reports
203 </a>
204 <?php endif; ?>
205
206 <!-- Settings -->
207 <a href="<?php echo admin_url('admin.php?page=easy-invoice-settings'); ?>"
208 class="<?php echo $is_settings_active ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
209 <svg class="<?php echo $is_settings_active ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
210 <circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
211 <path d="M19.4 15A1.65 1.65 0 0 0 18 14A6 6 0 0 0 6 14A1.65 1.65 0 0 0 4.6 15A2 2 0 0 0 6 19H18A2 2 0 0 0 19.4 15Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
212 </svg>
213 Settings
214 </a>
215
216 <!-- License -->
217 <?php
218 // Check if Pro plugin is active and get license status
219 $show_license_badge = false;
220 $license_status = 'inactive';
221 $license_text = 'Deactivated';
222
223 if (easy_invoice_has_pro()) {
224 $license_key = \EasyInvoicePro\Updater\License::get_license_key();
225 $is_valid = \EasyInvoicePro\Updater\License::has_valid_license();
226 $is_expired = \EasyInvoicePro\Updater\License::has_license_expired();
227
228 // Always show badge for Pro version
229 $show_license_badge = true;
230
231 if (!empty($license_key)) {
232 if ($is_valid && !$is_expired) {
233 $license_status = 'activated';
234 $license_text = 'Activated';
235 } elseif ($is_expired) {
236 $license_status = 'expired';
237 $license_text = 'Expired';
238 } else {
239 $license_status = 'inactive';
240 $license_text = 'Deactivated';
241 }
242 } else {
243 // No license key entered
244 $license_status = 'inactive';
245 $license_text = 'Inactive';
246 }
247 } else {
248 // Free version - show Free badge
249 $show_license_badge = true;
250 $license_status = 'free';
251 $license_text = 'Free';
252 }
253 ?>
254 <a href="<?php echo admin_url('admin.php?page=easy-invoice-license'); ?>"
255 class="<?php echo ($current_page === 'easy-invoice-license') ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
256 <svg class="<?php echo ($current_page === 'easy-invoice-license') ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
257 <path d="M12 2L13.09 8.26L20 9L13.09 9.74L12 16L10.91 9.74L4 9L10.91 8.26L12 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
258 </svg>
259 <span class="flex-1">License</span>
260 <?php if ($show_license_badge): ?>
261 <span class="license-status-badge <?php echo $license_status; ?>">
262 <span class="status-dot"></span>
263 <?php echo $license_text; ?>
264 </span>
265 <?php endif; ?>
266 </a>
267
268 <!-- Free vs Pro - only show in free version -->
269 <?php
270 $show_free_vs_pro = !easy_invoice_has_pro();
271
272 if ($show_free_vs_pro):
273 ?>
274 <a href="<?php echo admin_url('admin.php?page=easy-invoice-free-vs-pro'); ?>"
275 class="<?php echo ($current_page === 'easy-invoice-free-vs-pro') ? 'bg-indigo-50 text-indigo-700 border-r-2 border-indigo-600' : 'text-gray-600 hover:bg-gray-50 hover:text-gray-900'; ?> group flex items-center px-4 py-3 text-sm font-medium rounded-lg transition-all duration-200">
276 <svg class="<?php echo ($current_page === 'easy-invoice-free-vs-pro') ? 'text-indigo-600' : 'text-gray-400 group-hover:text-gray-500'; ?> mr-3 flex-shrink-0 h-5 w-5" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
277 <path d="M3 6L21 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
278 <path d="M3 12L21 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
279 <path d="M3 18L21 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
280 <path d="M9 3L9 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
281 <path d="M15 3L15 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
282 </svg>
283 <span class="flex-1"><?php esc_html_e('Free vs Pro', 'easy-invoice'); ?></span>
284 <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
285 <?php esc_html_e('Compare', 'easy-invoice'); ?>
286 </span>
287 </a>
288 <?php endif; ?>
289
290 </nav>
291
292 <!-- User Profile -->
293 <div class="absolute bottom-0 w-full border-t border-gray-200 p-4">
294 <div class="relative">
295 <button type="button" id="user-dropdown-button" class="flex items-center w-full text-left hover:bg-gray-50 rounded-lg p-2 transition-colors duration-200">
296 <div class="flex-shrink-0">
297 <div class="h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center">
298 <span class="text-gray-600 font-medium text-sm"><?php echo substr(wp_get_current_user()->display_name, 0, 1); ?></span>
299 </div>
300 </div>
301 <div class="ml-3 flex-1">
302 <p class="text-sm font-medium text-gray-700"><?php echo esc_html(wp_get_current_user()->display_name); ?></p>
303 <p class="text-xs text-gray-500"><?php echo esc_html(wp_get_current_user()->user_email); ?></p>
304 </div>
305 <div class="flex-shrink-0">
306 <svg class="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
307 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
308 </svg>
309 </div>
310 </button>
311
312 <!-- Dropdown Menu -->
313 <div id="user-dropdown-menu" class="hidden absolute bottom-full left-0 right-0 mb-2 bg-white border border-gray-200 rounded-lg shadow-lg z-50">
314 <div class="py-1">
315 <a href="<?php echo admin_url(); ?>" target="_blank" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition-colors duration-200">
316 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
317 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
318 </svg>
319 <?php _e('Back to WordPress', 'easy-invoice'); ?>
320 </a>
321 <a href="<?php echo wp_logout_url(); ?>" class="flex items-center px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition-colors duration-200">
322 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
323 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"></path>
324 </svg>
325 <?php _e('Logout', 'easy-invoice'); ?>
326 </a>
327 </div>
328 </div>
329 </div>
330 </div>
331 </div>
332
333 <!-- Mobile menu button -->
334 <div class="fixed top-0 left-0 z-50 p-4 sm:hidden">
335 <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-indigo-500" aria-expanded="false">
336 <i class="fas fa-bars"></i>
337 </button>
338 </div>
339
340 <script>
341 document.addEventListener('DOMContentLoaded', function() {
342 const mobileMenuButton = document.querySelector('button[aria-expanded="false"]');
343 const sidebar = document.querySelector('.fixed.inset-y-0.left-0');
344
345 if (mobileMenuButton && sidebar) {
346 mobileMenuButton.addEventListener('click', function() {
347 const expanded = this.getAttribute('aria-expanded') === 'true';
348 this.setAttribute('aria-expanded', !expanded);
349 sidebar.classList.toggle('hidden');
350 });
351 }
352
353 // Handle Reports menu click for premium feature
354 const reportsMenuLink = document.getElementById('reports-menu-link');
355 if (reportsMenuLink) {
356 reportsMenuLink.addEventListener('click', function(e) {
357 e.preventDefault();
358 // Show premium popup using the proper confirmation modal
359 if (typeof EasyInvoiceConfirmation !== 'undefined') {
360 EasyInvoiceConfirmation.showFeatureUpgrade('Detailed Reports', 'Get comprehensive insights into your business with detailed reports including revenue analysis, payment statistics, invoice status tracking, and monthly revenue charts. Upgrade to Easy Invoice Pro to unlock advanced reporting features.');
361 } else {
362 // Fallback to alert if confirmation modal is not available
363 alert('<?php echo esc_js(__('Detailed Reports is a premium feature. Upgrade to Easy Invoice Pro to unlock advanced reporting features including revenue analysis, payment statistics, and monthly revenue charts.', 'easy-invoice')); ?>');
364 }
365 });
366 }
367
368 // Handle user dropdown
369 const userDropdownButton = document.getElementById('user-dropdown-button');
370 const userDropdownMenu = document.getElementById('user-dropdown-menu');
371
372 if (userDropdownButton && userDropdownMenu) {
373 userDropdownButton.addEventListener('click', function(e) {
374 e.preventDefault();
375 e.stopPropagation();
376 userDropdownMenu.classList.toggle('hidden');
377 });
378
379 // Close dropdown when clicking outside
380 document.addEventListener('click', function(e) {
381 if (!userDropdownButton.contains(e.target) && !userDropdownMenu.contains(e.target)) {
382 userDropdownMenu.classList.add('hidden');
383 }
384 });
385
386 // Close dropdown when pressing Escape key
387 document.addEventListener('keydown', function(e) {
388 if (e.key === 'Escape') {
389 userDropdownMenu.classList.add('hidden');
390 }
391 });
392 }
393 });
394 </script>
395
396 <style>
397 html.wp-toolbar {
398 padding-top: 0 !important;
399 }
400
401 /* Custom color for active icons */
402 .group:hover svg {
403 color: rgb(79 70 229) !important;
404 }
405
406 /* Active state icon color */
407 .bg-indigo-50 svg {
408 color: rgb(79 70 229) !important;
409 }
410
411 /* Hover state for non-active items */
412 .group:hover:not(.bg-indigo-50) svg {
413 color: rgb(79 70 229) !important;
414 }
415 </style>
416
417 <div class="min-h-screen bg-gray-50 easy-invoice-admin">
418 <!-- Main Content -->
419 <div class="pl-64">
420 <?php
421
422 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'easy-invoice';
423 // Content will be inserted here
424 do_action('easy_invoice_admin_before_main_content', $page);
425
426 do_action('easy_invoice_admin_main_content', $page);
427
428 do_action('easy_invoice_admin_after_main_content', $page);
429
430 ?>
431 </div>
432 </div>
433