Hide "Add payment method" if no bank/credit card gateway configured

This commit is contained in:
Benjamin Beganović 2020-08-24 07:18:28 +02:00
parent 0b34fd0738
commit a0db7fdb1e

View File

@ -10,22 +10,24 @@
</select> </select>
</div> </div>
<div class="relative" x-data="{ open: false }" x-on:click.away="open = false"> <div class="relative" x-data="{ open: false }" x-on:click.away="open = false">
<button x-on:click="open = !open" class="button button-primary">{{ ctrans('texts.add_payment_method') }}</button> <!-- Add payment method button -->
<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-48 rounded-md shadow-lg"> @if($client->getCreditCardGateway() || $client->getBankTransferGateway())
<div class="py-1 rounded-md bg-white shadow-xs"> <button x-on:click="open = !open" class="button button-primary">{{ ctrans('texts.add_payment_method') }}</button>
@if($client->getCreditCardGateway()) <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-48 rounded-md shadow-lg">
<a href="{{ route('client.payment_methods.create', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition ease-in-out duration-150"> <div class="py-1 rounded-md bg-white shadow-xs">
{{ ctrans('texts.credit_card') }} @if($client->getCreditCardGateway())
</a> <a href="{{ route('client.payment_methods.create', ['method' => App\Models\GatewayType::CREDIT_CARD]) }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition ease-in-out duration-150">
@endif {{ ctrans('texts.credit_card') }}
</a>
@if($client->getBankTransferGateway()) @endif
<a href="{{ route('client.payment_methods.create', ['method' => $client->getBankTransferMethodType()]) }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition ease-in-out duration-150"> @if($client->getBankTransferGateway())
{{ ctrans('texts.bank_account') }} <a href="{{ route('client.payment_methods.create', ['method' => $client->getBankTransferMethodType()]) }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition ease-in-out duration-150">
</a> {{ ctrans('texts.bank_account') }}
@endif </a>
@endif
</div>
</div> </div>
</div> @endif
</div> </div>
</div> </div>
<div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8"> <div class="-my-2 py-2 overflow-x-auto sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8">