portal payment methods slider convert to tab component

This commit is contained in:
Burak Civan
2022-08-16 10:48:18 +03:00
parent 37fc0907ce
commit 36304d90d3
3 changed files with 151 additions and 135 deletions

View File

@@ -23,68 +23,70 @@
<div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0"> <div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0">
<div class="w-full lg:w-5/12"> <div class="w-full lg:w-5/12">
@if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled'])) @if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled']))
<div class="tabs w-full" x-data="{ active: '{{ reset($payment_methods) }}' }"> <x-tabs active="{{ reset($payment_methods) }}">
<div role="tablist" class="flex flex-wrap"> <div role="tablist" class="flex flex-wrap">
@php $is_active = true; @endphp @php $is_active = true; @endphp
<div class="swiper swiper-links w-full"> <x-slot name="navs">
<div class="swiper-wrapper"> <div class="swiper swiper-links w-full">
@foreach ($payment_methods as $key => $name) <div class="swiper-wrapper">
@stack('invoice_{{ $key }}_tab_start') @foreach ($payment_methods as $key => $name)
<div class="swiper-slide"> @stack('invoice_{{ $key }}_tab_start')
<div <div class="swiper-slide">
x-on:click="active = '{{ $name }}'" <x-tabs.nav
@click="onChangePaymentMethodSigned('{{ $key }}')" id="{{ $name }}"
id="tabs-payment-method-{{ $key }}-tab" @click="onChangePaymentMethodSigned('{{ $key }}')"
x-bind:class="active != '{{ $name }}' ? '' : 'active-tabs text-purple border-purple transition-all after:absolute after:w-full after:h-0.5 after:left-0 after:right-0 after:bottom-0 after:bg-purple after:rounded-tl-md after:rounded-tr-md'" >
class="relative text-sm text-black text-center pb-2 border-b cursor-pointer transition-all tabs-link" <div class="w-24 truncate">
> {{ $name }}
{{ $name }} </div>
</x-tabs.nav>
</div> </div>
</div> @stack('invoice_{{ $key }}_tab_end')
@stack('invoice_{{ $key }}_tab_end')
@php $is_active = false; @endphp @php $is_active = false; @endphp
@endforeach @endforeach
</div> </div>
<div class="swiper-button-next top-3 right-0"> <div class="swiper-button-next top-3 right-0">
<span class="material-icons">chevron_right</span> <span class="material-icons">chevron_right</span>
</div>
<div class="swiper-button-prev top-3 left-0">
<span class="material-icons">chevron_left</span>
</div>
</div> </div>
<div class="swiper-button-prev top-3 left-0"> </x-slot>
<span class="material-icons">chevron_left</span>
</div>
</div>
</div> </div>
@php $is_active = true; @endphp @php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name) <x-slot name="content">
@stack('invoice_{{ $key }}_content_start') @foreach ($payment_methods as $key => $name)
<div @stack('invoice_{{ $key }}_content_start')
x-bind:class="active != '{{ $name }}' ? 'hidden': 'block'" <x-tabs.tab id="{{ $name }}">
class="my-3" <div class="my-3">
id="tabs-payment-method-{{ $key }}" <component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
> </div>
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component> </x-tabs.tab>
</div> @stack('invoice_{{ $key }}_content_end')
@stack('invoice_{{ $key }}_content_end')
@php $is_active = false; @endphp @php $is_active = false; @endphp
@endforeach @endforeach
</div>
<x-form id="portal"> <x-form id="portal">
<x-form.group.payment-method <x-form.group.payment-method
id="payment-method" id="payment-method"
:selected="array_key_first($payment_methods)" :selected="array_key_first($payment_methods)"
not-required not-required
form-group-class="invisible" form-group-class="invisible"
placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}" placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
change="onChangePaymentMethodSigned('{{ array_key_first($payment_methods) }}')" change="onChangePaymentMethodSigned('{{ array_key_first($payment_methods) }}')"
/> />
<x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" /> <x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" />
</x-form> </x-form>
</x-slot>
</x-tabs>
@endif @endif
@if ($invoice->transactions->count()) @if ($invoice->transactions->count())

