added Third Grid product

pull/49/head
A1Gard 5 months ago
parent 83daefba26
commit 4848ed87de

@ -802,7 +802,7 @@ function getMenuBySetting($key)
/**
* get group's posts by setting key
* @param $key
* @param $limit
* @param integer $limit
* @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C
*/
function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
@ -814,7 +814,9 @@ function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
/**
* get group's posts by setting key
* @param $key
* @param $limit
* @param integer $limit
* @param string $order
* @param string $dir
* @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C
*/
function getCategoryProductBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")

@ -19,7 +19,7 @@ class ProductController extends XController
// protected $_MODEL_ = Product::class;
// protected $SAVE_REQUEST = ProductSaveRequest::class;
protected $cols = ['name','category_id','view','sell'];
protected $cols = ['name','category_id','view','sell','status'];
protected $extra_cols = ['id','slug','image_index'];
protected $searchable = ['name','slug','description','excerpt','sku','table'];
@ -170,6 +170,14 @@ class ProductController extends XController
}
break;
/*restore**/
case 'publish':
$this->_MODEL_::whereIn('id', $request->input('id'))->update(['status' => 1]);
$msg = __(':COUNT items published successfully', ['COUNT' => count($ids)]);
break;
case 'draft':
$this->_MODEL_::whereIn('id', $request->input('id'))->update(['status' => 0]);
$msg = __(':COUNT items drafted successfully', ['COUNT' => count($ids)]);
break;
default:
$msg = __('Unknown bulk action : :ACTION', ["ACTION" => $action]);
}

@ -272,4 +272,8 @@ class Product extends Model implements HasMedia
return route('');
}
public function getPrice(){
return number_format($this->price);
}
}

@ -28,7 +28,7 @@ a,a:visited{
}
.btn-primary{
background: var(--xshop-primary);
border-color: var(--xshop-secondary);
border-color: var(--xshop-primary);
color: var(--xshop-diff) !important;
&:hover{

@ -100,7 +100,7 @@ a.btn,a.action-btn,a.circle-btn{
.status-0,.status-CLOSED {
background: red;
}
.status-ANSWERED{
.status-1,.status-ANSWERED{
background: lime;
}
.status-PENDING{

@ -1,5 +1,6 @@
.FireFooter {
overflow: hidden;
padding-top: 7rem;
.footer {

@ -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

@ -4,6 +4,10 @@ var sliderSimple ;
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.SliderSimple')?.forEach(function (el) {
if (el.classList.contains('.tns-slider')){
console.log('ignore');
return 'ignore';
}
sliderSimple = tns({
container: el,
items: 1,

@ -356,7 +356,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group(
Route::get('test',function (){
// return \Resources\Views\Segments\PreloaderCircle::onAdd();
return \App\Helpers\TVisitor::GetKeyword();
return getCategoryProductBySetting('index_TreeGridProducts_category');
})->name('test');

Loading…
Cancel
Save