1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Enable E-Invoice for client download

This commit is contained in:
Lars Kusch 2023-08-07 21:55:12 +02:00
parent d8a6578be2
commit dd17119fd6
4 changed files with 44 additions and 15 deletions

View File

@ -12,6 +12,7 @@
namespace App\Http\Livewire;
use App\Services\Invoice\GetInvoiceEInvoice;
use App\Utils\Number;
use Livewire\Component;
use App\Utils\HtmlEngine;
@ -95,6 +96,20 @@ class PdfSlot extends Component
echo $file;
}, $file_name, $headers);
}
public function downloadEInvoice()
{
$file_name = $this->entity->numberFormatter().'.xml';
$file = (new GetInvoiceEInvoice($this->entity))->run();
$headers = ['Content-Type' => 'application/xml'];
return response()->streamDownload(function () use ($file) {
echo $file;
}, $file_name, $headers);
}
public function render()

View File

@ -12,6 +12,7 @@
namespace App\Jobs\Entity;
use App\Exceptions\FilePermissionsFailure;
use App\Jobs\Invoice\MergeEInvoice;
use App\Libraries\MultiDB;
use App\Models\Credit;
use App\Models\CreditInvitation;
@ -202,6 +203,9 @@ class CreateRawPdf implements ShouldQueue
if ($pdf) {
$maker =null;
$state = null;
if ($this->invitation->invoice->client->getSetting('enable_e_invoice') && $this->entity == "invoice"){
(new \App\Services\Invoice\MergeEInvoice($this->invitation->invoice))->run();
};
return $pdf;
}

View File

@ -9,6 +9,15 @@
</svg>
</div>
</button>
<button wire:loading.attr="disabled" wire:click="downloadEInvoice" class="bg-gray-100 hover:bg-gray-200 text-gray-800 font-bold px-2 rounded inline-flex" type="button">
<span>{{ ctrans('texts.download_xml') }}</span>
<div wire:loading wire:target="downloadEInvoice">
<svg class="animate-spin h-5 w-5 text-blue" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
</div>
</button>
</div>
<div class="hidden lg:block">
<div wire:init="getPdf()">

View File

@ -16,7 +16,8 @@
<form action="{{ route('client.invoices.bulk') }}" method="post" id="bulkActions">
@csrf
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" class="button button-primary bg-primary" name="action" value="download">{{ ctrans('texts.download') }}</button>
@csrf
<button type="submit" onclick="setTimeout(() => this.disabled = true, 0); setTimeout(() => this.disabled = false, 5000); return true;" class="button button-primary bg-secondary" name="action-xml" value="download">{{ ctrans('texts.download_xml') }}</button>
@if(!empty(auth()->user()->client->service()->getPaymentMethods(0)))
<button onclick="setTimeout(() => this.disabled = true, 0); return true;" type="submit" class="button button-primary bg-primary" name="action" value="payment">{{ ctrans('texts.pay_now') }}</button>
@endif