26 changed files with 416 additions and 319 deletions
-
20app/Http/Controllers/BackupsController.php
-
40app/Http/Controllers/InvoiceDraftsController.php
-
6app/Http/Controllers/InvoicesController.php
-
5app/Http/Controllers/Projects/FilesController.php
-
6app/Http/Controllers/Projects/InvoicesController.php
-
5app/Http/Controllers/Projects/TasksController.php
-
97app/Http/Controllers/ReportsController.php
-
6app/Http/Controllers/SubscriptionsController.php
-
2app/Http/Controllers/Users/UsersController.php
-
5app/Http/Middleware/GlobalViewVariables.php
-
5app/Http/Middleware/Role.php
-
7app/Providers/OptionServiceProvider.php
-
2app/Queries/AdminDashboardQuery.php
-
39resources/lang/id/invoice.php
-
37resources/views/invoice-drafts/index.blade.php
-
64resources/views/invoice-drafts/partials/draft-confirm.blade.php
-
78resources/views/invoice-drafts/partials/draft-item-list.blade.php
-
16resources/views/invoice-drafts/partials/form-draft-detail.blade.php
-
10resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php
-
29resources/views/invoices/create.blade.php
-
62resources/views/invoices/partials/draft-item-list.blade.php
-
10resources/views/invoices/partials/form-draft-detail.blade.php
-
24resources/views/invoices/show.blade.php
-
84resources/views/projects/invoices.blade.php
-
24routes/web/invoices.php
-
52tests/Feature/InvoiceEntryTest.php
@ -0,0 +1,37 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('title', 'Entry Invoice') |
|||
|
|||
@section('content') |
|||
<h1 class="page-header"> |
|||
<div class="pull-right"> |
|||
{!! FormField::formButton(['route' => 'invoice-drafts.create'], trans('invoice.create'), [ |
|||
'class' => 'btn btn-default', |
|||
'name' => 'create-invoice-draft', |
|||
'id' => 'invoice-draft-create-button' |
|||
] ) !!} |
|||
</div> |
|||
{{ trans('invoice.draft_list') }} |
|||
</h1> |
|||
|
|||
<?php use Facades\App\Services\InvoiceDrafts\InvoiceDraftCollection;?>
|
|||
@includeWhen(! InvoiceDraftCollection::isEmpty(), 'invoice-drafts.partials.invoice-draft-tabs') |
|||
@if ($draft) |
|||
@if (Request::get('action') == 'confirm') |
|||
@include('invoice-drafts.partials.draft-confirm') |
|||
@else |
|||
<div class="row" style="margin-top: 10px"> |
|||
<div class="col-md-9">@include('invoice-drafts.partials.draft-item-list')</div> |
|||
<div class="col-md-3">@include('invoice-drafts.partials.form-draft-detail')</div> |
|||
</div> |
|||
@endif |
|||
@else |
|||
{{ trans('invoice.draft_list_empty') }} |
|||
{!! FormField::formButton(['route' => 'invoice-drafts.create'], trans('invoice.create'), [ |
|||
'id' => 'invoice-draft-create-button', |
|||
'name' => 'create-invoice-draft', |
|||
'class' => 'btn btn-link', |
|||
'style' => 'padding:0px', |
|||
]) !!} |
|||
@endif |
|||
@endsection |
|||
@ -0,0 +1,78 @@ |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"> |
|||
<h3 class="panel-title"> |
|||
{{ trans('invoice.items') }} |
|||
<small class="text-muted">({{ $draft->getItemsCount() }} Item)</small> |
|||
</h3> |
|||
</div> |
|||
<table class="table"> |
|||
<thead> |
|||
<tr> |
|||
<th>#</th>
|
|||
<th>Deskripsi</th> |
|||
<th class="text-center">Biaya</th> |
|||
<th class="text-center">Action</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php $no = 1?>
|
|||
@foreach($draft->items() as $key => $item) |
|||
<tr> |
|||
<td>{{ $no }}</td> |
|||
<?php $no++;?>
|
|||
{{ Form::open(['route' => ['invoice-drafts.update-draft-item', $draft->draftKey], 'method' => 'patch']) }} |
|||
{{ Form::hidden('item_key', $key) }} |
|||
<td class="col-md-8"> |
|||
{!! FormField::textarea( |
|||
'description', |
|||
['id' => 'description-'.$key, 'value' => $item->description, 'label' => false] |
|||
) !!} |
|||
</td> |
|||
<td class="col-md-3"> |
|||
{!! FormField::price( |
|||
'amount', |
|||
['id' => 'amount-'.$key, 'value' => $item->amount, 'label' => false] |
|||
) !!} |
|||
{{ Form::submit('Update', ['id' => 'update-item-'.$key, 'class' => 'btn btn-success btn-xs pull-right']) }} |
|||
</td> |
|||
{{ Form::close() }} |
|||
<td class="col-md-1 text-center show-on-hover-parent"> |
|||
{!! FormField::delete([ |
|||
'route' => ['invoice-drafts.remove-draft-item', $draft->draftKey], |
|||
'onsubmit' => 'Yakin ingin menghapus Item ini?', |
|||
'class' => '', |
|||
], 'x', ['id' => 'remove-item-'.$key, 'class' => 'btn btn-danger btn-xs show-on-hover','title' => 'Hapus item ini'], ['item_index' => $key]) !!} |
|||
</td> |
|||
</tr> |
|||
@endforeach |
|||
<tr> |
|||
<th colspan="4">Tambah Item Invoice</th> |
|||
</tr> |
|||
<tr> |
|||
<td> </td> |
|||
{{ Form::open(['route' => ['invoice-drafts.add-draft-item', $draft->draftKey]]) }} |
|||
<td> |
|||
{!! FormField::textarea( |
|||
'description', |
|||
['id' => 'description', 'label' => false, 'placeholder' => 'Deskripsi Item'] |
|||
) !!} |
|||
</td> |
|||
<td> |
|||
{!! FormField::price( |
|||
'amount', |
|||
['id' => 'amount', 'label' => false, 'placeholder' => 'Biaya Item'] |
|||
) !!} |
|||
</td> |
|||
<td class="text-center">{{ Form::submit('add-item', ['class' => 'btn btn-primary']) }}</td> |
|||
{{ Form::close() }} |
|||
</tr> |
|||
</tbody> |
|||
<tfoot> |
|||
<tr> |
|||
<th colspan="2" class="text-right">{{ trans('invoice.amount') }} :</th> |
|||
<th class="text-right">{{ formatRp($draft->getTotal()) }}</th> |
|||
<th></th> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
</div> |
|||
@ -0,0 +1,16 @@ |
|||
<div class="panel panel-default"> |
|||
<div class="panel-heading"><h3 class="panel-title">{{ trans('invoice.detail') }}</h3></div> |
|||
{{ Form::open(['route' => ['invoice-drafts.draft-proccess', $draft->draftKey], 'method' => 'patch']) }} |
|||
<div class="panel-body"> |
|||
{!! FormField::select('project_id', $projects, [ |
|||
'label' => trans('invoice.project'), |
|||
'value' => $draft->projectId, |
|||
'required' => true, |
|||
] ) !!} |
|||
{!! FormField::textarea('notes', ['label' => trans('invoice.notes'), 'value' => $draft->notes]) !!} |
|||
</div> |
|||
<div class="panel-footer"> |
|||
{{ Form::submit(trans('invoice.proccess'), ['class' => 'btn btn-info']) }} |
|||
</div> |
|||
{{ Form::close() }} |
|||
</div> |
|||
@ -1,15 +1,15 @@ |
|||
<?php use Facades\App\Services\InvoiceDrafts\InvoiceDraftCollection; ?>
|
|||
<?php use Facades\App\Services\InvoiceDrafts\InvoiceDraftCollection;?>
|
|||
<ul class="nav nav-tabs transaction-draft-tabs"> |
|||
@foreach(InvoiceDraftCollection::content() as $key => $content) |
|||
<?php $active = ($draft->draftKey == $key) ? 'class=active' : '' ?>
|
|||
<?php $active = ($draft->draftKey == $key) ? 'class=active' : ''?>
|
|||
<li {{ $active }} role="presentation"> |
|||
<a href="{{ route('invoices.create', $key) }}"> |
|||
<a href="{{ route('invoice-drafts.show', $key) }}"> |
|||
{{ trans('invoice.invoice') }} - {{ $key }} |
|||
<form action="{{ route('cart.remove') }}" method="post" style="display:inline" onsubmit="return confirm('Yakin ingin menghapus Draft Transaksi ini?')"> |
|||
<form action="{{ route('invoice-drafts.remove', $key) }}" method="post" style="display:inline" onsubmit="return confirm('Yakin ingin menghapus Draft Transaksi ini?')"> |
|||
{{ csrf_field() }} |
|||
{{ method_field('delete') }} |
|||
<input type="hidden" name="draft_key" value="{{ $key }}"> |
|||
<input type="submit" value="x" style="margin: -2px -7px 0px 0px" class="btn-link btn-xs pull-right"> |
|||
<input type="submit" id="remove_draft_{{ $key }}" value="x" style="margin: -2px -7px 0px 0px" class="btn-link btn-xs pull-right"> |
|||
</form> |
|||
</a> |
|||
</li> |
|||
@ -1,29 +0,0 @@ |
|||
@extends('layouts.app') |
|||
|
|||
@section('title', 'Entry Invoice') |
|||
|
|||
@section('content') |
|||
<h1 class="page-header"> |
|||
<div class="pull-right"> |
|||
{!! FormField::formButton(['route' => 'invoices.add'], trans('invoice.create'), [ |
|||
'class' => 'btn btn-default', |
|||
'name' => 'create-invoice-draft', |
|||
'id' => 'invoice-draft-create-button' |
|||
] ) !!} |
|||
</div> |
|||
{{ trans('invoice.list') }} |
|||
</h1> |
|||
|
|||
<?php use Facades\App\Services\InvoiceDrafts\InvoiceDraftCollection; ?>
|
|||
@includeWhen(! InvoiceDraftCollection::isEmpty(), 'invoices.partials.invoice-draft-tabs') |
|||
@if ($draft) |
|||
@if (Request::get('action') == 'confirm') |
|||
@include('invoices.partials.draft-confirm') |
|||
@else |
|||
<div class="row"> |
|||
<div class="col-md-9">@include('invoices.partials.draft-item-list')</div> |
|||
<div class="col-md-3">@include('invoices.partials.form-draft-detail')</div> |
|||
</div> |
|||
@endif |
|||
@endif |
|||
@endsection |
|||
@ -1,62 +0,0 @@ |
|||
<legend> |
|||
{{ trans('invoice.items') }} |
|||
<small class="text-muted"> |
|||
({{ $draft->getItemsCount() }} Item) |
|||
</small> |
|||
</legend> |
|||
|
|||
<div class="panel panel-default"> |
|||
<div class="panel-body table-responsive"> |
|||
<table class="table"> |
|||
<thead> |
|||
<tr> |
|||
<th>#</th>
|
|||
<th>Deskripsi</th> |
|||
<th>Biaya</th> |
|||
<th class="text-center">Action</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<?php $no = 1 ?>
|
|||
@forelse($draft->items() as $key => $item) |
|||
<tr> |
|||
<td>{{ $no }} <?php $no++ ?></td>
|
|||
{{ Form::open(['route' => ['cart.update-draft-item', $draft->draftKey], 'method' => 'patch']) }} |
|||
{{ Form::hidden('item_key', $key) }} |
|||
<td>{{ Form::text('description', $item->description, ['id' => 'description-' . $key]) }}</td> |
|||
<td> |
|||
{{ Form::number('amount', $item->amount, ['id' => 'amount-' . $key]) }} |
|||
</td> |
|||
{{ Form::submit('update-item-' . $key, ['style'=>'display:none']) }} |
|||
{{ Form::close() }} |
|||
<td class="text-center show-on-hover-parent"> |
|||
{!! FormField::delete([ |
|||
'route' => ['cart.remove-draft-item', $draft->draftKey], |
|||
'onsubmit' => 'Yakin ingin menghapus Item ini?', |
|||
'class' => '', |
|||
], 'x', ['id' => 'remove-item-' . $key, 'class' => 'btn btn-danger btn-xs show-on-hover','title' => 'Hapus item ini'], ['item_index' => $key]) !!} |
|||
</td> |
|||
</tr> |
|||
@empty |
|||
@endforelse |
|||
<tr> |
|||
<td></td> |
|||
{{ Form::open(['route' => ['cart.add-draft-item', $draft->draftKey]]) }} |
|||
<td>{{ Form::text('description', null, ['id' => 'description']) }}</td> |
|||
<td> |
|||
{{ Form::number('amount', null, ['id' => 'amount']) }} |
|||
</td> |
|||
<td class="text-center">{{ Form::submit('add-item', ['class' => 'btn btn-primary']) }}</td> |
|||
{{ Form::close() }} |
|||
</tr> |
|||
</tbody> |
|||
<tfoot> |
|||
<tr> |
|||
<th colspan="2" class="text-right">{{ trans('invoice.amount') }} :</th> |
|||
<th class="text-right">{{ formatRp($draft->getTotal()) }}</th> |
|||
<th></th> |
|||
</tr> |
|||
</tfoot> |
|||
</table> |
|||
</div> |
|||
</div> |
|||
@ -1,10 +0,0 @@ |
|||
<legend>{{ trans('invoice.detail') }}</legend> |
|||
{{ Form::open(['route' => ['cart.draft-proccess', $draft->draftKey], 'method' => 'patch']) }} |
|||
{!! 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() }} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue