Commit 79edcbcd by Angel MAS

change text by select

parent 965dae36
......@@ -31,18 +31,23 @@ setlocale(LC_MONETARY, 'en_US');
<td>{{$product->name}}</td>
<td>{{money_format('%(#10n', $product->infoSale->sale_price)}}</td>
<td>
<input
type="number"
min="1"
<select
class="select-update"
value="{{$product->quantity}}"
id="product-{{$product->slug}}">
<a
href="#"
class="btn-update"
id="product-{{$product->slug}}"
data-href="{{ route('cart.update', [$product->slug,'']) }}"
data-slug = "{{ $product->slug }}">
Cambiar
</a>
>
@for ($i = 1; $i < 16; $i++)
@if($i == $product->quantity)
<option value="{{$i}}" selected="selected">{{$i}}</option>
@else
<option value="{{$i}}">{{$i}}</option>
@endif
@endfor
</select>
</td>
<td>{{money_format('%(#10n', ($product->infoSale->sale_price * $product->quantity))}}</td>
<td>
......@@ -89,12 +94,12 @@ setlocale(LC_MONETARY, 'en_US');
@section('scripts_extra')
<script type="text/javascript">
// Update item cart
$(".btn-update").on('click', function(e){
e.preventDefault();
$('.select-update').on('change', function() {
var slug = $(this).data('slug');
var href = $(this).data('href');
var quantity = $("#product-" + slug).val();
window.location.href = href + "/" + quantity;
});
window.location.href = href + "/" + this.value;
})
</script>
@endsection
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment