mirror of https://github.com/4xmen/xshop.git
added Third Grid product
parent
83daefba26
commit
4848ed87de
@ -0,0 +1,81 @@
|
||||
<section class='TreeGridProducts'
|
||||
style="---main-bg: {{getSetting($data->area->name.'_'.$data->part.'_color')}};
|
||||
--gx1: {{getSetting($data->area->name.'_'.$data->part.'_gradx1')}};
|
||||
--gx2: {{getSetting($data->area->name.'_'.$data->part.'_gradx2')}};
|
||||
--gy1: {{getSetting($data->area->name.'_'.$data->part.'_grady1')}};
|
||||
--gy2: {{getSetting($data->area->name.'_'.$data->part.'_grady2')}};
|
||||
"
|
||||
>
|
||||
<div class="{{gfx()['container']}}">
|
||||
|
||||
<div class="tree-grid">
|
||||
<div class="tree-grid-item">
|
||||
<div>
|
||||
<h1>
|
||||
{{getSetting($data->area->name.'_'.$data->part.'_title')}}
|
||||
</h1>
|
||||
<div class="w100 overflow-hidden">
|
||||
|
||||
<div class="section-main">
|
||||
@foreach(getCategoryProductBySetting($part->area->name . '_' . $part->part.'_category') as $product)
|
||||
<div class="item">
|
||||
<div class="tree-product-box">
|
||||
<a href="{{$product->webUrl()}}">
|
||||
<img src="{{$product->imgUrl()}}" alt="{{$product->name}}">
|
||||
</a>
|
||||
<h4>
|
||||
<a href="{{$product->webUrl()}}">
|
||||
{{$product->name}}
|
||||
</a>
|
||||
</h4>
|
||||
|
||||
<div class="price">
|
||||
{{$product->getPrice()}}
|
||||
</div>
|
||||
|
||||
<a href="" class="btn btn-primary btn-sm w-100">
|
||||
<i class="ri-shopping-cart-2-line"></i>
|
||||
<span>
|
||||
Add to card
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tree-grid-item">
|
||||
<span class="badge bg-secondary discount">
|
||||
{{getSetting($data->area->name.'_'.$data->part.'_badgex')}}
|
||||
</span>
|
||||
|
||||
<div class="section-second">
|
||||
@foreach(getCategoryProductBySetting($part->area->name . '_' . $part->part.'_categoryx') as $product)
|
||||
<div class="item text-center">
|
||||
<a href="{{$product->webUrl()}}">
|
||||
<img src="{{$product->imgUrl()}}" class="img-fluid" alt="{{$product->name}}">
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="tree-grid-item">
|
||||
<span class="badge bg-secondary discount">
|
||||
{{getSetting($data->area->name.'_'.$data->part.'_badgey')}}
|
||||
</span>
|
||||
|
||||
<div class="section-third">
|
||||
@foreach(getCategoryProductBySetting($part->area->name . '_' . $part->part.'_categoryy') as $product)
|
||||
<div class="item text-center">
|
||||
<a href="{{$product->webUrl()}}">
|
||||
<img src="{{$product->imgUrl()}}" class="img-fluid" alt="{{$product->name}}">
|
||||
</a>
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
@ -0,0 +1,82 @@
|
||||
import {tns} from "tiny-slider/src/tiny-slider";
|
||||
|
||||
var treeSlider,treeSliderX, treeSliderY ;
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.tree-grid .section-main')?.forEach(function (el) {
|
||||
if (el.classList.contains('.tns-slider')){
|
||||
console.log('ignore');
|
||||
return 'ignore';
|
||||
}
|
||||
treeSlider = tns({
|
||||
container: el,
|
||||
items: 3,
|
||||
slideBy: 'page',
|
||||
autoplay: true,
|
||||
autoplayButton: false,
|
||||
// nextButton: false,
|
||||
controls: false,
|
||||
autoplayHoverPause: true,
|
||||
mouseDrag: true,
|
||||
gutter: 7,
|
||||
responsive:{
|
||||
560:{
|
||||
items: 1,
|
||||
},
|
||||
768:{
|
||||
items: 2,
|
||||
},
|
||||
1000:{
|
||||
items: 3,
|
||||
},
|
||||
1400:{
|
||||
items: 4,
|
||||
},
|
||||
|
||||
}
|
||||
// speed:10000,
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('.tree-grid .section-second')?.forEach(function (el) {
|
||||
if (el.classList.contains('.tns-slider')){
|
||||
console.log('ignore');
|
||||
return 'ignore';
|
||||
}
|
||||
treeSliderX = tns({
|
||||
container: el,
|
||||
items: 1,
|
||||
slideBy: 'page',
|
||||
autoplay: true,
|
||||
autoplayButton: false,
|
||||
// nextButton: false,
|
||||
controls: false,
|
||||
autoplayHoverPause: true,
|
||||
autoplayTimeout: 8000,
|
||||
mouseDrag: true,
|
||||
gutter: 7,
|
||||
edgePadding: 60,
|
||||
// speed:10000,
|
||||
});
|
||||
});
|
||||
document.querySelectorAll('.tree-grid .section-third')?.forEach(function (el) {
|
||||
if (el.classList.contains('.tns-slider')){
|
||||
console.log('ignore');
|
||||
return 'ignore';
|
||||
}
|
||||
treeSliderX = tns({
|
||||
container: el,
|
||||
items: 1,
|
||||
slideBy: 'page',
|
||||
autoplay: true,
|
||||
autoplayTimeout: 7500,
|
||||
autoplayButton: false,
|
||||
// nextButton: false,
|
||||
controls: false,
|
||||
autoplayHoverPause: true,
|
||||
mouseDrag: true,
|
||||
gutter: 7,
|
||||
edgePadding: 60,
|
||||
// speed:10000,
|
||||
});
|
||||
});
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "TreeGridProducts",
|
||||
"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,131 @@
|
||||
<?php
|
||||
|
||||
namespace Resources\Views\Segments;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\Part;
|
||||
use App\Models\Setting;
|
||||
|
||||
class TreeGridProducts
|
||||
{
|
||||
public static function onAdd(Part $part = null)
|
||||
{
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_title';
|
||||
$setting->value = 'Favorite products';
|
||||
$setting->type = 'TEXT';
|
||||
$setting->size = 4;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' main title';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_color';
|
||||
$setting->value = '#273763';
|
||||
$setting->type = 'COLOR';
|
||||
$setting->size = 4;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' main color';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_category';
|
||||
$setting->value = Category::first()->id;
|
||||
$setting->type = 'CATEGORY';
|
||||
$setting->size = 4;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' main category';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_badgex';
|
||||
$setting->value = '22%';
|
||||
$setting->type = 'TEXT';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' Second badge text';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_gradx1';
|
||||
$setting->value = '#FF7D33';
|
||||
$setting->type = 'COLOR';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' second gradiant color 1';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_gradx2';
|
||||
$setting->value = '#FF971D';
|
||||
$setting->type = 'COLOR';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' second gradiant color 2';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_categoryx';
|
||||
$setting->value = Category::first()->id;
|
||||
$setting->type = 'CATEGORY';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' second category';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_badgey';
|
||||
$setting->value = 'Sale';
|
||||
$setting->type = 'TEXT';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' third badge text';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_grady1';
|
||||
$setting->value = '#FF7D33';
|
||||
$setting->type = 'COLOR';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' third gradiant color 1';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_grady2';
|
||||
$setting->value = '#430392';
|
||||
$setting->type = 'COLOR';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' third gradiant color 2';
|
||||
$setting->save();
|
||||
|
||||
$setting = new Setting();
|
||||
$setting->section = 'theme';
|
||||
$setting->key = $part->area->name . '_' . $part->part.'_categoryy';
|
||||
$setting->value = Category::first()->id;
|
||||
$setting->type = 'CATEGORY';
|
||||
$setting->size = 3;
|
||||
$setting->title = $part->area->name . ' ' . $part->part .' third category';
|
||||
$setting->save();
|
||||
}
|
||||
public static function onRemove(Part $part = null)
|
||||
{
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_title')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_category')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_color')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_badgex')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_gradx1')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_gradx2')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_categoryx')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_badgey')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_grady1')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_grady2')->first()?->delete();
|
||||
Setting::where('key',$part->area->name . '_' . $part->part.'_categoryy')->first()?->delete();
|
||||
}
|
||||
public static function onMount(Part $part = null)
|
||||
{
|
||||
return $part;
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
.TreeGridProducts {
|
||||
|
||||
margin-bottom: 2rem;
|
||||
|
||||
h1{
|
||||
font-size: 22px;
|
||||
}
|
||||
.tree-product-box{
|
||||
padding: .4rem;
|
||||
overflow: hidden;
|
||||
background: var(--xshop-background);
|
||||
border-radius: var(--xshop-border-radius);
|
||||
color: var(--xshop-text);
|
||||
.price{
|
||||
padding: 4px;
|
||||
text-align: center;
|
||||
color: var(--xshop-secondary);
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
|
||||
img{
|
||||
width: 100%;
|
||||
}
|
||||
h4{
|
||||
font-size: 17px;
|
||||
margin: 0;
|
||||
text-align: center;
|
||||
padding: .4rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
a{
|
||||
color: var(--xshop-text);
|
||||
}
|
||||
|
||||
}
|
||||
.tree-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(8,1fr);
|
||||
grid-template-rows: auto;
|
||||
grid-gap: 10px 10px;
|
||||
padding-top: 1rem;
|
||||
.tree-grid-item {
|
||||
|
||||
overflow: hidden;
|
||||
border-radius: var(--xshop-border-radius);
|
||||
//display: flex;
|
||||
//align-items: center;
|
||||
//justify-content: center;
|
||||
color: var(--xshop-diff);
|
||||
padding: 2rem 1rem;
|
||||
position: relative;
|
||||
box-shadow: var(--xshop-shadow);
|
||||
&:first-child {
|
||||
grid-column: 1/5 span;
|
||||
grid-row: 1/3;
|
||||
background: var(---main-bg);
|
||||
}
|
||||
&:nth-child(2) {
|
||||
grid-column: 6/3 span;
|
||||
grid-row: 1/2;
|
||||
background: rgb(255,125,51);
|
||||
background: linear-gradient(180deg, var(--gx1) 0%, var(--gx2) 100%);
|
||||
overflow: hidden;
|
||||
}
|
||||
&:nth-child(3) {
|
||||
grid-column: 6/3 span;
|
||||
grid-row: 2/2;
|
||||
background: linear-gradient(180deg, var(--gy1) 0%, var(--gy2) 100%);
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.badge {
|
||||
position: absolute;
|
||||
inset-inline-end: 0;
|
||||
top: 0;
|
||||
padding: 15px;
|
||||
border-radius: var(--xshop-border-radius);
|
||||
width: 75px;
|
||||
background: #283035aa !important;
|
||||
}
|
||||
|
||||
.section-second,.section-third{
|
||||
img{
|
||||
height: 128px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media ( max-width: 1024px ) {
|
||||
.TreeGridProducts {
|
||||
.tree-grid {
|
||||
grid-template-columns: repeat(1, 1fr) !important;
|
||||
grid-template-rows: repeat(1, 1fr) !important;
|
||||
.tree-grid-item {
|
||||
grid-column: auto !important;
|
||||
grid-row: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
Loading…
Reference in New Issue