PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.1.13
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.1.13
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.13, at templates/main-template.php

487 lines 31.2 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_item_library_active = in_array($current_page, [
50 'easy-invoice-pro-item-library', // Item Library (Pro)
51 'easy-invoice-item-library' // Item Library (alternative)
52 ]);
53 $is_templates_active = in_array($current_page, [
54 'easy-invoice-templates', // Template Builder (Pro)
55 'easy-invoice-template-builder' // Template Builder page
56 ]);
57 $is_reports_active = $current_page === 'easy-invoice-reports';
58 $is_settings_active = in_array($current_page, [
59 'easy-invoice-settings', // Main settings
60 'easy-invoice-email-settings', // Email settings
61 'easy-invoice-email-settings-general',
62 'easy-invoice-email-settings-invoice',
63 'easy-invoice-email-settings-quote',
64 'easy-invoice-email-settings-payment',
65 'easy-invoice-email-settings-payment-reminder',
66 'easy-invoice-pro-settings', // Pro settings
67 'easy-invoice-pro-translations' // Pro translations
68 ]);
69 ?>
70
71 <!-- Sidebar -->
72 <div class="fixed inset-y-0 left-0 w-64 bg-white shadow-lg border-r border-gray-200">
73 <!-- Logo and Back Button -->
74 <div class="flex flex-col items-center justify-center h-24 px-4 pt-3 pb-2 border-b border-gray-200">
75 <div class="flex items-center space-x-2 mb-2">
76 <div class="flex items-center justify-center w-8 h-8 bg-indigo-600 rounded">
77 <!-- Invoice Logo SVG -->
78 <svg class="h-5 w-5 text-white" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
79 <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"/>
80 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
81 <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
82 <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
83 <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
84 </svg>
85 </div>
86 <span class="text-lg font-semibold text-gray-900"><?php esc_html_e('Easy Invoice', 'easy-invoice'); ?></span>
87 </div>
88 <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">
89 <svg class="w-3 h-3 mr-1" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
90 <path d="M19 12H5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
91 <path d="M12 19L5 12L12 5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
92 </svg>
93 Back to WordPress
94 </a>
95
96 <!-- Version Information -->
97 <div class="mt-2 mb-2 flex items-center justify-center space-x-2">
98 <!-- Free Version Badge -->
99 <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">
100 <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">
101 <path d="M12 2L2 7L12 12L22 7L12 2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
102 <path d="M2 17L12 22L22 17" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
103 <path d="M2 12L12 17L22 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
104 </svg>
105 v<?php echo esc_html(EASY_INVOICE_VERSION); ?>
106 </span>
107
108 <?php if (defined('EASY_INVOICE_PRO_VERSION') && function_exists('is_plugin_active') && is_plugin_active('easy-invoice-pro/easy-invoice-pro.php')): ?>
109 <!-- Pro Version Badge -->
110 <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">
111 <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">
112 <path d="M9 12L11 14L15 10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
113 <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"/>
114 </svg>
115 Pro v<?php echo esc_html(EASY_INVOICE_PRO_VERSION); ?>
116 </span>
117 <?php endif; ?>
118 </div>
119 </div>
120
121 <!-- Navigation Links -->
122 <nav class="mt-6 px-3 space-y-2">
123 <!-- Dashboard -->
124 <a href="<?php echo admin_url('admin.php?page=easy-invoice'); ?>"
125 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">
126 <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">
127 <path d="M3 13H9V19H3V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
128 <path d="M9 13H15V19H9V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
129 <path d="M15 13H21V19H15V13Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
130 <path d="M3 5H9V11H3V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
131 <path d="M9 5H15V11H9V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
132 <path d="M15 5H21V11H15V5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
133 </svg>
134 Dashboard
135 </a>
136
137 <!-- Invoices -->
138 <a href="<?php echo admin_url('admin.php?page=easy-invoice-all'); ?>"
139 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">
140 <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">
141 <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"/>
142 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
143 <path d="M16 13H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
144 <path d="M16 17H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
145 <path d="M10 9H8" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
146 </svg>
147 Invoices
148 </a>
149
150 <!-- Quotes -->
151 <a href="<?php echo admin_url('admin.php?page=easy-quote-all'); ?>"
152 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">
153 <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">
154 <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"/>
155 <path d="M14 2V8H20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
156 <path d="M9 9H15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
157 <path d="M9 13H15" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
158 <path d="M9 17H13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
159 </svg>
160 Quotes
161 </a>
162
163 <!-- Payments -->
164 <a href="<?php echo admin_url('admin.php?page=easy-invoice-payments'); ?>"
165 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">
166 <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">
167 <rect x="1" y="4" width="22" height="16" rx="2" ry="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
168 <line x1="1" y1="10" x2="23" y2="10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
169 </svg>
170 Payments
171 </a>
172
173 <!-- Clients -->
174 <a href="<?php echo admin_url('admin.php?page=easy-invoice-clients'); ?>"
175 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">
176 <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">
177 <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"/>
178 <circle cx="9" cy="7" r="4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
179 <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"/>
180 <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"/>
181 </svg>
182 Clients
183 </a>
184
185 <?php if (easy_invoice_has_pro()): ?>
186 <!-- Item Library -->
187 <a href="<?php echo admin_url('admin.php?page=easy-invoice-pro-item-library'); ?>"
188 class="<?php echo $is_item_library_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">
189 <svg class="<?php echo $is_item_library_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">
190 <path d="M20 7H4C2.9 7 2 7.9 2 9V19C2 20.1 2.9 21 4 21H20C21.1 21 22 20.1 22 19V9C22 7.9 21.1 7 20 7Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
191 <path d="M16 3H8C7.4 3 7 3.4 7 4V7H17V4C17 3.4 16.6 3 16 3Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
192 <path d="M8 11H16" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
193 <path d="M8 15H13" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
194 </svg>
195 Item Library
196 </a>
197
198 <!-- Template Builder -->
199 <a href="<?php echo admin_url('admin.php?page=easy-invoice-templates'); ?>"
200 class="<?php echo $is_templates_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">
201 <svg class="<?php echo $is_templates_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">
202 <path d="M4 4h7v2H9.5L7.5 7.5H4V4zm7 4h7v2h2.5L17.5 7.5H11V4zm7 4h7v2h2.5L27.5 7.5H18V4z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
203 <path d="M4 11h7v2H9.5L7.5 14.5H4V11zm7 0h7v2h2.5L17.5 14.5H11V11zm7 0h7v2h2.5L27.5 14.5H18V11z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
204 <path d="M4 18h7v2H9.5L7.5 21.5H4V18zm7 0h7v2h2.5L17.5 21.5H11V18zm7 0h7v2h2.5L27.5 21.5H18V18z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
205 </svg>
206 Template Builder
207 </a>
208 <?php endif; ?>
209
210 <!-- Reports -->
211 <?php if (!easy_invoice_has_pro()): ?>
212 <a href="#" id="reports-menu-link"
213 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">
214 <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">
215 <path d="M18 20V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
216 <path d="M12 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
217 <path d="M6 20V14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
218 </svg>
219 Reports
220 <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">
221 <svg class="w-4 h-4 mr-1 text-white" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
222 <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"/>
223 </svg>
224 Pro
225 </span>
226 </a>
227 <?php else: ?>
228 <a href="<?php echo admin_url('admin.php?page=easy-invoice-reports'); ?>"
229 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">
230 <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">
231 <path d="M18 20V10" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
232 <path d="M12 20V4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
233 <path d="M6 20V14" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
234 </svg>
235 Reports
236 </a>
237 <?php endif; ?>
238
239 <!-- Settings -->
240 <a href="<?php echo admin_url('admin.php?page=easy-invoice-settings'); ?>"
241 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">
242 <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">
243 <circle cx="12" cy="12" r="3" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
244 <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"/>
245 </svg>
246 Settings
247 </a>
248
249 <!-- License -->
250 <?php
251 // Check if Pro plugin is active and get license status
252 $show_license_badge = false;
253 $license_status = 'inactive';
254 $license_text = 'Deactivated';
255
256 if (easy_invoice_has_pro()) {
257 $license_key = \EasyInvoicePro\Updater\License::get_license_key();
258 $is_valid = \EasyInvoicePro\Updater\License::has_valid_license();
259 $is_expired = \EasyInvoicePro\Updater\License::has_license_expired();
260
261 // Always show badge for Pro version
262 $show_license_badge = true;
263
264 if (!empty($license_key)) {
265 if ($is_valid && !$is_expired) {
266 $license_status = 'activated';
267 $license_text = 'Activated';
268 } elseif ($is_expired) {
269 $license_status = 'expired';
270 $license_text = 'Expired';
271 } else {
272 $license_status = 'inactive';
273 $license_text = 'Deactivated';
274 }
275 } else {
276 // No license key entered
277 $license_status = 'inactive';
278 $license_text = 'Inactive';
279 }
280 } else {
281 // Free version - show Free badge
282 $show_license_badge = true;
283 $license_status = 'free';
284 $license_text = 'Free';
285 }
286 ?>
287 <a href="<?php echo admin_url('admin.php?page=easy-invoice-license'); ?>"
288 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">
289 <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">
290 <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"/>
291 </svg>
292 <span class="flex-1">License</span>
293 <?php if ($show_license_badge): ?>
294 <span class="license-status-badge <?php echo $license_status; ?>">
295 <span class="status-dot"></span>
296 <?php echo $license_text; ?>
297 </span>
298 <?php endif; ?>
299 </a>
300
301 <!-- Free vs Pro - only show in free version -->
302 <?php
303 $show_free_vs_pro = !easy_invoice_has_pro();
304
305 if ($show_free_vs_pro):
306 ?>
307 <a href="<?php echo admin_url('admin.php?page=easy-invoice-free-vs-pro'); ?>"
308 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">
309 <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">
310 <path d="M3 6L21 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
311 <path d="M3 12L21 12" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
312 <path d="M3 18L21 18" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
313 <path d="M9 3L9 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
314 <path d="M15 3L15 21" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
315 </svg>
316 <span class="flex-1"><?php esc_html_e('Free vs Pro', 'easy-invoice'); ?></span>
317 <span class="inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-purple-100 text-purple-800">
318 <?php esc_html_e('Compare', 'easy-invoice'); ?>
319 </span>
320 </a>
321 <?php endif; ?>
322
323 <!-- Join Community -->
324 <a href="<?php echo esc_url('https://www.facebook.com/groups/mantrabraincommunity'); ?>"
325 target="_blank"
326 rel="noopener noreferrer"
327 class="<?php echo ($current_page === 'easy-invoice-join-community') ? '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">
328 <svg class="<?php echo ($current_page === 'easy-invoice-join-community') ? '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">
329 <path d="M18 2H15C13.6739 2 12.4021 2.52678 11.4645 3.46447C10.5268 4.40215 10 5.67392 10 7V10H7V14H10V22H14V14H17L18 10H14V7C14 6.73478 14.1054 6.48043 14.2929 6.29289C14.4804 6.10536 14.7348 6 15 6H18V2Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
330 </svg>
331 <span class="flex-1"><?php esc_html_e('Join Community', 'easy-invoice'); ?></span>
332 <svg class="flex-shrink-0 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
333 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/>
334 </svg>
335 </a>
336
337 </nav>
338
339 <!-- User Profile -->
340 <div class="absolute bottom-0 w-full border-t border-gray-200 p-4">
341 <div class="relative">
342 <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">
343 <div class="flex-shrink-0">
344 <div class="h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center">
345 <span class="text-gray-600 font-medium text-sm"><?php echo substr(wp_get_current_user()->display_name, 0, 1); ?></span>
346 </div>
347 </div>
348 <div class="ml-3 flex-1">
349 <p class="text-sm font-medium text-gray-700"><?php echo esc_html(wp_get_current_user()->display_name); ?></p>
350 <p class="text-xs text-gray-500"><?php echo esc_html(wp_get_current_user()->user_email); ?></p>
351 </div>
352 <div class="flex-shrink-0">
353 <svg class="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
354 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
355 </svg>
356 </div>
357 </button>
358
359 <!-- Dropdown Menu -->
360 <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">
361 <div class="py-1">
362 <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">
363 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
364 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
365 </svg>
366 <?php _e('Back to WordPress', 'easy-invoice'); ?>
367 </a>
368 <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">
369 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
370 <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>
371 </svg>
372 <?php _e('Logout', 'easy-invoice'); ?>
373 </a>
374 </div>
375 </div>
376 </div>
377 </div>
378 </div>
379
380 <!-- Mobile menu button -->
381 <div class="fixed top-0 left-0 z-50 p-4 sm:hidden">
382 <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">
383 <i class="fas fa-bars"></i>
384 </button>
385 </div>
386
387 <script>
388 document.addEventListener('DOMContentLoaded', function() {
389 const mobileMenuButton = document.querySelector('button[aria-expanded="false"]');
390 const sidebar = document.querySelector('.fixed.inset-y-0.left-0');
391
392 if (mobileMenuButton && sidebar) {
393 mobileMenuButton.addEventListener('click', function() {
394 const expanded = this.getAttribute('aria-expanded') === 'true';
395 this.setAttribute('aria-expanded', !expanded);
396 sidebar.classList.toggle('hidden');
397 });
398 }
399
400 // Handle Reports menu click for premium feature
401 const reportsMenuLink = document.getElementById('reports-menu-link');
402 if (reportsMenuLink) {
403 reportsMenuLink.addEventListener('click', function(e) {
404 e.preventDefault();
405 // Show premium popup using the proper confirmation modal
406 if (typeof EasyInvoiceConfirmation !== 'undefined') {
407 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.');
408 } else {
409 // Fallback to alert if confirmation modal is not available
410 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')); ?>');
411 }
412 });
413 }
414
415 // Handle user dropdown
416 const userDropdownButton = document.getElementById('user-dropdown-button');
417 const userDropdownMenu = document.getElementById('user-dropdown-menu');
418
419 if (userDropdownButton && userDropdownMenu) {
420 userDropdownButton.addEventListener('click', function(e) {
421 e.preventDefault();
422 e.stopPropagation();
423 userDropdownMenu.classList.toggle('hidden');
424 });
425
426 // Close dropdown when clicking outside
427 document.addEventListener('click', function(e) {
428 if (!userDropdownButton.contains(e.target) && !userDropdownMenu.contains(e.target)) {
429 userDropdownMenu.classList.add('hidden');
430 }
431 });
432
433 // Close dropdown when pressing Escape key
434 document.addEventListener('keydown', function(e) {
435 if (e.key === 'Escape') {
436 userDropdownMenu.classList.add('hidden');
437 }
438 });
439 }
440 });
441 </script>
442
443 <style>
444 html.wp-toolbar {
445 padding-top: 0 !important;
446 }
447
448 /* Custom color for active icons */
449 .group:hover svg {
450 color: rgb(79 70 229) !important;
451 }
452
453 /* Active state icon color */
454 .bg-indigo-50 svg {
455 color: rgb(79 70 229) !important;
456 }
457
458 /* Hover state for non-active items */
459 .group:hover:not(.bg-indigo-50) svg {
460 color: rgb(79 70 229) !important;
461 }
462 </style>
463
464 <div class="min-h-screen bg-gray-50 easy-invoice-admin">
465 <!-- Main Content -->
466 <div class="pl-64">
467 <?php
468
469 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'easy-invoice';
470 // Content will be inserted here
471 do_action('easy_invoice_admin_before_main_content', $page);
472
473 do_action('easy_invoice_admin_main_content', $page);
474
475 do_action('easy_invoice_admin_after_main_content', $page);
476
477 ?>
478 </div>
479
480 <!-- Add ajaxurl for custom notice JavaScript -->
481 <script>
482 if (typeof ajaxurl === 'undefined') {
483 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
484 }
485 </script>
486 </div>
487