diff --git a/app/Entities/Invoices/Invoice.php b/app/Entities/Invoices/Invoice.php index 04bb84a..997d0cb 100755 --- a/app/Entities/Invoices/Invoice.php +++ b/app/Entities/Invoices/Invoice.php @@ -11,6 +11,7 @@ class Invoice extends Model protected $guarded = ['id', 'created_at', 'updated_at']; protected $casts = ['items' => 'array']; + protected $perPage = 25; public function getRouteKeyName() { @@ -33,7 +34,7 @@ class Invoice extends Model $lastInvoice = $this->orderBy('number', 'desc')->first(); - if ( ! is_null($lastInvoice)) { + if (!is_null($lastInvoice)) { $lastInvoiceNo = $lastInvoice->number; if (substr($lastInvoiceNo, 0, 4) == $prefix) { return ++$lastInvoiceNo; diff --git a/app/Http/Controllers/InvoicesController.php b/app/Http/Controllers/InvoicesController.php index 1eb978a..93ec4b9 100644 --- a/app/Http/Controllers/InvoicesController.php +++ b/app/Http/Controllers/InvoicesController.php @@ -11,6 +11,13 @@ use App\Entities\Invoices\Invoice; */ class InvoicesController extends Controller { + public function index() + { + $invoices = Invoice::paginate(); + + return view('invoices.index', compact('invoices')); + } + public function show(Invoice $invoice) { return view('invoices.show', compact('invoice')); diff --git a/resources/views/invoice-drafts/index.blade.php b/resources/views/invoice-drafts/index.blade.php index b0ea8cb..d21b897 100644 --- a/resources/views/invoice-drafts/index.blade.php +++ b/resources/views/invoice-drafts/index.blade.php @@ -6,7 +6,7 @@
| {{ trans('app.table_no') }} | +{{ trans('invoice.number') }} | +{{ trans('app.date') }} | +{{ trans('project.project') }} | +{{ trans('invoice.customer') }} | +{{ trans('invoice.amount') }} | +{{ trans('app.action') }} | + + + @forelse($invoices as $key => $invoice) +
|---|---|---|---|---|---|---|
| {{ 1 + $key }} | +{{ $invoice->number }} | +{{ $invoice->created_at->format('Y-m-d') }} | +{{ $invoice->project->nameLink() }} | +{{ $invoice->project->customer->nameLink() }} | +{{ formatRp($invoice->amount) }} | ++ {!! html_link_to_route('invoices.show', '', [$invoice->number], ['class' => 'btn btn-info btn-xs','icon' => 'search','title' => 'Lihat ' . trans('invoice.show')]) !!} + {!! html_link_to_route('invoices.pdf', '', [$invoice->number], ['class' => 'btn btn-default btn-xs','icon' => 'print','title' => trans('invoice.print'), 'target' => '_blank']) !!} + | +
| {{ trans('invoice.empty') }} | ||||||
| {{ trans('app.total') }} | +{{ formatRp($invoices->sum('amount')) }} | ++ | ||||