View File

@@ -21,66 +21,70 @@
<div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0"> <div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0">
<div class="w-full lg:w-5/12"> <div class="w-full lg:w-5/12">
@if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled'])) @if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled']))
<div class="tabs w-full" x-data="{ active: '{{ reset($payment_methods) }}' }"> <x-tabs active="{{ reset($payment_methods) }}">
<div role="tablist" class="flex flex-wrap gap-y-4"> <div role="tablist" class="flex flex-wrap">
@php $is_active = true; @endphp @php $is_active = true; @endphp
<div class="swiper swiper-links w-full"> <x-slot name="navs">
<div class="swiper-wrapper"> <div class="swiper swiper-links w-full">
@foreach ($payment_methods as $key => $name) <div class="swiper-wrapper">
@stack('invoice_{{ $key }}_tab_start') @foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_tab_start')
<div class="swiper-slide">
<x-tabs.nav
id="{{ $name }}"
@click="onChangePaymentMethodSigned('{{ $key }}')"
>
<div class="w-24 truncate">
{{ $name }}
</div>
</x-tabs.nav>
</div>
@stack('invoice_{{ $key }}_tab_end')
<div class="swiper-slide"> @php $is_active = false; @endphp
<div @endforeach
x-on:click="active = '{{ $name }}'" </div>
@click="onChangePaymentMethod('{{ $key }}')"
id="tabs-payment-method-{{ $key }}-tab"
x-bind:class="active != '{{ $name }}' ? '' : 'active-tabs text-purple border-purple transition-all after:absolute after:w-full after:h-0.5 after:left-0 after:right-0 after:bottom-0 after:bg-purple after:rounded-tl-md after:rounded-tr-md'"
class="text-sm text-black text-center pb-2 border-b cursor-pointer transition-all tabs-link"
>
{{ $name }}
</div>
</div>
@stack('invoice_{{ $key }}_tab_end') <div class="swiper-button-next top-3 right-0">
<span class="material-icons">chevron_right</span>
</div>
@php $is_active = false; @endphp <div class="swiper-button-prev top-3 left-0">
@endforeach <span class="material-icons">chevron_left</span>
</div>
</div> </div>
</div> </x-slot>
</div> </div>
@php $is_active = true; @endphp @php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name) <x-slot name="content">
@stack('invoice_{{ $key }}_content_start') @foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_content_start')
<x-tabs.tab id="{{ $name }}">
<div class="my-3">
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
</x-tabs.tab>
@stack('invoice_{{ $key }}_content_end')
<div @php $is_active = false; @endphp
x-bind:class="active != '{{ $name }}' ? 'hidden': 'block'" @endforeach
class="my-3"
id="tabs-payment-method-{{ $key }}"
>
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
</div>
@stack('invoice_{{ $key }}_content_end') <x-form id="portal">
<x-form.group.payment-method
id="payment-method"
:selected="array_key_first($payment_methods)"
not-required
form-group-class="invisible"
placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
change="onChangePaymentMethod('{{ array_key_first($payment_methods) }}')"
/>
@php $is_active = false; @endphp <x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" />
@endforeach </x-form>
</div> </x-slot>
</x-tabs>
<x-form id="portal">
<x-form.group.payment-method
id="payment-method"
:selected="array_key_first($payment_methods)"
not-required
form-group-class="invisible"
placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
change="onChangePaymentMethod('{{ array_key_first($payment_methods) }}')"
/>
<x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" />
</x-form>
@endif @endif
@if ($invoice->transactions->count()) @if ($invoice->transactions->count())

View File

