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/modern.php +99 -29 2.3.2 → 2.4.2 View file →
@@ -3,9 +3,13 @@
3 3 * Modern Template - Sleek SaaS Design
4 4 * Modern, sleek, and contemporary 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 /* Modern Template - Sleek SaaS Design */
@@ -333,9 +337,9 @@
333 337 font-weight: 600;
334 338 color: var(--text-primary);
335 339 }
336 340
337 -.template-modern .invoice-grand-total {
341 +.template-modern .invoice-totals .invoice-grand-total {
338 342 font-size: var(--font-size-xl);
339 343 font-weight: 700;
340 344 color: var(--primary-color);
341 345 border-top: 2px solid var(--primary-color);
@@ -428,26 +432,66 @@
428 432 .template-modern .invoice-totals {
429 433 width: 100%;
430 434 }
431 435 }
436 +
437 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
438 +.template-modern .invoice-items th + th { text-align: right; }
439 +.template-modern .invoice-items .item-quantity,
440 +.template-modern .invoice-items .item-price,
441 +.template-modern .invoice-items .item-adjust,
442 +.template-modern .invoice-items .item-total,
443 +.template-modern .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
444 +.template-modern .meta-value { white-space: nowrap; }
445 +.template-modern .invoice-items .item-adjust { text-align: right; }
446 +.template-modern .client-contact { font-weight: 500; margin-bottom: 0.15em; }
447 +.template-modern .client-tax-number,
448 +.template-modern .company-tax-number { margin-top: 0.35em; }
449 +.template-modern .invoice-items .item-description { white-space: pre-line; }
450 +.template-modern .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; }
451 +
452 +/* Modern: one card in the header instead of a card inside a panel; lighter shadows; tighter rhythm. */
453 +.template-modern .invoice-header { background: transparent; border: 0; padding: 0 0 var(--spacing-6); margin-bottom: var(--spacing-8); border-bottom: 1px solid var(--border-color); border-radius: 0; }
454 +.template-modern .invoice-meta { box-shadow: var(--shadow-sm); gap: 0; padding: var(--spacing-5) var(--spacing-6); }
455 +.template-modern .invoice-title { margin-bottom: var(--spacing-2); }
456 +.template-modern .meta-item { padding: var(--spacing-2) 0; }
457 +.template-modern .meta-item:last-child { border-bottom: 0; }
458 +.template-modern .address-section { margin-bottom: var(--spacing-8); }
459 +.template-modern .address-block { padding: var(--spacing-5); }
460 +.template-modern .address-block h2 { font-size: var(--font-size-xs); letter-spacing: 0.14em; color: var(--text-muted); margin-bottom: var(--spacing-2); }
461 +.template-modern .invoice-items { box-shadow: var(--shadow-sm); margin-bottom: var(--spacing-8); border: 1px solid var(--border-color); }
462 +.template-modern .invoice-items th { padding: var(--spacing-3) var(--spacing-5); font-size: var(--font-size-xs); letter-spacing: 0.1em; }
463 +.template-modern .invoice-items td { padding: var(--spacing-4) var(--spacing-5); }
464 +.template-modern .invoice-items tr:hover { background: transparent; }
465 +.template-modern .invoice-totals { box-shadow: var(--shadow-sm); padding: var(--spacing-5) var(--spacing-6); width: 360px; }
466 +.template-modern .invoice-total-row { padding: var(--spacing-2) 0; }
467 +.template-modern .invoice-totals .invoice-grand-total { padding-top: var(--spacing-3); margin-top: var(--spacing-2); }
468 +.template-modern .invoice-notes, .template-modern .invoice-terms { margin-top: var(--spacing-8); padding: var(--spacing-5) var(--spacing-6); box-shadow: none; }
469 +.template-modern .invoice-notes h3, .template-modern .invoice-terms h3 { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); margin-bottom: var(--spacing-2); }
470 +.template-modern .invoice-footer { margin-top: var(--spacing-8); background: transparent; border: 0; border-top: 1px solid var(--border-color); border-radius: 0; padding: var(--spacing-5) 0 0; color: var(--text-muted); }
471 +.template-modern .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
472 +.template-modern .invoice-totals .invoice-balance-due { font-weight: 700; }
473 +.template-modern .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
474 +.template-modern .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
432 475 </style>
433 476
434 477 <div class="template template-modern">
435 478 <div class="invoice-header">
436 479 <div class="company-info">
480 + <?php if (!empty($company_info['logo'])): ?>
437 481 <div class="company-logo">
438 - <?php if (!empty($company_info['logo'])): ?>
439 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
440 - <?php endif; ?>
482 + <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)">
441 483 </div>
484 + <?php endif; ?>
442 485 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
443 486 <div class="company-details">
444 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
487 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
445 488 </div>
446 489 </div>
447 490
448 491 <div class="invoice-meta">
449 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
492 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
493 + <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>
450 494 <div class="meta-item">
451 495 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
452 496 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
453 497 </div>
@@ -454,30 +498,44 @@
454 498 <div class="meta-item">
455 499 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
456 500 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
457 501 </div>
502 + <?php if (empty($ei_is_credit_note)) : ?>
458 503 <div class="meta-item">
459 504 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
460 505 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
461 506 </div>
507 + <?php endif; ?>
508 + <?php if (empty($ei_is_credit_note)) : ?>
509 + <div class="meta-item meta-amount-due">
510 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
511 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
512 + </div>
513 + <?php endif; ?>
462 514 </div>
463 515 </div>
464 516
517 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
465 518 <div class="address-section">
466 519 <div class="address-block">
467 520 <h2><?php echo esc_html($text_settings['to']); ?></h2>
468 521 <div class="address-content">
469 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
470 - <?php if ($invoice->getCustomerAddress()): ?>
471 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
472 - <?php endif; ?>
473 - <?php if ($invoice->getCustomerEmail()): ?>
474 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
475 - <?php endif; ?>
522 + <?php echo wp_kses_post($ei_client_html); ?>
476 523 </div>
477 524 </div>
478 525 </div>
526 + <?php endif; ?>
479 527
528 + <?php
529 + // The adjustment column appears only when at least one line uses it.
530 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
531 + if ($ei_show_adjust) {
532 + $ei_show_adjust = false;
533 + foreach ($invoice->getItems() as $ei_item) {
534 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
535 + }
536 + }
537 + ?>
480 538 <table class="invoice-items">
481 539 <thead>
482 540 <tr>
483 541 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -482,15 +540,18 @@
482 540 <tr>
483 541 <th><?php echo esc_html($text_settings['service']); ?></th>
484 542 <th><?php echo esc_html($text_settings['qty']); ?></th>
485 543 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
486 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
544 + <?php if ($ei_show_adjust): ?>
487 545 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
488 546 <?php endif; ?>
489 - <th><?php echo esc_html($text_settings['total']); ?></th>
547 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
490 548 </tr>
491 549 </thead>
492 550 <tbody>
551 + <?php if (!$invoice->getItems()) : ?>
552 + <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>
553 + <?php endif; ?>
493 554 <?php foreach ($invoice->getItems() as $item): ?>
494 555 <tr>
495 556 <td class="item-name">
496 557 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -499,9 +560,9 @@
499 560 <?php endif; ?>
500 561 </td>
501 562 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
502 563 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
503 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
564 + <?php if ($ei_show_adjust): ?>
504 565 <td class="item-adjust"><?php
505 566 $adjust_percentage = $item->getAdjustPercentage();
506 567 if ($adjust_percentage != 0) {
507 568 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -516,14 +577,14 @@
516 577 </tbody>
517 578 </table>
518 579
519 580 <div class="invoice-totals">
520 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
581 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
521 582 </div>
522 583
523 584 <?php if ($invoice->getNotes()): ?>
524 585 <div class="invoice-notes">
525 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
586 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
526 587 <div class="notes-content">
527 588 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
528 589 </div>
529 590 </div>
@@ -529,13 +590,13 @@
529 590 </div>
530 591 <?php endif; ?>
531 592
532 593 <?php
533 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
594 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
534 595 if ($terms_conditions):
535 596 ?>
536 597 <div class="invoice-terms">
537 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
598 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
538 599 <div class="terms-content">
539 600 <?php echo wp_kses_post($terms_conditions); ?>
540 601 </div>
541 602 </div>
@@ -540,14 +601,23 @@
540 601 </div>
541 602 </div>
542 603 <?php endif; ?>
543 604
605 + <?php
606 + /**
607 + * Fires inside the document card, after notes and terms and before the
608 + * footer text: attachments, the signature block, e-invoicing notes. Being
609 + * inside the card, it is part of what "Download as PDF" captures.
610 + *
611 + * @param object $document The invoice model.
612 + * @param string $type 'invoice'.
613 + */
614 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
615 +
616 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
617 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
618 + ?>
544 619 <div class="invoice-footer">
545 - <?php
546 - $invoice_footer_text = $invoice->getFooterText();
547 - if (!$invoice_footer_text) {
548 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
549 - }
550 - ?>
551 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
620 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
552 621 </div>
553 -</div>
622 + <?php endif; ?>
623 +</div>