diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index b53cc50..4b70c80 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -1437,7 +1437,7 @@ function cacheNumber() * @param $asc * @return Category[]|\LaravelIdea\Helper\App\Models\_IH_Category_C */ -function getMainCategory($limit=4,$orderBy = 'id', $asc = 'ASC') +function getMainCategory($limit=4,$orderBy = 'sort', $asc = 'ASC') { return \App\Models\Category::whereNull('parent_id')->limit($limit)->orderBy($orderBy,$asc)->get(); } diff --git a/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.blade.php b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.blade.php new file mode 100644 index 0000000..5d7e531 --- /dev/null +++ b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.blade.php @@ -0,0 +1,26 @@ +
+
+

+ {{getSetting($part->area_name . '_' . $part->part.'_title')}} +

+
+
+ @foreach(getMainCategory(getSetting($part->area_name . '_' . $part->part.'_limit')) as $category) + + @endforeach +
+
+
+
diff --git a/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.js b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.js new file mode 100644 index 0000000..e69de29 diff --git a/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.json b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.json new file mode 100644 index 0000000..ee29139 --- /dev/null +++ b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.json @@ -0,0 +1,10 @@ +{ + "name": "MainCategoriesIcon", + "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": [] +} \ No newline at end of file diff --git a/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.php b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.php new file mode 100644 index 0000000..85bef68 --- /dev/null +++ b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.php @@ -0,0 +1,75 @@ +section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_bg'; + $setting->value = '#ffffff'; + $setting->type = 'COLOR'; + $setting->data = json_encode(['name' => 'cat-icon-bg']); + $setting->size = 4; + $setting->title = $part->area_name . ' ' . $part->part .' background color'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_box'; + $setting->value = gfx()['primary']; + $setting->type = 'COLOR'; + $setting->data = json_encode(['name' => 'cat-icon-box']); + $setting->size = 4; + $setting->title = $part->area_name . ' ' . $part->part .' box color'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_text'; + $setting->value = '#ffffff'; + $setting->type = 'COLOR'; + $setting->data = json_encode(['name' => 'cat-icon-text']); + $setting->size =4; + $setting->title = $part->area_name . ' ' . $part->part .' text color'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_title'; + $setting->value = 'Lorem ipsum dolor sit amet'; + $setting->type = 'TEXT'; + $setting->size = 6; + $setting->title = $part->area_name . ' ' . $part->part .' titles'; + $setting->save(); + + $setting = new Setting(); + $setting->section = 'theme'; + $setting->key = $part->area_name . '_' . $part->part.'_limit'; + $setting->value = '4'; + $setting->size = 6; + $setting->type = 'NUMBER'; + $setting->data = json_encode(['xmin' => 4, 'xmax' => 12]); + $setting->title = $part->area_name . ' ' . $part->part. ' limit'; + $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.'_limit')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_bg')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_box')->first()?->delete(); + Setting::where('key',$part->area_name . '_' . $part->part.'_text')->first()?->delete(); + } + public static function onMount(Part $part = null) + { + return $part; + } +} diff --git a/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.scss b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.scss new file mode 100644 index 0000000..c113f9b --- /dev/null +++ b/resources/views/segments/index/MainCategoriesIcon/MainCategoriesIcon.scss @@ -0,0 +1,51 @@ +.MainCategoriesIcon { + // scss + padding: 4rem; + background: var(--cat-icon-bg); + position: relative; + overflow: hidden; + + h1 { + position: absolute; + left: 2rem; + top: 1rem; + transform: rotateZ(-90deg); + white-space: nowrap; + font-size: 22px; + text-align: center; + width: 0; + } + + .cat-icon-box { + background: var(--cat-icon-box); + padding: 1rem; + border-radius: var(--xshop-border-radius); + + .row { + margin: 1rem; + } + + .l-box { + border-radius: var(--xshop-border-radius); + margin: 1rem; + background: var(--cat-icon-bg); + text-align: center; + + + img { + max-width: 70%; + margin: 1rem 0; + } + + } + } + + h4 { + padding: 1rem 0 0 0; + font-size: 20px; + font-weight: 300; + color: var(--cat-icon-text) !important; + text-align: center; + } + +} diff --git a/resources/views/segments/index/MainCategoriesIcon/screenshot.png b/resources/views/segments/index/MainCategoriesIcon/screenshot.png new file mode 100644 index 0000000..e122506 Binary files /dev/null and b/resources/views/segments/index/MainCategoriesIcon/screenshot.png differ diff --git a/resources/views/segments/index/MainCategoriesSlider/MainCategoriesSlider.blade.php b/resources/views/segments/index/MainCategoriesSlider/MainCategoriesSlider.blade.php index 1fb14d8..446df49 100644 --- a/resources/views/segments/index/MainCategoriesSlider/MainCategoriesSlider.blade.php +++ b/resources/views/segments/index/MainCategoriesSlider/MainCategoriesSlider.blade.php @@ -4,7 +4,7 @@ {{getSetting($data->area_name.'_'.$data->part.'_title')}}
- @foreach(\App\Models\Category::whereNull('parent_id')->limit(10)->get() as $category) + @foreach(getMainCategory(10) as $category)
{{$category->name}} diff --git a/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.blade.php b/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.blade.php index 0d8c228..b841a09 100644 --- a/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.blade.php +++ b/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.blade.php @@ -9,7 +9,7 @@
- @foreach(getCategoryProductBySetting($part->area_name . '_' . $part->part.'_category') as $product) + @foreach(getCategoryProductBySetting($part->area_name . '_' . $part->part.'_category',getSetting($part->area_name . '_' . $part->part.'_limit')) as $product)
diff --git a/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.js b/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.js index ed20603..5a7a5dd 100644 --- a/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.js +++ b/resources/views/segments/products/SamiraProductSlider/SamiraProductSlider.js @@ -2,6 +2,7 @@ import {tns} from "tiny-slider/src/tiny-slider"; var samSlider ; + document.addEventListener('DOMContentLoaded', () => { document.querySelectorAll('#samira-slider')?.forEach(function (el) { if (el.classList.contains('.tns-slider')){