@@ -30,60 +30,70 @@
<div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0"> <div class="flex flex-col lg:flex-row my-10 lg:space-x-24 rtl:space-x-reverse space-y-12 lg:space-y-0">
<div class="w-full lg:w-5/12"> <div class="w-full lg:w-5/12">
@if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled'])) @if (! empty($payment_methods) && ! in_array($invoice->status, ['paid', 'cancelled']))
<div class="tabs w-full" x-data="{ active: '{{ reset($payment_methods) }}' }"> <x-tabs active="{{ reset($payment_methods) }}">
<div role="tablist" class="flex flex-wrap"> <div role="tablist" class="flex flex-wrap">
@php $is_active = true; @endphp @php $is_active = true; @endphp
<div class="swiper swiper-links w-full"> <x-slot name="navs">
<div class="swiper-wrapper"> <div class="swiper swiper-links w-full">
<div class="swiper-wrapper">
@foreach ($payment_methods as $key => $name) @foreach ($payment_methods as $key => $name)
@stack('invoice_{{ $key }}_tab_start') @stack('invoice_{{ $key }}_tab_start')
<div class="swiper-slide"> <div class="swiper-slide">
<div <x-tabs.nav
x-on:click="active = '{{ $name }}'" id="{{ $name }}"
@click="onChangePaymentMethodSigned('{{ $key }}')" @click="onChangePaymentMethodSigned('{{ $key }}')"
id="tabs-payment-method-{{ $key }}-tab" >
x-bind:class="active != '{{ $name }}' ? '' : 'active-tabs text-purple border-purple transition-all after:absolute after:w-full after:h-0.5 after:left-0 after:right-0 after:bottom-0 after:bg-purple after:rounded-tl-md after:rounded-tr-md'" <div class="w-24 truncate">
class="relative text-sm text-black text-center pb-2 border-b cursor-pointer transition-all tabs-link" {{ $name }}
> </div>
{{ $name }} </x-tabs.nav>
</div> </div>
</div>
@stack('invoice_{{ $key }}_tab_end') @stack('invoice_{{ $key }}_tab_end')
@php $is_active = false; @endphp @php $is_active = false; @endphp
@endforeach @endforeach
</div>
<div class="swiper-button-next top-3 right-0">
<span class="material-icons">chevron_right</span>
</div>
<div class="swiper-button-prev top-3 left-0">
<span class="material-icons">chevron_left</span>
</div>
</div> </div>
</div> </x-slot>
</div> </div>
@php $is_active = true; @endphp @php $is_active = true; @endphp
@foreach ($payment_methods as $key => $name) <x-slot name="content">
@stack('invoice_{{ $key }}_content_start') @foreach ($payment_methods as $key => $name)
<div @stack('invoice_{{ $key }}_content_start')
x-bind:class="active != '{{ $name }}' ? 'hidden': 'block'" <x-tabs.tab id="{{ $name }}">
class="my-3" <div class="my-3">
id="tabs-payment-method-{{ $key }}" <component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component>
> </div>
<component v-bind:is="method_show_html" @interface="onRedirectConfirm"></component> </x-tabs.tab>
</div> @stack('invoice_{{ $key }}_content_end')
@stack('invoice_{{ $key }}_content_end')
@php $is_active = false; @endphp
@endforeach
@php $is_active = false; @endphp <x-form id="portal">
@endforeach <x-form.group.payment-method
</div> id="payment-method"
<x-form id="portal"> :selected="array_key_first($payment_methods)"
<x-form.group.payment-method not-required
id="payment-method" form-group-class="invisible"
:selected="array_key_first($payment_methods)" placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
not-required change="onChangePaymentMethodSigned('{{ array_key_first($payment_methods) }}')"
form-group-class="invisible" />
placeholder="{{ trans('general.form.select.field', ['field' => trans_choice('general.payment_methods', 1)]) }}"
change="onChangePaymentMethodSigned('{{ array_key_first($payment_methods) }}')"
/>
<x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" /> <x-form.input.hidden name="document_id" :value="$invoice->id" v-model="form.document_id" />
</x-form> </x-form>
</x-slot>
</x-tabs>
@endif @endif
@if ($invoice->transactions->count()) @if ($invoice->transactions->count())