Browse Source

Add flash message on invoice draft actions

Update invoice draft views
Update Invoice Draft class docblocks
pull/6/head
Nafies Luthfi 8 years ago
parent
commit
78484924d2
  1. 4
      app/Http/Controllers/Invoices/DraftsController.php
  2. 4
      app/Services/InvoiceDraft/InvoiceDraftCollection.php
  3. 4
      resources/lang/en/invoice.php
  4. 2
      resources/lang/id/invoice.php
  5. 27
      resources/views/invoice-drafts/partials/draft-item-list.blade.php
  6. 2
      resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php
  7. 2
      resources/views/jobs/partials/job-tasks.blade.php

4
app/Http/Controllers/Invoices/DraftsController.php

@ -89,6 +89,8 @@ class DraftsController extends Controller
$this->draftCollection->updateDraftItem($draftKey, $itemData['item_key'], $itemData); $this->draftCollection->updateDraftItem($draftKey, $itemData['item_key'], $itemData);
flash(trans('invoice.item_updated'), 'success');
return back(); return back();
} }
@ -96,6 +98,8 @@ class DraftsController extends Controller
{ {
$this->draftCollection->removeItemFromDraft($draftKey, $request->item_index); $this->draftCollection->removeItemFromDraft($draftKey, $request->item_index);
flash(trans('invoice.item_removed'), 'warning');
return back(); return back();
} }

4
app/Services/InvoiceDraft/InvoiceDraftCollection.php

@ -247,7 +247,7 @@ class InvoiceDraftCollection
/** /**
* Check if current invoice draft is empty. * Check if current invoice draft is empty.
* *
* @return boolean
* @return bool
*/ */
public function isEmpty() public function isEmpty()
{ {
@ -257,7 +257,7 @@ class InvoiceDraftCollection
/** /**
* Check if current invoice draft has content. * Check if current invoice draft has content.
* *
* @return boolean
* @return bool
*/ */
public function hasContent() public function hasContent()
{ {

4
resources/lang/en/invoice.php

@ -34,8 +34,10 @@ return [
'add_item' => 'Add Item', 'add_item' => 'Add Item',
'item_added' => 'Item added.', 'item_added' => 'Item added.',
'item_updated' => 'Item updated.', 'item_updated' => 'Item updated.',
'item_removed' => 'Item deleted.',
'item_remove' => 'Remove Item',
'item_removed' => 'Item removed.',
'confirm_instruction' => 'Please check this Invoice detail, hit :back_link to edit the detail.', 'confirm_instruction' => 'Please check this Invoice detail, hit :back_link to edit the detail.',
'draft_del_confirm' => 'Are you sure to remove this Invoice Draft?',
// Attributes // Attributes
'number' => 'Invocie No.', 'number' => 'Invocie No.',

2
resources/lang/id/invoice.php

@ -34,8 +34,10 @@ return [
'add_item' => 'Tambah Item', 'add_item' => 'Tambah Item',
'item_added' => 'Item berhasil ditambahkan.', 'item_added' => 'Item berhasil ditambahkan.',
'item_updated' => 'Item berhasil diupdate.', 'item_updated' => 'Item berhasil diupdate.',
'item_remove' => 'Hapus Item',
'item_removed' => 'Item berhasil dihapus.', 'item_removed' => 'Item berhasil dihapus.',
'confirm_instruction' => 'Silakan periksa rincian di bawah ini, jika belum sesuai, silakan klik :back_link.', 'confirm_instruction' => 'Silakan periksa rincian di bawah ini, jika belum sesuai, silakan klik :back_link.',
'draft_del_confirm' => 'Yakin ingin menghapus Draft Invoice ini?',
// Attributes // Attributes
'number' => 'No. Invoice', 'number' => 'No. Invoice',

27
resources/views/invoice-drafts/partials/draft-item-list.blade.php

@ -8,10 +8,10 @@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th>#</th>
<th>Deskripsi</th>
<th class="text-center">Biaya</th>
<th class="text-center">Action</th>
<th>{{ __('app.table_no') }}</th>
<th>{{ __('app.description') }}</th>
<th class="text-center">{{ __('invoice.item_amount') }}</th>
<th class="text-center">{{ __('app.action') }}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -38,20 +38,24 @@
'currency' => Option::get('money_sign', 'Rp') 'currency' => Option::get('money_sign', 'Rp')
] ]
) !!} ) !!}
{{ Form::submit('Update', ['id' => 'update-item-'.$key, 'class' => 'btn btn-success btn-xs pull-right']) }}
{{ Form::submit(__('app.update'), ['id' => 'update-item-'.$key, 'class' => 'btn btn-success btn-xs pull-right']) }}
</td> </td>
{{ Form::close() }} {{ Form::close() }}
<td class="col-md-1 text-center show-on-hover-parent"> <td class="col-md-1 text-center show-on-hover-parent">
{!! FormField::delete([ {!! FormField::delete([
'route' => ['invoice-drafts.remove-draft-item', $draft->draftKey], 'route' => ['invoice-drafts.remove-draft-item', $draft->draftKey],
'onsubmit' => 'Yakin ingin menghapus Item ini?',
'class' => '', 'class' => '',
], 'x', ['id' => 'remove-item-'.$key, 'class' => 'btn btn-danger btn-xs show-on-hover','title' => 'Hapus item ini'], ['item_index' => $key]) !!}
], 'x', ['id' => 'remove-item-'.$key, 'class' => 'btn btn-danger btn-xs show-on-hover', 'title' => __('invoice.item_remove')], ['item_index' => $key]) !!}
</td> </td>
</tr> </tr>
@endforeach @endforeach
<tr> <tr>
<th colspan="4">Tambah Item Invoice</th>
<th colspan="2" class="text-right">{{ trans('invoice.amount') }} :</th>
<th class="text-right">{{ formatRp($draft->getTotal()) }}</th>
<th>&nbsp;</th>
</tr>
<tr>
<th colspan="4">{{ __('app.add') }} {{ __('invoice.items') }}</th>
</tr> </tr>
<tr> <tr>
{{ Form::open(['route' => ['invoice-drafts.add-draft-item', $draft->draftKey]]) }} {{ Form::open(['route' => ['invoice-drafts.add-draft-item', $draft->draftKey]]) }}
@ -76,12 +80,5 @@
{{ Form::close() }} {{ Form::close() }}
</tr> </tr>
</tbody> </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> </table>
</div> </div>

2
resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php

@ -5,7 +5,7 @@
<li {{ $active }} role="presentation"> <li {{ $active }} role="presentation">
<a href="{{ route('invoice-drafts.show', $key) }}"> <a href="{{ route('invoice-drafts.show', $key) }}">
{{ trans('invoice.invoice') }} - {{ $key }} {{ trans('invoice.invoice') }} - {{ $key }}
<form action="{{ route('invoice-drafts.remove', $key) }}" 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('{{ __('invoice.draft_del_confirm') }}')">
{{ csrf_field() }} {{ csrf_field() }}
{{ method_field('delete') }} {{ method_field('delete') }}
<input type="hidden" name="draft_key" value="{{ $key }}"> <input type="hidden" name="draft_key" value="{{ $key }}">

2
resources/views/jobs/partials/job-tasks.blade.php

@ -56,7 +56,7 @@
</tbody> </tbody>
<tfoot> <tfoot>
<tr> <tr>
<th class="text-right" colspan="2">Total</th>
<th class="text-right" colspan="2">{{ __('app.total') }}</th>
<th class="text-center">{{ formatDecimal($job->tasks->avg('progress')) }} %</th> <th class="text-center">{{ formatDecimal($job->tasks->avg('progress')) }} %</th>
<th> <th>
@if (request('action') == 'sort_tasks') @if (request('action') == 'sort_tasks')

Loading…
Cancel
Save