5 changed files with 131 additions and 128 deletions
-
131resources/views/cart/index.blade.php
-
68resources/views/cart/partials/draft-item-list.blade.php
-
11resources/views/cart/partials/product-search-box.blade.php
-
32resources/views/cart/partials/product-search-result-box.blade.php
-
17resources/views/cart/partials/transaction-draft-tabs.blade.php
@ -0,0 +1,68 @@ |
|||||
|
<div class="panel panel-default"> |
||||
|
<div class="panel-body"> |
||||
|
<table class="table"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>#</th>
|
||||
|
<th>Nama Item</th> |
||||
|
<th>Harga Satuan</th> |
||||
|
<th>Diskon per Item</th> |
||||
|
<th>Qty</th> |
||||
|
<th class="text-right">Subtotal</th> |
||||
|
<th class="text-center">Action</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
@forelse($draft->items() as $key => $item) |
||||
|
<tr> |
||||
|
<td>{{ $key + 1 }}</td> |
||||
|
<td>{{ $item->name }}</td> |
||||
|
<td>{{ formatRp($item->price) }}</td> |
||||
|
<td> |
||||
|
{{ Form::open(['route' => ['cart.update-draft-item', $draft->draftKey], 'method' => 'patch']) }} |
||||
|
{{ Form::hidden('item_key', $key) }} |
||||
|
{{ Form::hidden('qty', $item->qty) }} |
||||
|
{{ Form::text('item_discount', $item->item_discount, ['id' => 'item_discount-' . $key, 'style' => 'width:100px;text-align:right']) }} |
||||
|
{{ Form::submit('update-item-' . $key, ['style'=>'display:none']) }} |
||||
|
{{ Form::close() }} |
||||
|
</td> |
||||
|
<td> |
||||
|
{{ Form::open(['route' => ['cart.update-draft-item', $draft->draftKey], 'method' => 'patch']) }} |
||||
|
{{ Form::hidden('item_key', $key) }} |
||||
|
{{ Form::hidden('item_discount', $item->item_discount) }} |
||||
|
{{ Form::number('qty', $item->qty, ['id' => 'qty-' . $key, 'style' => 'width:50px;text-align:center']) }} |
||||
|
{{ Form::submit('update-item-' . $key, ['style'=>'display:none']) }} |
||||
|
{{ Form::close() }} |
||||
|
</td> |
||||
|
<td class="text-right">{{ formatRp($item->subtotal) }}</td> |
||||
|
<td class="text-center"> |
||||
|
{!! 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'], ['item_index' => $key]) !!} |
||||
|
</td> |
||||
|
</tr> |
||||
|
@empty |
||||
|
@endforelse |
||||
|
</tbody> |
||||
|
<tfoot> |
||||
|
<tr> |
||||
|
<th colspan="5" class="text-right">Subtotal :</th> |
||||
|
<th class="text-right">{{ formatRp($draft->getSubtotal()) }}</th> |
||||
|
<th></th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th colspan="5" class="text-right">Diskon Total :</th> |
||||
|
<th class="text-right">{{ formatRp($draft->getDiscountTotal()) }}</th> |
||||
|
<th></th> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<th colspan="5" class="text-right">Total :</th> |
||||
|
<th class="text-right">{{ formatRp($draft->getTotal()) }}</th> |
||||
|
<th></th> |
||||
|
</tr> |
||||
|
</tfoot> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,11 @@ |
|||||
|
<div class="panel panel-default"> |
||||
|
<div class="panel-heading"> |
||||
|
<form method="get" action="{{ route('cart.show', $draft->draftKey) }}"> |
||||
|
<label for="query">{{ trans('cart.product_search') }}</label> |
||||
|
<input type="text" id="query" name="query" value="{{ request('query') }}"> |
||||
|
<input type="submit" value="{{ trans('cart.product_search') }}" class="btn btn-info btn-sm"> |
||||
|
<a href="{{ route('cart.show', $draft->draftKey) }}" class="btn btn-default btn-sm">Refresh</a> |
||||
|
</form> |
||||
|
</div> |
||||
|
@includeWhen ($queriedProducts, 'cart.partials.product-search-result-box') |
||||
|
</div> |
||||
@ -0,0 +1,32 @@ |
|||||
|
<div class="panel-body"> |
||||
|
<table class="table table-condensed"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>Produk</th> |
||||
|
<th>Harga Satuan ({{ $draft->type }})</th> |
||||
|
<th>Action</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
@forelse($queriedProducts as $product) |
||||
|
<tr> |
||||
|
<td>{{ $product->name }}</td> |
||||
|
<td>{{ formatRp($draft->type == 'cash' ? $product->cash_price : $product->credit_price) }}</td> |
||||
|
<td> |
||||
|
<form action="{{ route('cart.add-draft-item', [$draft->draftKey, $product->id]) }}" method="post" style="display:inline"> |
||||
|
{{ csrf_field() }} |
||||
|
<input type="number" id="qty-{{ $product->id }}" style="width:50px" name="qty" value="1"> |
||||
|
<input type="submit" id="add-product-{{ $product->id }}" value="Tambah"> |
||||
|
</form> |
||||
|
</td> |
||||
|
</tr> |
||||
|
@empty |
||||
|
<tr> |
||||
|
<td colspan="3"> |
||||
|
Produk tidak ditemukan dengan keyword : <strong><em>{{ request('query') }}</em></strong> |
||||
|
</td> |
||||
|
</tr> |
||||
|
@endforelse |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
@ -0,0 +1,17 @@ |
|||||
|
<?php use Facades\App\Cart\CartCollection; ?>
|
||||
|
<ul class="nav nav-tabs transaction-draft-tabs"> |
||||
|
@foreach(CartCollection::content() as $key => $content) |
||||
|
<?php $active = ($draft->draftKey == $key) ? 'class=active' : '' ?>
|
||||
|
<li {{ $active }} role="presentation"> |
||||
|
<a href="{{ route('cart.show', $key) }}"> |
||||
|
{{ trans('transaction.' . $content->type) }} - {{ $key }} |
||||
|
<form action="{{ route('cart.remove') }}" 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"> |
||||
|
</form> |
||||
|
</a> |
||||
|
</li> |
||||
|
@endforeach |
||||
|
</ul><!-- Tab panes --> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue