Skip to content

Commit

Permalink
fix uiv3
Browse files Browse the repository at this point in the history
  • Loading branch information
HUYNHDUCHUNG committed Apr 3, 2024
1 parent 6249d97 commit 3a3f608
Show file tree
Hide file tree
Showing 8 changed files with 465 additions and 390 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function index(Request $request)

$category = Category::all();
$product_featured = Product::where('product_featured', 1)->get();
$product_recent = Product::where('created_at', '>=', Carbon::now()->subDays(15))
$product_recent = Product::where('created_at', '>=', Carbon::now()->subDays(999))
->orderBy('created_at', 'desc')
->get();
return view('client.home', compact('category', 'product_featured', 'product_recent', 'cart_qty'));
Expand Down
36 changes: 36 additions & 0 deletions public/client/css/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,24 @@ body > div.container-fluid.bg-dark.mb-30 > div > div.col-lg-3.d-none.d-lg-block
color: var(--main-color);
}
#navbarCollapse > div > a{
position: relative;
color: #ffb700;
font-weight: 500;
}
#navbarCollapse > div > a:hover{
color: #fd9905;
background-color: #27272a1f;
border-radius: 8px;
}
#navbarCollapse > div > a:not(:last-child)::after{
content: "";
position: absolute;
width: 2px;
height: 70%;
top: 0;
right: 0;
background-color: #27272a1f;
transform: translateY(25%);
}

/* slide */
Expand Down Expand Up @@ -213,6 +230,9 @@ body > div:nth-child(4) > div > div.col-lg-9.col-md-8 > div > div > div > div.bo
box-shadow: 0 2px 12px 1px rgba(0, 0, 0, .18);
overflow: hidden;
}
body > div:nth-child(5) > div > div > div > div > div> div > div.text-center.py-4{
padding: 0 15px;
}


