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 / client-view-page.php

client-view-page.php in Easy Invoice – Invoice Generator, PDF Quotes & Payments 2.1.2, at templates/client-view-page.php

378 lines 22.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if (!defined('ABSPATH')) {
4 exit;
5 }
6
7 // Client data and invoices are passed from the render_client_view_page method
8 ?>
9
10 <div class="p-8">
11 <div class="flex justify-between items-center mb-6">
12 <div>
13 <h1 class="text-2xl font-bold text-gray-900 flex items-center">
14 <i class="fas fa-user-tie text-gray-400 mr-3"></i>
15 <span><?php echo esc_html($client->getBusinessClientName() ?: $client->getFirstName() . ' ' . $client->getLastName()); ?></span>
16 </h1>
17 <p class="text-sm text-gray-500 mt-1">
18 Client Overview & Invoice History
19 </p>
20 </div>
21 <div>
22 <a href="?page=easy-invoice-clients" class="text-gray-600 hover:text-indigo-600 mr-4 font-medium text-sm">
23 <i class="fas fa-arrow-left mr-1"></i> Back to Clients
24 </a>
25 <a href="?page=easy-invoice-client-edit&client_id=<?php echo esc_attr($client->getId()); ?>" class="bg-indigo-600 text-white px-4 py-2 rounded-lg hover:bg-indigo-700 text-sm font-semibold shadow-sm">
26 <i class="fas fa-pen mr-2"></i>Edit Client
27 </a>
28 </div>
29 </div>
30
31 <!-- Client Information Card -->
32 <div class="bg-white p-6 rounded-xl border border-gray-200 shadow-sm mb-8">
33 <div class="flex items-center justify-between pb-4 border-b border-gray-200 mb-4">
34 <h4 class="text-lg font-semibold text-gray-800 flex items-center">
35 <i class="fas fa-user-check text-indigo-500 mr-3"></i>
36 <span><?php _e('Client Details', 'easy-invoice'); ?></span>
37 </h4>
38 </div>
39
40 <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-x-8 gap-y-6 pt-2">
41 <!-- Client Name -->
42 <div class="flex items-start group">
43 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-user-tie text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
44 <div class="ml-3">
45 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Full Name', 'easy-invoice'); ?></label>
46 <p class="text-sm font-semibold text-gray-800 mt-1"><?php echo esc_html($client->getFirstName() . ' ' . $client->getLastName()); ?></p>
47 </div>
48 </div>
49
50 <!-- Company Name -->
51 <div class="flex items-start group">
52 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-building text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
53 <div class="ml-3">
54 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Company', 'easy-invoice'); ?></label>
55 <p class="text-sm font-semibold text-gray-800 mt-1"><?php echo esc_html($client->getBusinessClientName() ?: 'N/A'); ?></p>
56 </div>
57 </div>
58
59 <!-- Email -->
60 <div class="flex items-start group">
61 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-envelope text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
62 <div class="ml-3">
63 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Email', 'easy-invoice'); ?></label>
64 <p class="text-sm text-gray-800 mt-1 break-all"><?php echo esc_html($client->getEmail()); ?></p>
65 </div>
66 </div>
67
68 <!-- Phone -->
69 <div class="flex items-start group">
70 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-phone-alt text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
71 <div class="ml-3">
72 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Phone', 'easy-invoice'); ?></label>
73 <p class="text-sm text-gray-800 mt-1"><?php echo esc_html($client->getPhone() ?: 'N/A'); ?></p>
74 </div>
75 </div>
76
77 <!-- Username -->
78 <div class="flex items-start group">
79 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-at text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
80 <div class="ml-3">
81 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Username', 'easy-invoice'); ?></label>
82 <p class="text-sm text-gray-800 mt-1"><?php echo esc_html($client->getUsername()); ?></p>
83 </div>
84 </div>
85
86 <!-- Client ID -->
87 <div class="flex items-start group">
88 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-id-card text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
89 <div class="ml-3">
90 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Client ID', 'easy-invoice'); ?></label>
91 <p class="text-sm text-gray-800 mt-1"><?php echo esc_html($client->getId()); ?></p>
92 </div>
93 </div>
94
95 <!-- Client Role -->
96 <div class="flex items-start group">
97 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-user-shield text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
98 <div class="ml-3">
99 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Role', 'easy-invoice'); ?></label>
100 <div class="mt-1">
101 <?php
102 $role_class = 'bg-blue-100 text-blue-800';
103 $role_icon = 'fas fa-user';
104
105 if (isset($client_role)) {
106 switch ($client_role) {
107 case 'administrator':
108 $role_class = 'bg-red-100 text-red-800';
109 $role_icon = 'fas fa-crown';
110 break;
111 case 'editor':
112 $role_class = 'bg-purple-100 text-purple-800';
113 $role_icon = 'fas fa-user-edit';
114 break;
115 case 'author':
116 $role_class = 'bg-green-100 text-green-800';
117 $role_icon = 'fas fa-user-edit';
118 break;
119 case 'contributor':
120 $role_class = 'bg-yellow-100 text-yellow-800';
121 $role_icon = 'fas fa-user-plus';
122 break;
123 case 'subscriber':
124 $role_class = 'bg-gray-100 text-gray-800';
125 $role_icon = 'fas fa-user';
126 break;
127 default:
128 $role_class = 'bg-blue-100 text-blue-800';
129 $role_icon = 'fas fa-user';
130 }
131 }
132 ?>
133 <span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium <?php echo $role_class; ?>">
134 <i class="<?php echo $role_icon; ?> mr-1"></i>
135 <?php echo esc_html(ucfirst($client_role ?? 'client')); ?>
136 </span>
137 </div>
138 </div>
139 </div>
140
141 <!-- Website -->
142 <div class="flex items-start group">
143 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-globe-americas text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
144 <div class="ml-3">
145 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Website', 'easy-invoice'); ?></label>
146 <p class="text-sm text-gray-800 mt-1">
147 <?php if ($client->getWebsite()): ?>
148 <a href="<?php echo esc_url($client->getWebsite()); ?>" target="_blank" class="text-indigo-600 hover:text-indigo-800 hover:underline">
149 <?php echo esc_html($client->getWebsite()); ?>
150 </a>
151 <?php else: ?>
152 N/A
153 <?php endif; ?>
154 </p>
155 </div>
156 </div>
157
158 <!-- Address -->
159 <div class="flex items-start group md:col-span-2 lg:col-span-3">
160 <div class="flex-shrink-0 w-8 text-center pt-1"><i class="fas fa-map-marker-alt text-gray-400 group-hover:text-indigo-500 transition-colors"></i></div>
161 <div class="ml-3">
162 <label class="block text-xs font-medium text-gray-500 uppercase tracking-wider"><?php _e('Address', 'easy-invoice'); ?></label>
163 <p class="text-sm text-gray-800 mt-1 whitespace-pre-wrap"><?php echo esc_html($client->getAddress() ?: 'N/A'); ?></p>
164 </div>
165 </div>
166 </div>
167
168 <?php if ($client->getExtraInfo()): ?>
169 <div class="mt-6 pt-6 border-t border-gray-200">
170 <h3 class="text-sm font-semibold text-gray-800 mb-2 flex items-center">
171 <i class="fas fa-info-circle text-gray-400 mr-2"></i>
172 <span><?php _e('Extra Info', 'easy-invoice'); ?></span>
173 </h3>
174 <div class="bg-gray-50 p-4 rounded-md text-sm text-gray-700 prose max-w-none">
175 <?php echo nl2br(esc_html($client->getExtraInfo())); ?>
176 </div>
177 </div>
178 <?php endif; ?>
179 </div>
180
181 <!-- Client Invoices -->
182 <div class="bg-white shadow-sm rounded-xl border border-gray-200">
183 <div class="p-6 border-b border-gray-200">
184 <h2 class="text-lg font-semibold text-gray-800 flex items-center">
185 <i class="fas fa-file-invoice-dollar text-indigo-500 mr-3"></i>
186 <span>Invoices</span>
187 </h2>
188 </div>
189
190 <?php if (empty($invoices)): ?>
191 <div class="text-center py-12">
192 <div class="text-gray-400 mb-4"><i class="fas fa-file-invoice fa-4x"></i></div>
193 <p class="text-gray-500 font-medium mb-4">No invoices found for this client.</p>
194 </div>
195 <?php else: ?>
196 <div class="overflow-x-auto">
197 <table class="min-w-full divide-y divide-gray-200">
198 <thead class="bg-gray-50">
199 <tr>
200 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Invoice</th>
201 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
202 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Due Date</th>
203 <th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
204 <th scope="col" class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
205 <th scope="col" class="relative px-6 py-3">
206 <span class="sr-only">Actions</span>
207 </th>
208 </tr>
209 </thead>
210 <tbody class="bg-white divide-y divide-gray-200">
211 <?php foreach ($invoices as $invoice):
212 $status_class = '';
213 $status_icon = '';
214 switch ($invoice['status']) {
215 case 'paid':
216 $status_class = 'bg-green-100 text-green-800';
217 $status_icon = 'fas fa-check-circle';
218 break;
219 case 'pending':
220 $status_class = 'bg-yellow-100 text-yellow-800';
221 $status_icon = 'fas fa-hourglass-half';
222 break;
223 case 'overdue':
224 $status_class = 'bg-red-100 text-red-800';
225 $status_icon = 'fas fa-exclamation-triangle';
226 break;
227 default:
228 $status_class = 'bg-gray-100 text-gray-800';
229 $status_icon = 'fas fa-question-circle';
230 }
231 ?>
232 <tr>
233 <td class="px-6 py-4 whitespace-nowrap">
234 <div class="flex flex-col">
235 <div class="text-sm font-semibold text-indigo-600 hover:text-indigo-800">
236 <a href="<?php echo get_permalink($invoice['id']); ?>"><?php echo esc_html($invoice['title']); ?></a>
237 </div>
238 <div class="text-xs text-gray-500 font-mono">
239 <?php echo esc_html($invoice['invoice_number']); ?>
240 </div>
241 </div>
242 </td>
243 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
244 <?php echo esc_html(date("M d, Y", strtotime($invoice['date']))); ?>
245 </td>
246 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
247 <?php echo esc_html(date("M d, Y", strtotime($invoice['due_date']))); ?>
248 </td>
249 <td class="px-6 py-4 whitespace-nowrap text-right text-sm text-gray-800 font-medium">
250 <?php
251 // Use InvoiceFormatter for proper currency formatting
252 $formatter = new \EasyInvoice\Helpers\InvoiceFormatter();
253 echo esc_html($formatter->format($invoice['amount'] ?? 0));
254 ?>
255 </td>
256 <td class="px-6 py-4 whitespace-nowrap text-center">
257 <span class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full <?php echo $status_class; ?>">
258 <i class="<?php echo $status_icon; ?> mr-1.5"></i>
259 <?php echo ucfirst(esc_html($invoice['status'])); ?>
260 </span>
261 </td>
262 <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-3">
263 <a href="<?php echo get_permalink($invoice['id']); ?>" class="text-indigo-600 hover:text-indigo-900" data-tooltip="View Invoice">
264 <i class="fas fa-eye"></i>
265 </a>
266 <a href="?page=easy-invoice-builder&invoice_id=<?php echo esc_attr($invoice['id']); ?>" class="text-gray-500 hover:text-indigo-900" data-tooltip="Edit Invoice">
267 <i class="fas fa-pen"></i>
268 </a>
269 </td>
270 </tr>
271 <?php endforeach; ?>
272 </tbody>
273 </table>
274 </div>
275 <?php endif; ?>
276 </div>
277
278 <!-- Client Quotes -->
279 <div class="bg-white shadow-sm rounded-xl border border-gray-200 mt-6">
280 <div class="p-6 border-b border-gray-200">
281 <h2 class="text-lg font-semibold text-gray-800 flex items-center">
282 <i class="fas fa-file-contract text-green-500 mr-3"></i>
283 <span>Quotes</span>
284 </h2>
285 </div>
286
287 <?php if (empty($quotes)): ?>
288 <div class="text-center py-12">
289 <div class="text-gray-400 mb-4"><i class="fas fa-file-contract fa-4x"></i></div>
290 <p class="text-gray-500 font-medium mb-4">No quotes found for this client.</p>
291 </div>
292 <?php else: ?>
293 <div class="overflow-x-auto">
294 <table class="min-w-full divide-y divide-gray-200">
295 <thead class="bg-gray-50">
296 <tr>
297 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Quote</th>
298 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
299 <th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Expiry Date</th>
300 <th scope="col" class="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">Amount</th>
301 <th scope="col" class="px-6 py-3 text-center text-xs font-medium text-gray-500 uppercase tracking-wider">Status</th>
302 <th scope="col" class="relative px-6 py-3">
303 <span class="sr-only">Actions</span>
304 </th>
305 </tr>
306 </thead>
307 <tbody class="bg-white divide-y divide-gray-200">
308 <?php foreach ($quotes as $quote):
309 $status_class = '';
310 $status_icon = '';
311 switch ($quote['status']) {
312 case 'accepted':
313 $status_class = 'bg-green-100 text-green-800';
314 $status_icon = 'fas fa-check-circle';
315 break;
316 case 'pending':
317 $status_class = 'bg-yellow-100 text-yellow-800';
318 $status_icon = 'fas fa-hourglass-half';
319 break;
320 case 'declined':
321 $status_class = 'bg-red-100 text-red-800';
322 $status_icon = 'fas fa-times-circle';
323 break;
324 case 'expired':
325 $status_class = 'bg-gray-100 text-gray-800';
326 $status_icon = 'fas fa-clock';
327 break;
328 default:
329 $status_class = 'bg-gray-100 text-gray-800';
330 $status_icon = 'fas fa-question-circle';
331 }
332 ?>
333 <tr>
334 <td class="px-6 py-4 whitespace-nowrap">
335 <div class="flex flex-col">
336 <div class="text-sm font-semibold text-green-600 hover:text-green-800">
337 <a href="<?php echo get_permalink($quote['id']); ?>"><?php echo esc_html($quote['title']); ?></a>
338 </div>
339 <div class="text-xs text-gray-500 font-mono">
340 <?php echo esc_html($quote['quote_number']); ?>
341 </div>
342 </div>
343 </td>
344 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
345 <?php echo esc_html(date("M d, Y", strtotime($quote['date']))); ?>
346 </td>
347 <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
348 <?php echo esc_html(date("M d, Y", strtotime($quote['expiry_date']))); ?>
349 </td>
350 <td class="px-6 py-4 whitespace-nowrap text-right text-sm text-gray-800 font-medium">
351 <?php
352 // Use QuoteFormatter for proper currency formatting
353 $formatter = new \EasyInvoice\Helpers\QuoteFormatter();
354 echo esc_html($formatter->format($quote['amount'] ?? 0));
355 ?>
356 </td>
357 <td class="px-6 py-4 whitespace-nowrap text-center">
358 <span class="px-3 py-1 inline-flex text-xs leading-5 font-semibold rounded-full <?php echo $status_class; ?>">
359 <i class="<?php echo $status_icon; ?> mr-1.5"></i>
360 <?php echo ucfirst(esc_html($quote['status'])); ?>
361 </span>
362 </td>
363 <td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium space-x-3">
364 <a href="<?php echo get_permalink($quote['id']); ?>" class="text-green-600 hover:text-green-900" data-tooltip="View Quote">
365 <i class="fas fa-eye"></i>
366 </a>
367 <a href="?page=easy-invoice-quote-builder&quote_id=<?php echo esc_attr($quote['id']); ?>" class="text-gray-500 hover:text-green-900" data-tooltip="Edit Quote">
368 <i class="fas fa-pen"></i>
369 </a>
370 </td>
371 </tr>
372 <?php endforeach; ?>
373 </tbody>
374 </table>
375 </div>
376 <?php endif; ?>
377 </div>
378 </div>