From 1884ada219edde0edab950cfcd3dde69de206d1f Mon Sep 17 00:00:00 2001 From: drkthunder02 Date: Fri, 2 Apr 2021 18:53:58 +0900 Subject: [PATCH] unpaid search attempt --- .../MiningTaxesAdminController.php | 2 +- app/Http/Requests/Request.php | 10 ++++ .../miningtax/admin/display/unpaid.blade.php | 26 +++++++++- .../admin/display/unpaid_bak.blade.php | 52 +++++++++++++++++++ routes/web.php | 22 ++++++++ 5 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 app/Http/Requests/Request.php create mode 100644 resources/views/miningtax/admin/display/unpaid_bak.blade.php diff --git a/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php b/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php index de750112e..a055cd290 100644 --- a/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php +++ b/app/Http/Controllers/MiningTaxes/MiningTaxesAdminController.php @@ -43,7 +43,7 @@ class MiningTaxesAdminController extends Controller 'status' => 'Late', ])->orWhere([ 'status' => 'Deferred', - ])->orderByDesc('date_due')->paginate(50); + ])->orderByDesc('invoice_id')->paginate(50); $totalAmount = Invoice::where([ 'status' => 'Pending', diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.php new file mode 100644 index 000000000..a9cd77238 --- /dev/null +++ b/app/Http/Requests/Request.php @@ -0,0 +1,10 @@ +Invoice Status
- {{ $invoices->links() }} +
+
+
+ {{ $invoices->links() }} +
+
+
+ {!! Form::open(['method' => 'POST', 'role' => '/miningtax/admin/display/unpaid/search']) !!} + {{ Form::text('q', '', ['class' => 'form-control']) }} + {{ Form::submit('Search', ['class' => 'btn btn-default glyphicon glyphicon-search']) }} + {!! Form::close() !!} +
+
+
+
@@ -19,6 +33,15 @@ + @if(isset($error)) + + + + + + + + @else @foreach($invoices as $invoice) @@ -41,6 +64,7 @@ @endforeach + @endif
CharacterUpdate
N/AN/AN/AN/AN/AN/AN/A
{{ $invoice->character_name }}
{{ $invoices->links() }} diff --git a/resources/views/miningtax/admin/display/unpaid_bak.blade.php b/resources/views/miningtax/admin/display/unpaid_bak.blade.php new file mode 100644 index 000000000..5e12da496 --- /dev/null +++ b/resources/views/miningtax/admin/display/unpaid_bak.blade.php @@ -0,0 +1,52 @@ +@extends('layouts.admin.b4') +@section('content') +
+
+
+
+

Invoice Status

+
+
+ {{ $invoices->links() }} + + + + + + + + + + + + @foreach($invoices as $invoice) + + + + + + + + + + @endforeach + +
CharacterInvoice IdAmountDate IssuedDate DueStatusUpdate
{{ $invoice->character_name }}{{ $invoice->invoice_id }}{{ number_format($invoice->invoice_amount, 2, ".", ",") }}{{ $invoice->date_issued }}{{ $invoice->date_due }}{{ $invoice->status }} + {!! Form::open(['action' => 'MiningTaxes\MiningTaxesAdminController@UpdateInvoice', 'method' => 'POST']) !!} + {{ Form::hidden('invoiceId', $invoice->invoice_id) }} + {{ Form::label('status', 'Paid') }} + {{ Form::radio('status', 'Paid', true) }} + {{ Form::label('status', 'Deferred') }} + {{ Form::radio('status', 'Deferred') }} + {{ Form::label('status', 'Delete') }} + {{ Form::radio('status', 'Deleted') }} + {{ Form::submit('Submit', ['class' => 'btn btn-primary']) }} + {!! Form::close() !!} +
+ {{ $invoices->links() }} +
+

Total Amount Owed: {{ number_format($totalAmount, 2, ".", ",") }}

+
+
+
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 05f6c3d5e..621a5d374 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,5 +1,8 @@ ['auth']], function(){ Route::post('/miningtax/admin/update/invoice', 'MiningTaxes\MiningTaxesAdminController@UpdateInvoice'); Route::post('/miningtax/admin/delete/invoice', 'MiningTaxes\MiningTaxesAdminController@DeleteInvoice'); Route::get('/miningtax/admin/display/paid', 'MiningTaxes\MiningTaxesAdminController@DisplayPaidInvoices'); + Route::any('/miningtax/admin/display/unpaid/search', function() { + $q = Input::get('q'); + if($q != "") { + $invoices = Invoice::where('invoice_id', 'LIKE', '%' . $q . '%') + ->where(['status' => 'Pending']) + ->orWhere(['status' => 'Late']) + ->orWhere(['status' => 'Deferred']) + ->orderByDesc('invoice_id') + ->paginate(25) + ->setPath(''); + $pagination = $invoices->appends(array('q' => Input::get('q'))); + + if(count($invoices) > 0) { + return view('miningtax.admin.display.unpaid')->withDetails($invoices)->withQuery($q); + } + + return view('miningtax.admin.display.unpaid')->with('error', 'No invoices found. Try to search again!'); + } + }); /** * Scopes Controller display pages