Merge remote-tracking branch 'origin/master'

pull/49/head
sadeghpm 3 months ago
commit bdf3ef01a2

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

@ -20,7 +20,7 @@
## Access to xShop/v1 ## Access to xShop/v1
> [!WARNING] > [!WARNING]
> xShop/v1 available here: <a href="https://github.com/a1Gard/xshop.v1">https://github.com/a1Gard/xshop.v1</a> > xShop/v1 available here: <a href="https://github.com/4xmen/xshop.v1">https://github.com/4xmen/xshop.v1</a>
## Installation ## Installation

@ -816,25 +816,48 @@ function getGroupBySetting($key)
} }
/** /**
* get group by setting key * get menu by setting key
* @param $key * @param $key
* @return Menu * @return Menu
*/ */
function getMenuBySetting($key) function getMenuBySetting($key)
{ {
if (Menu::count() == 0) {
return [];
}
return Menu::where('id', getSetting($key) ?? 1)->first(); 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 * get group's posts by setting key
* @param $key * @param $key
* @param integer $limit * @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") function getGroupPostsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
{ {
return Group::where('id', getSetting($key) ?? 1)->first() $g = Group::where('id', getSetting($key) ?? 1)->first();
->posts()->where('status', 1)->orderBy($order, $dir)->limit($limit)->get(); 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 integer $limit
* @param string $order * @param string $order
* @param string $dir * @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") function getCategorySubCatsBySetting($key, $limit = 10, $order = 'id', $dir = "DESC")
{ {
return Category::where('id', getSetting($key) ?? 1)->first() $c = Category::where('id', getSetting($key) ?? 1)->first();
->children()->orderBy($order, $dir)->limit($limit)->get(); if ($c == null) {
return [];
}
return $c->children()->orderBy($order, $dir)->limit($limit)->get();
} }
/** /**
@ -994,6 +1020,7 @@ function postsUrl()
{ {
return fixUrlLang(\route('client.posts')); return fixUrlLang(\route('client.posts'));
} }
/** /**
* products url to best experience for multi lang shops * products url to best experience for multi lang shops
* @return string * @return string
@ -1002,6 +1029,7 @@ function productsUrl()
{ {
return fixUrlLang(\route('client.products')); return fixUrlLang(\route('client.products'));
} }
/** /**
* clips url to best experience for multi lang shops * clips url to best experience for multi lang shops
* @return string * @return string
@ -1010,6 +1038,7 @@ function clipsUrl()
{ {
return fixUrlLang(\route('client.clips')); return fixUrlLang(\route('client.clips'));
} }
/** /**
* galleries url to best experience for multi lang shops * galleries url to best experience for multi lang shops
* @return string * @return string
@ -1018,6 +1047,7 @@ function gallariesUrl()
{ {
return fixUrlLang(\route('client.galleries')); return fixUrlLang(\route('client.galleries'));
} }
/** /**
* attachments url to best experience for multi lang shops * attachments url to best experience for multi lang shops
* @return string * @return string
@ -1114,7 +1144,8 @@ function defTrannsport()
* @param $array * @param $array
* @return false|string * @return false|string
*/ */
function vueTranslate($array){ function vueTranslate($array)
{
return json_encode($array); return json_encode($array);
} }

@ -44,7 +44,7 @@ class TVisitor {
*/ */
public static function DetectOS() { public static function DetectOS() {
if (!isset($_SERVER['HTTP_USER_AGENT'])) if (!isset($_SERVER['HTTP_USER_AGENT']))
return 'Unknown'; return null;
$os_list = Visitor::$osList; $os_list = Visitor::$osList;
@ -54,7 +54,7 @@ class TVisitor {
} }
} }
return 'Unknown'; return null;
} }
/** /**
@ -118,7 +118,7 @@ class TVisitor {
*/ */
public static function DetectBrowser() { public static function DetectBrowser() {
if (!isset($_SERVER['HTTP_USER_AGENT'])) if (!isset($_SERVER['HTTP_USER_AGENT']))
return 'Unknown'; return null;
$browser_list = Visitor::$browserList; $browser_list = Visitor::$browserList;
@ -128,7 +128,7 @@ class TVisitor {
} }
} }
return 'Other'; return null;
} }
/** /**

@ -80,6 +80,11 @@ class AreaController extends Controller
logAdmin(__METHOD__, __CLASS__, $area->id); 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])]); return redirect()->back()->with(['message' => __('area :NAME of website updated', ['NAME' => $area->name])]);
} }

@ -57,7 +57,9 @@ class CategoryController extends XController
$category->name = $request->input('name'); $category->name = $request->input('name');
$category->subtitle = $request->input('subtitle'); $category->subtitle = $request->input('subtitle');
$category->description = $request->input('description'); $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); $category->slug = $this->getSlug($category);
if ($request->has('image')) { if ($request->has('image')) {
$category->image = $this->storeFile('image', $category, 'categories'); $category->image = $this->storeFile('image', $category, 'categories');

@ -51,7 +51,7 @@ class CustomerController extends XController
{ {
$customer->name = $request->input('name'); $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; $diff = $request->input('credit') - $customer->credit;
$customer->credit = $request->input('credit')??0 ; $customer->credit = $request->input('credit')??0 ;
$cr = new Credit(); $cr = new Credit();

@ -56,7 +56,9 @@ class GroupController extends XController
$group->name = $request->input('name'); $group->name = $request->input('name');
$group->subtitle = $request->input('subtitle'); $group->subtitle = $request->input('subtitle');
$group->description = $request->input('description'); $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); $group->slug = $this->getSlug($group);
if ($request->has('image')){ if ($request->has('image')){
$group->image = $this->storeFile('image',$group, 'groups'); $group->image = $this->storeFile('image',$group, 'groups');

@ -18,6 +18,7 @@ return new class extends Migration
$table->string('icon')->nullable(); $table->string('icon')->nullable();
$table->json('valid_segments'); $table->json('valid_segments');
$table->string('preview')->nullable(); $table->string('preview')->nullable();
$table->boolean('use_default')->default(true);
$table->timestamps(); $table->timestamps();
}); });
} }

@ -33,6 +33,24 @@ class AreaSeeder extends Seeder
'preview' => null, 'preview' => null,
'icon' => 'ri-ai-generate', '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', 'name' => 'index',
'valid_segments' => json_encode( 'valid_segments' => json_encode(
@ -201,7 +219,7 @@ class AreaSeeder extends Seeder
"parallax", "other", "login", "ads"] "parallax", "other", "login", "ads"]
), ),
'max' => 6, 'max' => 6,
'preview' => 'client.login', 'preview' => 'client.sign-in',
'icon' => 'ri-login-circle-line', 'icon' => 'ri-login-circle-line',
], ],
[ [
@ -252,6 +270,9 @@ class AreaSeeder extends Seeder
$a->valid_segments = $area['valid_segments']; $a->valid_segments = $area['valid_segments'];
$a->icon = $area['icon']; $a->icon = $area['icon'];
$a->preview = $area['preview']; $a->preview = $area['preview'];
if ($area['name'] == 'index'){
$a->use_default = false;
}
$a->save(); $a->save();
} }
} }

@ -83,37 +83,43 @@ class PartSeeder extends Seeder
// ------------------------------------------------------------- // -------------------------------------------------------------
// default header and footer
$part = new Part(); $part = new Part();
$part->segment = 'header'; $part->segment = 'menu';
$part->part = 'SimpleHeader'; $part->part = 'AplMenu';
$part->area_id = Area::where('name', 'card')->first()->id; $part->area_id = Area::where('name', 'default_header')->first()->id;
$part->sort = 0; $part->sort = 0;
$part->save(); $part->save();
$part = new Part(); $part = new Part();
$part->segment = 'card'; $part->segment = 'header';
$part->part = 'NsCard'; $part->part = 'SimpleHeader';
$part->area_id = Area::where('name', 'card')->first()->id; $part->area_id = Area::where('name', 'default_header')->first()->id;
$part->sort = 1; $part->sort = 0;
$part->save(); $part->save();
$part = new Part(); $part = new Part();
$part->segment = 'footer'; $part->segment = 'footer';
$part->part = 'WaveFooter'; $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->sort = 2;
$part->save(); $part->save();
// ------------------------------------------------------------- // -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'header'; $part->segment = 'card';
$part->part = 'SimpleHeader'; $part->part = 'NsCard';
$part->area_id = Area::where('name', 'products-list')->first()->id; $part->area_id = Area::where('name', 'card')->first()->id;
$part->sort = 0; $part->sort = 1;
$part->save(); $part->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'products_page'; $part->segment = 'products_page';
$part->part = 'ProductGridSidebar'; $part->part = 'ProductGridSidebar';
@ -121,23 +127,12 @@ class PartSeeder extends Seeder
$part->sort = 1; $part->sort = 1;
$part->save(); $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 = new Part();
$part->segment = 'product'; $part->segment = 'product';
@ -146,60 +141,120 @@ class PartSeeder extends Seeder
$part->sort = 1; $part->sort = 1;
$part->save(); $part->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'footer'; $part->segment = 'posts_page';
$part->part = 'WaveFooter'; $part->part = 'GridPostListSidebar';
$part->area_id = Area::where('name', 'product')->first()->id; $part->area_id = Area::where('name', 'posts-list')->first()->id;
$part->sort = 2; $part->sort = 1;
$part->save(); $part->save();
// ------------------------------------------------------------- // -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'header'; $part->segment = 'post';
$part->part = 'SimpleHeader'; $part->part = 'PostSidebar';
$part->area_id = Area::where('name', 'posts-list')->first()->id; $part->area_id = Area::where('name', 'post')->first()->id;
$part->sort = 0; $part->sort = 1;
$part->save(); $part->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'posts_page'; $part->segment = 'clips_page';
$part->part = 'GridPostListSidebar'; $part->part = 'ClipListGrid';
$part->area_id = Area::where('name', 'posts-list')->first()->id; $part->area_id = Area::where('name', 'clips-list')->first()->id;
$part->sort = 1; $part->sort = 1;
$part->save(); $part->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'footer'; $part->segment = 'clip';
$part->part = 'WaveFooter'; $part->part = 'DorClip';
$part->area_id = Area::where('name', 'posts-list')->first()->id; $part->area_id = Area::where('name', 'clip')->first()->id;
$part->sort = 2; $part->sort = 1;
$part->save(); $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 = new Part();
$part->segment = 'header'; $part->segment = 'gallery';
$part->part = 'SimpleHeader'; $part->part = 'GallaryGrid';
$part->area_id = Area::where('name', 'post')->first()->id; $part->area_id = Area::where('name', 'gallery')->first()->id;
$part->sort = 0; $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->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'post'; $part->segment = 'login';
$part->part = 'PostSidebar'; $part->part = 'LoginPatternBg';
$part->area_id = Area::where('name', 'post')->first()->id; $part->area_id = Area::where('name', 'login')->first()->id;
$part->sort = 1; $part->sort = 1;
$part->save(); $part->save();
// -------------------------------------------------------------
$part = new Part(); $part = new Part();
$part->segment = 'footer'; $part->segment = 'customer';
$part->part = 'WaveFooter'; $part->part = 'AvisaCustomer';
$part->area_id = Area::where('name', 'post')->first()->id; $part->area_id = Area::where('name', 'customer')->first()->id;
$part->sort = 2; $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(); $part->save();

@ -14,24 +14,26 @@ import "./client-custom/windowLoader.js";
import "../views/segments/preloader/PreloaderCircle/PreloaderCircle.js"; import "../views/segments/preloader/PreloaderCircle/PreloaderCircle.js";
import "../views/segments/menu/RecetMenu/RecetMenu.js"; import "../views/segments/menu/RecetMenu/RecetMenu.js";
import "../views/segments/slider/SliderSimple/SliderSimple.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/posts/PostsIconSimple/PostsIconSimple.js";
import "../views/segments/index/CounterGrid/CounterGrid.js"; import "../views/segments/index/CounterGrid/CounterGrid.js";
import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks.js"; import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks.js";
import "../views/segments/posts/PostIndexImage/PostIndexImage.js"; import "../views/segments/posts/PostIndexImage/PostIndexImage.js";
import "../views/segments/footer/WaveFooter/WaveFooter.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/header/SimpleHeader/SimpleHeader.js";
import "../views/segments/card/NsCard/NsCard.js";
import "../views/segments/footer/WaveFooter/WaveFooter.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/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/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/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/post/PostSidebar/PostSidebar.js";
import "../views/segments/footer/WaveFooter/WaveFooter.js"; import "../views/segments/clips_page/ClipListGrid/ClipListGrid.js";
import "../views/segments/products/LatestProducts/LatestProducts.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";

@ -25,24 +25,26 @@ $xshop-shadow:2px 2px 4px #777777;
@import "../views/segments/preloader/PreloaderCircle/PreloaderCircle"; @import "../views/segments/preloader/PreloaderCircle/PreloaderCircle";
@import "../views/segments/menu/RecetMenu/RecetMenu"; @import "../views/segments/menu/RecetMenu/RecetMenu";
@import "../views/segments/slider/SliderSimple/SliderSimple"; @import "../views/segments/slider/SliderSimple/SliderSimple";
@import "../views/segments/products/LatestProducts/LatestProducts";
@import "../views/segments/posts/PostsIconSimple/PostsIconSimple"; @import "../views/segments/posts/PostsIconSimple/PostsIconSimple";
@import "../views/segments/index/CounterGrid/CounterGrid"; @import "../views/segments/index/CounterGrid/CounterGrid";
@import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks"; @import "../views/segments/categories/CategoriesFavImageLinks/CategoriesFavImageLinks";
@import "../views/segments/posts/PostIndexImage/PostIndexImage"; @import "../views/segments/posts/PostIndexImage/PostIndexImage";
@import "../views/segments/footer/WaveFooter/WaveFooter"; @import "../views/segments/footer/WaveFooter/WaveFooter";
@import "../views/segments/menu/AplMenu/AplMenu";
@import "../views/segments/header/SimpleHeader/SimpleHeader"; @import "../views/segments/header/SimpleHeader/SimpleHeader";
@import "../views/segments/card/NsCard/NsCard";
@import "../views/segments/footer/WaveFooter/WaveFooter"; @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/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/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/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/post/PostSidebar/PostSidebar";
@import "../views/segments/footer/WaveFooter/WaveFooter"; @import "../views/segments/clips_page/ClipListGrid/ClipListGrid";
@import "../views/segments/products/LatestProducts/LatestProducts"; @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";

@ -14,6 +14,16 @@
{{__("Design :AREA",['AREA' => $area->name])}} <i class="{{$area->icon}}"></i> {{__("Design :AREA",['AREA' => $area->name])}} <i class="{{$area->icon}}"></i>
</h1> </h1>
@if(strpos($area->name,'default') !== 0 )
<div class="form-group p-3">
<div class="form-check form-switch">
<input value="1" class="form-check-input @error('use_default') is-invalid @enderror" name="use_default" @if( isset($area) && $area->use_default) checked @endif type="checkbox" id="use_default">
<label class="form-check-label" for="use_default"> {{__('Use default')}}</label>
</div>
</div>
@endif
<area-designer <area-designer
image-link="{{route('admin.area.image',['',''])}}" image-link="{{route('admin.area.image',['',''])}}"
:parts='@json($area->parts()->orderBy('sort')->get())' :parts='@json($area->parts()->orderBy('sort')->get())'

@ -10,9 +10,21 @@ if ($category->bg != null){
@endphp @endphp
@section('content') @section('content')
<main> <main>
@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) @foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData()) @php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']]) @include($p['blade'],['data' => $p['data']])
@endforeach @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
</main> </main>
@endsection @endsection

@ -5,9 +5,21 @@
@endsection @endsection
@section('content') @section('content')
<main> <main>
@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) @foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData()) @php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']]) @include($p['blade'],['data' => $p['data']])
@endforeach @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
</main> </main>
@endsection @endsection

@ -5,9 +5,21 @@
@endsection @endsection
@section('content') @section('content')
<main> <main>
@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) @foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData($gallery)) @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']]) @include($p['blade'],['data' => $p['data']])
@endforeach @endforeach
@endif
</main> </main>
@endsection @endsection

@ -10,9 +10,21 @@ if ($group->bg != null){
@endphp @endphp
@section('content') @section('content')
<main> <main>
@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) @foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData()) @php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']]) @include($p['blade'],['data' => $p['data']])
@endforeach @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
</main> </main>
@endsection @endsection

@ -5,10 +5,20 @@
{{$post->title}} - {{config('app.name')}} {{$post->title}} - {{config('app.name')}}
@endsection @endsection
@section('content') @section('content')
<main> @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) @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']]) @include($p['blade'],['data' => $p['data']])
@endforeach @endforeach
</main> @endif
@endsection @endsection

@ -5,9 +5,21 @@
@endsection @endsection
@section('content') @section('content')
<main> <main>
@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) @foreach(getParts($area) as $part)
@php($p = $part->getBladeWithData()) @php($p = $part->getBladeWithData())
@include($p['blade'],['data' => $p['data']]) @include($p['blade'],['data' => $p['data']])
@endforeach @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
</main> </main>
@endsection @endsection

@ -13,7 +13,7 @@ class DenaAttachList
$setting->section = 'theme'; $setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_title'; $setting->key = $part->area->name . '_' . $part->part.'_title';
$setting->value = __("Website attachments list").' [ pdf, docx, zip, png, jpg, svg, mp4, rar, mp3 ]'; $setting->value = __("Website attachments list").' [ pdf, docx, zip, png, jpg, svg, mp4, rar, mp3 ]';
$setting->type = 'text'; $setting->type = 'TEXT';
$setting->size = 6; $setting->size = 6;
$setting->title = $part->area->name . ' ' . $part->part; $setting->title = $part->area->name . ' ' . $part->part;
$setting->save(); $setting->save();

@ -7,7 +7,7 @@
</a> </a>
</li> </li>
@foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
<li> <li>
@if($item->meta == null) @if($item->meta == null)
<a href="{{$item->webUrl()}}"> <a href="{{$item->webUrl()}}">

@ -1,6 +1,3 @@
main{
padding-top: 47px;
}
#AplMenu { #AplMenu {
position: fixed; position: fixed;
left: 0; left: 0;
@ -149,4 +146,8 @@ main{
} }
} }
} }
~header{
margin-top: 44px;
}
} }

@ -5,7 +5,7 @@
<i class="ri-menu-line"></i> <i class="ri-menu-line"></i>
</a> </a>
</li> </li>
@foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item) @foreach(getMenuBySettingItems($data->area->name.'_'.$data->part.'_menu') as $item)
<li> <li>
<a href="{{$item->webUrl()}}"> <a href="{{$item->webUrl()}}">
{{$item->title}} {{$item->title}}

@ -1,5 +1,4 @@
#RecetMenu { #RecetMenu {
// scss
position: fixed; position: fixed;
inset-inline-start: 1rem; inset-inline-start: 1rem;
inset-inline-end: 1rem; inset-inline-end: 1rem;

@ -1,12 +1,12 @@
<section class='PostIndexImage'> <section class='PostIndexImage'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
<h1> <h1>
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->webUrl()}}"> <a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->name}} {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->name}}
</a> </a>
</h1> </h1>
<p class="text-muted"> <p class="text-muted">
{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->description}} {{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->description}}
</p> </p>
<div class="row"> <div class="row">
@foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',4) as $post ) @foreach( getGroupPostsBySetting($data->area->name.'_'.$data->part.'_group',4) as $post )
@ -28,7 +28,7 @@
@endforeach @endforeach
</div> </div>
<div class="py-5 text-center"> <div class="py-5 text-center">
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')->webUrl()}}" class="btn btn-outline-primary"> <a href="{{getGroupBySetting($data->area->name.'_'.$data->part.'_group')?->webUrl()}}" class="btn btn-outline-primary">
{{getSetting($data->area->name.'_'.$data->part.'_btn')}} {{getSetting($data->area->name.'_'.$data->part.'_btn')}}
</a> </a>
</div> </div>

@ -1,12 +1,12 @@
<section class='PostsIconSimple py-4'> <section class='PostsIconSimple py-4'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
<h1> <h1>
<a href="{{getGroupBySetting($data->area->name.'_'.$data->part)->webUrl()}}"> <a href="{{getGroupBySetting($data->area->name.'_'.$data->part)?->webUrl()}}">
{{getGroupBySetting($data->area->name.'_'.$data->part)->name}} {{getGroupBySetting($data->area->name.'_'.$data->part)?->name}}
</a> </a>
</h1> </h1>
<p> <p>
{{getGroupBySetting($data->area->name.'_'.$data->part)->description}} {{getGroupBySetting($data->area->name.'_'.$data->part)?->description}}
</p> </p>
<div class="row"> <div class="row">
@foreach(getGroupPostsBySetting($data->area->name.'_'.$data->part, getSetting($data->area->name.'_'.$data->part.'_limit')) as $post) @foreach(getGroupPostsBySetting($data->area->name.'_'.$data->part, getSetting($data->area->name.'_'.$data->part.'_limit')) as $post)
@ -20,7 +20,7 @@
{{$post->subtitle}} {{$post->subtitle}}
</p> </p>
<a href="{{$post->webUrl()}}" class="btn btn-outline-primary w-100"> <a href="{{$post?->webUrl()}}" class="btn btn-outline-primary w-100">
{{__("Read more")}} {{__("Read more")}}
</a> </a>
</div> </div>

@ -1,5 +1,6 @@
<section class='GridPostList content'> <section class='GridPostList content'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
@if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
<div class="row pinned-posts"> <div class="row pinned-posts">
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
<div class="col-md-6 p-1"> <div class="col-md-6 p-1">
@ -24,6 +25,7 @@
@endforeach @endforeach
</div> </div>
<hr> <hr>
@endif
<div class="row"> <div class="row">
<div class="col-12"> <div class="col-12">

@ -1,5 +1,6 @@
<section class='GridPostListSidebar content'> <section class='GridPostListSidebar content'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
@if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
<div class="row pinned-posts"> <div class="row pinned-posts">
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
<div class="col-md-6 p-1"> <div class="col-md-6 p-1">
@ -24,6 +25,7 @@
@endforeach @endforeach
</div> </div>
<hr> <hr>
@endif
<div class="row"> <div class="row">
@if(!getSetting($data->area->name.'_'.$data->part.'_invert')) @if(!getSetting($data->area->name.'_'.$data->part.'_invert'))
<div class="col-lg-3 p-0"> <div class="col-lg-3 p-0">

@ -1,5 +1,6 @@
<section class='SimplePostList content'> <section class='SimplePostList content'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
@if(\App\Models\Post::where('status',1)->where('is_pinned',1)->count() < 0 )
<div class="row pinned-posts"> <div class="row pinned-posts">
@foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post) @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
<div class="col-md-6 p-1"> <div class="col-md-6 p-1">
@ -24,6 +25,7 @@
@endforeach @endforeach
</div> </div>
<hr> <hr>
@endif
@foreach($posts as $post) @foreach($posts as $post)
<div class="post-list-item"> <div class="post-list-item">
<img src="{{$post->imgUrl()}}" class="float-start me-4" alt="{{$post->title}}"> <img src="{{$post->imgUrl()}}" class="float-start me-4" alt="{{$post->title}}">

@ -1,6 +1,7 @@
<section class='SimplePostListSideBar content'> <section class='SimplePostListSideBar content'>
<div class="{{gfx()['container']}}"> <div class="{{gfx()['container']}}">
<div class="row pinned-posts"> <div class="row pinned-posts">
@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) @foreach(\App\Models\Post::where('status',1)->where('is_pinned',1)->limit(2)->get() as $post)
<div class="col-md-6 p-1"> <div class="col-md-6 p-1">
<div class="post-item"> <div class="post-item">
@ -22,6 +23,7 @@
</div> </div>
</div> </div>
@endforeach @endforeach
@endif
</div> </div>
<hr> <hr>
<div class="row"> <div class="row">

@ -4,14 +4,14 @@
<div> <div>
<div class="parallax-slider" data-bg="{{$slider->imgUrl()}}"></div> <div class="parallax-slider" data-bg="{{$slider->imgUrl()}}"></div>
<div class="parallax-slide-item"> <div class="parallax-slide-item">
<div class="main-content"> <div class="main-content" @if(langIsRTL(config('app.locale'))) dir="rtl" @else dir="ltr" @endif>
{!! $slider->body !!} {!! $slider->body !!}
<br> <br>
<p class="text-center"> <p class="text-center">
{{$slider->dataz['index_ParallaxSlider_subtitle']}} {{$slider->dataz['index_ParallaxSlider_subtitle']}}
<br> <br>
<a class="btn btn-outline-dark mt-5" <a class="btn btn-outline-dark mt-5"
href="{{$slider->dataz['index_ParallaxSlider_link']}}"> href="{{fixUrlLang($slider->dataz['index_ParallaxSlider_link'])}}">
{{$slider->dataz['index_ParallaxSlider_btn']}} {{$slider->dataz['index_ParallaxSlider_btn']}}
</a> </a>
</p> </p>

@ -1,5 +1,10 @@
#ParallaxSlider { #ParallaxSlider {
.tns-inner{
direction: ltr;
}
#ParallaxSliderTns > div{ #ParallaxSliderTns > div{
position: relative; position: relative;
overflow: hidden; overflow: hidden;

@ -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]) Route::middleware([\App\Http\Middleware\VisitorCounter::class])
->name('client.')->group(function () { ->name('client.')->group(function () {

@ -0,0 +1,75 @@
<?php
namespace Tests\Feature;
use App\Models\Category;
use App\Models\Group;
use App\Models\Post;
use App\Models\Product;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class ClientWebPagesTest extends TestCase
{
public function test_web_client_index(): void
{
$response = $this->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);
}
}

@ -0,0 +1,29 @@
<?php
namespace Tests\Feature;
use App\Models\Customer;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class CustomerTest extends TestCase
{
public function check(){
if (Customer::count() == 0){
Customer::factory(1)->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);
}
}

@ -3,17 +3,22 @@
namespace Tests\Feature; namespace Tests\Feature;
// use Illuminate\Foundation\Testing\RefreshDatabase; // use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Log;
use Tests\TestCase; use Tests\TestCase;
class ExampleTest extends TestCase class ExampleTest extends TestCase
{ {
/** /**
* A basic test example. * A basic test example.
*/ */
public function test_the_application_returns_a_successful_response(): void public function test_the_application_returns_a_successful_response(): void
{ {
$response = $this->get('/');
$response = $this->get(route('client.welcome'));
$response->assertStatus(200); $response->assertStatus(200);
} }
} }

@ -0,0 +1,20 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Foundation\Testing\WithFaker;
use Tests\TestCase;
class SiteMapTest extends TestCase
{
/**
* A basic feature test example.
*/
public function test_sitemap(): void
{
$response = $this->get(route('sitemap'));
$response->assertStatus(200);
}
}

@ -4,12 +4,12 @@ namespace Tests\Unit;
use PHPUnit\Framework\TestCase; 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); $this->assertTrue(true);
} }
Loading…
Cancel
Save