Commit 79edcbcd by Angel MAS

change text by select

parent 965dae36
...@@ -31,18 +31,23 @@ setlocale(LC_MONETARY, 'en_US'); ...@@ -31,18 +31,23 @@ setlocale(LC_MONETARY, 'en_US');
<td>{{$product->name}}</td> <td>{{$product->name}}</td>
<td>{{money_format('%(#10n', $product->infoSale->sale_price)}}</td> <td>{{money_format('%(#10n', $product->infoSale->sale_price)}}</td>
<td> <td>
<input <select
type="number" class="select-update"
min="1"
value="{{$product->quantity}}" value="{{$product->quantity}}"
id="product-{{$product->slug}}"> id="product-{{$product->slug}}"
<a
href="#"
class="btn-update"
data-href="{{ route('cart.update', [$product->slug,'']) }}" data-href="{{ route('cart.update', [$product->slug,'']) }}"
data-slug = "{{ $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>
<td>{{money_format('%(#10n', ($product->infoSale->sale_price * $product->quantity))}}</td> <td>{{money_format('%(#10n', ($product->infoSale->sale_price * $product->quantity))}}</td>
<td> <td>
...@@ -89,12 +94,12 @@ setlocale(LC_MONETARY, 'en_US'); ...@@ -89,12 +94,12 @@ setlocale(LC_MONETARY, 'en_US');
@section('scripts_extra') @section('scripts_extra')
<script type="text/javascript"> <script type="text/javascript">
// Update item cart // Update item cart
$(".btn-update").on('click', function(e){ $('.select-update').on('change', function() {
e.preventDefault();
var slug = $(this).data('slug'); var slug = $(this).data('slug');
var href = $(this).data('href'); var href = $(this).data('href');
var quantity = $("#product-" + slug).val(); var quantity = $("#product-" + slug).val();
window.location.href = href + "/" + quantity;
}); window.location.href = href + "/" + this.value;
})
</script> </script>
@endsection @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