PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.2
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.2
2.4.3 2.4.4 2.4.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 All 60 releases
← All changes | templates/invoice-templates/elegant.php +127 -42 2.3.7 → 2.4.2 View file →
@@ -3,33 +3,37 @@
3 3 * Elegant Template - Sophisticated Design
4 4 * Elegant, sophisticated, and refined invoice template
5 5 */
6 6
7 -$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings();
7 +if ( ! defined( 'ABSPATH' ) ) {
8 + exit;
9 +}
10 +$text_settings = \EasyInvoice\Helpers\TemplateTextHelper::forDocument(\EasyInvoice\Helpers\TemplateTextHelper::getInvoiceTextSettings(), $invoice);
11 +$ei_is_credit_note = \EasyInvoice\Helpers\TemplateTextHelper::isCreditNote($invoice);
8 12 $company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo();
9 13 ?>
10 14 <style>
11 15 /* Elegant Template - Sophisticated Design */
12 16 :root {
13 - --primary-color: #7c3aed;
14 - --primary-light: #a855f7;
15 - --primary-dark: #5b21b6;
16 - --secondary-color: #8b5cf6;
17 + --primary-color: #8a6a3d;
18 + --primary-light: #b08d57;
19 + --primary-dark: #5f4627;
20 + --secondary-color: #8a6a3d;
17 21 --accent-color: #f59e0b;
18 22 --success-color: #10b981;
19 23 --warning-color: #f59e0b;
20 24 --error-color: #ef4444;
21 - --text-primary: #1e293b;
22 - --text-secondary: #64748b;
23 - --text-muted: #94a3b8;
24 - --border-color: #e2e8f0;
25 - --border-light: #f1f5f9;
25 + --text-primary: #1f1b16;
26 + --text-secondary: #5b544c;
27 + --text-muted: #8a8279;
28 + --border-color: #d9d2c7;
29 + --border-light: #ebe6de;
26 30 --background-primary: #ffffff;
27 - --background-secondary: #f8fafc;
28 - --background-accent: #f1f5f9;
31 + --background-secondary: #ffffff;
32 + --background-accent: #faf8f4;
29 33
30 - --font-family: 'Playfair Display', Georgia, serif;
31 - --font-family-heading: 'Playfair Display', Georgia, serif;
34 + --font-family: 'Georgia', 'Times New Roman', serif;
35 + --font-family-heading: 'Georgia', 'Times New Roman', serif;
32 36 --font-family-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
33 37
34 38 --font-size-xs: 0.75rem;
35 39 --font-size-sm: 0.875rem;
@@ -331,9 +335,9 @@
331 335 font-weight: 600;
332 336 color: var(--text-primary);
333 337 }
334 338
335 -.template-elegant .invoice-grand-total {
339 +.template-elegant .invoice-totals .invoice-grand-total {
336 340 font-size: var(--font-size-xl);
337 341 font-weight: 700;
338 342 color: var(--primary-color);
339 343 border-top: 2px solid var(--primary-color);
@@ -422,26 +426,81 @@
422 426 .template-elegant .invoice-totals {
423 427 width: 100%;
424 428 }
425 429 }
430 +
431 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
432 +.template-elegant .invoice-items th + th { text-align: right; }
433 +.template-elegant .invoice-items .item-quantity,
434 +.template-elegant .invoice-items .item-price,
435 +.template-elegant .invoice-items .item-adjust,
436 +.template-elegant .invoice-items .item-total,
437 +.template-elegant .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
438 +.template-elegant .meta-value { white-space: nowrap; }
439 +.template-elegant .invoice-items .item-adjust { text-align: right; }
440 +.template-elegant .client-contact { font-weight: 500; margin-bottom: 0.15em; }
441 +.template-elegant .client-tax-number,
442 +.template-elegant .company-tax-number { margin-top: 0.35em; }
443 +.template-elegant .invoice-items .item-description { white-space: pre-line; }
444 +
445 +/* Elegant: ink, hairlines and small capitals; nothing sits in a tinted panel. */
446 +.template-elegant { border-radius: 0; font-family: var(--font-family-body); }
447 +.template-elegant::before { height: 4px; background: var(--primary-color); }
448 +.template-elegant .invoice-header { border-bottom: 1px solid var(--border-color); padding-bottom: var(--spacing-6); margin-bottom: var(--spacing-8); }
449 +.template-elegant .invoice-header::after { display: none; }
450 +.template-elegant .company-name { font-family: var(--font-family-heading); font-weight: 400; font-size: var(--font-size-3xl); letter-spacing: 0.01em; }
451 +.template-elegant .invoice-meta { background: transparent; border: 0; box-shadow: none; padding: 0; min-width: 280px; gap: 0; }
452 +.template-elegant .invoice-title { font-family: var(--font-family-heading); font-style: normal; font-weight: 400; color: var(--text-primary); text-transform: uppercase; letter-spacing: 0.22em; font-size: var(--font-size-xl); text-align: right; margin-bottom: var(--spacing-4); }
453 +.template-elegant .meta-item { border-bottom: 1px solid var(--border-light); padding: var(--spacing-2) 0; }
454 +.template-elegant .meta-item:last-child { border-bottom: 0; }
455 +.template-elegant .meta-label { text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--font-size-xs); color: var(--text-muted); }
456 +.template-elegant .meta-value { font-weight: 500; font-size: var(--font-size-sm); }
457 +.template-elegant .address-section { margin-bottom: var(--spacing-8); }
458 +.template-elegant .address-block { background: transparent; border: 0; padding: 0; overflow: visible; }
459 +.template-elegant .address-block::before { display: none; }
460 +.template-elegant .address-block h2 { font-family: var(--font-family-body); font-size: var(--font-size-xs); letter-spacing: 0.16em; color: var(--text-muted); margin-bottom: var(--spacing-2); }
461 +.template-elegant .client-name { font-family: var(--font-family-heading); font-size: var(--font-size-lg); font-weight: 400; }
462 +.template-elegant .invoice-items { border: 0; box-shadow: none; border-radius: 0; border-top: 1px solid var(--text-primary); border-bottom: 1px solid var(--text-primary); margin-bottom: var(--spacing-8); }
463 +.template-elegant .invoice-items th { background: transparent; color: var(--text-muted); font-size: var(--font-size-xs); letter-spacing: 0.16em; font-weight: 500; padding: var(--spacing-3) var(--spacing-3); border-bottom: 1px solid var(--border-color); }
464 +.template-elegant .invoice-items td { padding: var(--spacing-4) var(--spacing-3); border-bottom: 1px solid var(--border-light); }
465 +.template-elegant .invoice-items th:first-child, .template-elegant .invoice-items td:first-child { padding-left: 0; }
466 +.template-elegant .invoice-items th:last-child, .template-elegant .invoice-items td:last-child { padding-right: 0; }
467 +.template-elegant .invoice-items tr:hover { background: transparent; }
468 +.template-elegant .item-name .item-title { font-family: var(--font-family-heading); font-weight: 400; font-size: var(--font-size-base); }
469 +.template-elegant .invoice-totals { background: transparent; border: 0; box-shadow: none; padding: 0; width: 340px; }
470 +.template-elegant .invoice-total-row { padding: var(--spacing-2) 0; border-bottom: 1px solid var(--border-light); }
471 +.template-elegant .invoice-total-label { text-transform: uppercase; letter-spacing: 0.1em; font-size: var(--font-size-xs); color: var(--text-muted); font-weight: 500; }
472 +.template-elegant .invoice-total-value { font-weight: 500; }
473 +.template-elegant .invoice-totals .invoice-grand-total { border-top: 1px solid var(--text-primary); border-bottom: 3px double var(--text-primary); color: var(--text-primary); padding: var(--spacing-3) 0; margin-top: var(--spacing-2); font-size: var(--font-size-lg); }
474 +.template-elegant .invoice-totals .invoice-grand-total .invoice-total-label { color: var(--text-primary); font-size: var(--font-size-sm); }
475 +.template-elegant .invoice-totals .invoice-grand-total .invoice-total-value { font-family: var(--font-family-heading); font-weight: 400; font-size: var(--font-size-2xl); color: var(--primary-color); }
476 +.template-elegant .invoice-notes, .template-elegant .invoice-terms { background: transparent; border: 0; border-top: 1px solid var(--border-color); border-radius: 0; padding: var(--spacing-5) 0 0; margin-top: var(--spacing-6); }
477 +.template-elegant .invoice-notes h3, .template-elegant .invoice-terms h3 { border: 0; padding: 0; font-family: var(--font-family-body); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-muted); font-weight: 500; margin-bottom: var(--spacing-2); }
478 +.template-elegant .invoice-footer { border-top: 1px solid var(--border-color); font-family: var(--font-family-heading); font-style: italic; }
479 +.template-elegant .document-kind { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-muted, #8a8a8a); font-family: var(--font-family-body, inherit); font-style: normal; margin-bottom: 0.3em; line-height: 1.2; }
480 +.template-elegant .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
481 +.template-elegant .invoice-totals .invoice-balance-due { font-weight: 700; }
482 +.template-elegant .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
483 +.template-elegant .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
426 484 </style>
427 485
428 486 <div class="template template-elegant">
429 487 <div class="invoice-header">
430 488 <div class="company-info">
489 + <?php if (!empty($company_info['logo'])): ?>
431 490 <div class="company-logo">
432 - <?php if (!empty($company_info['logo'])): ?>
433 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
434 - <?php endif; ?>
491 + <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image" onerror="this.parentNode.parentNode.removeChild(this.parentNode)">
435 492 </div>
493 + <?php endif; ?>
436 494 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
437 495 <div class="company-details">
438 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
496 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
439 497 </div>
440 498 </div>
441 499
442 500 <div class="invoice-meta">
443 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
501 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
502 + <div class="invoice-title"><?php if ('' !== $ei_title && 0 !== strcasecmp($ei_title, $ei_kind)) : ?><span class="document-kind"><?php echo esc_html($ei_kind); ?></span><?php endif; ?><?php echo esc_html('' !== $ei_title ? $ei_title : $ei_kind); ?></div>
444 503 <div class="meta-item">
445 504 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
446 505 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
447 506 </div>
@@ -448,30 +507,44 @@
448 507 <div class="meta-item">
449 508 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
450 509 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
451 510 </div>
511 + <?php if (empty($ei_is_credit_note)) : ?>
452 512 <div class="meta-item">
453 513 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
454 514 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
455 515 </div>
516 + <?php endif; ?>
517 + <?php if (empty($ei_is_credit_note)) : ?>
518 + <div class="meta-item meta-amount-due">
519 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
520 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
521 + </div>
522 + <?php endif; ?>
456 523 </div>
457 524 </div>
458 525
526 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
459 527 <div class="address-section">
460 528 <div class="address-block">
461 529 <h2><?php echo esc_html($text_settings['to']); ?></h2>
462 530 <div class="address-content">
463 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
464 - <?php if ($invoice->getCustomerAddress()): ?>
465 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
466 - <?php endif; ?>
467 - <?php if ($invoice->getCustomerEmail()): ?>
468 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
469 - <?php endif; ?>
531 + <?php echo wp_kses_post($ei_client_html); ?>
470 532 </div>
471 533 </div>
472 534 </div>
535 + <?php endif; ?>
473 536
537 + <?php
538 + // The adjustment column appears only when at least one line uses it.
539 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
540 + if ($ei_show_adjust) {
541 + $ei_show_adjust = false;
542 + foreach ($invoice->getItems() as $ei_item) {
543 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
544 + }
545 + }
546 + ?>
474 547 <table class="invoice-items">
475 548 <thead>
476 549 <tr>
477 550 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -476,15 +549,18 @@
476 549 <tr>
477 550 <th><?php echo esc_html($text_settings['service']); ?></th>
478 551 <th><?php echo esc_html($text_settings['qty']); ?></th>
479 552 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
480 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
553 + <?php if ($ei_show_adjust): ?>
481 554 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
482 555 <?php endif; ?>
483 - <th><?php echo esc_html($text_settings['total']); ?></th>
556 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
484 557 </tr>
485 558 </thead>
486 559 <tbody>
560 + <?php if (!$invoice->getItems()) : ?>
561 + <tr class="no-items"><td colspan="<?php echo $ei_show_adjust ? 5 : 4; ?>" style="text-align:center;color:#9ca3af;padding:18px;"><?php esc_html_e('No items yet.', 'easy-invoice'); ?></td></tr>
562 + <?php endif; ?>
487 563 <?php foreach ($invoice->getItems() as $item): ?>
488 564 <tr>
489 565 <td class="item-name">
490 566 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -493,9 +569,9 @@
493 569 <?php endif; ?>
494 570 </td>
495 571 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
496 572 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
497 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
573 + <?php if ($ei_show_adjust): ?>
498 574 <td class="item-adjust"><?php
499 575 $adjust_percentage = $item->getAdjustPercentage();
500 576 if ($adjust_percentage != 0) {
501 577 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -510,14 +586,14 @@
510 586 </tbody>
511 587 </table>
512 588
513 589 <div class="invoice-totals">
514 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
590 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
515 591 </div>
516 592
517 593 <?php if ($invoice->getNotes()): ?>
518 594 <div class="invoice-notes">
519 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
595 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
520 596 <div class="notes-content">
521 597 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
522 598 </div>
523 599 </div>
@@ -523,13 +599,13 @@
523 599 </div>
524 600 <?php endif; ?>
525 601
526 602 <?php
527 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
603 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
528 604 if ($terms_conditions):
529 605 ?>
530 606 <div class="invoice-terms">
531 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
607 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
532 608 <div class="terms-content">
533 609 <?php echo wp_kses_post($terms_conditions); ?>
534 610 </div>
535 611 </div>
@@ -534,14 +610,23 @@
534 610 </div>
535 611 </div>
536 612 <?php endif; ?>
537 613
614 + <?php
615 + /**
616 + * Fires inside the document card, after notes and terms and before the
617 + * footer text: attachments, the signature block, e-invoicing notes. Being
618 + * inside the card, it is part of what "Download as PDF" captures.
619 + *
620 + * @param object $document The invoice model.
621 + * @param string $type 'invoice'.
622 + */
623 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
624 +
625 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
626 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
627 + ?>
538 628 <div class="invoice-footer">
539 - <?php
540 - $invoice_footer_text = $invoice->getFooterText();
541 - if (!$invoice_footer_text) {
542 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
543 - }
544 - ?>
545 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
629 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
546 630 </div>
547 -</div>
631 + <?php endif; ?>
632 +</div>