Merge pull request #5734 from beganovich/v5-1805-credits-updates

(v5) Client portal: "Credits" updates
This commit is contained in:
Benjamin Beganović 2021-05-18 12:05:05 +02:00 committed by GitHub
commit 21d12bef77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 84 additions and 111 deletions

View File

@ -3,6 +3,7 @@
## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop) ## [Unreleased (daily channel)](https://github.com/invoiceninja/invoiceninja/tree/v5-develop)
- Add Cache-control: no-cache to prevent overaggressive caching of assets - Add Cache-control: no-cache to prevent overaggressive caching of assets
- Client portal: Multiple accounts access improvements (#5703) - Client portal: Multiple accounts access improvements (#5703)
- Client portal: "Credits" updates (#5734)
## [v5.1.56-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.56-release) ## [v5.1.56-release](https://github.com/invoiceninja/invoiceninja/releases/tag/v5.1.56-release)
## Fixed: ## Fixed:

View File

@ -22,8 +22,15 @@ class CreditController extends Controller
public function show(ShowCreditRequest $request, Credit $credit) public function show(ShowCreditRequest $request, Credit $credit)
{ {
return $this->render('credits.show', [ set_time_limit(0);
'credit' => $credit,
]); $data = ['credit' => $credit];
if ($request->query('mode') === 'fullscreen') {
return render('credits.show-fullscreen', $data);
}
return $this->render('credits.show', $data);
} }
} }

View File

@ -59,7 +59,7 @@
{{ $credit->formatDate($credit->date, $credit->client->date_format()) }} {{ $credit->formatDate($credit->date, $credit->client->date_format()) }}
</td> </td>
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500"> <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
{{ empty($credit->public_notes) ? '/' : $credit->public_notes }} {{ $credit->public_notes }}
</td> </td>
<td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500"> <td class="px-6 py-4 whitespace-no-wrap text-sm leading-5 text-gray-500">
<a href="{{ route('client.credit.show', $credit->hashed_id) }}" class="button-link text-primary"> <a href="{{ route('client.credit.show', $credit->hashed_id) }}" class="button-link text-primary">

View File

@ -0,0 +1,2 @@
<iframe src="{{ $credit->pdf_file_path(null, '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>

View File

