code refactroing for reconcile index

This commit is contained in:
Burak Civan 2022-08-02 16:45:05 +03:00
parent 5ba180603d
commit b3841b09a2
2 changed files with 148 additions and 159 deletions

View File

@ -18,71 +18,69 @@
<x-form.input.hidden name="ended_at" :value="$reconciliation->ended_at" />
<x-form.input.hidden name="reconcile" :value="$reconciliation->reconcile" id="hidden-reconcile" />
<div class="overflow-x-visible">
<div class="py-2 align-middle inline-block min-w-full">
<table class="min-w-full divide-y divide-gray-200">
<thead>
<tr class="flex items-center px-1">
<th scope="col" class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table>
<x-table.thead>
<x-table.tr class="flex items-center px-1">
<x-table.th class="w-2/12 hidden sm:table-cell">
{{ trans('general.date') }}
</th>
</x-table.th>
<th scope="col" class="w-3/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.th class="w-3/12 hidden sm:table-cell">
{{ trans('general.description') }}
</th>
</x-table.th>
<th scope="col" class="w-3/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.th class="w-6/12 lg:w-3/12">
{{ trans_choice('general.contacts', 1) }}
</th>
</x-table.th>
<th scope="col" class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.th class="w-2/12 hidden sm:table-cell">
{{ trans('reconciliations.deposit') }}
</th>
</x-table.th>
<th scope="col" class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.th class="w-6/12 lg:w-2/12">
{{ trans('reconciliations.withdrawal') }}
</th>
</x-table.th>
<th scope="col" class="ltr:pl-6 rtl:pr-6 ltr:text-right rtl:text-left py-4 text-center text-sm font-medium">
<x-table.th kind="amount" class="none-truncate">
{{ trans('general.clear') }}
</th>
</tr>
</thead>
</x-table.th>
</x-table.tr>
</x-table.thead>
<tbody>
<x-table.tbody>
@foreach($transactions as $item)
<tr class="relative flex items-center border-b hover:bg-gray-100 px-1 group">
<td class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.tr>
<x-table.td class="w-2/12 hidden sm:table-cell" kind="cursor-none">
<x-date date="{{ $item->paid_at }}" />
</td>
</x-table.td>
<td class="w-3/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider truncate">
<x-table.td class="w-3/12 hidden sm:table-cell" kind="cursor-none">
{{ $item->description }}
</td>
</x-table.td>
<td class="w-3/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider truncate">
<x-table.td class="w-6/12 lg:w-3/12" kind="cursor-none">
{{ $item->contact->name }}
</td>
</x-table.td>
@if ($item->isIncome())
<td class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.td class="w-6/12 lg:w-2/12" kind="cursor-none">
<x-money :amount="$item->amount" :currency="$item->currency_code" convert />
</td>
</x-table.td>
<td class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.td class="w-6/12 lg:w-2/12" kind="cursor-none">
<x-empty-data />
</td>
</x-table.td>
@else
<td class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.td class="w-6/12 lg:w-2/12" kind="cursor-none">
<x-empty-data />
</td>
</x-table.td>
<td class="w-2/12 ltr:pr-6 rtl:pl-6 py-3 ltr:text-left rtl:text-right text-xs font-medium text-black tracking-wider">
<x-table.td class="w-6/12 lg:w-2/12" kind="cursor-none">
<x-money :amount="$item->amount" :currency="$item->currency_code" convert />
</td>
</x-table.td>
@endif
<td class="ltr:pl-6 rtl:pr-6 py-4 text-center text-sm font-medium">
<x-table.td kind="amount" class="none-truncate">
@php $type = $item->isIncome() ? 'income' : 'expense'; @endphp
<x-form.input.checkbox name="{{ $type . '_' . $item->id }}"
@ -95,11 +93,11 @@
class="text-purple focus:outline-none focus:ring-purple focus:border-purple"
@change="onCalculate"
/>
</td>
</tr>
</x-table.td>
</x-table.tr>
@endforeach
</tbody>
</table>
</x-table.tbody>
</x-table>
@if ($transactions->count())
<table class="min-w-full divide-y divide-gray-200">
@ -182,8 +180,6 @@
</tbody>
</table>
@endif
</div>
</div>
@can('update-banking-reconciliations')
<div class="mt-6">

View File

@ -146,14 +146,12 @@
id="features"
name="{{ trans('modules.tab.features') }}"
active
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@else
<x-tabs.nav
id="description"
name="{{ trans('general.description') }}"
active
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif
@ -163,7 +161,6 @@
<x-tabs.nav
id="reviews"
name="{{ trans('modules.tab.reviews') }}"
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif
@ -173,7 +170,6 @@
<x-tabs.nav
id="installation"
name="{{ trans('modules.tab.installation') }}"
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif
@ -183,7 +179,6 @@
<x-tabs.nav
id="documentation"
name="{{ trans('modules.documentation') }}"
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif
@ -193,7 +188,6 @@
<x-tabs.nav
id="screenshots"
name="{{ trans('modules.tab.screenshots') }}"
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif
@ -203,7 +197,6 @@
<x-tabs.nav
id="changelog"
name="{{ trans('modules.tab.changelog') }}"
class="relative px-8 text-sm text-black text-center pb-2 cursor-pointer transition-all border-b tabs-link"
/>
@endif