From c502b73632fd363dc0f3c8e07bc5427e0cf6b67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Tue, 12 Jan 2021 22:21:59 +0300 Subject: [PATCH] Portal > Payment search and filter --- app/Http/Controllers/Portal/Payments.php | 17 ++++++++++++++++- config/search-string.php | 15 +++++++++++++++ resources/views/portal/payments/index.blade.php | 5 ++--- routes/portal.php | 1 + 4 files changed, 34 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Portal/Payments.php b/app/Http/Controllers/Portal/Payments.php index 82eefc662..d9ce57df8 100644 --- a/app/Http/Controllers/Portal/Payments.php +++ b/app/Http/Controllers/Portal/Payments.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers\Portal; use App\Abstracts\Http\Controller; use App\Models\Banking\Transaction; +use App\Models\Setting\Currency; use App\Http\Requests\Portal\PaymentShow as Request; use App\Utilities\Modules; @@ -16,7 +17,9 @@ class Payments extends Controller */ public function index() { - $payments = Transaction::income()->where('contact_id', '=', user()->contact->id)->paginate(); + $search = request()->get('search'); + + $payments = Transaction::income()->where('contact_id', '=', user()->contact->id)->usingSearchString($search)->sortable('paid_at')->paginate(); $payment_methods = Modules::getPaymentMethods('all'); @@ -36,4 +39,16 @@ class Payments extends Controller return view('portal.payments.show', compact('payment', 'payment_methods')); } + + /** + * Display a listing of the resource. + * + * @return Response + */ + public function currencies() + { + $currencies = Currency::collect(); + + return $this->response('portal.currencies.index', compact('currencies')); + } } diff --git a/config/search-string.php b/config/search-string.php index 5317dd6d3..f65dfa820 100644 --- a/config/search-string.php +++ b/config/search-string.php @@ -295,4 +295,19 @@ return [ ], ], + App\Models\Portal\Banking\Transaction::class => [ + 'columns' => [ + 'paid_at' => ['date' => true], + 'amount', + 'currency_code' => [ + 'route' => 'portal.payment.currencies' + ], + 'document_id', + 'description' => ['searchable' => true], + 'payment_method', + 'reference', + 'parent_id', + ], + ], + ]; diff --git a/resources/views/portal/payments/index.blade.php b/resources/views/portal/payments/index.blade.php index 7b130d90a..3ba9da383 100644 --- a/resources/views/portal/payments/index.blade.php +++ b/resources/views/portal/payments/index.blade.php @@ -13,9 +13,8 @@ ]) !!}
-
- {{ trans('general.search') }}: - +
+
diff --git a/routes/portal.php b/routes/portal.php index 302e24b41..968f71144 100644 --- a/routes/portal.php +++ b/routes/portal.php @@ -16,6 +16,7 @@ Route::group(['as' => 'portal.'], function () { Route::post('invoices/{invoice}/confirm', 'Portal\Invoices@confirm')->name('invoices.confirm'); Route::resource('invoices', 'Portal\Invoices'); + Route::get('payments/currencies', 'Portal\Payments@currencies')->name('payment.currencies'); Route::resource('payments', 'Portal\Payments'); Route::get('profile/read-invoices', 'Portal\Profile@readOverdueInvoices')->name('invoices.read');