Attach invoice documents to payment emails

This commit is contained in:
David Bomba 2022-12-15 16:55:47 +11:00
parent bbcf2b3459
commit a24a051004
2 changed files with 34 additions and 35 deletions

View File

@ -96,11 +96,13 @@ class PaymentEmailEngine extends BaseEmailEngine
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $invoice->numberFormatter().'.pdf']]); $this->setAttachments([['file' => base64_encode($pdf), 'name' => $invoice->numberFormatter().'.pdf']]);
foreach ($invoice->documents as $document) {
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
}
}); });
// foreach ($this->payment->documents as $document) {
// $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
// }
} }
return $this; return $this;

View File

@ -8,9 +8,8 @@
</h1> </h1>
</div> </div>
@if(isset($invoice))
@if(isset($invoice)) <div class="flex items-center mt-4 text-sm">
<div class="flex items-center mt-4 text-sm">
<form action="{{ route('client.payments.process', ['hash' => $hash, 'sidebar' => 'hidden']) }}" <form action="{{ route('client.payments.process', ['hash' => $hash, 'sidebar' => 'hidden']) }}"
method="post" method="post"
id="payment-method-form"> id="payment-method-form">
@ -28,8 +27,8 @@
<input type="hidden" name="company_gateway_id" value="{{ $company_gateway_id }}"/> <input type="hidden" name="company_gateway_id" value="{{ $company_gateway_id }}"/>
<input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}"/> <input type="hidden" name="payment_method_id" value="{{ $payment_method_id }}"/>
</form> </form>
</div> </div>
@endif @endif
<form wire:submit.prevent="submit"> <form wire:submit.prevent="submit">
<!-- Recurring Plan Products--> <!-- Recurring Plan Products-->
@ -65,7 +64,6 @@
@endfor @endfor
</select> </select>
</div> </div>
@endif @endif
</div> </div>
@error("data.{$index}.recurring_qty") @error("data.{$index}.recurring_qty")
@ -83,7 +81,7 @@
@foreach($products as $product) @foreach($products as $product)
<li class="flex py-6"> <li class="flex py-6">
@if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL))
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200"> <div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2">
<img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center"> <img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center">
</div> </div>
@endif @endif
@ -122,7 +120,7 @@
@foreach($optional_recurring_products as $index => $product) @foreach($optional_recurring_products as $index => $product)
<li class="flex py-6"> <li class="flex py-6">
@if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL))
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200"> <div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2">
<img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center"> <img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center">
</div> </div>
@endif @endif
@ -130,9 +128,8 @@
<div> <div>
<div class="flex justify-between text-base font-medium text-gray-900"> <div class="flex justify-between text-base font-medium text-gray-900">
<h3>{!! nl2br($product->notes) !!}</h3> <h3>{!! nl2br($product->notes) !!}</h3>
<p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} </p> <p class="ml-0">{{ \App\Utils\Number::formatMoney($product->price, $subscription->company) }} / {{ App\Models\RecurringInvoice::frequencyForKey($subscription->frequency_id) }}</p>
</div> </div>
</div> </div>
<div class="flex justify-between text-sm mt-1"> <div class="flex justify-between text-sm mt-1">
@if(is_numeric($product->custom_value2)) @if(is_numeric($product->custom_value2))
@ -149,7 +146,7 @@
@endif @endif
> >
<option value="0" selected="selected">0</option> <option value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity,$product->custom_value2) : $product->custom_value2); $i++) @for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity, max(100,$product->custom_value2)) : max(100,$product->custom_value2)); $i++)
<option value="{{$i}}">{{$i}}</option> <option value="{{$i}}">{{$i}}</option>
@endfor @endfor
</select> </select>
@ -164,7 +161,7 @@
@foreach($optional_products as $index => $product) @foreach($optional_products as $index => $product)
<li class="flex py-6"> <li class="flex py-6">
@if(filter_var($product->custom_value1, FILTER_VALIDATE_URL)) @if(filter_var($product->custom_value1, FILTER_VALIDATE_URL))
<div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200"> <div class="h-24 w-24 flex-shrink-0 overflow-hidden rounded-md border border-gray-200 mr-2">
<img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center"> <img src="{{$product->custom_value1}}" alt="" class="h-full w-full object-cover object-center">
</div> </div>
@endif @endif
@ -187,7 +184,7 @@
@endif @endif
<select wire:model.debounce.300ms="data.{{ $index }}.optional_qty" class="rounded-md border-gray-300 shadow-sm sm:text-sm"> <select wire:model.debounce.300ms="data.{{ $index }}.optional_qty" class="rounded-md border-gray-300 shadow-sm sm:text-sm">
<option value="0" selected="selected">0</option> <option value="0" selected="selected">0</option>
@for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity,$product->custom_value2) : $product->custom_value2); $i++) @for ($i = 1; $i <= ($subscription->use_inventory_management ? min($product->in_stock_quantity, min(100,$product->custom_value2)) : min(100,$product->custom_value2)); $i++)
<option value="{{$i}}">{{$i}}</option> <option value="{{$i}}">{{$i}}</option>
@endfor @endfor
</select> </select>