161 lines
8.4 KiB
PHP
161 lines
8.4 KiB
PHP
<div class="responsive-table m-0">
|
|
<table class="table" id="datatable">
|
|
<thead>
|
|
<tr>
|
|
<th class="w-60">
|
|
<div class="d-flex align-items-center gap-3">
|
|
<input type="checkbox" class="select-all-delete multi-delete">
|
|
</div>
|
|
</th>
|
|
<th>{{ __('SL') }}.</th>
|
|
<th>{{ __('Date') }}</th>
|
|
<th>{{ __('Type') }}</th>
|
|
<th>{{ __('Payment') }}</th>
|
|
<th>{{ __('Name') }}</th>
|
|
<th>{{ __('Amount') }}</th>
|
|
<th class="text-center">{{ __('Action') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($cashes as $cash)
|
|
<tr>
|
|
<td class="w-60 checkbox">
|
|
<input type="checkbox" name="ids[]" class="delete-checkbox-item multi-delete"
|
|
value="{{ $cash->id }}">
|
|
</td>
|
|
|
|
<td>{{ ($cashes->currentPage() - 1) * $cashes->perPage() + $loop->iteration }}</td>
|
|
<td>{{ formatted_date($cash->date) }}</td>
|
|
<td>{{ ucwords(str_replace('_', ' ', $cash->platform)) }}</td>
|
|
<td>{{ ucwords(str_replace('_', ' ', $cash->transaction_type)) }}</td>
|
|
|
|
<td>{{ $cash->user->name ?? '' }}</td>
|
|
|
|
<td class="
|
|
{{ $cash->type == 'credit' || $cash->transaction_type == 'bank_to_cash' ? 'text-success' :
|
|
($cash->type == 'debit' || $cash->transaction_type == 'cash_to_bank' ? 'text-danger' : '') }}
|
|
">
|
|
{{ currency_format($cash->amount, currency: business_currency()) }}
|
|
</td>
|
|
|
|
<td>
|
|
<div class="dropdown table-action">
|
|
<button type="button" data-bs-toggle="dropdown">
|
|
<i class="far fa-ellipsis-v"></i>
|
|
</button>
|
|
|
|
<ul class="dropdown-menu">
|
|
|
|
{{-- View --}}
|
|
@usercan('cashes.read')
|
|
<li>
|
|
<a href="#" class="cash-view-btn" data-bs-toggle="modal"
|
|
data-bs-target="#cash-view"
|
|
data-img="{{ asset($cash->image ?? 'assets/img/icon/no-image.svg') }}"
|
|
data-user="{{ $cash->user->name ?? '' }}"
|
|
data-transaction-type="{{ ucwords(str_replace('_', ' ', $cash->transaction_type)) }}"
|
|
data-platform="{{ ucwords(str_replace('_', ' ', $cash->platform)) }}"
|
|
data-amount="{{ currency_format($cash->amount, currency: business_currency()) }}"
|
|
data-note="{{ $cash->note }}"
|
|
data-date="{{ formatted_date($cash->date) }}">
|
|
<i class="fal fa-eye"></i> {{ __('View') }}
|
|
</a>
|
|
</li>
|
|
@endusercan
|
|
|
|
@php
|
|
$editConfig = null;
|
|
|
|
if ($cash->platform == 'cash') {
|
|
$editConfig = [
|
|
'url' => 'javascript:void(0)',
|
|
'is_cash' => true,
|
|
'attrs' => [
|
|
'class' => 'edit-transaction',
|
|
'data-route' => route('business.cashes.update', $cash->id),
|
|
'data-id' => $cash->id,
|
|
'data-transaction_type' => $cash->transaction_type,
|
|
'data-from' => 'Cash',
|
|
'data-to' => $cash->to_bank ?? null,
|
|
'data-type' => $cash->type,
|
|
'data-amount' => $cash->amount,
|
|
'data-date' => $cash->date,
|
|
'data-note' => $cash->note,
|
|
'data-image' => $cash->image
|
|
? asset($cash->image)
|
|
: asset('assets/images/products/box.svg'),
|
|
],
|
|
];
|
|
} elseif ($cash->platform == 'bank') {
|
|
$editConfig = [
|
|
'url' => route('business.bank-transactions.index', [
|
|
'payment_type_id' => $cash->from_bank,
|
|
]),
|
|
];
|
|
} elseif ($cash->platform === 'cash') {
|
|
$editConfig = ['url' => route('business.cashes.index')];
|
|
} elseif ($cash->platform === 'cheque') {
|
|
$editConfig = ['url' => route('business.cheques.index')];
|
|
} elseif ($cash->platform === 'sale') {
|
|
$editConfig = ['url' => route('business.sales.index')];
|
|
} elseif ($cash->platform === 'purchase') {
|
|
$editConfig = ['url' => route('business.purchases.index')];
|
|
} elseif ($cash->platform === 'income' && $cash->reference_id) {
|
|
$editConfig = ['url' => route('business.incomes.edit', $cash->reference_id)];
|
|
}elseif ($cash->platform === 'expense' && $cash->reference_id) {
|
|
$editConfig = ['url' => route('business.expenses.edit', $cash->reference_id)];
|
|
}elseif ($cash->platform === 'sale_return') {
|
|
$editConfig = ['url' => route('business.sale-returns.index')];
|
|
}elseif ($cash->platform === 'purchase_return') {
|
|
$editConfig = ['url' => route('business.purchase-returns.index')];
|
|
}elseif ($cash->platform === 'due_collect') {
|
|
$editConfig = ['url' => route('business.dues.index')];
|
|
}elseif ($cash->platform === 'due_pay') {
|
|
$editConfig = ['url' => route('business.dues.index')];
|
|
}
|
|
@endphp
|
|
|
|
{{-- Edit --}}
|
|
@usercan('cashes.update')
|
|
@if ($editConfig)
|
|
<li>
|
|
@if (!empty($editConfig['is_cash']))
|
|
<a href="{{ $editConfig['url'] }}"
|
|
@foreach ($editConfig['attrs'] as $key => $value)
|
|
{{ $key }}="{{ $value }}"
|
|
@endforeach
|
|
>
|
|
<i class="fal fa-edit"></i> {{ __('Edit') }}
|
|
</a>
|
|
@else
|
|
<a href="{{ $editConfig['url'] }}">
|
|
<i class="fal fa-edit"></i> {{ __('Edit') }}
|
|
</a>
|
|
@endif {{-- ✔ FIXED: Missing @endif --}}
|
|
</li>
|
|
@endif
|
|
@endusercan
|
|
|
|
{{-- Delete --}}
|
|
@usercan('cashes.delete')
|
|
<li>
|
|
<a href="{{ route('business.cashes.destroy', $cash->id) }}"
|
|
class="confirm-action" data-method="DELETE">
|
|
<i class="fal fa-trash-alt"></i> {{ __('Delete') }}
|
|
</a>
|
|
</li>
|
|
@endusercan
|
|
|
|
</ul>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div>
|
|
{{ $cashes->links('vendor.pagination.bootstrap-5') }}
|
|
</div>
|