| @@ -3,8 +3,11 @@ | ||
| 3 | 3 | * Minimalist Quote Template - Clean & Simple Design |
| 4 | 4 | * Minimalist, clean, and simple quote template |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 8 | + exit; | |
| 9 | +} | |
| 7 | 10 | $text_settings = \EasyInvoice\Helpers\TemplateTextHelper::getQuoteTextSettings(); |
| 8 | 11 | $company_info = \EasyInvoice\Helpers\TemplateTextHelper::getCompanyInfo(); |
| 9 | 12 | // Ensure a formatter is available |
| 10 | 13 | if (!isset($formatter) || !$formatter) { |
| @@ -266,9 +269,9 @@ | ||
| 266 | 269 | font-weight: 600; |
| 267 | 270 | color: var(--text-primary); |
| 268 | 271 | } |
| 269 | 272 | |
| 270 | -.template-minimalist .quote-grand-total { | |
| 273 | +.template-minimalist .quote-totals .quote-grand-total { | |
| 271 | 274 | font-size: var(--font-size-lg); |
| 272 | 275 | font-weight: 700; |
| 273 | 276 | color: var(--text-primary); |
| 274 | 277 | border-top: 2px solid var(--border-color); |
| @@ -365,27 +368,70 @@ | ||
| 365 | 368 | .template-minimalist .quote-totals { |
| 366 | 369 | width: 100%; |
| 367 | 370 | } |
| 368 | 371 | } |
| 372 | + | |
| 373 | +/* Shared polish: numbers line up, numeric headings sit over their figures. */ | |
| 374 | +.template-minimalist .quote-items th + th { text-align: right; } | |
| 375 | +.template-minimalist .quote-items .item-quantity, | |
| 376 | +.template-minimalist .quote-items .item-price, | |
| 377 | +.template-minimalist .quote-items .item-adjust, | |
| 378 | +.template-minimalist .quote-items .item-total, | |
| 379 | +.template-minimalist .quote-total-value { font-variant-numeric: tabular-nums; white-space: nowrap; } | |
| 380 | +.template-minimalist .meta-value { white-space: nowrap; } | |
| 381 | +.template-minimalist .quote-items .item-adjust { text-align: right; } | |
| 382 | +.template-minimalist .client-contact { font-weight: 500; margin-bottom: 0.15em; } | |
| 383 | +.template-minimalist .client-tax-number, | |
| 384 | +.template-minimalist .company-tax-number { margin-top: 0.35em; } | |
| 385 | +.template-minimalist .quote-items .item-description { white-space: pre-line; } | |
| 386 | +.template-minimalist .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; } | |
| 387 | + | |
| 388 | +/* Minimalist: hairlines only — no filled panels anywhere. */ | |
| 389 | +.template-minimalist .quote-header { margin-bottom: var(--spacing-8); padding-bottom: var(--spacing-6); border-bottom: 1px solid var(--border-color); } | |
| 390 | +.template-minimalist .address-section { margin-bottom: var(--spacing-8); } | |
| 391 | +.template-minimalist .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); } | |
| 392 | +.template-minimalist .quote-items { border: 0; margin-bottom: var(--spacing-6); } | |
| 393 | +.template-minimalist .quote-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); } | |
| 394 | +.template-minimalist .quote-items td { padding: var(--spacing-4) var(--spacing-3); } | |
| 395 | +.template-minimalist .quote-items th:first-child, .template-minimalist .quote-items td:first-child { padding-left: 0; } | |
| 396 | +.template-minimalist .quote-items th:last-child, .template-minimalist .quote-items td:last-child { padding-right: 0; } | |
| 397 | +.template-minimalist .quote-totals { background: transparent; border: 0; padding: 0; width: 320px; } | |
| 398 | +.template-minimalist .quote-total-row { padding: var(--spacing-2) 0; border-bottom: 1px solid var(--border-light); } | |
| 399 | +.template-minimalist .quote-totals .quote-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); } | |
| 400 | +.template-minimalist .quote-totals .quote-grand-total .quote-total-value { font-size: var(--font-size-xl); } | |
| 401 | +.template-minimalist .quote-notes, .template-minimalist .quote-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); } | |
| 402 | +.template-minimalist .quote-notes h3, .template-minimalist .quote-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; } | |
| 403 | +.template-minimalist .quote-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); } | |
| 404 | +.template-minimalist { padding: var(--spacing-12) var(--spacing-10); } | |
| 405 | +.template-minimalist .quote-header { display: block; text-align: center; border-bottom: 0; padding-bottom: 0; } | |
| 406 | +.template-minimalist .company-info { margin-bottom: var(--spacing-6); } | |
| 407 | +.template-minimalist .company-logo { display: flex; justify-content: center; } | |
| 408 | +.template-minimalist .company-details { max-width: 420px; margin: 0 auto; } | |
| 409 | +.template-minimalist .quote-meta { text-align: center; min-width: 0; max-width: 360px; margin: 0 auto; border-top: 1px solid var(--text-primary); border-bottom: 1px solid var(--text-primary); padding: var(--spacing-4) 0; } | |
| 410 | +.template-minimalist .quote-title { font-size: var(--font-size-2xl); font-weight: 500; letter-spacing: 0.02em; margin-bottom: var(--spacing-3); } | |
| 411 | +.template-minimalist .meta-item { justify-content: space-between; border-bottom: 0; padding: var(--spacing-1) 0; margin: 0; } | |
| 412 | +.template-minimalist .meta-label { text-transform: uppercase; letter-spacing: 0.12em; font-size: var(--font-size-xs); color: var(--text-muted); } | |
| 413 | +.template-minimalist .address-section { margin-top: var(--spacing-8); } | |
| 414 | +@media (max-width: 640px) { .template-minimalist { padding: var(--spacing-6) var(--spacing-4); } } | |
| 369 | 415 | </style> |
| 370 | 416 | |
| 371 | 417 | <div class="template template-minimalist"> |
| 372 | - <!-- Header --> | |
| 373 | 418 | <div class="quote-header"> |
| 374 | 419 | <div class="company-info"> |
| 420 | + <?php if (!empty($company_info['logo'])): ?> | |
| 375 | 421 | <div class="company-logo"> |
| 376 | - <?php if (!empty($company_info['logo'])): ?> | |
| 377 | - <img src="<?php echo esc_url($company_info['logo']); ?>" alt="<?php echo esc_attr($company_info['name']); ?>" class="logo-image"> | |
| 378 | - <?php endif; ?> | |
| 422 | + <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)"> | |
| 379 | 423 | </div> |
| 424 | + <?php endif; ?> | |
| 380 | 425 | <div class="company-name"><?php echo esc_html($company_info['name']); ?></div> |
| 381 | 426 | <div class="company-details"> |
| 382 | - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only'); ?> | |
| 427 | + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateFromSection($company_info, false, 'details-only')); ?> | |
| 383 | 428 | </div> |
| 384 | 429 | </div> |
| 385 | 430 | |
| 386 | 431 | <div class="quote-meta"> |
| 387 | - <div class="quote-title"><?php echo esc_html($quote->getTitle() ?: __('Quote', 'easy-invoice')); ?></div> | |
| 432 | + <?php $ei_kind = \EasyInvoice\Controllers\SettingsController::getTextQuote(); $ei_title = trim((string) $quote->getTitle()); ?> | |
| 433 | + <div class="quote-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> | |
| 388 | 434 | <div class="meta-item"> |
| 389 | 435 | <span class="meta-label"><?php echo esc_html($text_settings['quote_number']); ?></span> |
| 390 | 436 | <span class="meta-value"><?php echo esc_html($quote->getNumber()); ?></span> |
| 391 | 437 | </div> |
| @@ -399,25 +445,19 @@ | ||
| 399 | 445 | </div> |
| 400 | 446 | </div> |
| 401 | 447 | </div> |
| 402 | 448 | |
| 403 | - <!-- Address Section --> | |
| 449 | + <?php $ei_client_html = \EasyInvoice\Helpers\TemplateTextHelper::generateClientBlock($quote); if ('' !== $ei_client_html) : ?> | |
| 404 | 450 | <div class="address-section"> |
| 405 | 451 | <div class="address-block"> |
| 406 | 452 | <h2><?php echo esc_html($text_settings['to']); ?></h2> |
| 407 | 453 | <div class="address-content"> |
| 408 | - <div class="client-name"><?php echo esc_html($quote->getCustomerName()); ?></div> | |
| 409 | - <?php if ($quote->getCustomerAddress()): ?> | |
| 410 | - <?php echo nl2br(esc_html($quote->getCustomerAddress())); ?><br> | |
| 411 | - <?php endif; ?> | |
| 412 | - <?php if ($quote->getCustomerEmail()): ?> | |
| 413 | - <?php echo esc_html($quote->getCustomerEmail()); ?><br> | |
| 414 | - <?php endif; ?> | |
| 454 | + <?php echo wp_kses_post($ei_client_html); ?> | |
| 415 | 455 | </div> |
| 416 | 456 | </div> |
| 417 | 457 | </div> |
| 458 | + <?php endif; ?> | |
| 418 | 459 | |
| 419 | - <!-- Quote Description --> | |
| 420 | 460 | <?php if ($quote->getDescription()): ?> |
| 421 | 461 | <div class="quote-description" style="margin-bottom: 1.5rem;"> |
| 422 | 462 | <div class="description-content" style="color:#6b7280; line-height:1.6; font-size:0.875rem; white-space:pre-wrap;"> |
| 423 | 463 | <?php echo wp_kses_post($quote->getDescription()); ?> |
| @@ -424,9 +464,18 @@ | ||
| 424 | 464 | </div> |
| 425 | 465 | </div> |
| 426 | 466 | <?php endif; ?> |
| 427 | 467 | |
| 428 | - <!-- Quote Items --> | |
| 468 | + <?php | |
| 469 | + // The adjustment column appears only when at least one line uses it. | |
| 470 | + $ei_show_adjust = \EasyInvoice\Controllers\SettingsController::shouldShowQuoteAdjustField(); | |
| 471 | + if ($ei_show_adjust) { | |
| 472 | + $ei_show_adjust = false; | |
| 473 | + foreach ($quote->getItems() as $ei_item) { | |
| 474 | + if ((float) $ei_item->getAdjustPercentage() != 0.0) { $ei_show_adjust = true; break; } | |
| 475 | + } | |
| 476 | + } | |
| 477 | + ?> | |
| 429 | 478 | <table class="quote-items"> |
| 430 | 479 | <thead> |
| 431 | 480 | <tr> |
| 432 | 481 | <th><?php echo esc_html($text_settings['service']); ?></th> |
| @@ -431,15 +480,18 @@ | ||
| 431 | 480 | <tr> |
| 432 | 481 | <th><?php echo esc_html($text_settings['service']); ?></th> |
| 433 | 482 | <th><?php echo esc_html($text_settings['qty']); ?></th> |
| 434 | 483 | <th><?php echo esc_html($text_settings['rate_price']); ?></th> |
| 435 | - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowQuoteAdjustField()): ?> | |
| 484 | + <?php if ($ei_show_adjust): ?> | |
| 436 | 485 | <th><?php echo esc_html($text_settings['adjust']); ?> (%)</th> |
| 437 | 486 | <?php endif; ?> |
| 438 | - <th><?php echo esc_html($text_settings['total']); ?></th> | |
| 487 | + <th><?php echo esc_html($text_settings['line_total'] ?? $text_settings['total']); ?></th> | |
| 439 | 488 | </tr> |
| 440 | 489 | </thead> |
| 441 | 490 | <tbody> |
| 491 | + <?php if (!$quote->getItems()) : ?> | |
| 492 | + <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> | |
| 493 | + <?php endif; ?> | |
| 442 | 494 | <?php foreach ($quote->getItems() as $item): ?> |
| 443 | 495 | <tr> |
| 444 | 496 | <td class="item-name"> |
| 445 | 497 | <div class="item-title"><?php echo esc_html($item->getName()); ?></div> |
| @@ -448,9 +500,9 @@ | ||
| 448 | 500 | <?php endif; ?> |
| 449 | 501 | </td> |
| 450 | 502 | <td class="item-quantity"><?php echo esc_html($item->getQuantity() ?: '0'); ?></td> |
| 451 | 503 | <td class="item-price"><?php echo esc_html($formatter->format($item->getPrice())); ?></td> |
| 452 | - <?php if (\EasyInvoice\Controllers\SettingsController::shouldShowQuoteAdjustField()): ?> | |
| 504 | + <?php if ($ei_show_adjust): ?> | |
| 453 | 505 | <td class="item-adjust"><?php |
| 454 | 506 | $adjust_percentage = $item->getAdjustPercentage(); |
| 455 | 507 | if ($adjust_percentage != 0) { |
| 456 | 508 | echo esc_html($adjust_percentage > 0 ? '+' : '') . esc_html($adjust_percentage) . '%'; |
| @@ -464,17 +516,15 @@ | ||
| 464 | 516 | <?php endforeach; ?> |
| 465 | 517 | </tbody> |
| 466 | 518 | </table> |
| 467 | 519 | |
| 468 | - <!-- Quote Totals --> | |
| 469 | 520 | <div class="quote-totals"> |
| 470 | - <?php echo \EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($quote, $text_settings, $formatter, 'quote'); ?> | |
| 521 | + <?php echo wp_kses_post(\EasyInvoice\Helpers\TemplateTextHelper::generateTotalsSection($quote, $text_settings, $formatter, 'quote')); ?> | |
| 471 | 522 | </div> |
| 472 | 523 | |
| 473 | - <!-- Notes --> | |
| 474 | 524 | <?php if ($quote->getNotes()): ?> |
| 475 | 525 | <div class="quote-notes"> |
| 476 | - <h3><?php _e('Notes:', 'easy-invoice'); ?></h3> | |
| 526 | + <h3><?php esc_html_e('Notes', 'easy-invoice'); ?></h3> | |
| 477 | 527 | <div class="notes-content"> |
| 478 | 528 | <?php echo wp_kses_post($quote->getNotes() ?: ''); ?> |
| 479 | 529 | </div> |
| 480 | 530 | </div> |
| @@ -479,15 +529,14 @@ | ||
| 479 | 529 | </div> |
| 480 | 530 | </div> |
| 481 | 531 | <?php endif; ?> |
| 482 | 532 | |
| 483 | - <!-- Terms and Conditions --> | |
| 484 | 533 | <?php |
| 485 | 534 | $terms_conditions = $quote->getTerms() ?: \EasyInvoice\Controllers\SettingsController::getQuoteTermsConditions(); |
| 486 | 535 | if ($terms_conditions): |
| 487 | 536 | ?> |
| 488 | 537 | <div class="quote-terms"> |
| 489 | - <h3><?php _e('Terms & Conditions:', 'easy-invoice'); ?></h3> | |
| 538 | + <h3><?php esc_html_e('Terms & Conditions', 'easy-invoice'); ?></h3> | |
| 490 | 539 | <div class="terms-content"> |
| 491 | 540 | <?php echo wp_kses_post($terms_conditions); ?> |
| 492 | 541 | </div> |
| 493 | 542 | </div> |
| @@ -492,15 +541,23 @@ | ||
| 492 | 541 | </div> |
| 493 | 542 | </div> |
| 494 | 543 | <?php endif; ?> |
| 495 | 544 | |
| 496 | - <!-- Footer --> | |
| 545 | + <?php | |
| 546 | + /** | |
| 547 | + * Fires inside the document card, after notes and terms and before the | |
| 548 | + * footer text: attachments, the signature block, e-invoicing notes. Being | |
| 549 | + * inside the card, it is part of what "Download as PDF" captures. | |
| 550 | + * | |
| 551 | + * @param object $document The quote model. | |
| 552 | + * @param string $type 'quote'. | |
| 553 | + */ | |
| 554 | + do_action('easy_invoice_document_body_after', $quote, 'quote'); | |
| 555 | + | |
| 556 | + $ei_footer_text = \EasyInvoice\Helpers\TemplateTextHelper::footerText($quote, 'quote'); | |
| 557 | + if ('' !== trim(wp_strip_all_tags((string) $ei_footer_text))) : | |
| 558 | + ?> | |
| 497 | 559 | <div class="quote-footer"> |
| 498 | - <?php | |
| 499 | - $footer_text = $quote->getFooterText(); | |
| 500 | - if (!$footer_text) { | |
| 501 | - $footer_text = \EasyInvoice\Controllers\SettingsController::getQuoteFooterText(); | |
| 502 | - } | |
| 503 | - ?> | |
| 504 | - <p><?php echo wp_kses_post($footer_text); ?></p> | |
| 560 | + <p><?php echo wp_kses_post($ei_footer_text); ?></p> | |
| 505 | 561 | </div> |
| 506 | -</div> | |
| 562 | + <?php endif; ?> | |
| 563 | +</div> | |