unpaid search attempt

This commit is contained in:
2021-04-02 18:53:58 +09:00
parent 3991ce3e9a
commit 1884ada219
5 changed files with 110 additions and 2 deletions

View File

@@ -43,7 +43,7 @@ class MiningTaxesAdminController extends Controller
'status' => 'Late', 'status' => 'Late',
])->orWhere([ ])->orWhere([
'status' => 'Deferred', 'status' => 'Deferred',
])->orderByDesc('date_due')->paginate(50); ])->orderByDesc('invoice_id')->paginate(50);
$totalAmount = Invoice::where([ $totalAmount = Invoice::where([
'status' => 'Pending', 'status' => 'Pending',

View File

@@ -0,0 +1,10 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
abstract class Request extends FormRequest
{
//
}

View File

@@ -7,7 +7,21 @@
<h2>Invoice Status</h2> <h2>Invoice Status</h2>
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="container">
<div class="row">
<div class="column">
{{ $invoices->links() }} {{ $invoices->links() }}
</div>
<div class="column">
<div class="container">
{!! 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() !!}
</div>
</div>
</div>
</div>
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<thead> <thead>
<th>Character</th> <th>Character</th>
@@ -19,6 +33,15 @@
<th>Update</th> <th>Update</th>
</thead> </thead>
<tbody> <tbody>
@if(isset($error))
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
<td>N/A</td>
@else
@foreach($invoices as $invoice) @foreach($invoices as $invoice)
<tr> <tr>
<td>{{ $invoice->character_name }}</td> <td>{{ $invoice->character_name }}</td>
@@ -41,6 +64,7 @@
</td> </td>
</tr> </tr>
@endforeach @endforeach
@endif
</tbody> </tbody>
</table> </table>
{{ $invoices->links() }} {{ $invoices->links() }}

View File

@@ -0,0 +1,52 @@
@extends('layouts.admin.b4')
@section('content')
<br>
<div class="container-fluid">
<div class="card">
<div class="card-header">
<h2>Invoice Status</h2>
</div>
<div class="card-body">
{{ $invoices->links() }}
<table class="table table-striped table-bordered">
<thead>
<th>Character</th>
<th>Invoice Id</th>
<th>Amount</th>
<th>Date Issued</th>
<th>Date Due</th>
<th>Status</th>
<th>Update</th>
</thead>
<tbody>
@foreach($invoices as $invoice)
<tr>
<td>{{ $invoice->character_name }}</td>
<td>{{ $invoice->invoice_id }}</td>
<td>{{ number_format($invoice->invoice_amount, 2, ".", ",") }}</td>
<td>{{ $invoice->date_issued }}</td>
<td>{{ $invoice->date_due }}</td>
<td>{{ $invoice->status }}</td>
<td>
{!! 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() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
{{ $invoices->links() }}
<br>
<h2>Total Amount Owed: {{ number_format($totalAmount, 2, ".", ",") }}</h2>
</div>
</div>
</div>
@endsection

View File

@@ -1,5 +1,8 @@
<?php <?php
use Illuminate\Support\Facades\Input;
use App\Models\MiningTax\Invoice;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Web Routes | Web Routes
@@ -86,6 +89,25 @@ Route::group(['middleware' => ['auth']], function(){
Route::post('/miningtax/admin/update/invoice', 'MiningTaxes\MiningTaxesAdminController@UpdateInvoice'); Route::post('/miningtax/admin/update/invoice', 'MiningTaxes\MiningTaxesAdminController@UpdateInvoice');
Route::post('/miningtax/admin/delete/invoice', 'MiningTaxes\MiningTaxesAdminController@DeleteInvoice'); Route::post('/miningtax/admin/delete/invoice', 'MiningTaxes\MiningTaxesAdminController@DeleteInvoice');
Route::get('/miningtax/admin/display/paid', 'MiningTaxes\MiningTaxesAdminController@DisplayPaidInvoices'); 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 * Scopes Controller display pages