Ensure correct PDF is displayed to the contact

This commit is contained in:
David Bomba 2022-08-24 18:28:08 +10:00
parent 496da291d8
commit a2b8d57313
13 changed files with 18 additions and 14 deletions

View File

@ -1 +1 @@
5.5.15 6

View File

@ -35,6 +35,7 @@ class CreditController extends Controller
$data = [ $data = [
'credit' => $credit, 'credit' => $credit,
'key' => $invitation ? $invitation->key : false, 'key' => $invitation ? $invitation->key : false,
'invitation' => $invitation
]; ];
if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) { if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {

View File

@ -69,6 +69,7 @@ class InvoiceController extends Controller
$data = [ $data = [
'invoice' => $invoice, 'invoice' => $invoice,
'invitation' => $invitation,
'key' => $invitation ? $invitation->key : false, 'key' => $invitation ? $invitation->key : false,
]; ];

View File

@ -61,6 +61,7 @@ class QuoteController extends Controller
$data = [ $data = [
'quote' => $quote, 'quote' => $quote,
'key' => $invitation ? $invitation->key : false, 'key' => $invitation ? $invitation->key : false,
'invitation' => $invitation
]; ];
if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) { if ($invitation && auth()->guard('contact') && ! request()->has('silent') && ! $invitation->viewed_date) {

View File

@ -99,6 +99,7 @@ class PurchaseOrderController extends Controller
'settings' => $purchase_order->company->settings, 'settings' => $purchase_order->company->settings,
'sidebar' => $this->sidebarMenu(), 'sidebar' => $this->sidebarMenu(),
'company' => $purchase_order->company, 'company' => $purchase_order->company,
'invitation' => $invitation
]; ];
if ($request->query('mode') === 'fullscreen') { if ($request->query('mode') === 'fullscreen') {

View File

@ -28,17 +28,17 @@ class QuotesTable extends Component
public $company; public $company;
public $sort_field = 'status_id'; // Default sortBy. Feel free to change or pull from client/company settings. public $sort = 'status_id'; // Default sortBy. Feel free to change or pull from client/company settings.
public $sort_asc = true; public $sort_asc = true;
public function sortBy($field) public function sortBy($field)
{ {
$this->sort_field === $field $this->sort === $field
? $this->sort_asc = ! $this->sort_asc ? $this->sort_asc = ! $this->sort_asc
: $this->sort_asc = true; : $this->sort_asc = true;
$this->sort_field = $field; $this->sort = $field;
} }
public function mount() public function mount()
@ -51,7 +51,7 @@ class QuotesTable extends Component
$query = Quote::query() $query = Quote::query()
->with('client.gateway_tokens', 'company', 'client.contacts') ->with('client.gateway_tokens', 'company', 'client.contacts')
->orderBy($this->sort_field, $this->sort_asc ? 'asc' : 'desc'); ->orderBy($this->sort, $this->sort_asc ? 'asc' : 'desc');
if (count($this->status) > 0) { if (count($this->status) > 0) {

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.15', 'app_version' => '5.5.16',
'app_tag' => '5.5.15', 'app_tag' => '5.5.16',
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''), 'api_secret' => env('API_SECRET', ''),

View File

@ -3,7 +3,7 @@
@endphp @endphp
@push('head') @push('head')
<meta name="pdf-url" content="{{ $url ?? $entity->pdf_file_path(null, 'url', true) }}?cache_buster={{time()}}"> <meta name="pdf-url" content="{{ $url ?? $entity->pdf_file_path($invitation, 'url', true) }}?cache_buster={{time()}}">
<script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script> <script src="{{ asset('js/vendor/pdf.js/pdf.min.js') }}"></script>
@endpush @endpush
@ -86,7 +86,7 @@
<canvas id="pdf-placeholder" class="shadow rounded-lg bg-white"></canvas> <canvas id="pdf-placeholder" class="shadow rounded-lg bg-white"></canvas>
</div> </div>
@else @else
<iframe id="pdf-iframe" src="{{ $url ?? $entity->pdf_file_path(null, 'url', true) }}?cache_buster={{time()}}" class="h-screen w-full border-0 mt-4"></iframe> <iframe id="pdf-iframe" src="{{ $url ?? $entity->pdf_file_path($invitation, 'url', true) }}?cache_buster={{time()}}" class="h-screen w-full border-0 mt-4"></iframe>
@endif @endif

View File

@ -33,7 +33,7 @@
@include('portal.ninja2020.components.entity-documents', ['entity' => $credit]) @include('portal.ninja2020.components.entity-documents', ['entity' => $credit])
@include('portal.ninja2020.components.pdf-viewer', ['entity' => $credit]) @include('portal.ninja2020.components.pdf-viewer', ['entity' => $credit, 'invitation' => $invitation])
@endsection @endsection

View File

@ -1,2 +1,2 @@
<iframe src="{{ $invoice->pdf_file_path(null, 'url', true) }}" <iframe src="{{ $invoice->pdf_file_path($invitation, 'url', true) }}"
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> 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

@ -96,7 +96,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $invoice]) @include('portal.ninja2020.components.entity-documents', ['entity' => $invoice])
@include('portal.ninja2020.components.pdf-viewer', ['entity' => $invoice]) @include('portal.ninja2020.components.pdf-viewer', ['entity' => $invoice, 'invitation' => $invitation])
@include('portal.ninja2020.invoices.includes.terms', ['entities' => [$invoice], 'entity_type' => ctrans('texts.invoice')]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$invoice], 'entity_type' => ctrans('texts.invoice')])
@include('portal.ninja2020.invoices.includes.signature') @include('portal.ninja2020.invoices.includes.signature')
@endsection @endsection

View File

@ -46,7 +46,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $purchase_order]) @include('portal.ninja2020.components.entity-documents', ['entity' => $purchase_order])
@include('portal.ninja2020.components.pdf-viewer', ['entity' => $purchase_order]) @include('portal.ninja2020.components.pdf-viewer', ['entity' => $purchase_order, 'invitation' => $invitation])
@include('portal.ninja2020.invoices.includes.terms', ['entities' => [$purchase_order], 'entity_type' => ctrans('texts.purchase_order')]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$purchase_order], 'entity_type' => ctrans('texts.purchase_order')])
@include('portal.ninja2020.invoices.includes.signature') @include('portal.ninja2020.invoices.includes.signature')
@endsection @endsection

View File

@ -105,7 +105,7 @@
@endif @endif
@include('portal.ninja2020.components.entity-documents', ['entity' => $quote]) @include('portal.ninja2020.components.entity-documents', ['entity' => $quote])
@include('portal.ninja2020.components.pdf-viewer', ['entity' => $quote]) @include('portal.ninja2020.components.pdf-viewer', ['entity' => $quote, 'invitation' => $invitation])
@include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')]) @include('portal.ninja2020.invoices.includes.terms', ['entities' => [$quote], 'entity_type' => ctrans('texts.quote')])
@include('portal.ninja2020.invoices.includes.signature') @include('portal.ninja2020.invoices.includes.signature')
@endsection @endsection