diff --git a/resources/views/cart/index.blade.php b/resources/views/cart/index.blade.php index fe23d6e..8746b85 100644 --- a/resources/views/cart/index.blade.php +++ b/resources/views/cart/index.blade.php @@ -3,134 +3,9 @@ @section('content') -@if (! CartCollection::isEmpty()) - -@endif +@includeWhen (! CartCollection::isEmpty(), 'cart.partials.transaction-draft-tabs') @if ($draft) -
-
-
- - - - Refresh -
-
- @if ($queriedProducts) -
- - - - - - - - - - @forelse($queriedProducts as $product) - - - - - - @empty - - - - @endforelse - -
ProdukHarga Satuan ({{ $draft->type }})Action
{{ $product->name }}{{ formatRp($draft->type == 'cash' ? $product->cash_price : $product->credit_price) }} -
- {{ csrf_field() }} - - -
-
- Produk tidak ditemukan dengan keyword : {{ request('query') }} -
-
- @endif -
-
- - - - - - - - - - - - - - @forelse($draft->items() as $key => $item) - - - - - - - - - - @empty - @endforelse - - - - - - - - - - - - - - - - - - -
#Nama ItemHarga SatuanDiskon per ItemQtySubtotalAction
{{ $key + 1 }}{{ $item->name }}{{ formatRp($item->price) }} - {{ 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() }} - - {{ 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() }} - {{ formatRp($item->subtotal) }} - {!! 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]) !!} -
Subtotal :{{ formatRp($draft->getSubtotal()) }}
Diskon Total :{{ formatRp($draft->getDiscountTotal()) }}
Total :{{ formatRp($draft->getTotal()) }}
-
+ @include ('cart.partials.product-search-box') + @include('cart.partials.draft-item-list') @endif @endsection \ No newline at end of file diff --git a/resources/views/cart/partials/draft-item-list.blade.php b/resources/views/cart/partials/draft-item-list.blade.php new file mode 100644 index 0000000..e88208a --- /dev/null +++ b/resources/views/cart/partials/draft-item-list.blade.php @@ -0,0 +1,68 @@ +
+
+ + + + + + + + + + + + + + @forelse($draft->items() as $key => $item) + + + + + + + + + + @empty + @endforelse + + + + + + + + + + + + + + + + + + +
#Nama ItemHarga SatuanDiskon per ItemQtySubtotalAction
{{ $key + 1 }}{{ $item->name }}{{ formatRp($item->price) }} + {{ 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() }} + + {{ 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() }} + {{ formatRp($item->subtotal) }} + {!! 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]) !!} +
Subtotal :{{ formatRp($draft->getSubtotal()) }}
Diskon Total :{{ formatRp($draft->getDiscountTotal()) }}
Total :{{ formatRp($draft->getTotal()) }}
+
+
\ No newline at end of file diff --git a/resources/views/cart/partials/product-search-box.blade.php b/resources/views/cart/partials/product-search-box.blade.php new file mode 100644 index 0000000..2aa1526 --- /dev/null +++ b/resources/views/cart/partials/product-search-box.blade.php @@ -0,0 +1,11 @@ +
+
+
+ + + + Refresh +
+
+ @includeWhen ($queriedProducts, 'cart.partials.product-search-result-box') +
\ No newline at end of file diff --git a/resources/views/cart/partials/product-search-result-box.blade.php b/resources/views/cart/partials/product-search-result-box.blade.php new file mode 100644 index 0000000..1926613 --- /dev/null +++ b/resources/views/cart/partials/product-search-result-box.blade.php @@ -0,0 +1,32 @@ +
+ + + + + + + + + + @forelse($queriedProducts as $product) + + + + + + @empty + + + + @endforelse + +
ProdukHarga Satuan ({{ $draft->type }})Action
{{ $product->name }}{{ formatRp($draft->type == 'cash' ? $product->cash_price : $product->credit_price) }} +
+ {{ csrf_field() }} + + +
+
+ Produk tidak ditemukan dengan keyword : {{ request('query') }} +
+
\ No newline at end of file diff --git a/resources/views/cart/partials/transaction-draft-tabs.blade.php b/resources/views/cart/partials/transaction-draft-tabs.blade.php new file mode 100644 index 0000000..960869a --- /dev/null +++ b/resources/views/cart/partials/transaction-draft-tabs.blade.php @@ -0,0 +1,17 @@ + + \ No newline at end of file