fixed ui bugs

added Vickushka theme part
pull/49/head
A1Gard 2 months ago
parent c3d04f24ff
commit f906151be3

@ -1419,8 +1419,24 @@ function findArea($name,$model = null)
return \App\Models\Area::where('name', $name)->first();
}
/**
* cache number
* @return false|mixed|string|null
*/
function cacheNumber()
{
return getSetting('cache_number');
}
/**
* get website main categories
* @param $limit
* @param $orderBy
* @param $asc
* @return Category[]|\LaravelIdea\Helper\App\Models\_IH_Category_C
*/
function getMainCategory($limit=4,$orderBy = 'id', $asc = 'ASC')
{
return \App\Models\Category::whereNull('parent_id')->limit($limit)->orderBy($orderBy,$asc)->get();
}

@ -56,6 +56,7 @@ class CategoryController extends XController
$category->name = $request->input('name');
$category->subtitle = $request->input('subtitle');
$category->icon = $request->input('icon');
$category->description = $request->input('description');
if ($category->parent_id != ''){
$category->parent_id = $request->input('parent_id',null);
@ -83,6 +84,7 @@ class CategoryController extends XController
config('app.media.watermark_opacity'));
}
$i->save(storage_path() . '/app/public/categories/optimized-'. $category->$key);
}
if ($request->has('bg')) {
$category->bg = $this->storeFile('bg', $category, 'categories');
@ -104,6 +106,10 @@ class CategoryController extends XController
}
$i->save(storage_path() . '/app/public/categories/optimized-'. $category->$key);
}
if ($request->has('svg')){
$category->svg = $this->storeFile('svg',$category, 'categories');
}
$category->save();
return $category;

@ -22,6 +22,14 @@ class Category extends Model
return \Storage::url('categories/optimized-' . $this->image);
}
public function svgUrl()
{
if ($this->svg == null) {
return asset('/assets/upload/logo.svg');
}
return \Storage::url('categories/' . $this->svg);
}
public function imgOriginalUrl()
{

@ -16,9 +16,11 @@ return new class extends Migration
$table->text('name');
$table->string('slug',128)->unique();
$table->text('subtitle')->nullable();
$table->string('icon')->nullable();
$table->text('description')->nullable();
$table->integer('sort')->default(0);
$table->string('image',2048)->nullable()->default(null);
$table->string('svg',2048)->nullable()->default(null);
$table->string('bg',2048)->nullable()->default(null);
$table->unsignedInteger('parent_id')->nullable()->default(null)->index();
$table->json('theme')->nullable();

@ -24,6 +24,16 @@
</ul>
</div>
<div class="item-list mb-3">
<h3 class="p-3">
<i class="ri-remixicon-line"></i>
{{__("Icon")}}
</h3>
<div class="p-1 text-center pb-4">
<remix-icon-picker xname="icon" xvalue="{{old('icon',$item->icon??null)}}"></remix-icon-picker>
</div>
</div>
@if(isset($item))
<div class="item-list mb-3">
<h3 class="p-3">
@ -43,6 +53,17 @@
</div>
@endif
@if(isset($item))
<div class="item-list mb-3">
<h3 class="p-3">
<i class="ri-image-2-line"></i>
{{__('SVG image')}}
</h3>
<img src="{{$item->svgUrl()}}" alt="{{$item->name}}" data-open-file="#svg" class="img-fluid mb-4">
</div>
@endif
@if(isset($item))
<div class="item-list mb-3">
<div class="p-3">
@ -107,7 +128,7 @@
value="{{old('subtitle',$item->subtitle??null)}}"/>
</div>
</div>
<div class="col-md-4 mt-3">
<div class="col-md-3 mt-3">
<label for="parent">
{{__('Group Parent')}}
</label>
@ -124,7 +145,7 @@
@endforeach
</select>
</div>
<div class="col-md-4 mt-3">
<div class="col-md-3 mt-3">
<div class="form-group">
<label for="image">
{{__('Feature image')}}
@ -134,7 +155,16 @@
placeholder="{{__('Feature image')}}"/>
</div>
</div>
<div class="col-md-4 mt-3">
<div class="col-md-3 mt-3">
<div class="form-group">
<label for="svg">
{{__('Svg image')}}
</label>
<input accept=".svg" name="svg" type="file"
class="form-control @error('svg') is-invalid @enderror" id="svg"/>
</div>
</div>
<div class="col-md-3 mt-3">
<div class="form-group">
<label for="bg">
{{__('Background image')}}

@ -0,0 +1,47 @@
<section class='VickushkaMainCategoriesSlider'>
<div class="{{gfx()['container']}}">
<div class="row">
@foreach(getMainCategory() as $category)
<div class="col-md">
<div class="v-main-category" data-id="#v-cat-{{$category->id}}">
<img src="{{$category->svgUrl()}}" alt="svg {{$category->name}}">
<h4 class="text-center">
{{$category->name}}
</h4>
</div>
</div>
@endforeach
</div>
<h2 class="text-center mb-5">
{{getSetting($data->area_name.'_'.$data->part.'_title')}}
</h2>
<div id="v-cats" class="text-center">
@foreach(getMainCategory() as $category)
<div class="v-item" id="v-cat-{{$category->id}}">
<h3 class="mb-3">
{{$category->name}}
</h3>
<h4 class="text-muted mb-4">
{{$category->subtitle}}
</h4>
<div class="row">
@foreach($category->children as $subCat)
<div class="col-md-4">
<a href="{{$subCat->webUrl()}}">
<img src="{{$subCat->imgUrl()}}" alt="{{$subCat->name}}" class="v-sub-img">
<h5>
{{$subCat->name}}
</h5>
</a>
</div>
@endforeach
</div>
</div>
@endforeach
</div>
</div>
</section>

@ -0,0 +1,22 @@
document.addEventListener('DOMContentLoaded',function () {
document.querySelectorAll('.v-main-category')?.forEach(function (el) {
el.addEventListener('click',function () {
document.querySelectorAll('.v-item').forEach(function (elm) {
elm.style.display = 'none';
});
// Get the element to be displayed
const targetId = el.getAttribute('data-id');
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.style.display = 'block';
// Scroll to the element
targetElement.scrollIntoView({
behavior: 'smooth', // Smooth scroll effect
block: 'start' // Scroll to the top of the element
});
}
});
});
});

