2023-07-12 06:06:32 +02:00
|
|
|
<div>
|
2023-08-17 00:58:10 +02:00
|
|
|
<div class="flex flex-row space-x-2 float-right mb-2" x-data>
|
2023-08-09 00:07:03 +02:00
|
|
|
<button wire:loading.attr="disabled" wire:click="downloadPdf" class="bg-primary text-white px-4 py-4 lg:px-2 lg:py-2 rounded" type="button">
|
|
|
|
<span class="mr-0">{{ ctrans('texts.download_pdf') }}</span>
|
2023-07-16 04:40:32 +02:00
|
|
|
<div wire:loading wire:target="downloadPdf">
|
|
|
|
<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>
|
2023-08-21 12:56:06 +02:00
|
|
|
@if($entity_type == 'invoice' && $settings->enable_e_invoice)
|
2023-08-17 00:58:10 +02:00
|
|
|
<button wire:loading.attr="disabled" wire:click="downloadEInvoice" class="bg-primary text-white px-4 py-4 lg:px-2 lg:py-2 rounded" type="button">
|
|
|
|
<span>{{ ctrans('texts.download_e_invoice') }}</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>
|
|
|
|
@endif
|
2023-07-16 04:40:32 +02:00
|
|
|
</div>
|
2024-01-28 05:05:30 +01:00
|
|
|
@if($html_entity_option)
|
2023-07-16 04:40:32 +02:00
|
|
|
<div class="hidden lg:block">
|
2024-01-28 05:05:30 +01:00
|
|
|
@else
|
|
|
|
<div>
|
|
|
|
@endif
|
2023-07-16 04:40:32 +02:00
|
|
|
<div wire:init="getPdf()">
|
2023-07-16 06:28:56 +02:00
|
|
|
<div class="flex mt-4 place-items-center" id="loader" wire:ignore>
|
|
|
|
<span class="loader m-auto" wire:ignore></span>
|
2023-07-16 04:40:32 +02:00
|
|
|
<style type="text/css">
|
|
|
|
.loader {
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
border-radius: 50%;
|
|
|
|
position: relative;
|
|
|
|
animation: rotate 1s linear infinite
|
|
|
|
}
|
|
|
|
.loader::before , .loader::after {
|
|
|
|
content: "";
|
|
|
|
box-sizing: border-box;
|
|
|
|
position: absolute;
|
|
|
|
inset: 0px;
|
|
|
|
border-radius: 50%;
|
|
|
|
border: 5px solid #454545;
|
|
|
|
animation: prixClipFix 2s linear infinite ;
|
|
|
|
}
|
|
|
|
.loader::after{
|
|
|
|
border-color: #FF3D00;
|
|
|
|
animation: prixClipFix 2s linear infinite , rotate 0.5s linear infinite reverse;
|
|
|
|
inset: 6px;
|
|
|
|
}
|
|
|
|
@keyframes rotate {
|
|
|
|
0% {transform: rotate(0deg)}
|
|
|
|
100% {transform: rotate(360deg)}
|
|
|
|
}
|
|
|
|
@keyframes prixClipFix {
|
|
|
|
0% {clip-path:polygon(50% 50%,0 0,0 0,0 0,0 0,0 0)}
|
|
|
|
25% {clip-path:polygon(50% 50%,0 0,100% 0,100% 0,100% 0,100% 0)}
|
|
|
|
50% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,100% 100%,100% 100%)}
|
|
|
|
75% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 100%)}
|
|
|
|
100% {clip-path:polygon(50% 50%,0 0,100% 0,100% 100%,0 100%,0 0)}
|
|
|
|
}
|
2023-07-16 06:28:56 +02:00
|
|
|
</style>
|
2023-07-16 04:40:32 +02:00
|
|
|
</div>
|
2023-07-16 05:12:45 +02:00
|
|
|
@if($pdf)
|
|
|
|
<iframe id="pdf-iframe" src="/{{ $route_entity }}/showBlob/{{ $pdf }}" class="h-screen w-full border-0 mt-4"></iframe>
|
2023-07-16 04:40:32 +02:00
|
|
|
@endif
|
|
|
|
</div>
|
2023-07-12 06:06:32 +02:00
|
|
|
</div>
|
|
|
|
|
2024-01-28 05:05:30 +01:00
|
|
|
@if($html_entity_option)
|
2023-07-16 04:40:32 +02:00
|
|
|
<div class="block lg:hidden">
|
|
|
|
@include('portal.ninja2020.components.html-viewer')
|
|
|
|
</div>
|
2024-01-28 05:05:30 +01:00
|
|
|
@endif
|
2023-07-16 05:12:45 +02:00
|
|
|
|
2024-01-28 05:05:30 +01:00
|
|
|
</div>
|
2023-07-16 05:12:45 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
waitForElement("#pdf-iframe", 0).then(function(){
|
|
|
|
const iframe = document.getElementById("pdf-iframe");
|
|
|
|
|
|
|
|
iframe.addEventListener("load", function () {
|
2023-07-16 06:28:56 +02:00
|
|
|
const loader = document.getElementById("loader")
|
|
|
|
loader.classList.add("hidden");
|
2023-07-16 05:12:45 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
function waitForElement(querySelector, timeout){
|
|
|
|
return new Promise((resolve, reject)=>{
|
|
|
|
var timer = false;
|
|
|
|
if(document.querySelectorAll(querySelector).length) return resolve();
|
|
|
|
const observer = new MutationObserver(()=>{
|
|
|
|
if(document.querySelectorAll(querySelector).length){
|
|
|
|
observer.disconnect();
|
|
|
|
if(timer !== false) clearTimeout(timer);
|
|
|
|
return resolve();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
observer.observe(document.body, {
|
2023-08-07 21:55:12 +02:00
|
|
|
childList: true,
|
2023-07-16 05:12:45 +02:00
|
|
|
subtree: true
|
|
|
|
});
|
|
|
|
if(timeout) timer = setTimeout(()=>{
|
|
|
|
observer.disconnect();
|
|
|
|
reject();
|
|
|
|
}, timeout);
|
|
|
|
});
|
2023-07-16 06:28:56 +02:00
|
|
|
|
2023-07-16 05:12:45 +02:00
|
|
|
}
|
|
|
|
|
2023-08-07 21:55:12 +02:00
|
|
|
</script>
|