PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.3
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.3
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/minimal.php +96 -29 2.3.8 → 2.4.3 View file →
@@ -3,9 +3,13 @@
3 3 * Minimal Template - Clean & Simple Design
4 4 * Minimal, clean, and simple 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 /* Minimal Template - Clean & Simple Design */
@@ -262,9 +266,9 @@
262 266 font-weight: 600;
263 267 color: var(--text-primary);
264 268 }
265 269
266 -.template-minimal .invoice-grand-total {
270 +.template-minimal .invoice-totals .invoice-grand-total {
267 271 font-size: var(--font-size-lg);
268 272 font-weight: 700;
269 273 color: var(--text-primary);
270 274 border-top: 2px solid var(--border-color);
@@ -369,26 +373,63 @@
369 373 .template-minimal .invoice-totals {
370 374 width: 100%;
371 375 }
372 376 }
377 +
378 +/* Shared polish: numbers line up, numeric headings sit over their figures. */
379 +.template-minimal .invoice-items th + th { text-align: right; }
380 +.template-minimal .invoice-items .item-quantity,
381 +.template-minimal .invoice-items .item-price,
382 +.template-minimal .invoice-items .item-adjust,
383 +.template-minimal .invoice-items .item-total,
384 +.template-minimal .invoice-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
385 +.template-minimal .meta-value { white-space: nowrap; }
386 +.template-minimal .invoice-items .item-adjust { text-align: right; }
387 +.template-minimal .client-contact { font-weight: 500; margin-bottom: 0.15em; }
388 +.template-minimal .client-tax-number,
389 +.template-minimal .company-tax-number { margin-top: 0.35em; }
390 +.template-minimal .invoice-items .item-description { white-space: pre-line; }
391 +.template-minimal .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; }
392 +
393 +/* Minimal: hairlines only — no filled panels anywhere. */
394 +.template-minimal .invoice-header { margin-bottom: var(--spacing-8); padding-bottom: var(--spacing-6); border-bottom: 1px solid var(--border-color); }
395 +.template-minimal .address-section { margin-bottom: var(--spacing-8); }
396 +.template-minimal .address-block h2 { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); font-weight: 600; margin-bottom: var(--spacing-2); }
397 +.template-minimal .invoice-items { border: 0; margin-bottom: var(--spacing-6); }
398 +.template-minimal .invoice-items th { background: transparent; color: var(--text-muted); font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.12em; padding: var(--spacing-2) var(--spacing-3); border-bottom: 1px solid var(--text-primary); }
399 +.template-minimal .invoice-items td { padding: var(--spacing-4) var(--spacing-3); }
400 +.template-minimal .invoice-items th:first-child, .template-minimal .invoice-items td:first-child { padding-left: 0; }
401 +.template-minimal .invoice-items th:last-child, .template-minimal .invoice-items td:last-child { padding-right: 0; }
402 +.template-minimal .invoice-totals { background: transparent; border: 0; padding: 0; width: 320px; }
403 +.template-minimal .invoice-total-row { padding: var(--spacing-2) 0; border-bottom: 1px solid var(--border-light); }
404 +.template-minimal .invoice-totals .invoice-grand-total { border-top: 1px solid var(--text-primary); border-bottom: 0; margin-top: var(--spacing-1); padding-top: var(--spacing-3); font-size: var(--font-size-lg); }
405 +.template-minimal .invoice-totals .invoice-grand-total .invoice-total-value { font-size: var(--font-size-xl); }
406 +.template-minimal .invoice-notes, .template-minimal .invoice-terms { background: transparent; border: 0; border-top: 1px solid var(--border-light); border-radius: 0; padding: var(--spacing-5) 0 0; margin-top: var(--spacing-6); }
407 +.template-minimal .invoice-notes h3, .template-minimal .invoice-terms h3 { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-muted); font-weight: 600; margin-bottom: var(--spacing-2); border: 0; padding: 0; }
408 +.template-minimal .invoice-footer { background: transparent; border: 0; border-top: 1px solid var(--border-light); padding: var(--spacing-4) 0 0; margin-top: var(--spacing-8); color: var(--text-muted); font-size: var(--font-size-sm); }
409 +.template-minimal .invoice-totals .invoice-paid-row .invoice-total-value { color: var(--success-color, #047857); }
410 +.template-minimal .invoice-totals .invoice-balance-due { font-weight: 700; }
411 +.template-minimal .invoice-totals .invoice-balance-due .invoice-total-label { color: inherit; font-weight: 700; }
412 +.template-minimal .meta-amount-due .meta-value { font-weight: 700; font-size: 1.08em; }
373 413 </style>
374 414
375 415 <div class="template template-minimal">
376 416 <div class="invoice-header">
377 417 <div class="company-info">
418 + <?php if (!empty($company_info['logo'])): ?>
378 419 <div class="company-logo">
379 - <?php if (!empty($company_info['logo'])): ?>
380 - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image">
381 - <?php endif; ?>
420 + <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)">
382 421 </div>
422 + <?php endif; ?>
383 423 <div class="company-name"><?php echo esc_html($company_info['name']); ?></div>
384 424 <div class="company-details">
385 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?>
425 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?>
386 426 </div>
387 427 </div>
388 428
389 429 <div class="invoice-meta">
390 - <div class="invoice-title"><?php echo esc_html($invoice->getTitle() ?: __('Invoice', 'easy-invoice')); ?></div>
430 + <?php $ei_kind = \EasyInvoice\Helpers\TemplateTextHelper::documentKind($invoice); $ei_title = trim((string) $invoice->getTitle()); ?>
431 + <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>
391 432 <div class="meta-item">
392 433 <span class="meta-label"><?php echo esc_html($text_settings['invoice_number']); ?></span>
393 434 <span class="meta-value"><?php echo esc_html($invoice->getNumber()); ?></span>
394 435 </div>
@@ -395,30 +436,44 @@
395 436 <div class="meta-item">
396 437 <span class="meta-label"><?php echo esc_html($text_settings['invoice_date']); ?></span>
397 438 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getIssueDate())); ?></span>
398 439 </div>
440 + <?php if (empty($ei_is_credit_note)) : ?>
399 441 <div class="meta-item">
400 442 <span class="meta-label"><?php echo esc_html($text_settings['due_date']); ?></span>
401 443 <span class="meta-value"><?php echo esc_html(\EasyInvoice\Controllers\SettingsController::formatDate($invoice->getDueDate())); ?></span>
402 444 </div>
445 + <?php endif; ?>
446 + <?php if (empty($ei_is_credit_note)) : ?>
447 + <div class="meta-item meta-amount-due">
448 + <span class="meta-label"><?php echo esc_html($text_settings['total_due']); ?></span>
449 + <span class="meta-value"><?php echo esc_html($formatter->format(\EasyInvoice\Helpers\TemplateTextHelper::amountDue($invoice))); ?></span>
450 + </div>
451 + <?php endif; ?>
403 452 </div>
404 453 </div>
405 454
455 + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($invoice); if ('' !== $ei_client_html) : ?>
406 456 <div class="address-section">
407 457 <div class="address-block">
408 458 <h2><?php echo esc_html($text_settings['to']); ?></h2>
409 459 <div class="address-content">
410 - <div class="client-name"><?php echo esc_html($invoice->getCustomerName()); ?></div>
411 - <?php if ($invoice->getCustomerAddress()): ?>
412 - <?php echo nl2br(esc_html($invoice->getCustomerAddress())); ?><br>
413 - <?php endif; ?>
414 - <?php if ($invoice->getCustomerEmail()): ?>
415 - <?php echo esc_html($invoice->getCustomerEmail()); ?><br>
416 - <?php endif; ?>
460 + <?php echo wp_kses_post($ei_client_html); ?>
417 461 </div>
418 462 </div>
419 463 </div>
464 + <?php endif; ?>
420 465
466 + <?php
467 + // The adjustment column appears only when at least one line uses it.
468 + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField();
469 + if ($ei_show_adjust) {
470 + $ei_show_adjust = false;
471 + foreach ($invoice->getItems() as $ei_item) {
472 + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; }
473 + }
474 + }
475 + ?>
421 476 <table class="invoice-items">
422 477 <thead>
423 478 <tr>
424 479 <th><?php echo esc_html($text_settings['service']); ?></th>
@@ -423,15 +478,18 @@
423 478 <tr>
424 479 <th><?php echo esc_html($text_settings['service']); ?></th>
425 480 <th><?php echo esc_html($text_settings['qty']); ?></th>
426 481 <th><?php echo esc_html($text_settings['rate_price']); ?></th>
427 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
482 + <?php if ($ei_show_adjust): ?>
428 483 <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th>
429 484 <?php endif; ?>
430 - <th><?php echo esc_html($text_settings['total']); ?></th>
485 + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th>
431 486 </tr>
432 487 </thead>
433 488 <tbody>
489 + <?php if (!$invoice->getItems()) : ?>
490 + <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>
491 + <?php endif; ?>
434 492 <?php foreach ($invoice->getItems() as $item): ?>
435 493 <tr>
436 494 <td class="item-name">
437 495 <div class="item-title"><?php echo esc_html($item->getName()); ?></div>
@@ -440,9 +498,9 @@
440 498 <?php endif; ?>
441 499 </td>
442 500 <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td>
443 501 <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td>
444 - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowInvoiceAdjustField()): ?>
502 + <?php if ($ei_show_adjust): ?>
445 503 <td class="item-adjust"><?php
446 504 $adjust_percentage = $item->getAdjustPercentage();
447 505 if ($adjust_percentage != 0) {
448 506 echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%';
@@ -457,14 +515,14 @@
457 515 </tbody>
458 516 </table>
459 517
460 518 <div class="invoice-totals">
461 - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice'); ?>
519 + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($invoice, $text_settings, $formatter, 'invoice')); ?>
462 520 </div>
463 521
464 522 <?php if ($invoice->getNotes()): ?>
465 523 <div class="invoice-notes">
466 - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3>
524 + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3>
467 525 <div class="notes-content">
468 526 <?php echo wp_kses_post($invoice->getNotes() ?: ''); ?>
469 527 </div>
470 528 </div>
@@ -470,13 +528,13 @@
470 528 </div>
471 529 <?php endif; ?>
472 530
473 531 <?php
474 - $terms_conditions = $invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions();
532 + $terms_conditions = empty($ei_is_credit_note) ? ($invoice->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getInvoiceTermsConditions()) : '';
475 533 if ($terms_conditions):
476 534 ?>
477 535 <div class="invoice-terms">
478 - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3>
536 + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3>
479 537 <div class="terms-content">
480 538 <?php echo wp_kses_post($terms_conditions); ?>
481 539 </div>
482 540 </div>
@@ -481,14 +539,23 @@
481 539 </div>
482 540 </div>
483 541 <?php endif; ?>
484 542
543 + <?php
544 + /**
545 + * Fires inside the document card, after notes and terms and before the
546 + * footer text: attachments, the signature block, e-invoicing notes. Being
547 + * inside the card, it is part of what "Download as PDF" captures.
548 + *
549 + * @param object $document The invoice model.
550 + * @param string $type 'invoice'.
551 + */
552 + do_action('easy_invoice_document_body_after', $invoice, 'invoice');
553 +
554 + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($invoice, 'invoice');
555 + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) :
556 + ?>
485 557 <div class="invoice-footer">
486 - <?php
487 - $invoice_footer_text = $invoice->getFooterText();
488 - if (!$invoice_footer_text) {
489 - $invoice_footer_text = \EasyInvoice\Controllers\SettingsController::getInvoiceFooterText();
490 - }
491 - ?>
492 - <p><?php echo wp_kses_post($invoice_footer_text); ?></p>
558 + <p><?php echo wp_kses_post($ei_footer_text); ?></p>
493 559 </div>
494 -</div>
560 + <?php endif; ?>
561 +</div>