@ -0,0 +1,10 @@
{
"name": "VickushkaMainCategoriesSlider",
"version": "1.0",
"author": "xStack",
"email": "xshop@xstack.ir",
"license": "GPL-3.0-or-later",
"url": "https:\/\/xstack.ir",
"author_url": "https:\/\/4xmen.ir",
"packages": []
}

@ -0,0 +1,40 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Part;
use App\Models\Setting;
class VickushkaMainCategoriesSlider
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_title';
$setting->value = 'categories here';
$setting->type = 'TEXT';
$setting->size = 6;
$setting->title = $part->area_name . ' ' . $part->part .' sub title';
$setting->save();
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area_name . '_' . $part->part.'_color';
$setting->value = '#ebfebe';
$setting->type = 'COLOR';
$setting->data = json_encode(['name' => 'vicka-bg-color']);
$setting->size = 6;
$setting->title = $part->area_name . ' ' . $part->part .' main color';
$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.'_color')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,52 @@
.VickushkaMainCategoriesSlider {
background: var(--vicka-bg-color);
// scss
padding-bottom: 4rem;
.container{
position: relative;
top: -4rem;
}
.v-main-category{
background: var(--xshop-secondary);
border-radius: var(--xshop-border-radius);
color: var(--xshop-diff2);
padding: 1rem 0;
margin-bottom: 3rem;
cursor: pointer;
img{
width: 35%;
margin: 0 auto -4rem;
display: block;
background: var(--xshop-primary);
border-radius: 50%;
color: var(--xshop-diff);
padding: 1rem;
position: relative;
top: -5rem;
}
}
#v-cats{
.v-item{
display: none;
margin: 2rem 0;
.v-sub-img{
width: 175px;
height: 175px;
object-fit: cover;
border-radius: 50%;
margin: 1rem 0;
border: 1px solid rgba(0, 0, 0, 0.1);
}
}
.v-item:first-child{
display: block;
}
}
h1,h2,h3,h4,h5{
font-weight: 200;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

@ -1,7 +1,7 @@
const toggleSideMenu = function (e) {
e.preventDefault();
let txt = '<ul>';
document.querySelectorAll('#AplMenu > ul > li').forEach(function (el) {
document.querySelectorAll('#AplMenu > ul > li')?.forEach(function (el) {
if(!el.classList.contains('icon-menu')){
txt += el.outerHTML;
}
@ -10,5 +10,5 @@ const toggleSideMenu = function (e) {
document.querySelector('#reps-menu').innerHTML = txt;
};
document.addEventListener('DOMContentLoaded',function () {
document.querySelector('#toggler-menu').addEventListener('click',toggleSideMenu);
document.querySelector('#toggler-menu')?.addEventListener('click',toggleSideMenu);
});

@ -48,7 +48,11 @@ document.addEventListener('DOMContentLoaded', () => {
const viewportCenter = windowHeight / 2;
const distanceFromCenter = sliderCenter - viewportCenter;
const parallaxOffset = distanceFromCenter * -0.7; // Adjust this value to control parallax intensity
let parallaxOffset = distanceFromCenter * -.4; // Adjust this value to control parallax intensity
if (sliderRect.width < 1000){
parallaxOffset = distanceFromCenter * -.7; // Adjust this value to control parallax intensity
}
const bgImage = slider.getAttribute('data-bg');
slider.style.backgroundImage = `url('${bgImage}')`;

@ -396,6 +396,7 @@ Route::middleware([\App\Http\Middleware\VisitorCounter::class])
// index
Route::get('/', [ClientController::class, 'welcome'])->name('welcome');
Route::get('/posts', [ClientController::class, 'posts'])->name('posts');
Route::get('/post/{post}', [ClientController::class, 'post'])->name('post');
Route::get('/customer/sign-out', [ClientController::class, 'signOut'])->name('sign-out');
Route::post('/customer/sign-in/do', [ClientController::class, 'singInDo'])->name('sign-in-do');
Route::get('/customer/sign-in', [ClientController::class, 'signIn'])->name('sign-in');
@ -435,7 +436,6 @@ Route::middleware([\App\Http\Middleware\VisitorCounter::class])
Route::get('/gallery/{gallery}', [ClientController::class, 'gallery'])->name('gallery');
Route::get('/search', [ClientController::class, 'search'])->name('search');
Route::get('attach/download/{attachment}', [ClientController::class, 'attachDl'])->name('attach-dl');
Route::get('/post/{post}', [ClientController::class, 'post'])->name('post');
Route::get('pay/{invoice}', [ClientController::class, 'pay'])->name('pay');
Route::get('product/fav/toggle/{product}', [\App\Http\Controllers\CustomerController::class, 'ProductFavToggle'])->name('product-fav-toggle');

Loading…
Cancel
Save