Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Feature: Invoice design improvements (#1021)
Dave Earleyb5dbe9d7a7ef
diff --git a/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php b/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.phpindex 43e7d7fb9..c9e608d56 100644--- a/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php+++ b/backend/app/Services/Domain/Payment/Stripe/EventHandlers/PaymentIntentSucceededHandler.php@@ -8,6 +8,8 @@ use Brick\Math\Exception\RoundingNecessaryException;use Brick\Money\Exception\UnknownCurrencyException;use Carbon\Carbon;use HiEvents\DomainObjects\Enums\PaymentProviders;+use HiEvents\DomainObjects\EventSettingDomainObject;+use HiEvents\DomainObjects\Generated\EventSettingDomainObjectAbstract;use HiEvents\DomainObjects\Generated\OrderDomainObjectAbstract;use HiEvents\DomainObjects\Generated\StripePaymentDomainObjectAbstract;use HiEvents\DomainObjects\OrderDomainObject;@@ -23,6 +25,7 @@ use HiEvents\Repository\Eloquent\StripePaymentsRepository;use HiEvents\Repository\Eloquent\Value\Relationship;use HiEvents\Repository\Interfaces\AffiliateRepositoryInterface;use HiEvents\Repository\Interfaces\AttendeeRepositoryInterface;+use HiEvents\Repository\Interfaces\EventSettingsRepositoryInterface;use HiEvents\Repository\Interfaces\OrderRepositoryInterface;use HiEvents\Services\Domain\Order\OrderApplicationFeeService;use HiEvents\Services\Domain\Payment\Stripe\StripeRefundExpiredOrderService;@@ -40,17 +43,18 @@ use Throwable;class PaymentIntentSucceededHandler{public function __construct(- private readonly OrderRepositoryInterface $orderRepository,- private readonly StripePaymentsRepository $stripePaymentsRepository,- private readonly AffiliateRepositoryInterface $affiliateRepository,- private readonly ProductQuantityUpdateService $quantityUpdateService,- private readonly StripeRefundExpiredOrderService $refundExpiredOrderService,- private readonly AttendeeRepositoryInterface $attendeeRepository,- private readonly DatabaseManager $databaseManager,- private readonly LoggerInterface $logger,- private readonly Repository $cache,- private readonly DomainEventDispatcherService $domainEventDispatcherService,- private readonly OrderApplicationFeeService $orderApplicationFeeService,+ private readonly OrderRepositoryInterface $orderRepository,+ private readonly StripePaymentsRepository $stripePaymentsRepository,+ private readonly AffiliateRepositoryInterface $affiliateRepository,+ private readonly ProductQuantityUpdateService $quantityUpdateService,+ private readonly StripeRefundExpiredOrderService $refundExpiredOrderService,+ private readonly AttendeeRepositoryInterface $attendeeRepository,+ private readonly DatabaseManager $databaseManager,+ private readonly LoggerInterface $logger,+ private readonly Repository $cache,+ private readonly DomainEventDispatcherService $domainEventDispatcherService,+ private readonly OrderApplicationFeeService $orderApplicationFeeService,+ private readonly EventSettingsRepositoryInterface $eventSettingsRepository,){}@@ -94,7 +98,12 @@ class PaymentIntentSucceededHandler$this->quantityUpdateService->updateQuantitiesFromOrder($updatedOrder);- OrderStatusChangedEvent::dispatch($updatedOrder);+ /** @var EventSettingDomainObject $eventSettings */+ $eventSettings = $this->eventSettingsRepository->findFirstWhere([+ EventSettingDomainObjectAbstract::EVENT_ID => $updatedOrder->getEventId(),+ ]);++ event(new OrderStatusChangedEvent($updatedOrder, createInvoice: $eventSettings->getEnableInvoicing()));$this->domainEventDispatcherService->dispatch(new OrderEvent(diff --git a/backend/resources/views/invoice.blade.php b/backend/resources/views/invoice.blade.phpindex 86aa461ad..9db23e899 100644--- a/backend/resources/views/invoice.blade.php+++ b/backend/resources/views/invoice.blade.php@@ -1,11 +1,16 @@@php use Carbon\Carbon; @endphp@php use HiEvents\Helper\Currency; @endphp+@php use HiEvents\DomainObjects\Status\InvoiceStatus; @endphp@php /** @var \HiEvents\DomainObjects\EventDomainObject $event */ @endphp@php /** @var \HiEvents\DomainObjects\EventSettingDomainObject $eventSettings */ @endphp@php /** @var \HiEvents\DomainObjects\OrderDomainObject $order */ @endphp@php /** @var \HiEvents\DomainObjects\InvoiceDomainObject $invoice */ @endphp+@php+ $isPaid = $invoice->getStatus() === InvoiceStatus::PAID->name;+ $isVoid = $invoice->getStatus() === InvoiceStatus::VOID->name;+@endphp- <!DOCTYPE html>+<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8">@@ -21,40 +26,75 @@body {font-family: 'DejaVu Sans', Arial, sans-serif;font-size: 12px;- line-height: 1.4;+ line-height: 1.5;color: #1a1a1a;padding: 20px 30px;}- .header {- margin-bottom: 30px;- min-height: 100px;- display: block;+ table.header-table {+ width: 100%;+ margin-bottom: 25px;+ }++ table.header-table td {+ vertical-align: top;}.logo-title {- font-size: 36px;- font-weight: normal;+ font-family: 'DejaVu Sans', Arial, sans-serif;+ font-size: 28px;+ font-weight: 700;color: #1a1a1a;+ margin: 0 0 2px 0;+ letter-spacing: -0.5px;+ }++ .header-event-name {+ font-family: 'DejaVu Sans', Arial, sans-serif;+ font-size: 12px;+ color: #666;margin: 0;- float: left;- width: 50%;}.company-details {- float: right;text-align: right;line-height: 1.6;- width: 45%;+ color: #555;}- .company-details > div {- margin-bottom: 3px;+ .company-name {+ font-weight: bold;+ color: #1a1a1a;}- .invoice-info-container {- clear: both;- padding-top: 20px;+ .status-badge {+ display: inline-block;+ padding: 4px 14px;+ margin-top: 6px;+ border-radius: 4px;+ font-family: 'DejaVu Sans', Arial, sans-serif;+ font-size: 11px;+ font-weight: bold;+ letter-spacing: 0.5px;+ text-transform: uppercase;+ }++ .status-paid {+ background-color: #e6f9ee;+ color: #1a7d42;+ border: 1px solid #b8e6cc;+ }++ .status-unpaid {+ background-color: #fff3e0;+ color: #b36b00;+ border: 1px solid #ffe0b2;+ }++ .status-void {+ background-color: #f5f5f5;+ color: #888;+ border: 1px solid #ddd;}.invoice-info-grid {@@ -65,26 +105,30 @@}.invoice-info-grid td {- padding: 10px;- width: 25%;+ padding: 12px 14px;vertical-align: top;}.info-label {- color: #8a6bc0;- font-size: 12px;+ font-family: 'DejaVu Sans', Arial, sans-serif;+ color: #888;+ font-size: 10px;font-weight: bold;display: block;margin-bottom: 4px;+ text-transform: uppercase;+ letter-spacing: 0.3px;}.info-value {+ font-family: 'DejaVu Sans', Arial, sans-serif;font-size: 13px;+ font-weight: 500;}.billing-section {margin-bottom: 20px;- background: #f8f8f8;+ background: #f9f9fb;padding: 15px;border-radius: 4px;width: 48%;@@ -92,10 +136,17 @@}.billing-title {- color: #8a6bc0;- font-size: 12px;+ color: #888;+ font-size: 10px;font-weight: bold;margin-bottom: 8px;+ text-transform: uppercase;+ letter-spacing: 0.3px;+ }++ .billing-name {+ font-weight: bold;+ margin-bottom: 2px;}table.items {@@ -106,29 +157,31 @@}.items th {- background: #8a6bc0;- color: white;+ background: #f9f9fb;+ color: #555;text-align: left;- padding: 12px 15px;+ padding: 10px 15px;font-weight: bold;- font-size: 12px;- letter-spacing: 0.5px;+ font-size: 10px;+ letter-spacing: 0.3px;+ text-transform: uppercase;+ border-bottom: 2px solid #e6e6e6;}.items td {padding: 12px 15px;- border-bottom: 1px solid #e6e6e6;+ border-bottom: 1px solid #f0f0f0;vertical-align: middle;}.item-description {- color: #666;+ color: #888;font-size: 11px;margin-top: 4px;}.item-price-original {- color: #666;+ color: #999;text-decoration: line-through;font-size: 11px;margin-bottom: 2px;@@ -141,39 +194,52 @@.totals {width: 350px;margin-left: auto;- margin-top: 20px;+ margin-top: 10px;}.totals td {- padding: 8px 10px;+ padding: 6px 10px;text-align: right;}.total-line td {- border-top: 2px solid #8a6bc0;+ border-top: 2px solid #1a1a1a;font-weight: bold;font-size: 14px;padding-top: 12px;- background: #f8f8f8;+ }++ .amount-paid-line td {+ color: #1a7d42;+ font-size: 12px;+ padding-top: 8px;+ }++ .balance-due-line td {+ border-top: 1px solid #e6e6e6;+ font-weight: bold;+ font-size: 14px;+ padding-top: 10px;}.subtotal td {font-weight: bold;- padding-top: 15px;+ padding-top: 12px;}.breakdown td {- color: #666;+ color: #888;font-size: 11px;}.invoice-notes {margin: 30px 0;padding: 15px;- background-color: #f8f8f8;+ background-color: #f9f9fb;border-radius: 4px;line-height: 1.6;clear: both;+ color: #555;}.invoice-footer {@@ -183,17 +249,18 @@text-align: center;line-height: 1.6;clear: both;+ color: #888;+ font-size: 11px;}.tax-info {- margin-top: 20px;- padding-top: 15px;+ margin-top: 15px;+ padding-top: 12px;border-top: 1px dashed #e6e6e6;font-size: 11px;- color: #666;+ color: #888;}- /* Specific column widths for items table */.col-description {width: 55%;}@@ -214,50 +281,75 @@body {padding: 15px;}++ .status-paid {+ background-color: #e6f9ee !important;+ -webkit-print-color-adjust: exact;+ print-color-adjust: exact;+ }}</style></head><body>-<div class="header">- <h1 class="logo-title">{{ $eventSettings->getInvoiceLabel() ?? __('Invoice') }}</h1>- <div class="company-details">- <div>{{ $eventSettings->getOrganizationName() }}</div>- <div>{!! $eventSettings->getOrganizationAddress() !!}</div>- @if($eventSettings->getSupportEmail())- <div>{{ $eventSettings->getSupportEmail() }}</div>- @endif- </div>-</div>-<div class="invoice-info-container">- <table class="invoice-info-grid">- <tr>- <td>- <span class="info-label">{{ __('Invoice Number') }}</span>- <span class="info-value">#{{ $invoice->getInvoiceNumber() }}</span>- </td>- <td>- <span class="info-label">{{ __('Date Issued') }}</span>- <span class="info-value">{{ Carbon::parse($order->getCreatedAt())->format('d/m/Y') }}</span>- </td>- @if($invoice->getDueDate())- <td>- <span class="info-label">{{ __('Due Date') }}</span>- <span- class="info-value">{{ Carbon::parse($invoice->getDueDate())->format('d/m/Y') }}</span>- </td>+<table class="header-table">+ <tr>+ <td style="width: 55%;">+ <h1 class="logo-title">{{ $eventSettings->getInvoiceLabel() ?? __('Invoice') }}</h1>+ <p class="header-event-name">{{ $event->getTitle() }}</p>+ </td>+ <td class="company-details">+ <div class="company-name">{{ $eventSettings->getOrganizationName() }}</div>+ <div>{!! $eventSettings->getOrganizationAddress() !!}</div>+ @if($eventSettings->getSupportEmail())+ <div>{{ $eventSettings->getSupportEmail() }}</div>@endif+ </td>+ </tr>+</table>++<table class="invoice-info-grid">+ <tr>+ <td>+ <span class="info-label">{{ __('Invoice Number') }}</span>+ <span class="info-value">#{{ $invoice->getInvoiceNumber() }}</span>+ </td>+ <td>+ <span class="info-label">{{ __('Date Issued') }}</span>+ <span class="info-value">{{ Carbon::parse($invoice->getIssueDate())->format('d/m/Y') }}</span>+ </td>+ @if(!$isPaid && $invoice->getDueDate())<td>- <span class="info-label">{{ __('Amount Due') }}</span>- <span class="info-value">{{ Currency::format($order->getTotalGross(), $order->getCurrency()) }}</span>+ <span class="info-label">{{ __('Due Date') }}</span>+ <span class="info-value">{{ Carbon::parse($invoice->getDueDate())->format('d/m/Y') }}</span></td>- </tr>- </table>-</div>+ @endif+ <td>+ @if($isPaid)+ <span class="info-label">{{ __('Amount Paid') }}</span>+ @else+ <span class="info-label">{{ __('Amount Due') }}</span>+ @endif+ <span class="info-value">{{ Currency::format($order->getTotalGross(), $order->getCurrency()) }}</span>+ </td>+ <td>+ <span class="info-label">{{ __('Status') }}</span>+ <span class="info-value">+ @if($isPaid)+ <span class="status-badge status-paid">{{ __('Paid') }}</span>+ @elseif($isVoid)+ <span class="status-badge status-void">{{ __('Void') }}</span>+ @else+ <span class="status-badge status-unpaid">{{ __('Unpaid') }}</span>+ @endif+ </span>+ </td>+ </tr>+</table><div class="billing-section"><div class="billing-title">{{ __('Billed To') }}</div>- <div>{{ $order->getFullName() }}</div>+ <div class="billing-name">{{ $order->getFullName() }}</div><div>{{ $order->getEmail() }}</div>@if($order->getAddress())<div>{{ $order->getBillingAddressString() }}</div>@@ -267,10 +359,10 @@<table class="items"><thead><tr>- <th class="col-description">{{ __('DESCRIPTION') }}</th>- <th class="col-rate align-right">{{ __('RATE') }}</th>- <th class="col-qty align-right">{{ __('QTY') }}</th>- <th class="col-amount align-right">{{ __('AMOUNT') }}</th>+ <th class="col-description">{{ __('Description') }}</th>+ <th class="col-rate align-right">{{ __('Rate') }}</th>+ <th class="col-qty align-right">{{ __('Qty') }}</th>+ <th class="col-amount align-right">{{ __('Amount') }}</th></tr></thead><tbody>@@ -364,9 +456,20 @@@endif<tr class="total-line">- <td>{{ __('Total Amount') }}</td>+ <td>{{ __('Total') }}</td><td>{{ Currency::format($order->getTotalGross(), $order->getCurrency()) }}</td></tr>++ @if($isPaid)+ <tr class="amount-paid-line">+ <td>{{ __('Amount Paid') }}</td>+ <td>-{{ Currency::format($order->getTotalGross(), $order->getCurrency()) }}</td>+ </tr>+ <tr class="balance-due-line">+ <td>{{ __('Balance Due') }}</td>+ <td>{{ Currency::format(0, $order->getCurrency()) }}</td>+ </tr>+ @endif</table>@if($eventSettings->getInvoiceNotes())