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 @@

{!! FormField::formButton(['route' => 'invoice-drafts.create'], trans('invoice.create'), [ - 'class' => 'btn btn-default', + 'class' => 'btn btn-success', 'name' => 'create-invoice-draft', 'id' => 'invoice-draft-create-button' ] ) !!} diff --git a/resources/views/invoices/index.blade.php b/resources/views/invoices/index.blade.php new file mode 100755 index 0000000..11890b5 --- /dev/null +++ b/resources/views/invoices/index.blade.php @@ -0,0 +1,56 @@ +@extends('layouts.app') + +@section('title', trans('invoice.list')) + +@section('content') + +

+
+ {!! FormField::formButton(['route' => 'invoice-drafts.create'], trans('invoice.create'), [ + 'class' => 'btn btn-success', + 'name' => 'create-invoice-draft', + 'id' => 'invoice-draft-create-button' + ]) !!} +
+ {{ trans('invoice.list') }} +

+ +
+ + + + + + + + + + + + @forelse($invoices as $key => $invoice) + + + + + + + + + + @empty + + @endforelse + + + + + + + + +
{{ trans('app.table_no') }}{{ trans('invoice.number') }}{{ trans('app.date') }}{{ trans('project.project') }}{{ trans('invoice.customer') }}{{ trans('invoice.amount') }}{{ trans('app.action') }}
{{ 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')) }}
+
+@endsection diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index 6addab1..4941d52 100755 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -25,6 +25,7 @@
  • {!! html_link_to_route('reports.current-credits', 'Piutang', [], ['icon' => 'money']) !!}
  • {!! html_link_to_route('users.calendar', 'Calendar', [], ['icon' => 'calendar']) !!}
  • {!! html_link_to_route('subscriptions.index', trans('subscription.subscription'), [], ['icon' => 'retweet']) !!}
  • +
  • {!! html_link_to_route('invoices.index', trans('invoice.list'), [], ['icon' => 'table']) !!}
  • {!! html_link_to_route('payments.index', trans('payment.payments'), [], ['icon' => 'money']) !!}
  • {!! html_link_to_route('customers.index', trans('customer.list'), [], ['icon' => 'users']) !!}
  • {!! html_link_to_route('vendors.index', trans('vendor.list'), [], ['icon' => 'users']) !!}
  • diff --git a/resources/views/payments/index.blade.php b/resources/views/payments/index.blade.php index 6638c29..44a66af 100755 --- a/resources/views/payments/index.blade.php +++ b/resources/views/payments/index.blade.php @@ -4,7 +4,9 @@ @section('content')

    - {!! link_to_route('payments.create', trans('payment.create'), [], ['class'=>'btn btn-success pull-right']) !!} +
    + {!! link_to_route('payments.create', trans('payment.create'), [], ['class'=>'btn btn-success']) !!} +
    {{ trans('payment.payments') }} {{ $payments->total() }} {{ trans('payment.found') }}

    diff --git a/resources/views/projects/invoices.blade.php b/resources/views/projects/invoices.blade.php index 084cc2a..5d442ef 100755 --- a/resources/views/projects/invoices.blade.php +++ b/resources/views/projects/invoices.blade.php @@ -7,11 +7,11 @@

    - {!! FormField::formButton(['route' => 'invoice-drafts.store'], trans('invoice.create'), [ - 'class' => 'btn btn-default', + {!! FormField::formButton(['route' => 'invoice-drafts.create'], trans('invoice.create'), [ + 'class' => 'btn btn-success', 'name' => 'create-invoice-draft', 'id' => 'invoice-draft-create-button' - ] ) !!} + ]) !!}
    {{ $project->name }} {{ trans('project.invoices') }}

    diff --git a/routes/web/invoices.php b/routes/web/invoices.php index 3383fe6..4b26809 100644 --- a/routes/web/invoices.php +++ b/routes/web/invoices.php @@ -19,6 +19,7 @@ Route::group(['middleware' => ['web', 'role:admin']], function () { /* * Invoices Routes */ + Route::get('invoices', ['as' => 'invoices.index', 'uses' => 'InvoicesController@index']); Route::get('invoices/{invoice}', ['as' => 'invoices.show', 'uses' => 'InvoicesController@show']); Route::get('invoices/{invoice}/pdf', ['as' => 'invoices.pdf', 'uses' => 'InvoicesController@pdf']); }); diff --git a/tests/Feature/InvoiceEntryTest.php b/tests/Feature/Invoices/InvoiceEntryTest.php similarity index 99% rename from tests/Feature/InvoiceEntryTest.php rename to tests/Feature/Invoices/InvoiceEntryTest.php index e7f2e76..f7e49f4 100644 --- a/tests/Feature/InvoiceEntryTest.php +++ b/tests/Feature/Invoices/InvoiceEntryTest.php @@ -1,6 +1,6 @@ adminUserSigningIn(); + + $this->visit(route('invoices.index')); + + $this->seePageIs(route('invoices.index')); + $this->see(trans('invoice.list')); + } +}