add new arrivals
This commit is contained in:
parent
a3675b87c9
commit
2ab0549f02
|
|
@ -238,26 +238,31 @@ class Items extends Model
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return $this->hasOne(Discount::class,DB::raw("item_reference.item_id"))
|
return $this->hasOne(Discount::class, 'id', 'item_reference_id')
|
||||||
->leftJoin("discount_items","discounts.id","=","discount_id")
|
->leftJoin('discount_items', 'discount_items.discount_id', '=', 'discounts.id')
|
||||||
->leftJoin("item_reference","item_reference.id","=","item_reference_id")
|
->where('discounts.type', 'price')
|
||||||
->where("discounts.type","price")
|
|
||||||
->orderBy("discounts.created_at","desc")
|
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereNull("valid_at")
|
$query->where('valid_at', '<=', now())
|
||||||
->orWhereDate("valid_at", "<=", Carbon::now());
|
->orWhereNull('valid_at');
|
||||||
})
|
})
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereNull("expired_at")
|
$query->where('expired_at', '>', now())
|
||||||
->orWhereDate("expired_at", ">=", Carbon::now());
|
->orWhereNull('expired_at');
|
||||||
})
|
})
|
||||||
->where(function ($query) use ($location_id, $is_consignment) {
|
->where(function ($query) use ($location_id, $is_consignment) {
|
||||||
if (!$is_consignment)
|
if (!$is_consignment) {
|
||||||
$query->whereNull("discounts.location_id");
|
$query->whereNull('discounts.location_id');
|
||||||
if ($location_id)
|
}
|
||||||
$query->orWhere("discounts.location_id", $location_id);
|
|
||||||
|
if ($location_id) {
|
||||||
|
$query->orWhere('discounts.location_id', $location_id);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
->select("item_id","price");
|
->orderByDesc('discounts.created_at')
|
||||||
|
->select([
|
||||||
|
'discount_items.item_reference_id',
|
||||||
|
'discount_items.price',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function stock()
|
public function stock()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\View\Components\Home;
|
||||||
|
|
||||||
|
use App\Repositories\Catalog\ProductRepository;
|
||||||
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\View\View;
|
||||||
|
|
||||||
|
class NewArrivals extends Component
|
||||||
|
{
|
||||||
|
public $products;
|
||||||
|
|
||||||
|
public function __construct(ProductRepository $productRepository)
|
||||||
|
{
|
||||||
|
$params = [
|
||||||
|
'sort' => 'new',
|
||||||
|
];
|
||||||
|
$this->products = $productRepository->getList($params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the view/contents that represent the component.
|
||||||
|
*/
|
||||||
|
public function render(): View
|
||||||
|
{
|
||||||
|
return view('components.home.new-arrivals');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,97 @@
|
||||||
|
<!-- Special collection carousel -->
|
||||||
|
<section class="container pb-5 mb-2 mb-sm-3 mb-lg-4 mb-xl-5">
|
||||||
|
<div class="d-md-none text-center pb-3 mb-3">
|
||||||
|
<p class="mb-2">New arrivals</p>
|
||||||
|
<h2 class="mb-0">Meet the {{ config('app.name') }} collection</h2>
|
||||||
|
</div>
|
||||||
|
<div class="row align-items-center pb-xxl-3">
|
||||||
|
|
||||||
|
<!-- Preview images (controlled slider) -->
|
||||||
|
<div class="col-md-7 order-md-2 mb-4 mb-md-0">
|
||||||
|
<div class="swiper user-select-none" id="previewImages"
|
||||||
|
data-swiper='{
|
||||||
|
"allowTouchMove": false,
|
||||||
|
"loop": true,
|
||||||
|
"effect": "fade",
|
||||||
|
"fadeEffect": {
|
||||||
|
"crossFade": true
|
||||||
|
}
|
||||||
|
}'>
|
||||||
|
<div class="swiper-wrapper">
|
||||||
|
|
||||||
|
@foreach ($products as $key => $product)
|
||||||
|
<div class="swiper-slide">
|
||||||
|
<div class="ratio" style="--cz-aspect-ratio: calc(720 / 746 * 100%)">
|
||||||
|
<img src="{{ $product->image_url }}" class="rounded-5" alt="Image">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Products master slider -->
|
||||||
|
<div class="col-md-5 order-md-1 text-center">
|
||||||
|
<div class="d-none d-md-block pb-3 mb-2 mb-lg-3 mx-auto" style="max-width: 306px">
|
||||||
|
<p class="mb-2">New arrivals</p>
|
||||||
|
<h2 class="mb-0">Meet the Cartzilla collection</h2>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex align-items-center justify-content-center">
|
||||||
|
|
||||||
|
<!-- Prev button -->
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-icon btn-outline-secondary animate-slide-start rounded-circle mt-n5"
|
||||||
|
id="collectionPrev" aria-label="Prev">
|
||||||
|
<i class="ci-chevron-left fs-lg animate-target"></i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<!-- Slider -->
|
||||||
|
<div class="swiper mx-3 mx-lg-4"
|
||||||
|
data-swiper='{
|
||||||
|
"spaceBetween": 24,
|
||||||
|
"loop": true,
|
||||||
|
"speed": 400,
|
||||||
|
"controlSlider": "#previewImages",
|
||||||
|
"navigation": {
|
||||||
|
"prevEl": "#collectionPrev",
|
||||||
|
"nextEl": "#collectionNext"
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
style="max-width: 306px">
|
||||||
|
<div class="swiper-wrapper">
|
||||||
|
|
||||||
|
@foreach ($products as $key => $product)
|
||||||
|
<div class="swiper-slide">
|
||||||
|
<div class="animate-underline hover-effect-opacity">
|
||||||
|
<a class="d-flex bg-body-tertiary rounded p-3 mb-3"
|
||||||
|
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
||||||
|
<div class="ratio" style="--cz-aspect-ratio: calc(308 / 274 * 100%)">
|
||||||
|
<img src="{{ $product->image_url }}" loading="lazy" class="w-100 h-100 object-cover">
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="nav justify-content-center mb-2">
|
||||||
|
<a class="nav-link animate-target min-w-0 text-dark-emphasis p-0"
|
||||||
|
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
||||||
|
<span class="text-truncate">{{ $product->name }}</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="h6 mb-0">{{ number_format($product->price, 0, ',', '.') }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Next button -->
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-icon btn-outline-secondary animate-slide-end rounded-circle mt-n5"
|
||||||
|
id="collectionNext" aria-label="Next">
|
||||||
|
<i class="ci-chevron-right fs-lg animate-target"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -1268,119 +1268,7 @@
|
||||||
<x-home.product-highlight />
|
<x-home.product-highlight />
|
||||||
|
|
||||||
<!-- Special collection carousel -->
|
<!-- Special collection carousel -->
|
||||||
<section class="container pb-5 mb-2 mb-sm-3 mb-lg-4 mb-xl-5">
|
<x-home.new-arrivals />
|
||||||
<div class="d-md-none text-center pb-3 mb-3">
|
|
||||||
<p class="mb-2">New arrivals</p>
|
|
||||||
<h2 class="mb-0">Meet the Cartzilla collection</h2>
|
|
||||||
</div>
|
|
||||||
<div class="row align-items-center pb-xxl-3">
|
|
||||||
|
|
||||||
<!-- Preview images (controlled slider) -->
|
|
||||||
<div class="col-md-7 order-md-2 mb-4 mb-md-0">
|
|
||||||
<div class="swiper user-select-none" id="previewImages"
|
|
||||||
data-swiper='{
|
|
||||||
"allowTouchMove": false,
|
|
||||||
"loop": true,
|
|
||||||
"effect": "fade",
|
|
||||||
"fadeEffect": {
|
|
||||||
"crossFade": true
|
|
||||||
}
|
|
||||||
}'>
|
|
||||||
<div class="swiper-wrapper">
|
|
||||||
<div class="swiper-slide">
|
|
||||||
<div class="ratio" style="--cz-aspect-ratio: calc(720 / 746 * 100%)">
|
|
||||||
<img src="/img/home/fashion/v1/collection/01.jpg" class="rounded-5" alt="Image">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="swiper-slide">
|
|
||||||
<div class="ratio" style="--cz-aspect-ratio: calc(720 / 746 * 100%)">
|
|
||||||
<img src="/img/home/fashion/v1/collection/02.jpg" class="rounded-5" alt="Image">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Products master slider -->
|
|
||||||
<div class="col-md-5 order-md-1 text-center">
|
|
||||||
<div class="d-none d-md-block pb-3 mb-2 mb-lg-3 mx-auto" style="max-width: 306px">
|
|
||||||
<p class="mb-2">New arrivals</p>
|
|
||||||
<h2 class="mb-0">Meet the Cartzilla collection</h2>
|
|
||||||
</div>
|
|
||||||
<div class="d-flex align-items-center justify-content-center">
|
|
||||||
|
|
||||||
<!-- Prev button -->
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-icon btn-outline-secondary animate-slide-start rounded-circle mt-n5"
|
|
||||||
id="collectionPrev" aria-label="Prev">
|
|
||||||
<i class="ci-chevron-left fs-lg animate-target"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<!-- Slider -->
|
|
||||||
<div class="swiper mx-3 mx-lg-4"
|
|
||||||
data-swiper='{
|
|
||||||
"spaceBetween": 24,
|
|
||||||
"loop": true,
|
|
||||||
"speed": 400,
|
|
||||||
"controlSlider": "#previewImages",
|
|
||||||
"navigation": {
|
|
||||||
"prevEl": "#collectionPrev",
|
|
||||||
"nextEl": "#collectionNext"
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
style="max-width: 306px">
|
|
||||||
<div class="swiper-wrapper">
|
|
||||||
|
|
||||||
<!-- Item -->
|
|
||||||
<div class="swiper-slide">
|
|
||||||
<div class="animate-underline hover-effect-opacity">
|
|
||||||
<a class="d-flex bg-body-tertiary rounded p-3 mb-3"
|
|
||||||
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
|
||||||
<div class="ratio" style="--cz-aspect-ratio: calc(308 / 274 * 100%)">
|
|
||||||
<img src="/img/shop/fashion/03.png" alt="Image">
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<div class="nav justify-content-center mb-2">
|
|
||||||
<a class="nav-link animate-target min-w-0 text-dark-emphasis p-0"
|
|
||||||
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
|
||||||
<span class="text-truncate">Sneakers with a massive sole</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="h6 mb-0">$86.50</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Item -->
|
|
||||||
<div class="swiper-slide">
|
|
||||||
<div class="animate-underline hover-effect-opacity">
|
|
||||||
<a class="d-flex bg-body-tertiary rounded p-3 mb-3"
|
|
||||||
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
|
||||||
<div class="ratio" style="--cz-aspect-ratio: calc(308 / 274 * 100%)">
|
|
||||||
<img src="/img/shop/fashion/12.png" alt="Image">
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<div class="nav justify-content-center mb-2">
|
|
||||||
<a class="nav-link animate-target min-w-0 text-dark-emphasis p-0"
|
|
||||||
href="{{ route('second', ['shop', 'product-fashion']) }}">
|
|
||||||
<span class="text-truncate">Single breasted oversized blazer</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div class="h6 mb-0">$113.99</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Next button -->
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-icon btn-outline-secondary animate-slide-end rounded-circle mt-n5"
|
|
||||||
id="collectionNext" aria-label="Next">
|
|
||||||
<i class="ci-chevron-right fs-lg animate-target"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Brands -->
|
<!-- Brands -->
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue