added bulk action to transactions
This commit is contained in:
parent
3f3f2f86d1
commit
a487d040a9
37
app/BulkActions/Banking/Transactions.php
Normal file
37
app/BulkActions/Banking/Transactions.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\BulkActions\Banking;
|
||||
|
||||
use App\Abstracts\BulkAction;
|
||||
use App\Exports\Banking\Transactions as Export;
|
||||
use App\Models\Banking\Transaction;
|
||||
|
||||
class Transactions extends BulkAction
|
||||
{
|
||||
public $model = Transaction::class;
|
||||
|
||||
public $actions = [
|
||||
'delete' => [
|
||||
'name' => 'general.delete',
|
||||
'message' => 'bulk_actions.message.delete',
|
||||
'permission' => 'delete-banking-transactions',
|
||||
],
|
||||
'export' => [
|
||||
'name' => 'general.export',
|
||||
'message' => 'bulk_actions.message.export',
|
||||
'type' => 'download',
|
||||
],
|
||||
];
|
||||
|
||||
public function destroy($request)
|
||||
{
|
||||
$this->deleteTransactions($request);
|
||||
}
|
||||
|
||||
public function export($request)
|
||||
{
|
||||
$selected = $this->getSelectedInput($request);
|
||||
|
||||
return \Excel::download(new Export($selected), \Str::filename(trans_choice('general.transactions', 2)) . '.xlsx');
|
||||
}
|
||||
}
|
@ -13,6 +13,7 @@ import DashboardPlugin from './../../plugins/dashboard-plugin';
|
||||
import Global from './../../mixins/global';
|
||||
|
||||
import Form from './../../plugins/form';
|
||||
import BulkAction from './../../plugins/bulk-action';
|
||||
|
||||
// plugin setup
|
||||
Vue.use(DashboardPlugin);
|
||||
@ -27,6 +28,7 @@ const app = new Vue({
|
||||
data: function () {
|
||||
return {
|
||||
form: new Form('transaction'),
|
||||
bulk_action: new BulkAction('transactions')
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -15,14 +15,18 @@
|
||||
|
||||
@section('content')
|
||||
<div class="card">
|
||||
<div class="card-header border-bottom-0">
|
||||
<div class="card-header border-bottom-0" :class="[{'bg-gradient-primary': bulk_action.show}]">
|
||||
{!! Form::open([
|
||||
'method' => 'GET',
|
||||
'route' => 'transactions.index',
|
||||
'role' => 'form',
|
||||
'class' => 'mb-0'
|
||||
]) !!}
|
||||
<x-search-string model="App\Models\Banking\Transaction" />
|
||||
<div class="align-items-center" v-if="!bulk_action.show">
|
||||
<x-search-string model="App\Models\Banking\Transaction" />
|
||||
</div>
|
||||
|
||||
{{ Form::bulkActionRowGroup('general.transactions', $bulk_actions, ['group' => 'banking', 'type' => 'transactions']) }}
|
||||
{!! Form::close() !!}
|
||||
</div>
|
||||
|
||||
@ -30,28 +34,30 @@
|
||||
<table class="table table-flush table-hover">
|
||||
<thead class="thead-light">
|
||||
<tr class="row table-head-line">
|
||||
<th class="col-sm-2 col-md-2 d-none d-sm-block">@sortablelink('paid_at', trans('general.date'))</th>
|
||||
<th class="col-xs-4 col-sm-2 col-md-2 text-right">@sortablelink('amount', trans('general.amount'))</th>
|
||||
<th class="col-xs-4 col-sm-3 col-md-2">@sortablelink('type', trans_choice('general.types', 1))</th>
|
||||
<th class="col-sm-2 col-md-2 d-none d-sm-block">@sortablelink('category.name', trans_choice('general.categories', 1))</th>
|
||||
<th class="col-xs-4 col-sm-3 col-md-2">@sortablelink('account.name', trans_choice('general.accounts', 1))</th>
|
||||
<th class="col-md-2 d-none d-md-block">@sortablelink('description', trans('general.description'))</th>
|
||||
<th class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionAllGroup() }}</th>
|
||||
<th class="col-xs-4 col-sm-4 col-md-3 col-lg-1 col-xl-1">@sortablelink('paid_at', trans('general.date'))</th>
|
||||
<th class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right">@sortablelink('amount', trans('general.amount'))</th>
|
||||
<th class="col-md-2 col-lg-1 col-xl-1 d-none d-md-block text-left">@sortablelink('type', trans_choice('general.types', 1))</th>
|
||||
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('category.name', trans_choice('general.categories', 1))</th>
|
||||
<th class="col-lg-2 col-xl-2 d-none d-lg-block text-left">@sortablelink('account.name', trans_choice('general.accounts', 1))</th>
|
||||
<th class="col-xs-4 col-sm-2 col-md-2 col-lg-3 col-xl-3 d-none d-md-block">@sortablelink('description', trans('general.description'))</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@foreach($transactions as $item)
|
||||
<tr class="row align-items-center border-top-1 tr-py">
|
||||
<td class="col-sm-2 col-md-2 d-none d-sm-block">
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionGroup($item->id, $item->contact->name) }}</td>
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-1 col-xl-1">
|
||||
<a href="{{ route($item->route_name, $item->route_id) }}">
|
||||
@date($item->paid_at)
|
||||
</a>
|
||||
</td>
|
||||
<td class="col-xs-4 col-sm-2 col-md-2 text-right">@money($item->amount, $item->currency_code, true)</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2">{{ $item->type_title }}</td>
|
||||
<td class="col-sm-2 col-md-2 d-none d-sm-block">{{ $item->category->name }}</td>
|
||||
<td class="col-xs-4 col-sm-3 col-md-2">{{ $item->account->name }}</td>
|
||||
<td class="col-md-2 d-none d-md-block long-texts">{{ $item->description }}</td>
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-2 text-right">@money($item->amount, $item->currency_code, true)</td>
|
||||
<td class="col-md-2 col-lg-1 col-xl-1 d-none d-md-block text-left">{{ $item->type_title }}</td>
|
||||
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">{{ $item->category->name }}</td>
|
||||
<td class="col-lg-2 col-xl-2 d-none d-lg-block text-left">{{ $item->account->name }}</td>
|
||||
<td class="col-xs-4 col-sm-2 col-md-2 col-lg-3 col-xl-3 d-none d-md-block long-texts">{{ $item->description }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<tr class="row align-items-center border-top-1">
|
||||
<td class="col-sm-2 col-md-2 col-lg-1 col-xl-1 d-none d-sm-block">{{ Form::bulkActionGroup($item->id, $item->contact->name) }}</td>
|
||||
@if ($item->reconciled)
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-1"><a class="col-aka" href="#">@date($item->paid_at)</a></td>
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-1 col-xl-1"><a class="col-aka" href="#">@date($item->paid_at)</a></td>
|
||||
@else
|
||||
<td class="col-xs-4 col-sm-4 col-md-3 col-lg-2 col-xl-1"><a class="col-aka" href="{{ route('revenues.edit', $item->id) }}">@date($item->paid_at)</a></td>
|
||||
@endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user