@ -7,121 +7,84 @@
@endpush @endpush
@section('body') @section('body')
<div class="container mx-auto" x-data="{ tab: 'overview' }"> <div class="flex items-center justify-between">
<div class="flex mb-4"> <section class="flex items-center">
<button class="button button-primary text-black mr-4" x-on:click="tab = 'overview'" x-bind:class="{ 'border border-black': tab == 'overview' }"> <div class="items-center" style="display: none" id="pagination-button-container">
Overview <button class="input-label focus:outline-none hover:text-blue-600 transition ease-in-out duration-300"
</button> id="previous-page-button" title="Previous page">
<button class="button button-primary text-black" x-on:click="tab = 'pdf'" x-bind:class="{ 'border border-black': tab == 'pdf' }"> <svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
PDF <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</button> </svg>
</div> </button>
<div class="bg-white shadow overflow-hidden sm:rounded-lg" x-show="tab == 'overview'"> <button class="input-label focus:outline-none hover:text-blue-600 transition ease-in-out duration-300"
<div class="px-4 py-5 border-b border-gray-200 sm:px-6"> id="next-page-button" title="Next page">
<h3 class="text-lg leading-6 font-medium text-gray-900"> <svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
{{ ctrans('texts.credit') }} <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
</h3> </svg>
<p class="mt-1 max-w-2xl text-sm leading-5 text-gray-500" translate> </button>
</p>
</div> </div>
<div> <span class="text-sm text-gray-700 ml-2 lg:hidden">{{ ctrans('texts.page') }}:
<dl> <span id="current-page-container"></span>
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> <span>{{ strtolower(ctrans('texts.of')) }}</span>
<dt class="text-sm leading-5 font-medium text-gray-500"> <span id="total-page-container"></span>
{{ ctrans('texts.amount') }} </span>
</dt> </section>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> <section class="flex items-center space-x-1">
{{ App\Utils\Number::formatMoney($credit->amount, $credit->client) }} <div class="flex items-center mr-4 space-x-1 lg:hidden">
</dd> <span class="text-gray-600 mr-2" id="zoom-level">100%</span>
</div> <a href="#" id="zoom-in">
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> <svg class="text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600 cursor-pointer"
<dt class="text-sm leading-5 font-medium text-gray-500"> xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
{{ ctrans('texts.balance') }} stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
</dt> <circle cx="11" cy="11" r="8"></circle>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
{{ App\Utils\Number::formatMoney($credit->balance, $credit->client) }} <line x1="11" y1="8" x2="11" y2="14"></line>
</dd> <line x1="8" y1="11" x2="14" y2="11"></line>
</div> </svg>
<div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> </a>
<dt class="text-sm leading-5 font-medium text-gray-500"> <a href="#" id="zoom-out">
{{ ctrans('texts.credit_date') }} <svg class="text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600 cursor-pointer"
</dt> xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2"> stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
{{ $credit->formatDate($credit->date, $credit->client->date_format()) }} <circle cx="11" cy="11" r="8"></circle>
</dd> <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
</div> <line x1="8" y1="11" x2="14" y2="11"></line>
<div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6"> </svg>
<dt class="text-sm leading-5 font-medium text-gray-500"> </a>
{{ ctrans('texts.public_notes') }}
</dt>
<dd class="mt-1 text-sm leading-5 text-gray-900 sm:mt-0 sm:col-span-2">
{{ $credit->public_notes }}
</dd>
</div>
</dl>
</div> </div>
</div> <div x-data="{ open: false }" @keydown.escape="open = false" @click.away="open = false"
<div class="flex items-center justify-between" x-show="tab == 'pdf'"> class="relative inline-block text-left">
<section class="flex items-center"> <div>
<div class="items-center" style="display: none" id="pagination-button-container"> <button @click="open = !open"
<button class="input-label focus:outline-none hover:text-blue-600 transition ease-in-out duration-300" id="previous-page-button" title="Previous page"> class="flex items-center text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" /> <path
</svg> d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z"/>
</button>
<button class="input-label focus:outline-none hover:text-blue-600 transition ease-in-out duration-300" id="next-page-button" title="Next page">
<svg class="w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg> </svg>
</button> </button>
</div> </div>
<span class="text-sm text-gray-700 ml-2">{{ ctrans('texts.page') }}: <div x-show="open" x-transition:enter="transition ease-out duration-100"
<span id="current-page-container"></span> x-transition:enter-start="transform opacity-0 scale-95"
<span>{{ strtolower(ctrans('texts.of')) }}</span> x-transition:enter-end="transform opacity-100 scale-100"
<span id="total-page-container"></span> x-transition:leave="transition ease-in duration-75"
</span> x-transition:leave-start="transform opacity-100 scale-100"
</section> x-transition:leave-end="transform opacity-0 scale-95"
<section class="flex items-center space-x-1"> class="origin-top-right absolute right-0 mt-2 w-56 rounded-md shadow-lg">
<div class="flex items-center mr-4 space-x-1"> <div class="rounded-md bg-white shadow-xs">
<span class="text-gray-600 mr-2" id="zoom-level">100%</span> <div class="py-1">
<a href="#" id="zoom-in"> <a target="_blank" href="?mode=fullscreen"
<svg class="text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600 cursor-pointer" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> 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>
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
<line x1="11" y1="8" x2="11" y2="14"></line>
<line x1="8" y1="11" x2="14" y2="11"></line>
</svg>
</a>
<a href="#" id="zoom-out">
<svg class="text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600 cursor-pointer" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="11" cy="11" r="8"></circle>
<line x1="21" y1="21" x2="16.65" y2="16.65"></line>
<line x1="8" y1="11" x2="14" y2="11"></line>
</svg>
</a>
</div>
<div x-data="{ open: false }" @keydown.escape="open = false" @click.away="open = false" class="relative inline-block text-left">
<div>
<button @click="open = !open" class="flex items-center text-gray-400 hover:text-gray-600 focus:outline-none focus:text-gray-600">
<svg class="h-5 w-5" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 6a2 2 0 110-4 2 2 0 010 4zM10 12a2 2 0 110-4 2 2 0 010 4zM10 18a2 2 0 110-4 2 2 0 010 4z" />
</svg>
</button>
</div>
<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="?mode=fullscreen" 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>
</div> </div>
</div> </div>
</section> </div>
</div> </section>
<div class="flex justify-center" x-show="tab == 'pdf'"> </div>
<canvas id="pdf-placeholder" class="shadow rounded-lg bg-white mt-4 p-4"></canvas>
</div> <iframe src="{{ $credit->pdf_file_path(null, 'url', true) }}" 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>
</div> </div>
@endsection @endsection