/* footer */
Expand Down Expand Up @@ -276,4 +296,20 @@ body > div:nth-child(4) > div > div.col-lg-8.table-responsive.mb-5 > table{
body > div:nth-child(4) > div > div.col-lg-8.table-responsive.mb-5 > table > thead{
background-color: var(--main-color);
color: #fff;
}

body > div:nth-child(7) > div > div > div > div > div > div.owl-stage-outer > div > div > div > div.text-center.py-4 > div.d-flex.align-items-center.justify-content-center.mb-1 > small{
color: var(--seccond-color) !important;
}

body > div:nth-child(7) > div > div > div > div > div > div.owl-stage-outer > div > div > div{
background-color: #fff;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 2px 12px 1px rgba(0, 0, 0, .18) !important;

}

body > div:nth-child(7) > div > div > div > div > div > div.owl-stage-outer > div > div > div > div.text-center.py-4{
padding: 0 15px;
}
199 changes: 99 additions & 100 deletions resources/views/client/cart.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@

<th>Size</th>
<th>Màu sắc</th>
<th>Số lượng</th>
<th style="width: 100px">Số lượng</th>
<th>Tổng tiền</th>
<th>Xóa</th>
</tr>
</thead>
<tbody class="align-middle">
@foreach ($cartDetails as $key => $item)
@forelse ($cartDetails as $key => $item)
<tr data-id={{ $item->id }} class="item-cart">
<td class="align-middle"><img src="{{ asset('storage/upload/' . $img[$key]) }}"
alt="" style="width: 80px; border-radius: 4px"></td>
Expand All @@ -44,28 +44,20 @@
<td class="align-middle" style="width: 90px;">{{ $item->color }}</td>

<td class="align-middle">
<div class="input-group quantity mx-auto ">
<div class="input-group-btn">
<button class="btn btn-sm btn-custom-shop btn-minus">
<i class="fa fa-minus btn-icon"></i>
</button>
</div>
<input type="text"
class="form-control form-control-sm bg-secondary border-0 text-center"
value="{{ $item->quantity }}">
<div class="input-group-btn">
<button class="btn btn-sm btn-custom-shop btn-plus">
<i class="fa fa-plus btn-icon"></i>
</button>
</div>
</div>
{{ $item->quantity }}
</td>
<td class="align-middle total" style="width: 100px;">
{{ number_format($item->price * $item->quantity) }}</td>
<td class="align-middle" style="width: 120px;"><button class="btn btn-sm btn-danger"><i
class="fa fa-times btn-icon"></i></button></td>
</tr>
@endforeach
@empty
<tr>
<td colspan="8" style="padding: 40px">
Bạn chưa có sản phẩm nào trong giỏ hàng!
</td>
</tr>
@endforelse


</tbody>
Expand All @@ -87,21 +79,22 @@ class="fa fa-times btn-icon"></i></button></td>
<div class="bg-light mb-5">
<div class="border-bottom pb-2">
<div class="d-flex justify-content-between mb-3">
<h6>Subtotal</h6>
<h6>Tổng phụ:</h6>
<h6>{{ number_format($total_all) }}</h6>
</div>
<div class="d-flex justify-content-between">
<h6 class="font-weight-medium">Shipping</h6>
<h6 class="font-weight-medium">Free ship</h6>
<h6 class="font-weight-medium">Phí ship:</h6>
<h6 class="font-weight-medium">Miễn phí</h6>
</div>
</div>
<div class="pt-2">
<div class="d-flex justify-content-between mt-2">
<h5>Total</h5>
<h5>Tổng giá</h5>
<h5>{{ number_format($total_all) }}</h5>
</div>
<a href="{{ route('checkout') }}"
class="btn btn-block font-weight-bold my-3 py-3 btn-custom-shop" style="border-radius: 4px">Proceed To Checkout</a>
class="btn btn-block font-weight-bold my-3 py-3 btn-custom-shop"
style="border-radius: 4px">Thanh toán</a>
</div>
</div>
</div>
Expand All @@ -120,84 +113,90 @@ class="btn btn-block font-weight-bold my-3 py-3 btn-custom-shop" style="border-r
$('.btn-minus').on('click', function() {
// alert( $(this).closest('.item-cart').data('id'));
var btn = $(this)
var quantity = $(this).closest('.quantity').find('input').first().val();
if (quantity == 0) {
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.isConfirmed) {
Swal.fire(
'Deleted!',
'Your file has been deleted.',
'success'
)
$(this).closest('.item-cart').find('.btn-danger').click();
} else {
$(this).closest('.quantity').find('input').first().val(1);
$.ajax({
url: '/plus-quanity',
method: 'GET',
data: {
'id': btn.closest('.item-cart').data('id'),
},
// dataType: 'text',
success: function(data) {
// alert(data);
btn.closest('.item-cart').find('.total').first()
.html(data);
}
})
}
})
}
$.ajax({
url: '/minus-quanity',
method: 'GET',
data: {
'id': btn.closest('.item-cart').data('id'),
},
// dataType: 'text',
success: function(data) {
// alert(data);
btn.closest('.item-cart').find('.total').first().html(data);
// $('.btn-minus').on('click', function() {
// // alert( $(this).closest('.item-cart').data('id'));
// var btn = $(this)
// var quantity = $(this).closest('.quantity').find('input').first().val();
// if (quantity == 1) {
// Swal.fire({
// title: 'Are you sure?',
// text: "You won't be able to revert this!",
// icon: 'warning',
// showCancelButton: true,
// confirmButtonColor: '#3085d6',
// cancelButtonColor: '#d33',
// confirmButtonText: 'Yes, delete it!'
// }).then((result) => {
// if (result.isConfirmed) {
// Swal.fire(
// 'Deleted!',
// 'Your file has been deleted.',
// 'success'
// )
// $(this).closest('.item-cart').find('.btn-danger').click();
// } else {
// $(this).closest('.quantity').find('input').first().val(1);
// $.ajax({
// url: '/plus-quanity',
// method: 'GET',
// data: {
// 'id': btn.closest('.item-cart').data('id'),
// },
// // dataType: 'text',
// success: function(data) {
// // alert(data);
// btn.closest('.item-cart').find('.total').first()
// .html(data);
// }
// })
// }
// })
// }
// $.ajax({
// url: '/minus-quanity',
// method: 'GET',
// data: {
// 'id': btn.closest('.item-cart').data('id'),
// },
// // dataType: 'text',
// success: function(data) {
// // alert(data);
// btn.closest('.item-cart').find('.total').first().html(data);
// var input = document.getElementById('input-quantity');
// var value = parseInt(input.value, 10);
// input.value = isNaN(value) ? 1 : value - 1;
// }
// })
// })
// $('.btn-plus').on('click', function() {
// // alert( $(this).closest('.item-cart').data('id'));
// var btn = $(this)
// $.ajax({
// url: '/plus-quanity',
// method: 'GET',
// data: {
// 'id': btn.closest('.item-cart').data('id'),
// },
// // dataType: 'text',
// success: function(data) {
// // alert(data);
// btn.closest('.item-cart').find('.total').first().html(data);
// var input = document.getElementById('input-quantity');
// var value = parseInt(input.value, 10);
// input.value = isNaN(value) ? 1 : value + 1;
// }
// })
// })
}
})
})
$('.btn-plus').on('click', function() {
// alert( $(this).closest('.item-cart').data('id'));
var btn = $(this)
$.ajax({
url: '/plus-quanity',
method: 'GET',
data: {
'id': btn.closest('.item-cart').data('id'),
},
// dataType: 'text',
success: function(data) {
// alert(data);
btn.closest('.item-cart').find('.total').first().html(data);
}
})
})
$('.btn-danger').on('click', function() {
// alert( $(this).closest('.item-cart').data('id'));
Expand Down
Loading

0 comments on commit 3a3f608

Please sign in to comment.