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

518 lines 34.3 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="ei-app-sidebar-top flex flex-col items-center justify-center px-4 py-2 border-b border-gray-200 box-border">
75 <div class="flex items-center space-x-2 mb-1">
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 <?php esc_html_e( 'Back to WordPress', 'easy-invoice' ); ?>
94 </a>
95
96 <!-- Version Information -->
97 <div class="mt-1 flex flex-wrap items-center justify-center gap-1.5">
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 <?php echo esc_html( sprintf( __( 'Pro v%s', 'easy-invoice' ), 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 <?php esc_html_e( 'Dashboard', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Invoices', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Quotes', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Payments', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Clients', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Item Library', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Template Builder', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Reports', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Pro', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Reports', 'easy-invoice' ); ?>
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 <?php esc_html_e( 'Settings', 'easy-invoice' ); ?>
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', 'easy-invoice' );
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', 'easy-invoice' );
268 } elseif ($is_expired) {
269 $license_status = 'expired';
270 $license_text = __( 'Expired', 'easy-invoice' );
271 } else {
272 $license_status = 'inactive';
273 $license_text = __( 'Deactivated', 'easy-invoice' );
274 }
275 } else {
276 // No license key entered
277 $license_status = 'inactive';
278 $license_text = __( 'Inactive', 'easy-invoice' );
279 }
280 } else {
281 // Free version - show Free badge
282 $show_license_badge = true;
283 $license_status = 'free';
284 $license_text = __( 'Free', 'easy-invoice' );
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"><?php esc_html_e( 'License', 'easy-invoice' ); ?></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 esc_html( $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 <!-- Documentation -->
338 <a href="<?php echo esc_url('https://easy-invoice.matrixaddons.com/docs/'); ?>"
339 target="_blank"
340 rel="noopener noreferrer"
341 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">
342 <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">
343 <path d="M4 19.5V4.5C4 3.4 4.9 2.5 6 2.5H19C19.5 2.5 20 3 20 3.5V20.5C20 21 19.5 21.5 19 21.5H6C4.9 21.5 4 20.6 4 19.5Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
344 <path d="M8 7H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
345 <path d="M8 11H16" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
346 <path d="M8 15H13" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
347 </svg>
348 <span class="flex-1"><?php esc_html_e('Documentation', 'easy-invoice'); ?></span>
349 <svg class="flex-shrink-0 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
350 <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"/>
351 </svg>
352 </a>
353
354 </nav>
355
356 <!-- User Profile -->
357 <div class="absolute bottom-0 w-full border-t border-gray-200 p-4">
358 <div class="relative">
359 <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">
360 <div class="flex-shrink-0">
361 <div class="h-8 w-8 rounded-full bg-gray-200 flex items-center justify-center">
362 <span class="text-gray-600 font-medium text-sm"><?php echo substr(wp_get_current_user()->display_name, 0, 1); ?></span>
363 </div>
364 </div>
365 <div class="ml-3 flex-1">
366 <p class="text-sm font-medium text-gray-700"><?php echo esc_html(wp_get_current_user()->display_name); ?></p>
367 <p class="text-xs text-gray-500"><?php echo esc_html(wp_get_current_user()->user_email); ?></p>
368 </div>
369 <div class="flex-shrink-0">
370 <svg class="h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
371 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
372 </svg>
373 </div>
374 </button>
375
376 <!-- Dropdown Menu -->
377 <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">
378 <div class="py-1">
379 <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">
380 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
381 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 19l-7-7m0 0l7-7m-7 7h18"></path>
382 </svg>
383 <?php _e('Back to WordPress', 'easy-invoice'); ?>
384 </a>
385 <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">
386 <svg class="mr-3 h-4 w-4 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
387 <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>
388 </svg>
389 <?php _e('Logout', 'easy-invoice'); ?>
390 </a>
391 </div>
392 </div>
393 </div>
394 </div>
395 </div>
396
397 <!-- Mobile menu button -->
398 <div class="fixed top-0 left-0 z-50 p-4 sm:hidden">
399 <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" aria-label="<?php echo esc_attr__( 'Open menu', 'easy-invoice' ); ?>">
400 <svg class="h-6 w-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" aria-hidden="true">
401 <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
402 </svg>
403 </button>
404 </div>
405
406 <script>
407 document.addEventListener('DOMContentLoaded', function() {
408 const mobileMenuButton = document.querySelector('button[aria-expanded="false"]');
409 const sidebar = document.querySelector('.fixed.inset-y-0.left-0');
410
411 if (mobileMenuButton && sidebar) {
412 mobileMenuButton.addEventListener('click', function() {
413 const expanded = this.getAttribute('aria-expanded') === 'true';
414 this.setAttribute('aria-expanded', !expanded);
415 sidebar.classList.toggle('hidden');
416 });
417 }
418
419 // Handle Reports menu click for premium feature
420 const reportsMenuLink = document.getElementById('reports-menu-link');
421 if (reportsMenuLink) {
422 reportsMenuLink.addEventListener('click', function(e) {
423 e.preventDefault();
424 // Show premium popup using the proper confirmation modal
425 if (typeof EasyInvoiceConfirmation !== 'undefined') {
426 EasyInvoiceConfirmation.showFeatureUpgrade(
427 <?php echo wp_json_encode( __( 'Detailed Reports', 'easy-invoice' ) ); ?>,
428 <?php echo wp_json_encode( __( '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.', 'easy-invoice' ) ); ?>
429 );
430 } else {
431 // Fallback to alert if confirmation modal is not available
432 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')); ?>');
433 }
434 });
435 }
436
437 // Handle user dropdown
438 const userDropdownButton = document.getElementById('user-dropdown-button');
439 const userDropdownMenu = document.getElementById('user-dropdown-menu');
440
441 if (userDropdownButton && userDropdownMenu) {
442 userDropdownButton.addEventListener('click', function(e) {
443 e.preventDefault();
444 e.stopPropagation();
445 userDropdownMenu.classList.toggle('hidden');
446 });
447
448 // Close dropdown when clicking outside
449 document.addEventListener('click', function(e) {
450 if (!userDropdownButton.contains(e.target) && !userDropdownMenu.contains(e.target)) {
451 userDropdownMenu.classList.add('hidden');
452 }
453 });
454
455 // Close dropdown when pressing Escape key
456 document.addEventListener('keydown', function(e) {
457 if (e.key === 'Escape') {
458 userDropdownMenu.classList.add('hidden');
459 }
460 });
461 }
462 });
463 </script>
464
465 <style>
466 html.wp-toolbar {
467 padding-top: 0 !important;
468 }
469 /* Matches hideAdminUi: hidden admin bar must not reserve body padding or main content shifts vs fixed sidebar */
470 body.easy-invoice-admin-body.admin-bar {
471 padding-top: 0 !important;
472 }
473 body.easy-invoice-admin-body.admin-bar #wpbody,
474 body.easy-invoice-admin-body.admin-bar #wpbody-content {
475 padding-top: 0 !important;
476 }
477
478 /* Custom color for active icons */
479 .group:hover svg {
480 color: rgb(79 70 229) !important;
481 }
482
483 /* Active state icon color */
484 .bg-indigo-50 svg {
485 color: rgb(79 70 229) !important;
486 }
487
488 /* Hover state for non-active items */
489 .group:hover:not(.bg-indigo-50) svg {
490 color: rgb(79 70 229) !important;
491 }
492 </style>
493
494 <div class="min-h-screen bg-gray-50 easy-invoice-admin">
495 <a href="#easy-invoice-main" class="easy-invoice-skip-link screen-reader-text"><?php esc_html_e( 'Skip to main content', 'easy-invoice' ); ?></a>
496 <!-- Main Content -->
497 <div id="easy-invoice-main" class="pl-64" tabindex="-1">
498 <?php
499
500 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : 'easy-invoice';
501 // Content will be inserted here
502 do_action('easy_invoice_admin_before_main_content', $page);
503
504 do_action('easy_invoice_admin_main_content', $page);
505
506 do_action('easy_invoice_admin_after_main_content', $page);
507
508 ?>
509 </div>
510
511 <!-- Add ajaxurl for custom notice JavaScript -->
512 <script>
513 if (typeof ajaxurl === 'undefined') {
514 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>';
515 }
516 </script>
517 </div>
518