From a487d040a9b8c8939ed146c29f1518692e1c3a47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Wed, 20 Jan 2021 12:35:34 +0300 Subject: [PATCH] added bulk action to transactions --- app/BulkActions/Banking/Transactions.php | 37 +++++++++++++++++++ .../assets/js/views/banking/transactions.js | 2 + .../banking/transactions/index.blade.php | 36 ++++++++++-------- .../views/sales/revenues/index.blade.php | 2 +- 4 files changed, 61 insertions(+), 16 deletions(-) create mode 100644 app/BulkActions/Banking/Transactions.php diff --git a/app/BulkActions/Banking/Transactions.php b/app/BulkActions/Banking/Transactions.php new file mode 100644 index 000000000..6c26a728c --- /dev/null +++ b/app/BulkActions/Banking/Transactions.php @@ -0,0 +1,37 @@ + [ + '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'); + } +} diff --git a/resources/assets/js/views/banking/transactions.js b/resources/assets/js/views/banking/transactions.js index d9bf498b8..712547d24 100644 --- a/resources/assets/js/views/banking/transactions.js +++ b/resources/assets/js/views/banking/transactions.js @@ -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') } }, diff --git a/resources/views/banking/transactions/index.blade.php b/resources/views/banking/transactions/index.blade.php index 6b16ba24a..bc7a02295 100644 --- a/resources/views/banking/transactions/index.blade.php +++ b/resources/views/banking/transactions/index.blade.php @@ -15,14 +15,18 @@ @section('content')
-
+
{!! Form::open([ 'method' => 'GET', 'route' => 'transactions.index', 'role' => 'form', 'class' => 'mb-0' ]) !!} - +
+ +
+ + {{ Form::bulkActionRowGroup('general.transactions', $bulk_actions, ['group' => 'banking', 'type' => 'transactions']) }} {!! Form::close() !!}
@@ -30,28 +34,30 @@ - - - - - - + + + + + + + @foreach($transactions as $item) - - + + - - - - - + + + + + @endforeach diff --git a/resources/views/sales/revenues/index.blade.php b/resources/views/sales/revenues/index.blade.php index dc35b83a4..a74bf6372 100644 --- a/resources/views/sales/revenues/index.blade.php +++ b/resources/views/sales/revenues/index.blade.php @@ -47,7 +47,7 @@ @if ($item->reconciled) - + @else @endif
@sortablelink('paid_at', trans('general.date'))@sortablelink('amount', trans('general.amount'))@sortablelink('type', trans_choice('general.types', 1))@sortablelink('category.name', trans_choice('general.categories', 1))@sortablelink('account.name', trans_choice('general.accounts', 1))@sortablelink('description', trans('general.description')){{ Form::bulkActionAllGroup() }}@sortablelink('paid_at', trans('general.date'))@sortablelink('amount', trans('general.amount'))@sortablelink('type', trans_choice('general.types', 1))@sortablelink('category.name', trans_choice('general.categories', 1))@sortablelink('account.name', trans_choice('general.accounts', 1))@sortablelink('description', trans('general.description'))
+
{{ Form::bulkActionGroup($item->id, $item->contact->name) }} @date($item->paid_at) @money($item->amount, $item->currency_code, true){{ $item->type_title }}{{ $item->category->name }}{{ $item->account->name }}{{ $item->description }}@money($item->amount, $item->currency_code, true){{ $item->type_title }}{{ $item->category->name }}{{ $item->account->name }}{{ $item->description }}
{{ Form::bulkActionGroup($item->id, $item->contact->name) }}@date($item->paid_at)@date($item->paid_at)@date($item->paid_at)