From 2a6667a5133368beb8813fe5183850fba9b6a39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Wed, 21 Jul 2021 13:01:53 +0200 Subject: [PATCH] Extract pdf-viewer into component & make it show iframe on non-android devices --- .../ninja2020/components/pdf-viewer.blade.php | 97 +++++++++++++++++++ .../portal/ninja2020/credits/show.blade.php | 76 +-------------- .../portal/ninja2020/invoices/show.blade.php | 85 +--------------- .../portal/ninja2020/quotes/show.blade.php | 60 +----------- 4 files changed, 100 insertions(+), 218 deletions(-) create mode 100644 resources/views/portal/ninja2020/components/pdf-viewer.blade.php diff --git a/resources/views/portal/ninja2020/components/pdf-viewer.blade.php b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php new file mode 100644 index 000000000000..ec97ae97e34b --- /dev/null +++ b/resources/views/portal/ninja2020/components/pdf-viewer.blade.php @@ -0,0 +1,97 @@ +@php + $android = stripos($_SERVER['HTTP_USER_AGENT'], 'Android'); +@endphp + +@push('head') + + +@endpush + +
+
+
+ + +
+ {{ ctrans('texts.page') }}: + + {{ strtolower(ctrans('texts.of')) }} + + +
+
+ +
+
+ +
+ +
+
+
+ +@if($android) +
+ +
+@else + +@endif + + +@if($android) + @push('footer') + + @endpush +@endif \ No newline at end of file diff --git a/resources/views/portal/ninja2020/credits/show.blade.php b/resources/views/portal/ninja2020/credits/show.blade.php index 11bfcf3d4b1a..1b914210e85e 100644 --- a/resources/views/portal/ninja2020/credits/show.blade.php +++ b/resources/views/portal/ninja2020/credits/show.blade.php @@ -9,81 +9,7 @@ @section('body') @include('portal.ninja2020.components.entity-documents', ['entity' => $credit]) -
-
- - {{ ctrans('texts.page') }}: - - {{ strtolower(ctrans('texts.of')) }} - - -
-
- -
-
- -
- -
-
-
- - + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $credit])
diff --git a/resources/views/portal/ninja2020/invoices/show.blade.php b/resources/views/portal/ninja2020/invoices/show.blade.php index c26c3c9a71e5..aeaee1553fc5 100644 --- a/resources/views/portal/ninja2020/invoices/show.blade.php +++ b/resources/views/portal/ninja2020/invoices/show.blade.php @@ -2,10 +2,8 @@ @section('meta_title', ctrans('texts.view_invoice')) @push('head') - - @endpush @@ -71,92 +69,11 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $invoice]) - -
-
- - {{ ctrans('texts.page') }}: - - {{ strtolower(ctrans('texts.of')) }} - - -
-
- -
-
- -
- -
-
-
- - - -
- -
- + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $invoice]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$invoice], 'entity_type' => ctrans('texts.invoice')]) @include('portal.ninja2020.invoices.includes.signature') @endsection @section('footer') - @endsection diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index 46ddef487cad..da929a86561c 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -28,69 +28,11 @@ @endif @include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) - -
-
- - {{ ctrans('texts.page') }}: - - {{ strtolower(ctrans('texts.of')) }} - - -
-
-
- 100% - - - - - - -
-
-
- -
- -
-
-
- -
- -
- - - + @include('portal.ninja2020.components.pdf-viewer', ['entity' => $quote]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')]) @include('portal.ninja2020.invoices.includes.signature') @endsection @section('footer') - @endsection