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. 2
      app/Services/InvoiceDraft/InvoiceDraft.php
  3. 10
      app/Services/InvoiceDraft/InvoiceDraftCollection.php
  4. 4
      resources/lang/en/invoice.php
  5. 2
      resources/lang/id/invoice.php
  6. 27
      resources/views/invoice-drafts/partials/draft-item-list.blade.php
  7. 2
      resources/views/invoice-drafts/partials/invoice-draft-tabs.blade.php
  8. 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);
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();
}

2
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

10
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()
{

4
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.',

2
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',

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

@ -8,10 +8,10 @@
<table class="table">
<thead>
<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>
</thead>
<tbody>
@ -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']) }}
</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]) !!}
], 'x', ['id' => 'remove-item-'.$key, 'class' => 'btn btn-danger btn-xs show-on-hover', 'title' => __('invoice.item_remove')], ['item_index' => $key]) !!}
</td>
</tr>
@endforeach
<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>
{{ Form::open(['route' => ['invoice-drafts.add-draft-item', $draft->draftKey]]) }}
@ -76,12 +80,5 @@
{{ 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>

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

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

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

@ -56,7 +56,7 @@
</tbody>
<tfoot>
<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>
@if (request('action') == 'sort_tasks')

Loading…
Cancel
Save