1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-12 14:12:44 +01:00

Merge pull request #5715 from turbo124/v5-develop

Fixes for client portal PDF display ae74f5a
This commit is contained in:
David Bomba 2021-05-15 17:14:56 +10:00 committed by GitHub
commit 8faeb15737
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 19 deletions

View File

@ -105,6 +105,8 @@ class CreateSingleAccount extends Command
'account_id' => $account->id,
'slack_webhook_url' => config('ninja.notification.slack'),
'default_password_timeout' => 30*60000,
'portal_mode' => 'domain',
'portal_domain' => 'http://ninja.test:8000',
]);
$account->default_company_id = $company->id;

View File

@ -251,7 +251,7 @@ class Credit extends BaseModel
$this->save();
}
public function pdf_file_path($invitation = null, string $type = 'url')
public function pdf_file_path($invitation = null, string $type = 'path')
{
if (! $invitation) {
@ -267,13 +267,11 @@ class Credit extends BaseModel
if(!$invitation)
throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?');
$file_path = CreateEntityPdf::dispatchNow($invitation);
return Storage::disk('public')->path($file_path);
return Storage::disk('public')->{$type}($file_path);
}
public function markInvitationsSent()
{
$this->invitations->each(function ($invitation) {

View File

@ -392,7 +392,7 @@ class Invoice extends BaseModel
return $invoice_calc->build();
}
public function pdf_file_path($invitation = null, string $type = 'url')
public function pdf_file_path($invitation = null, string $type = 'path')
{
if (! $invitation) {
@ -408,10 +408,9 @@ class Invoice extends BaseModel
if(!$invitation)
throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?');
$file_path = CreateEntityPdf::dispatchNow($invitation);
return Storage::disk('public')->path($file_path);
return Storage::disk('public')->{$type}($file_path);
}
public function markInvitationsSent()

View File

@ -207,7 +207,7 @@ class Quote extends BaseModel
}
public function pdf_file_path($invitation = null, string $type = 'url')
public function pdf_file_path($invitation = null, string $type = 'path')
{
if (! $invitation) {
@ -223,13 +223,13 @@ class Quote extends BaseModel
if(!$invitation)
throw new \Exception('Hard fail, could not create an invitation - is there a valid contact?');
$file_path = CreateEntityPdf::dispatchNow($invitation);
return Storage::disk('public')->path($file_path);
return Storage::disk('public')->{$type}($file_path);
}
/**
* @param int $status
* @return string

View File

@ -2,7 +2,7 @@
@section('meta_title', ctrans('texts.entity_number_placeholder', ['entity' => ctrans('texts.credit'), 'entity_number' => $credit->number]))
@push('head')
<meta name="pdf-url" content="{{ $credit->pdf_file_path() }}">
<meta name="pdf-url" content="{{ $credit->pdf_file_path(null, 'url') }}">
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
@endpush

View File

@ -1,2 +1,2 @@
<iframe src="{{ $invoice->pdf_file_path() }}"
<iframe src="{{ $invoice->pdf_file_path(null, 'url') }}"
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>

View File

@ -2,7 +2,7 @@
@section('meta_title', ctrans('texts.view_invoice'))
@push('head')
<meta name="pdf-url" content="{{ $invoice->pdf_file_path() }}">
<meta name="pdf-url" content="{{ $invoice->pdf_file_path(null, 'url') }}">
<meta name="show-invoice-terms" content="{{ $settings->show_accept_invoice_terms ? true : false }}">
<meta name="require-invoice-signature" content="{{ $client->user->account->hasFeature(\App\Models\Account::FEATURE_INVOICE_SETTINGS) && $settings->require_invoice_signature }}">
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
@ -174,7 +174,7 @@
</section>
</div>
<iframe src="{{ $invoice->pdf_file_path() }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
<iframe src="{{ $invoice->pdf_file_path(null, 'url') }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
<div class="flex justify-center">
<canvas id="pdf-placeholder" class="shadow rounded-lg bg-white lg:hidden mt-4 p-4"></canvas>

View File

@ -1,2 +1,2 @@
<iframe src="{{ $quote->pdf_file_path() }}"
<iframe src="{{ $quote->pdf_file_path(null,'url') }}"
style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;"></iframe>

View File

@ -2,7 +2,7 @@
@section('meta_title', ctrans('texts.entity_number_placeholder', ['entity' => ctrans('texts.quote'), 'entity_number' => $quote->number]))
@push('head')
<meta name="pdf-url" content="{{ asset($quote->pdf_file_path()) }}">
<meta name="pdf-url" content="{{ asset($quote->pdf_file_path(null, 'url')) }}">
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
<meta name="show-quote-terms" content="{{ $settings->show_accept_quote_terms ? true : false }}">
@ -78,7 +78,7 @@
<canvas id="pdf-placeholder" class="shadow rounded-lg bg-white lg:hidden mt-4 p-4"></canvas>
</div>
<iframe src="{{ $quote->pdf_file_path() }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
<iframe src="{{ $quote->pdf_file_path(null, 'url') }}" class="h-screen w-full border-0 hidden lg:block mt-4"></iframe>
@include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')])
@include('portal.ninja2020.invoices.includes.signature')

View File

@ -1,7 +1,7 @@
@extends('portal.ninja2020.layout.clean')
@push('head')
<meta name="pdf-url" content="{{ asset($entity->pdf_file_path()) }}">
<meta name="pdf-url" content="{{ asset($entity->pdf_file_path(null, 'url')) }}">
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.7.x/dist/alpine.min.js" defer></script>
@endpush
@ -39,7 +39,7 @@
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg">
<div class="rounded-md bg-white shadow-xs">
<div class="py-1">
<a target="_blank" href="{{ asset($entity->pdf_file_path()) }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ ctrans('texts.open_in_new_tab') }}</a>
<a target="_blank" href="{{ asset($entity->pdf_file_path(null, 'url')) }}" class="block px-4 py-2 text-sm leading-5 text-gray-700 hover:bg-gray-100 hover:text-gray-900 focus:outline-none focus:bg-gray-100 focus:text-gray-900">{{ ctrans('texts.open_in_new_tab') }}</a>
</div>
</div>
</div>