diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml new file mode 100644 index 0000000..e46f7ac --- /dev/null +++ b/.github/workflows/laravel.yml @@ -0,0 +1,54 @@ +name: Laravel + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + laravel-tests: + + runs-on: ubuntu-latest + + steps: + - uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e + with: + php-version: '8.2' + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + - name: remove composer lock + run: rm composer.lock + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --ignore-platform-reqs + - name: Generate key + run: php artisan key:generate + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + - name: Create Database + run: | + mkdir -p database + touch database/database.sqlite + - name: Dataseeder + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: php artisan migrate --seed + - name: Npm install + run: npm install + - name: client build + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: php artisan client + - name: npm build + run: npm run build + - name: Execute tests (Unit and Feature tests) via PHPUnit + env: + DB_CONNECTION: sqlite + DB_DATABASE: database/database.sqlite + run: php artisan test diff --git a/README.md b/README.md index bef485a..9360590 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ ## Access to xShop/v1 > [!WARNING] -> xShop/v1 available here: https://github.com/a1Gard/xshop.v1 +> xShop/v1 available here: https://github.com/4xmen/xshop.v1 ## Installation diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php index c2801a1..d7cedae 100644 --- a/app/Helpers/Helper.php +++ b/app/Helpers/Helper.php @@ -816,25 +816,48 @@ function getGroupBySetting($key) } /** - * get group by setting key + * get menu by setting key * @param $key * @return Menu */ function getMenuBySetting($key) { + if (Menu::count() == 0) { + return []; + } return Menu::where('id', getSetting($key) ?? 1)->first(); } +/** + * get menu's items by setting key + * @param $key + * @return array + */ +function getMenuBySettingItems($key) +{ + if (Menu::count() == 0) { + return []; + } + $r = Menu::where('id', getSetting($key) ?? 1)->first(); + if ($r == null) { + $r = Menu::first(); + } + return $r->items; +} + /** * get group's posts by setting key * @param $key * @param integer $limit - * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C + * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C|array */ function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC") { - return Group::where('id', getSetting($key) ?? 1)->first() - ->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get(); + $g = Group::where('id', getSetting($key) ?? 1)->first(); + if ($g == null) { + return []; + } + return $g->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get(); } /** @@ -857,12 +880,15 @@ function getCategoryProductBySetting($key, $limit = 10, $order = 'id', $dir = "D * @param integer $limit * @param string $order * @param string $dir - * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C + * @return \App\Models\Post[]|\Illuminate\Database\Eloquent\Collection|\LaravelIdea\Helper\App\Models\_IH_Post_C | array */ function getCategorySubCatsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC") { - return Category::where('id', getSetting($key) ?? 1)->first() - ->children()->orderBy($order, $dir)->limit($limit)->get(); + $c = Category::where('id', getSetting($key) ?? 1)->first(); + if ($c == null) { + return []; + } + return $c->children()->orderBy($order, $dir)->limit($limit)->get(); } /** @@ -994,6 +1020,7 @@ function postsUrl() { return fixUrlLang(\route('client.posts')); } + /** * products url to best experience for multi lang shops * @return string @@ -1002,6 +1029,7 @@ function productsUrl() { return fixUrlLang(\route('client.products')); } + /** * clips url to best experience for multi lang shops * @return string @@ -1010,6 +1038,7 @@ function clipsUrl() { return fixUrlLang(\route('client.clips')); } + /** * galleries url to best experience for multi lang shops * @return string @@ -1018,6 +1047,7 @@ function gallariesUrl() { return fixUrlLang(\route('client.galleries')); } + /** * attachments url to best experience for multi lang shops * @return string @@ -1101,11 +1131,11 @@ function transports() */ function defTrannsport() { - if (\App\Models\Transport::where('is_default',1)->count() == 0){ + if (\App\Models\Transport::where('is_default', 1)->count() == 0) { return null; } - return \App\Models\Transport::where('is_default',1)->first()->id; + return \App\Models\Transport::where('is_default', 1)->first()->id; } @@ -1114,7 +1144,8 @@ function defTrannsport() * @param $array * @return false|string */ -function vueTranslate($array){ +function vueTranslate($array) +{ return json_encode($array); } @@ -1137,7 +1168,7 @@ function markUpBreadcrumbList($items) "name" => $index, ]; if ($item != '' || $item != null) { - $json[$i-1]['item'] = $item; + $json[$i - 1]['item'] = $item; } } @@ -1166,9 +1197,9 @@ RESULT; */ function fixUrlLang($url) { - if ( config('app.xlang.active') && app()->getLocale() != config('app.xlang.main')){ + if (config('app.xlang.active') && app()->getLocale() != config('app.xlang.main')) { $welcome = \route('client.welcome'); - return str_replace($welcome,$welcome .'/'.app()->getLocale(),$url); + return str_replace($welcome, $welcome . '/' . app()->getLocale(), $url); } return $url; } diff --git a/app/Helpers/TVisitor.php b/app/Helpers/TVisitor.php index 1b811aa..1e669da 100644 --- a/app/Helpers/TVisitor.php +++ b/app/Helpers/TVisitor.php @@ -44,7 +44,7 @@ class TVisitor { */ public static function DetectOS() { if (!isset($_SERVER['HTTP_USER_AGENT'])) - return 'Unknown'; + return null; $os_list = Visitor::$osList; @@ -54,7 +54,7 @@ class TVisitor { } } - return 'Unknown'; + return null; } /** @@ -118,7 +118,7 @@ class TVisitor { */ public static function DetectBrowser() { if (!isset($_SERVER['HTTP_USER_AGENT'])) - return 'Unknown'; + return null; $browser_list = Visitor::$browserList; @@ -128,7 +128,7 @@ class TVisitor { } } - return 'Other'; + return null; } /** diff --git a/app/Http/Controllers/Admin/AreaController.php b/app/Http/Controllers/Admin/AreaController.php index ec3a3c5..3f4b6b0 100644 --- a/app/Http/Controllers/Admin/AreaController.php +++ b/app/Http/Controllers/Admin/AreaController.php @@ -80,6 +80,11 @@ class AreaController extends Controller logAdmin(__METHOD__, __CLASS__, $area->id); + if ($request->has('use_default')){ + $area->use_default = 1; + $area->save(); + } + return redirect()->back()->with(['message' => __('area :NAME of website updated', ['NAME' => $area->name])]); } diff --git a/app/Http/Controllers/Admin/CategoryController.php b/app/Http/Controllers/Admin/CategoryController.php index fad4f4a..6438253 100644 --- a/app/Http/Controllers/Admin/CategoryController.php +++ b/app/Http/Controllers/Admin/CategoryController.php @@ -57,7 +57,9 @@ class CategoryController extends XController $category->name = $request->input('name'); $category->subtitle = $request->input('subtitle'); $category->description = $request->input('description'); - $category->parent_id = $request->input('parent_id'); + if ($category->parent_id != ''){ + $category->parent_id = $request->input('parent_id',null); + } $category->slug = $this->getSlug($category); if ($request->has('image')) { $category->image = $this->storeFile('image', $category, 'categories'); diff --git a/app/Http/Controllers/Admin/CustomerController.php b/app/Http/Controllers/Admin/CustomerController.php index 8bc85d0..b2afa2e 100644 --- a/app/Http/Controllers/Admin/CustomerController.php +++ b/app/Http/Controllers/Admin/CustomerController.php @@ -51,7 +51,7 @@ class CustomerController extends XController { $customer->name = $request->input('name'); - if ($customer->credit != $request->input('credit')){ + if ($customer->credit != $request->input('credit') && $customer->id != null){ $diff = $request->input('credit') - $customer->credit; $customer->credit = $request->input('credit')??0 ; $cr = new Credit(); diff --git a/app/Http/Controllers/Admin/GroupController.php b/app/Http/Controllers/Admin/GroupController.php index b1a9dc7..0d0f3d7 100644 --- a/app/Http/Controllers/Admin/GroupController.php +++ b/app/Http/Controllers/Admin/GroupController.php @@ -56,7 +56,9 @@ class GroupController extends XController $group->name = $request->input('name'); $group->subtitle = $request->input('subtitle'); $group->description = $request->input('description'); - $group->parent_id = $request->input('parent_id'); + if ($group->parent_id != ''){ + $group->parent_id = $request->input('parent_id',null); + } $group->slug = $this->getSlug($group); if ($request->has('image')){ $group->image = $this->storeFile('image',$group, 'groups'); diff --git a/database/migrations/2024_07_04_050212_create_areas_table.php b/database/migrations/2024_07_04_050212_create_areas_table.php index 2677a58..161657d 100644 --- a/database/migrations/2024_07_04_050212_create_areas_table.php +++ b/database/migrations/2024_07_04_050212_create_areas_table.php @@ -18,6 +18,7 @@ return new class extends Migration $table->string('icon')->nullable(); $table->json('valid_segments'); $table->string('preview')->nullable(); + $table->boolean('use_default')->default(true); $table->timestamps(); }); } diff --git a/database/seeders/AreaSeeder.php b/database/seeders/AreaSeeder.php index 4c2fa01..12c0013 100644 --- a/database/seeders/AreaSeeder.php +++ b/database/seeders/AreaSeeder.php @@ -33,6 +33,24 @@ class AreaSeeder extends Seeder 'preview' => null, 'icon' => 'ri-ai-generate', ], + [ + 'name' => 'default_header', + 'valid_segments' => json_encode( + ["top", "header", "other", "ads", "menu"] + ), + 'max' => 2, + 'preview' => null, + 'icon' => 'ri-window-line', + ], + [ + 'name' => 'default_footer', + 'valid_segments' => json_encode( + ["footer", "other", "ads" , "groups"] + ), + 'max' => 2, + 'preview' => null, + 'icon' => 'ri-window-line rotate-180', + ], [ 'name' => 'index', 'valid_segments' => json_encode( @@ -71,7 +89,7 @@ class AreaSeeder extends Seeder "parallax", "other", "clip", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-video-line', ], [ @@ -91,7 +109,7 @@ class AreaSeeder extends Seeder "parallax", "other", "gallery", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-image-line', ], [ @@ -111,7 +129,7 @@ class AreaSeeder extends Seeder "parallax", "other", "product", "comments", "ads", "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-vip-diamond-line', ], [ @@ -131,7 +149,7 @@ class AreaSeeder extends Seeder "parallax", "other", "attachment", "comments", "ads"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-attachment-line', ], [ @@ -171,7 +189,7 @@ class AreaSeeder extends Seeder "parallax", "other", "group", "ads", 'posts_page', "attachments"] ), 'max' => 6, - 'preview' => null, + 'preview' => null, 'icon' => 'ri-book-shelf-line', ], // [ @@ -201,7 +219,7 @@ class AreaSeeder extends Seeder "parallax", "other", "login", "ads"] ), 'max' => 6, - 'preview' => 'client.login', + 'preview' => 'client.sign-in', 'icon' => 'ri-login-circle-line', ], [ @@ -252,6 +270,9 @@ class AreaSeeder extends Seeder $a->valid_segments = $area['valid_segments']; $a->icon = $area['icon']; $a->preview = $area['preview']; + if ($area['name'] == 'index'){ + $a->use_default = false; + } $a->save(); } } diff --git a/database/seeders/PartSeeder.php b/database/seeders/PartSeeder.php index fa7b561..eca39b4 100644 --- a/database/seeders/PartSeeder.php +++ b/database/seeders/PartSeeder.php @@ -83,37 +83,43 @@ class PartSeeder extends Seeder // ------------------------------------------------------------- - + // default header and footer $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'card')->first()->id; + $part->segment = 'menu'; + $part->part = 'AplMenu'; + $part->area_id = Area::where('name', 'default_header')->first()->id; $part->sort = 0; $part->save(); + $part = new Part(); - $part->segment = 'card'; - $part->part = 'NsCard'; - $part->area_id = Area::where('name', 'card')->first()->id; - $part->sort = 1; + $part->segment = 'header'; + $part->part = 'SimpleHeader'; + $part->area_id = Area::where('name', 'default_header')->first()->id; + $part->sort = 0; $part->save(); $part = new Part(); $part->segment = 'footer'; $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'card')->first()->id; + $part->area_id = Area::where('name', 'default_footer')->first()->id; $part->sort = 2; $part->save(); // ------------------------------------------------------------- $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'products-list')->first()->id; - $part->sort = 0; + $part->segment = 'card'; + $part->part = 'NsCard'; + $part->area_id = Area::where('name', 'card')->first()->id; + $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + + + + $part = new Part(); $part->segment = 'products_page'; $part->part = 'ProductGridSidebar'; @@ -121,23 +127,12 @@ class PartSeeder extends Seeder $part->sort = 1; $part->save(); - $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'products-list')->first()->id; - $part->sort = 2; - $part->save(); + // ------------------------------------------------------------- - $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'product')->first()->id; - $part->sort = 0; - $part->save(); $part = new Part(); $part->segment = 'product'; @@ -146,60 +141,120 @@ class PartSeeder extends Seeder $part->sort = 1; $part->save(); + + + // ------------------------------------------------------------- + + + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'product')->first()->id; - $part->sort = 2; + $part->segment = 'posts_page'; + $part->part = 'GridPostListSidebar'; + $part->area_id = Area::where('name', 'posts-list')->first()->id; + $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + + $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; - $part->sort = 0; + $part->segment = 'post'; + $part->part = 'PostSidebar'; + $part->area_id = Area::where('name', 'post')->first()->id; + $part->sort = 1; $part->save(); + + + // ------------------------------------------------------------- + + $part = new Part(); - $part->segment = 'posts_page'; - $part->part = 'GridPostListSidebar'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; + $part->segment = 'clips_page'; + $part->part = 'ClipListGrid'; + $part->area_id = Area::where('name', 'clips-list')->first()->id; $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'posts-list')->first()->id; - $part->sort = 2; + $part->segment = 'clip'; + $part->part = 'DorClip'; + $part->area_id = Area::where('name', 'clip')->first()->id; + $part->sort = 1; $part->save(); // ------------------------------------------------------------- + $part = new Part(); + $part->segment = 'galleries_page'; + $part->part = 'GalleriesList'; + $part->area_id = Area::where('name', 'galleries-list')->first()->id; + $part->sort = 1; + $part->save(); + + + + // ------------------------------------------------------------- $part = new Part(); - $part->segment = 'header'; - $part->part = 'SimpleHeader'; - $part->area_id = Area::where('name', 'post')->first()->id; - $part->sort = 0; + $part->segment = 'gallery'; + $part->part = 'GallaryGrid'; + $part->area_id = Area::where('name', 'gallery')->first()->id; + $part->sort = 1; + $part->save(); + + + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'compare'; + $part->part = 'CompareProducts'; + $part->area_id = Area::where('name', 'compare')->first()->id; + $part->sort = 1; $part->save(); + + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'post'; - $part->part = 'PostSidebar'; - $part->area_id = Area::where('name', 'post')->first()->id; + $part->segment = 'login'; + $part->part = 'LoginPatternBg'; + $part->area_id = Area::where('name', 'login')->first()->id; $part->sort = 1; $part->save(); + // ------------------------------------------------------------- + $part = new Part(); - $part->segment = 'footer'; - $part->part = 'WaveFooter'; - $part->area_id = Area::where('name', 'post')->first()->id; - $part->sort = 2; + $part->segment = 'customer'; + $part->part = 'AvisaCustomer'; + $part->area_id = Area::where('name', 'customer')->first()->id; + $part->sort = 1; + $part->save(); + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'attachments_page'; + $part->part = 'DenaAttachList'; + $part->area_id = Area::where('name', 'attachments-list')->first()->id; + $part->sort = 1; + $part->save(); + + // ------------------------------------------------------------- + + $part = new Part(); + $part->segment = 'attachment'; + $part->part = 'AttachmentWithPreview'; + $part->area_id = Area::where('name', 'attachment')->first()->id; + $part->sort = 1; $part->save(); diff --git a/resources/js/client.js b/resources/js/client.js index 082c06e..cbdbc41 100644 --- a/resources/js/client.js +++ b/resources/js/client.js @@ -14,24 +14,26 @@ import "./client-custom/windowLoader.js"; import "../views/segments/preloader/PreloaderCircle/PreloaderCircle.js"; import "../views/segments/menu/RecetMenu/RecetMenu.js"; import "../views/segments/slider/SliderSimple/SliderSimple.js"; +import "../views/segments/products/LatestProducts/LatestProducts.js"; import "../views/segments/posts/PostsIconSimple/PostsIconSimple.js"; import "../views/segments/index/CounterGrid/CounterGrid.js"; import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks.js"; import "../views/segments/posts/PostIndexImage/PostIndexImage.js"; import "../views/segments/footer/WaveFooter/WaveFooter.js"; +import "../views/segments/menu/AplMenu/AplMenu.js"; import "../views/segments/header/SimpleHeader/SimpleHeader.js"; -import "../views/segments/card/NsCard/NsCard.js"; import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; +import "../views/segments/card/NsCard/NsCard.js"; import "../views/segments/products_page/ProductGridSidebar/ProductGridSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/product/ProductKaren/ProductKaren.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/header/SimpleHeader/SimpleHeader.js"; import "../views/segments/post/PostSidebar/PostSidebar.js"; -import "../views/segments/footer/WaveFooter/WaveFooter.js"; -import "../views/segments/products/LatestProducts/LatestProducts.js"; +import "../views/segments/clips_page/ClipListGrid/ClipListGrid.js"; +import "../views/segments/clip/DorClip/DorClip.js"; +import "../views/segments/galleries_page/GalleriesList/GalleriesList.js"; +import "../views/segments/gallery/GallaryGrid/GallaryGrid.js"; +import "../views/segments/compare/CompareProducts/CompareProducts.js"; +import "../views/segments/login/LoginPatternBg/LoginPatternBg.js"; +import "../views/segments/customer/AvisaCustomer/AvisaCustomer.js"; +import "../views/segments/attachments_page/DenaAttachList/DenaAttachList.js"; +import "../views/segments/attachment/AttachmentWithPreview/AttachmentWithPreview.js"; diff --git a/resources/sass/client.scss b/resources/sass/client.scss index a56f232..ed562ca 100644 --- a/resources/sass/client.scss +++ b/resources/sass/client.scss @@ -25,24 +25,26 @@ $xshop-shadow:2px 2px 4px #777777; @import "../views/segments/preloader/PreloaderCircle/PreloaderCircle"; @import "../views/segments/menu/RecetMenu/RecetMenu"; @import "../views/segments/slider/SliderSimple/SliderSimple"; +@import "../views/segments/products/LatestProducts/LatestProducts"; @import "../views/segments/posts/PostsIconSimple/PostsIconSimple"; @import "../views/segments/index/CounterGrid/CounterGrid"; @import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks"; @import "../views/segments/posts/PostIndexImage/PostIndexImage"; @import "../views/segments/footer/WaveFooter/WaveFooter"; +@import "../views/segments/menu/AplMenu/AplMenu"; @import "../views/segments/header/SimpleHeader/SimpleHeader"; -@import "../views/segments/card/NsCard/NsCard"; @import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; +@import "../views/segments/card/NsCard/NsCard"; @import "../views/segments/products_page/ProductGridSidebar/ProductGridSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/product/ProductKaren/ProductKaren"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/posts_page/GridPostListSidebar/GridPostListSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/post/PostSidebar/PostSidebar"; -@import "../views/segments/footer/WaveFooter/WaveFooter"; -@import "../views/segments/products/LatestProducts/LatestProducts"; +@import "../views/segments/clips_page/ClipListGrid/ClipListGrid"; +@import "../views/segments/clip/DorClip/DorClip"; +@import "../views/segments/galleries_page/GalleriesList/GalleriesList"; +@import "../views/segments/gallery/GallaryGrid/GallaryGrid"; +@import "../views/segments/compare/CompareProducts/CompareProducts"; +@import "../views/segments/login/LoginPatternBg/LoginPatternBg"; +@import "../views/segments/customer/AvisaCustomer/AvisaCustomer"; +@import "../views/segments/attachments_page/DenaAttachList/DenaAttachList"; +@import "../views/segments/attachment/AttachmentWithPreview/AttachmentWithPreview"; diff --git a/resources/views/admin/areas/area-design.blade.php b/resources/views/admin/areas/area-design.blade.php index 2e34936..71e3347 100644 --- a/resources/views/admin/areas/area-design.blade.php +++ b/resources/views/admin/areas/area-design.blade.php @@ -14,6 +14,16 @@ {{__("Design :AREA",['AREA' => $area->name])}} + @if(strpos($area->name,'default') !== 0 ) + +
+ +
+ use_default) checked @endif type="checkbox" id="use_default"> + +
+
+ @endif get())' diff --git a/resources/views/client/category.blade.php b/resources/views/client/category.blade.php index 458e0d4..c19c860 100644 --- a/resources/views/client/category.blade.php +++ b/resources/views/client/category.blade.php @@ -10,9 +10,21 @@ if ($category->bg != null){ @endphp @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/default-list.blade.php b/resources/views/client/default-list.blade.php index e31f1c2..887eea9 100644 --- a/resources/views/client/default-list.blade.php +++ b/resources/views/client/default-list.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/gallery.blade.php b/resources/views/client/gallery.blade.php index b5536e2..610fc06 100644 --- a/resources/views/client/gallery.blade.php +++ b/resources/views/client/gallery.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData($gallery)) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/group.blade.php b/resources/views/client/group.blade.php index a181eb5..52a42d8 100644 --- a/resources/views/client/group.blade.php +++ b/resources/views/client/group.blade.php @@ -10,9 +10,21 @@ if ($group->bg != null){ @endphp @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/client/post.blade.php b/resources/views/client/post.blade.php index 81b78e0..7f1e2bc 100644 --- a/resources/views/client/post.blade.php +++ b/resources/views/client/post.blade.php @@ -5,10 +5,20 @@ {{$post->title}} - {{config('app.name')}} @endsection @section('content') -
+ @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData($post)) + @php($p = $part->getBladeWithData()) @include($p['blade'],['data' => $p['data']]) @endforeach -
+ @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif @endsection diff --git a/resources/views/client/welcome.blade.php b/resources/views/client/welcome.blade.php index d35ed59..376aa96 100644 --- a/resources/views/client/welcome.blade.php +++ b/resources/views/client/welcome.blade.php @@ -5,9 +5,21 @@ @endsection @section('content')
- @foreach(getParts($area) as $part) - @php($p = $part->getBladeWithData()) - @include($p['blade'],['data' => $p['data']]) - @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_header') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif + @foreach(getParts($area) as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @if(\App\Models\Area::where('name',$area)->first()->use_default) + @foreach(getParts('default_footer') as $part) + @php($p = $part->getBladeWithData()) + @include($p['blade'],['data' => $p['data']]) + @endforeach + @endif
@endsection diff --git a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php index b2bd50d..73df08b 100644 --- a/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php +++ b/resources/views/segments/attachments_page/DenaAttachList/DenaAttachList.php @@ -13,7 +13,7 @@ class DenaAttachList $setting->section = 'theme'; $setting->key = $part->area->name . '_' . $part->part.'_title'; $setting->value = __("Website attachments list").' [ pdf, docx, zip, png, jpg, svg, mp4, rar, mp3 ]'; - $setting->type = 'text'; + $setting->type = 'TEXT'; $setting->size = 6; $setting->title = $part->area->name . ' ' . $part->part; $setting->save(); diff --git a/resources/views/segments/menu/AplMenu/AplMenu.blade.php b/resources/views/segments/menu/AplMenu/AplMenu.blade.php index 4fb6eae..9955c99 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.blade.php +++ b/resources/views/segments/menu/AplMenu/AplMenu.blade.php @@ -7,7 +7,7 @@ - @foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) + @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
  • @if($item->meta == null) diff --git a/resources/views/segments/menu/AplMenu/AplMenu.scss b/resources/views/segments/menu/AplMenu/AplMenu.scss index 9bc78f1..470452f 100644 --- a/resources/views/segments/menu/AplMenu/AplMenu.scss +++ b/resources/views/segments/menu/AplMenu/AplMenu.scss @@ -1,6 +1,3 @@ -main{ - padding-top: 47px; -} #AplMenu { position: fixed; left: 0; @@ -149,4 +146,8 @@ main{ } } } + + ~header{ + margin-top: 44px; + } } diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php index bdd629d..31696be 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.blade.php @@ -5,7 +5,7 @@
  • - @foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) + @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
  • {{$item->title}} diff --git a/resources/views/segments/menu/RecetMenu/RecetMenu.scss b/resources/views/segments/menu/RecetMenu/RecetMenu.scss index 93f18ed..58dc2a8 100644 --- a/resources/views/segments/menu/RecetMenu/RecetMenu.scss +++ b/resources/views/segments/menu/RecetMenu/RecetMenu.scss @@ -1,5 +1,4 @@ #RecetMenu { - // scss position: fixed; inset-inline-start: 1rem; inset-inline-end: 1rem; diff --git a/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php b/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php index 20979c5..7da1696 100644 --- a/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php +++ b/resources/views/segments/posts/PostIndexImage/PostIndexImage.blade.php @@ -1,12 +1,12 @@

    - - {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->name}} + + {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->name}}

    - {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->description}} + {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->description}}

    @foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',4) as $post ) @@ -28,7 +28,7 @@ @endforeach
    diff --git a/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php b/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php index 2917c64..bf0bcf7 100755 --- a/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php +++ b/resources/views/segments/posts/PostsIconSimple/PostsIconSimple.blade.php @@ -1,12 +1,12 @@

    - - {{getGroupBySetting($data->area->name.'_'.$data->part)->name}} + + {{getGroupBySetting($data->area->name.'_'.$data->part)?->name}}

    - {{getGroupBySetting($data->area->name.'_'.$data->part)->description}} + {{getGroupBySetting($data->area->name.'_'.$data->part)?->description}}

    @foreach(getGroupPostsBySetting($data->area->name.'_'.$data->part, getSetting($data->area->name.'_'.$data->part.'_limit')) as $post) @@ -20,7 +20,7 @@ {{$post->subtitle}}

    - + {{__("Read more")}}
    diff --git a/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php b/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php index 71bba0d..52a5775 100644 --- a/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php +++ b/resources/views/segments/posts_page/GridPostList/GridPostList.blade.php @@ -1,5 +1,6 @@
    + @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
    @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
    @@ -24,6 +25,7 @@ @endforeach

    + @endif
    diff --git a/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php b/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php index 75b5861..49c79e2 100644 --- a/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php +++ b/resources/views/segments/posts_page/GridPostListSidebar/GridPostListSidebar.blade.php @@ -1,5 +1,6 @@
    + @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
    @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
    @@ -24,6 +25,7 @@ @endforeach

    + @endif
    @if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
    diff --git a/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php b/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php index f3c4093..c4b0ec3 100644 --- a/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php +++ b/resources/views/segments/posts_page/SimplePostList/SimplePostList.blade.php @@ -1,5 +1,6 @@
    + @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
    @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
    @@ -24,6 +25,7 @@ @endforeach

    + @endif @foreach($posts as $post)
    {{$post->title}} diff --git a/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php b/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php index cc2f27c..de47d18 100644 --- a/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php +++ b/resources/views/segments/posts_page/SimplePostListSideBar/SimplePostListSideBar.blade.php @@ -1,27 +1,29 @@
    - @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) -
    -
    -
    - {{$post->mainGroup->name}} -
    - - {{$post->title}} - -
    -

    - {{$post->title}} -

    - + @if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 ) + @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) +
    +
    +
    + {{$post->mainGroup->name}} +
    + + {{$post->title}} + +
    +

    + {{$post->title}} +

    + {{$post->created_at->ldate('Y/m/d l')}} +
    -
    - @endforeach + @endforeach + @endif

    diff --git a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php index c115265..a3a311d 100644 --- a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php +++ b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.blade.php @@ -4,14 +4,14 @@
    -
    +
    {!! $slider->body !!}

    {{$slider->dataz['index_ParallaxSlider_subtitle']}}
    + href="{{fixUrlLang($slider->dataz['index_ParallaxSlider_link'])}}"> {{$slider->dataz['index_ParallaxSlider_btn']}}

    diff --git a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss index ae64ba6..dd0211d 100644 --- a/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss +++ b/resources/views/segments/slider/ParallaxSlider/ParallaxSlider.scss @@ -1,5 +1,10 @@ #ParallaxSlider { + .tns-inner{ + direction: ltr; + } + + #ParallaxSliderTns > div{ position: relative; overflow: hidden; diff --git a/routes/web.php b/routes/web.php index 9775cb8..e473677 100644 --- a/routes/web.php +++ b/routes/web.php @@ -357,7 +357,7 @@ Route::prefix(config('app.panel.prefix'))->name('admin.')->group( }); -Route::get('theme/variable.css', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css'); +Route::get('/theme/variable', [\App\Http\Controllers\ThemeController::class, 'cssVariables'])->name('theme.variable.css'); Route::middleware([\App\Http\Middleware\VisitorCounter::class]) ->name('client.')->group(function () { diff --git a/tests/Feature/ClientWebPagesTest.php b/tests/Feature/ClientWebPagesTest.php new file mode 100644 index 0000000..d404ff8 --- /dev/null +++ b/tests/Feature/ClientWebPagesTest.php @@ -0,0 +1,75 @@ +get(route('client.welcome')); + + $response->assertStatus(200); + } + + public function test_web_client_posts(): void + { + $response = $this->get(route('client.posts')); + + $response->assertStatus(200); + } + + public function test_web_client_products(): void + { + $response = $this->get(route('client.products')); + + $response->assertStatus(200); + } + + public function test_web_client_product(): void + { + + if (Product::count() == 0) { + Product::factory(1)->create(); + } + $response = $this->get(Product::first()->webUrl()); + $response->assertStatus(200); + } + + public function test_web_client_post(): void + { + + if (Post::count() == 0) { + Post::factory(1)->create(); + } + $response = $this->get(Post::first()->webUrl()); + $response->assertStatus(200); + } + + public function test_web_client_group(): void + { + + if (Group::count() == 0) { + Group::factory(1)->create(); + } + $response = $this->get(Group::first()->webUrl()); + $response->assertStatus(200); + } + public function test_web_client_category(): void + { + + if (Category::count() == 0) { + Category::factory(1)->create(); + } + $response = $this->get(Category::first()->webUrl()); + $response->assertStatus(200); + } +} diff --git a/tests/Feature/CustomerTest.php b/tests/Feature/CustomerTest.php new file mode 100644 index 0000000..5843d93 --- /dev/null +++ b/tests/Feature/CustomerTest.php @@ -0,0 +1,29 @@ +create(); + } + } + /** + * A basic feature test example. + */ + public function test_customer_profile(): void + { + + $this->check(); + $response = $this->actingAs(Customer::inRandomOrder()->first(),'customer')->get(route('client.profile')); + + $response->assertStatus(200); + } +} diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index 8364a84..bf9ba1d 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -3,17 +3,22 @@ namespace Tests\Feature; // use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Foundation\Testing\RefreshDatabase; +use Illuminate\Support\Facades\Log; use Tests\TestCase; class ExampleTest extends TestCase { + /** * A basic test example. */ public function test_the_application_returns_a_successful_response(): void { - $response = $this->get('/'); + + $response = $this->get(route('client.welcome')); $response->assertStatus(200); + } } diff --git a/tests/Feature/SiteMapTest.php b/tests/Feature/SiteMapTest.php new file mode 100644 index 0000000..5d8e7ff --- /dev/null +++ b/tests/Feature/SiteMapTest.php @@ -0,0 +1,20 @@ +get(route('sitemap')); + + $response->assertStatus(200); + } +} diff --git a/tests/Unit/ExampleTest.php b/tests/Unit/SampleTest.php similarity index 52% rename from tests/Unit/ExampleTest.php rename to tests/Unit/SampleTest.php index 5773b0c..9e2b25e 100644 --- a/tests/Unit/ExampleTest.php +++ b/tests/Unit/SampleTest.php @@ -4,12 +4,12 @@ namespace Tests\Unit; use PHPUnit\Framework\TestCase; -class ExampleTest extends TestCase +class SampleTest extends TestCase { /** - * A basic test example. + * A basic unit test example. */ - public function test_that_true_is_true(): void + public function test_example(): void { $this->assertTrue(true); }