PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.1
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.1
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
← All changes | templates/invoice-templates/creative.php +96 -30 2.3.42.4.1 View file →
@@ -3,9 +3,13 @@
3 3 * Creative Template - Artistic Design
4 4 * Creative, artistic, and innovative 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 /* Creative Template - Artistic Design */
@@ -10,9 +14,9 @@
10 14 <style>
11 15 /* Creative Template - Artistic Design */
12 16 :root {
13 17 --primary-color: #8b5cf6;
14 - --primary-light: #a855f7;
18 + --primary-light: #d946ef;
15 19 --primary-dark: #7c3aed;
16 20 --secondary-color: #06b6d4;
17 21 --accent-color: #f59e0b;
18 22 --success-color: #10b981;
@@ -353,9 +357,9 @@
353 357 font-weight: 600;
354 358 color: var(--text-primary);
355 359 }
356 360
357 -.template-creative .invoice-grand-total {
361 +.template-creative .invoice-totals .invoice-grand-total {
358 362 font-size: var(--font-size-xl);
359 363 font-weight: 700;
360 364 color: var(--primary-color);
361 365 border-top: 2px solid var(--primary-color);
@@ -444,26 +448,62 @@
444 448 .template-creative .invoice-totals {
445 449 width: 100%;
446 450 }
447 451 }
452 +
453 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
454 +.template-creative .invoice-items th + th { text-align: right; }
455 +.template-creative .invoice-items .item-quantity,
456 +.template-creative .invoice-items .item-price,
457 +.template-creative .invoice-items .item-adjust,
458 +.template-creative .invoice-items .item-total,
459 +.template-creative .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
460 +.template-creative .meta-value { white-space: nowrap; }
461 +.template-creative .invoice-items .item-adjust { text-align: right; }
462 +.template-creative .client-contact { font-weight: 500; margin-bottom: 0.15em; }
463 +.template-creative .client-tax-number,
464 +.template-creative .company-tax-number { margin-top: 0.35em; }
465 +.template-creative .invoice-items .item-description { white-space: pre-line; }
466 +
467 +/* Creative: one bold gradient carries the character; everything else stays quiet. */
468 +.template-creative::before { height: 10px; background: linear-gradient(90deg, var(--primary-color), var(--primary-light)); }
469 +.template-creative .invoice-header::after { background: linear-gradient(90deg, var(--primary-color), var(--primary-light)); }
470 +.template-creative .invoice-meta { border-radius: var(--radius-xl); }
471 +.template-creative .invoice-title { color: var(--primary-dark); }
472 +.template-creative .address-block { border-radius: var(--radius-xl); }
473 +.template-creative .address-block::before { background: linear-gradient(90deg, var(--primary-color), var(--primary-light)); }
474 +.template-creative .invoice-items { border-radius: var(--radius-xl); }
475 +.template-creative .invoice-items thead { background: linear-gradient(90deg, var(--primary-color), var(--primary-light)); }
476 +.template-creative .invoice-items th { background: transparent; }
477 +.template-creative .invoice-items tbody tr:nth-child(even) td { background: var(--background-accent); }
478 +.template-creative .invoice-items tr:hover { background: transparent; }
479 +.template-creative .invoice-totals { border-radius: var(--radius-xl); }
480 +.template-creative .invoice-totals .invoice-grand-total { color: var(--primary-dark); border-top: 2px solid var(--primary-light); }
481 +.template-creative .invoice-notes, .template-creative .invoice-terms { border-radius: var(--radius-xl); }
482 +.template-creative .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; }
483 +.template-creative .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
484 +.template-creative .invoice-totals .invoice-balance-due { font-weight: 700; }
485 +.template-creative .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
486 +.template-creative .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
448 487 </style>
449 488
450 489 <div class="template template-creative">
451 490 <div class="invoice-header">
452 491 <div class="company-info">
492 + <?php if (!empty($company_info['logo'])): ?>
453 493 <div class="company-logo">
454 - <?php if (!empty($company_info['logo'])): ?>
455 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
456 - <?php endif; ?>
494 + <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)">
457 495 </div>
496 + <?php endif; ?>
458 497 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
459 498 <div class="company-details">
460 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
499 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
461 500 </div>
462 501 </div>
463 502
464 503 <div class="invoice-meta">
465 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
504 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
505 + <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>
466 506 <div class="meta-item">
467 507 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
468 508 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
469 509 </div>
@@ -470,30 +510,44 @@
470 510 <div class="meta-item">
471 511 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
472 512 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
473 513 </div>
514 + <?php if (empty($ei_is_credit_note)) : ?>
474 515 <div class="meta-item">
475 516 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
476 517 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
477 518 </div>
519 + <?php endif; ?>
520 + <?php if (empty($ei_is_credit_note)) : ?>
521 + <div class="meta-item meta-amount-due">
522 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
523 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
524 + </div>
525 + <?php endif; ?>
478 526 </div>
479 527 </div>
480 528
529 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
481 530 <div class="address-section">
482 531 <div class="address-block">
483 532 <h2><?php echo esc_html($text_settings['to']); ?></h2>
484 533 <div class="address-content">
485 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
486 - <?php if ($invoice->getCustomerAddress()): ?>
487 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
488 - <?php endif; ?>
489 - <?php if ($invoice->getCustomerEmail()): ?>
490 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
491 - <?php endif; ?>
534 + <?php echo wp_kses_post($ei_client_html); ?>
492 535 </div>
493 536 </div>
494 537 </div>
538 + <?php endif; ?>
495 539
540 + <?php
541 + // The adjustment column appears only when at least one line uses it.
542 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
543 + if ($ei_show_adjust) {
544 + $ei_show_adjust = false;
545 + foreach ($invoice->getItems() as $ei_item) {
546 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
547 + }
548 + }
549 + ?>
496 550 <table class="invoice-items">
497 551 <thead>
498 552 <tr>
499 553 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -498,15 +552,18 @@
498 552 <tr>
499 553 <th><?php echo esc_html($text_settings['service']); ?></th>
500 554 <th><?php echo esc_html($text_settings['qty']); ?></th>
501 555 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
502 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
556 + <?php if ($ei_show_adjust): ?>
503 557 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
504 558 <?php endif; ?>
505 - <th><?php echo esc_html($text_settings['total']); ?></th>
559 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
506 560 </tr>
507 561 </thead>
508 562 <tbody>
563 + <?php if (!$invoice->getItems()) : ?>
564 + <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>
565 + <?php endif; ?>
509 566 <?php foreach ($invoice->getItems() as $item): ?>
510 567 <tr>
511 568 <td class="item-name">
512 569 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -515,9 +572,9 @@
515 572 <?php endif; ?>
516 573 </td>
517 574 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
518 575 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
519 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
576 + <?php if ($ei_show_adjust): ?>
520 577 <td class="item-adjust"><?php
521 578 $adjust_percentage = $item->getAdjustPercentage();
522 579 if ($adjust_percentage != 0) {
523 580 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -532,14 +589,14 @@
532 589 </tbody>
533 590 </table>
534 591
535 592 <div class="invoice-totals">
536 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
593 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
537 594 </div>
538 595
539 596 <?php if ($invoice->getNotes()): ?>
540 597 <div class="invoice-notes">
541 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
598 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
542 599 <div class="notes-content">
543 600 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
544 601 </div>
545 602 </div>
@@ -545,13 +602,13 @@
545 602 </div>
546 603 <?php endif; ?>
547 604
548 605 <?php
549 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
606 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
550 607 if ($terms_conditions):
551 608 ?>
552 609 <div class="invoice-terms">
553 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
610 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
554 611 <div class="terms-content">
555 612 <?php echo wp_kses_post($terms_conditions); ?>
556 613 </div>
557 614 </div>
@@ -556,14 +613,23 @@
556 613 </div>
557 614 </div>
558 615 <?php endif; ?>
559 616
617 + <?php
618 + /**
619 + * Fires inside the document card, after notes and terms and before the
620 + * footer text: attachments, the signature block, e-invoicing notes. Being
621 + * inside the card, it is part of what "Download as PDF" captures.
622 + *
623 + * @param object $document The invoice model.
624 + * @param string $type 'invoice'.
625 + */
626 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
627 +
628 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
629 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
630 + ?>
560 631 <div class="invoice-footer">
561 - <?php
562 - $invoice_footer_text = $invoice->getFooterText();
563 - if (!$invoice_footer_text) {
564 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
565 - }
566 - ?>
567 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
632 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
568 633 </div>
569 -</div>
634 + <?php endif; ?>
635 +</div>