added subcategories grid theme part

changed directory some theme part
pull/49/head
A1Gard 5 months ago
parent a7d9607343
commit 66cc2b1acc

@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\Attachment;
use App\Models\Category;
use App\Models\Comment;
use App\Models\Customer;
use App\Models\Gallery;
@ -143,6 +144,14 @@ class ClientController extends Controller
$posts = $group->posts()->orderByDesc('id')->paginate($this->paginate);
return view('client.group', compact('area', 'posts', 'title', 'subtitle', 'group'));
}
public function category(Category $category)
{
$area = 'category';
$title = $category->name;
$subtitle = $category->subtitle;
$products = $category->products()->orderByDesc('id')->paginate($this->paginate);
return view('client.category', compact('area', 'products', 'title', 'subtitle', 'category'));
}
public function attachDl(Attachment $attachment)
{

@ -77,8 +77,7 @@ class Category extends Model
public function webUrl()
{
return '#';// WIP
return route('');
return route('client.category',$this->slug);
}
public function products()

@ -0,0 +1,18 @@
@extends('website.inc.website-layout')
@section('title')
{{$title}} - {{config('app.name')}}
@endsection
@php
if ($category->bg != null){
$bg = $category->bgUrl();
}
@endphp
@section('content')
<main>
@foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']])
@endforeach
</main>
@endsection

@ -0,0 +1,23 @@
<section class='SubCategoriesGrid content'>
<div class="{{gfx()['container']}}">
@if($category->children()->count() > 0)
<div class="px-4">
<h3>
{{__("Sub categories")}}
</h3>
<div class="row">
@foreach($category->children as $subCat)
<div class="col-md">
<div class="sub-category">
<img src="{{$subCat->imgUrl()}}" alt="{{$subCat->name}}" class="img-fluid">
<h4>
{{$subCat->name}}
</h4>
</div>
</div>
@endforeach
</div>
</div>
@endif
</div>
</section>

@ -0,0 +1,10 @@
{
"name": "SubCategoriesGrid",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,21 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
class SubCategoriesGrid
{
public static function onAdd(Part $part = null)
{
}
public static function onRemove(Part $part = null)
{
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,49 @@
.SubCategoriesGrid {
padding-top: 1rem;
padding-bottom: 1rem;
.row{
[class^="col-md"]{
padding: 2px;
}
}
.sub-category{
height: 300px;
width: 100%;
position: relative;
overflow: hidden;
img{
position: absolute;
height: 300px;
width: 100%;
left: 0;
right: 0;
top: 0;
bottom: 0;
object-fit: cover;
transition: 400ms;
}
h4{
z-index: 3;
position: absolute;
left: 0;
right: 0;
bottom: 0;
text-align: center;
background: #ffffff33;
backdrop-filter: blur(4px);
margin: 0;
padding: 1rem;
transition: 400ms;
}
&:hover{
h4{
background: #ffffff88;
}
img{
transform: scale(1.3) rotateZ(15deg);
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 KiB

@ -1,60 +0,0 @@
<section class='ProductGridSidebar content'>
<div class="{{gfx()['container']}}">
<h1>
{{$title}}
</h1>
<div class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-lg-1 pt-lg-0">
@include('segments.products.ProductGridSidebar.inc.product-sidebar')
</div>
@endif
<div class="col-lg-9">
<div class="row">
@foreach($products as $product)
<div class="col-md-4 p-2">
<div class="product-item">
<a class="fav-btn" data-slug="{{$product->slug}}" data-is-fav="{{$product->isFav()}}">
<i class="ri-heart-line"></i>
<i class="ri-heart-fill"></i>
</a>
<a class="compare-btn" data-slug="{{$product->slug}}">
<i class="ri-scales-3-line"></i>
</a>
<a href="{{$product->webUrl()}}">
<img src="{{$product->imgUrl()}}" alt="{{$product->name}}">
<h3>
{{$product->name}}
</h3>
<div class="prices">
@if($product->hasDiscount())
<span class="old-price">
{{$product->oldPrice()}}
</span>
@endif
<span class="price">
{{$product->getPrice()}}
</span>
</div>
<div class="p-2">
<a href="{{ route('client.product-card-toggle',$product->slug) }}" class="btn btn-outline-primary w-100 add-to-card">
<i class="ri-shopping-bag-3-line"></i>
{{__("Add to card")}}
</a>
</div>
</a>
</div>
</div>
@endforeach
</div>
{{$products->links()}}
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3">
@include('segments.products.ProductGridSidebar.inc.product-sidebar')
</div>
@endif
</div>
</div>
</section>

@ -0,0 +1,61 @@
<section class='ProductGridSidebar content'>
<div class="{{gfx()['container']}}">
<h1>
{{$title}}
</h1>
<div class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-lg-1 pt-lg-0">
@include('segments.products_page.ProductGridSidebar.inc.product-sidebar')
</div>
@endif
<div class="col-lg-9">
<div class="row">
@foreach($products as $product)
<div class="col-md-4 p-2">
<div class="product-item">
<a class="fav-btn" data-slug="{{$product->slug}}" data-is-fav="{{$product->isFav()}}">
<i class="ri-heart-line"></i>
<i class="ri-heart-fill"></i>
</a>
<a class="compare-btn" data-slug="{{$product->slug}}">
<i class="ri-scales-3-line"></i>
</a>
<a href="{{$product->webUrl()}}">
<img src="{{$product->imgUrl()}}" alt="{{$product->name}}">
<h3>
{{$product->name}}
</h3>
<div class="prices">
@if($product->hasDiscount())
<span class="old-price">
{{$product->oldPrice()}}
</span>
@endif
<span class="price">
{{$product->getPrice()}}
</span>
</div>
<div class="p-2">
<a href="{{ route('client.product-card-toggle',$product->slug) }}"
class="btn btn-outline-primary w-100 add-to-card">
<i class="ri-shopping-bag-3-line"></i>
{{__("Add to card")}}
</a>
</div>
</a>
</div>
</div>
@endforeach
</div>
{{$products->links()}}
</div>
@if(getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3">
@include('segments.products_page.ProductGridSidebar.inc.product-sidebar')
</div>
@endif
</div>
</div>
</section>

@ -18,7 +18,7 @@
</h4>
<div class="side-data side-list">
<ul class="ps-3">
{!! showCatNested(\App\Models\Category::all(['id','name','parent_id'])) !!}
{!! showCatNested(\App\Models\Category::all(['id','name','parent_id','slug'])) !!}
</ul>
</div>
</div>

@ -127,6 +127,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group(
Route::get('create', [\App\Http\Controllers\Admin\CategoryController::class, 'create'])->name('create');
Route::post('store', [\App\Http\Controllers\Admin\CategoryController::class, 'store'])->name('store');
Route::get('edit/{item}', [\App\Http\Controllers\Admin\CategoryController::class, 'edit'])->name('edit');
Route::get('show/{item}', [\App\Http\Controllers\Admin\CategoryController::class, 'show'])->name('show');
Route::post('update/{item}', [\App\Http\Controllers\Admin\CategoryController::class, 'update'])->name('update');
Route::get('delete/{item}', [\App\Http\Controllers\Admin\CategoryController::class, 'destroy'])->name('destroy');
Route::get('restore/{item}', [\App\Http\Controllers\Admin\CategoryController::class, 'restore'])->name('restore');
@ -363,6 +364,7 @@ Route::name('client.')->group(function (){
Route::get('/products', [\App\Http\Controllers\ClientController::class,'products'])->name('products');
Route::get('/tag/{post}', [\App\Http\Controllers\ClientController::class,'tag'])->name('tag'); // wip
Route::get('/group/{group}', [\App\Http\Controllers\ClientController::class,'group'])->name('group');
Route::get('/category/{category}', [\App\Http\Controllers\ClientController::class,'category'])->name('category');
Route::get('/gallery/{gallery}', [\App\Http\Controllers\ClientController::class,'gallery'])->name('gallery');
Route::get('/search', [\App\Http\Controllers\ClientController::class,'search'])->name('search');
Route::get('attach/download/{attachment}', [\App\Http\Controllers\ClientController::class,'attachDl'])->name('attach-dl');

Loading…
Cancel
Save