Browse Source
Add invoice detail page
Add invoice detail page
Change invoice_no column into number in invoices tablepull/1/head
12 changed files with 118 additions and 20 deletions
-
8app/Entities/Invoices/Invoice.php
-
4app/Http/Controllers/InvoiceDraftController.php
-
2app/Http/Controllers/InvoicesController.php
-
10app/Services/InvoiceDraft/InvoiceDraft.php
-
8app/Services/InvoiceDraft/InvoiceDraftCollection.php
-
16database/factories/ModelFactory.php
-
2database/migrations/2017_10_05_162758_create_invoices_table.php
-
5resources/lang/id/invoice.php
-
6resources/views/invoices/partials/form-draft-detail.blade.php
-
58resources/views/invoices/show.blade.php
-
2tests/Feature/InvoiceEntryTest.php
-
17tests/Unit/Models/InvoiceTest.php
@ -1,6 +1,10 @@ |
|||
<legend>{{ trans('invoice.detail') }}</legend> |
|||
{{ Form::open(['route' => ['cart.draft-proccess', $draft->draftKey], 'method' => 'patch']) }} |
|||
{!! FormField::select('project_id', $projects, ['label' => trans('invoice.project'), 'required' => true]) !!} |
|||
{!! FormField::select('project_id', $projects, [ |
|||
'label' => trans('invoice.project'), |
|||
'value' => $draft->projectId, |
|||
'required' => true, |
|||
] ) !!} |
|||
{!! FormField::textarea('notes', ['label' => trans('invoice.notes'), 'value' => $draft->notes]) !!} |
|||
{{ Form::submit(trans('invoice.proccess'), ['class' => 'btn btn-info']) }} |
|||
{{ Form::close() }} |
|||
@ -0,0 +1,58 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('title', $invoice->number . ' - ' . trans('invoice.detail')) |
|||
|
|||
@section('content') |
|||
{{-- <div class="pull-right">{{ link_to_route('invoices.pdf', trans('invoice.invoice_print'), [$invoice->number], ['class' => 'btn btn-info']) }}</div> --}} |
|||
<h1 class="page-header">{{ $invoice->number }} <small>{{ trans('invoice.detail') }}</small></h1> |
|||
<div class="row"> |
|||
<div class="col-sm-4"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">{{ trans('invoice.detail') }}</h3></div> |
|||
<div class="panel-body"> |
|||
<table class="table table-condensed"> |
|||
<tbody> |
|||
<tr><td>{{ trans('invoice.number') }}</td><td class="text-primary strong">{{ $invoice->number }}</td></tr> |
|||
<tr><td>{{ trans('app.date') }}</td><td>{{ $invoice->created_at->format('Y-m-d') }}</td></tr> |
|||
<tr><td>{{ trans('invoice.project') }}</td><td>{{ $invoice->project_id }}</td></tr> |
|||
<tr><td>{{ trans('invoice.customer_phone') }}</td><td>{{ $invoice->customer['phone'] }}</td></tr> |
|||
<tr><td>{{ trans('invoice.items_count') }}</td><td>{{ $invoice->items_count }}</td></tr> |
|||
<tr><td>{{ trans('invoice.amount') }}</td><td class="text-right strong">{{ formatRp($invoice->amount) }}</td></tr> |
|||
</tbody> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<div class="col-sm-8"> |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">{{ trans('invoice.items') }}</h3></div> |
|||
<div class="panel-body"> |
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr> |
|||
<th>{{ trans('app.table_no') }}</th> |
|||
<th>{{ trans('invoice.item_description') }}</th> |
|||
<th class="text-right">{{ trans('invoice.item_amount') }}</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
@foreach($invoice->items as $key => $item) |
|||
<tr> |
|||
<td>{{ $key + 1 }}</td> |
|||
<td>{{ $item['description'] }}</td> |
|||
<td class="text-right">{{ formatRp($item['amount']) }}</td> |
|||
</tr> |
|||
@endforeach |
|||
</tbody> |
|||
<tfoot> |
|||
<tr> |
|||
<th colspan="2" class="text-right">{{ trans('app.total') }} :</th> |
|||
<th class="text-right">{{ formatRp($invoice['total']) }}</th> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
@endsection |
|||
@ -0,0 +1,17 @@ |
|||
<?php |
|||
|
|||
namespace Tests\Unit\Models; |
|||
|
|||
use App\Entities\Invoices\Invoice; |
|||
use App\Entities\Projects\Project; |
|||
use Tests\TestCase; |
|||
|
|||
class InvoiceTest extends TestCase |
|||
{ |
|||
/** @test */ |
|||
public function it_has_project_relation() |
|||
{ |
|||
$invoice = factory(Invoice::class)->create(); |
|||
$this->assertTrue($invoice->project instanceof Project); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue