From 78484924d26f9e8c88a99b2dc5df87eb250f15da Mon Sep 17 00:00:00 2001 From: Nafies Luthfi Date: Tue, 20 Mar 2018 18:18:48 +0800 Subject: [PATCH] Add flash message on invoice draft actions Update invoice draft views Update Invoice Draft class docblocks --- app/Http/Controllers/Invoices/DraftsController.php | 4 ++++ app/Services/InvoiceDraft/InvoiceDraft.php | 2 +- .../InvoiceDraft/InvoiceDraftCollection.php | 10 ++++---- resources/lang/en/invoice.php | 4 +++- resources/lang/id/invoice.php | 2 ++ .../partials/draft-item-list.blade.php | 27 ++++++++++------------ .../partials/invoice-draft-tabs.blade.php | 2 +- resources/views/jobs/partials/job-tasks.blade.php | 2 +- 8 files changed, 29 insertions(+), 24 deletions(-) diff --git a/app/Http/Controllers/Invoices/DraftsController.php b/app/Http/Controllers/Invoices/DraftsController.php index 65323f0..4c1073f 100644 --- a/app/Http/Controllers/Invoices/DraftsController.php +++ b/app/Http/Controllers/Invoices/DraftsController.php @@ -89,6 +89,8 @@ class DraftsController extends Controller $this->draftCollection->updateDraftItem($draftKey, $itemData['item_key'], $itemData); + flash(trans('invoice.item_updated'), 'success'); + return back(); } @@ -96,6 +98,8 @@ class DraftsController extends Controller { $this->draftCollection->removeItemFromDraft($draftKey, $request->item_index); + flash(trans('invoice.item_removed'), 'warning'); + return back(); } diff --git a/app/Services/InvoiceDraft/InvoiceDraft.php b/app/Services/InvoiceDraft/InvoiceDraft.php index ee0554e..af4b59c 100644 --- a/app/Services/InvoiceDraft/InvoiceDraft.php +++ b/app/Services/InvoiceDraft/InvoiceDraft.php @@ -115,7 +115,7 @@ class InvoiceDraft /** * Update an invoice item. * - * @param int $itemKey The item key + * @param int $itemKey The item key * @param array $newItemData The item attributes. * * @return null|\App\Services\InvoiceDrafts\Item diff --git a/app/Services/InvoiceDraft/InvoiceDraftCollection.php b/app/Services/InvoiceDraft/InvoiceDraftCollection.php index 9c619d3..e5adf6e 100644 --- a/app/Services/InvoiceDraft/InvoiceDraftCollection.php +++ b/app/Services/InvoiceDraft/InvoiceDraftCollection.php @@ -204,9 +204,9 @@ class InvoiceDraftCollection /** * Update invoice draft item attributes. * - * @param string $draftKey Invoice draft key. - * @param string $itemKey Invoice item key. - * @param array $newItemData Array of item attribute. + * @param string $draftKey Invoice draft key. + * @param string $itemKey Invoice item key. + * @param array $newItemData Array of item attribute. * * @return void */ @@ -247,7 +247,7 @@ class InvoiceDraftCollection /** * Check if current invoice draft is empty. * - * @return boolean + * @return bool */ public function isEmpty() { @@ -257,7 +257,7 @@ class InvoiceDraftCollection /** * Check if current invoice draft has content. * - * @return boolean + * @return bool */ public function hasContent() { diff --git a/resources/lang/en/invoice.php b/resources/lang/en/invoice.php index 4400839..688d56a 100644 --- a/resources/lang/en/invoice.php +++ b/resources/lang/en/invoice.php @@ -34,8 +34,10 @@ return [ 'add_item' => 'Add Item', 'item_added' => 'Item added.', '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.', + 'draft_del_confirm' => 'Are you sure to remove this Invoice Draft?', // Attributes 'number' => 'Invocie No.', diff --git a/resources/lang/id/invoice.php b/resources/lang/id/invoice.php index 537bfba..db4fd17 100644 --- a/resources/lang/id/invoice.php +++ b/resources/lang/id/invoice.php @@ -34,8 +34,10 @@ return [ 'add_item' => 'Tambah Item', 'item_added' => 'Item berhasil ditambahkan.', 'item_updated' => 'Item berhasil diupdate.', + 'item_remove' => 'Hapus Item', 'item_removed' => 'Item berhasil dihapus.', '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 'number' => 'No. Invoice', diff --git a/resources/views/invoice-drafts/partials/draft-item-list.blade.php b/resources/views/invoice-drafts/partials/draft-item-list.blade.php index 7eaf9f8..65f8217 100644 --- a/resources/views/invoice-drafts/partials/draft-item-list.blade.php +++ b/resources/views/invoice-drafts/partials/draft-item-list.blade.php @@ -8,10 +8,10 @@ - - - - + + + + @@ -38,20 +38,24 @@ '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']) }} {{ Form::close() }} @endforeach - + + + + + + {{ Form::open(['route' => ['invoice-drafts.add-draft-item', $draft->draftKey]]) }} @@ -76,12 +80,5 @@ {{ Form::close() }} - - - - - - -
#DeskripsiBiayaAction{{ __('app.table_no') }}{{ __('app.description') }}{{ __('invoice.item_amount') }}{{ __('app.action') }}
{!! 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]) !!} + ], 'x', ['id' => 'remove-item-'.$key, 'class' => 'btn btn-danger btn-xs show-on-hover', 'title' => __('invoice.item_remove')], ['item_index' => $key]) !!}
Tambah Item Invoice{{ trans('invoice.amount') }} :{{ formatRp($draft->getTotal()) }} 
{{ __('app.add') }} {{ __('invoice.items') }}
{{ trans('invoice.amount') }} :{{ formatRp($draft->getTotal()) }}
\ No newline at end of file diff --git a/resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php b/resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php index 0845abc..e0469a6 100644 --- a/resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php +++ b/resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php @@ -5,7 +5,7 @@
  • {{ trans('invoice.invoice') }} - {{ $key }} -
    + {{ csrf_field() }} {{ method_field('delete') }} diff --git a/resources/views/jobs/partials/job-tasks.blade.php b/resources/views/jobs/partials/job-tasks.blade.php index f47faa6..995dcb4 100644 --- a/resources/views/jobs/partials/job-tasks.blade.php +++ b/resources/views/jobs/partials/job-tasks.blade.php @@ -56,7 +56,7 @@ - Total + {{ __('app.total') }} {{ formatDecimal($job->tasks->avg('progress')) }} % @if (request('action') == 'sort_tasks')