added recet menu

pull/44/head
A1Gard 5 months ago
parent 247b490185
commit e77d1dc21a

@ -6,6 +6,7 @@ use App\Models\Group;
use App\Models\Category;
use App\Models\Area;
use App\Models\Part;
use App\Models\Menu;
use Illuminate\Support\Facades\Route;
@ -783,6 +784,15 @@ function getGroupBySetting($key)
{
return Group::where('id', getSetting($key) ?? 1)->first();
}
/**
* get group by setting key
* @param $key
* @return Menu
*/
function getMenuBySetting($key)
{
return Menu::where('id', getSetting($key) ?? 1)->first();
}
/**
* get group's posts by setting key

@ -26,4 +26,8 @@ class Item extends Model
{
return $this->hasMany(MenuItem::class, 'parent');
}
public function dest(){
return $this->morphTo('menuable','menuable_type','menuable_id');
}
}

@ -4,7 +4,7 @@ use Translator\Framework\LaravelConfigLoader;
use Translator\Infra\LaravelJsonTranslationRepository;
return [
'languages' => ["fa","ar"],
'languages' => ["fa"],
'directories' => [
app_path(),
resource_path('views'),

@ -38,7 +38,8 @@ class DatabaseSeeder extends Seeder
AreaSeeder::class,
PartSeeder::class,
InvoiceSeeder::class,
VisitorSeeder::class
VisitorSeeder::class,
MenuSeeder::class,
]
);
}

@ -1,368 +0,0 @@
{
" days ago": "منذ أيام",
" hours ago": "منذ ساعات",
" minutes ago": "منذ دقائق",
" seconds ago": "منذ ثواني",
"$role": "$ دور",
":ADDRESS removed": ": تمت إزالة العنوان",
":COUNT Images uploaded successfully": ":تم تحميل COUNT من الصور بنجاح",
":COUNT items answered successfully": ":تم الرد على COUNT من العناصر بنجاح",
":COUNT items changed status successfully": ": تم تغيير حالة COUNT من العناصر بنجاح",
":COUNT items closed successfully": ":تم إغلاق COUNT من العناصر بنجاح",
":COUNT items deleted successfully": ":تم حذف COUNT من العناصر بنجاح",
":COUNT items drafted successfully": ": تمت صياغة COUNT من العناصر بنجاح",
":COUNT items pending successfully": ":COUNT من العناصر المعلقة بنجاح",
":COUNT items published successfully": ":تم نشر COUNT من العناصر بنجاح",
":COUNT items restored successfully": ": تمت استعادة COUNT من العناصر بنجاح",
":COUNT users role changed to :NEWROLE successfully": ":تم تغيير دور COUNT من المستخدمين إلى :COUNT بنجاح",
"A fresh verification link has been sent to your email address.": "تم إرسال رابط تحقق جديد إلى عنوان بريدك الإلكتروني.",
"AI translate form original source": "",
"API error!": "",
"Add": "أضف",
"Add another one": "أضف واحدًا آخر",
"Add cover to better results": "أضف غطاء لنتائج أفضل",
"Add new adv": "إضافة إعلان جديد",
"Add new attachment": "إضافة مرفق جديد",
"Add new category": "إضافة تصنيف جديد",
"Add new city": "إضافة مدينة جديدة",
"Add new clip": "إضافة مقطع جديد",
"Add new comment": "إضافة تعليق جديد",
"Add new contact": "إضافة جهة اتصال جديدة",
"Add new customer": "إضافة عميل جديد",
"Add new discount": "إضافة خصم جديد",
"Add new gallery": "إضافة معرض جديد",
"Add new group": "إضافة مجموعة جديدة",
"Add new language": "إضافة لغة جديدة",
"Add new post": "إضافة مشاركة جديدة",
"Add new product": "إضافة منتج جديد",
"Add new prop": "إضافة دعامة جديدة",
"Add new question": "إضافة سؤال جديد",
"Add new setting": "إضافة إعداد جديد",
"Add new slider": "إضافة شريط تمرير جديد",
"Add new state": "إضافة حالة جديدة",
"Add new ticket": "إضافة تذكرة جديدة",
"Add new transport": "إضافة وسيلة نقل جديدة",
"Add new user": "إضافة مستخدم جديد",
"Add to setting": "أضف إلى الإعداد",
"Added by:": "أضيفت بواسطة :",
"Additional data": "بيانات إضافية",
"Address added to :CUSTOMER": "تم إضافة العنوان إلى :CUSTOMER",
"Addresses": "العناوين",
"Advertise": "أعلن",
"Advs list": "قائمة الإعلانات",
"Amount": "المبلغ",
"Answer": "الإجابة",
"Answer: <br>": "",
"Answered": "تمت الإجابة",
"Approve": "موافقة",
"Approved": "تمت الموافقة",
"Area design": "تصميم المنطقة",
"As you wished created successfully": "",
"As you wished deattached successfully": "",
"As you wished removed successfully": "",
"As you wished restored successfully": "",
"As you wished sort saved": "",
"As you wished updated successfully": "",
"Attaching": "",
"Attachments": "",
"Attachments list": "",
"Background image": "",
"Base price": "",
"Basic data": "",
"Batch delete": "",
"Batch restore": "",
"Before proceeding, please check your email for a verification link.": "",
"Bulk actions:": "",
"Catalog": "",
"Categories": "",
"Categories list": "",
"Category": "",
"Category name": "",
"Category slug": "",
"Change latitude and longitude": "",
"Check all": "",
"Cities list": "",
"City": "",
"Click here to upload or drag and drop here": "",
"Clips list": "",
"Close": "",
"Code": "",
"Colleague": "",
"Command ignored, segment part exists!": "",
"Comment": "",
"Comment :STATUS": "",
"Comment replay": "",
"Commentator": "",
"Comments": "",
"Confirm Password": "",
"Contact us": "",
"Contacts list": "",
"Contents": "",
"Country": "",
"Cover": "",
"Credit": "",
"Customers": "",
"Customers list": "",
"Dashboard": "",
"Date": "",
"Deattach": "",
"Default": "",
"Description": "",
"Description Table": "",
"Description Text": "",
"Design": "",
"Design :AREA": "",
"Devices": "",
"Discount code": "",
"Discount data": "",
"Discounts": "",
"Discounts list": "",
"Do it": "",
"Double click on image to change index image": "",
"Download": "",
"Download json file": "",
"Draft": "",
"E-mail is unique each users": "",
"Edit": "",
"Edit adv": "",
"Edit attachment": "",
"Edit category": "",
"Edit city": "",
"Edit clip": "",
"Edit comment": "",
"Edit contact": "",
"Edit customer": "",
"Edit discount": "",
"Edit gallery": "",
"Edit group": "",
"Edit language": "",
"Edit post": "",
"Edit product": "",
"Edit prop": "",
"Edit question": "",
"Edit slider": "",
"Edit state": "",
"Edit ticket": "",
"Edit transport": "",
"Edit user": "",
"Email": "",
"Email Address": "",
"Emoji": "",
"Excerpt": "",
"Expire": "",
"Expire date": "",
"Expire date": "",
"False": "",
"Feature image": "",
"File": "",
"File ext": "",
"File name": "",
"File size": "",
"Flag": "",
"Forgot Your Password?": "",
"From - To": "",
"GFX of website updated": "",
"Galleries": "",
"Galleries list": "",
"Graphic": "",
"Group Parent": "",
"Group name": "",
"Group slug": "",
"Groups": "",
"Groups list": "",
"Icon": "",
"If not choose expire expire time will be unlimited": "",
"If you did not receive the email": "",
"If you want to change the password, choose both the same. Otherwise, leave the password field blank.": "",
"If you want to only attach to other staff members and do not want to appear in the website attachment list, uncheck `fillable`": "",
"Image": "",
"Image deleted successfully": "",
"Image uploaded successfully": "",
"Images": "",
"Index image": "",
"Information": "",
"Interaction": "",
"Invalid area segment": "",
"Invalid json file!": "",
"Invalid morph": "",
"Invoices": "",
"Is default": "",
"Is effective price?": "",
"Is fillable": "",
"Key": "",
"Label": "",
"Languages": "",
"Languages list": "",
"Last month visitors devices": "",
"Last week orders": "",
"Latitude": "",
"Link": "",
"Login": "",
"Logout": "",
"Logs of admins": "",
"Logs of guests": "",
"Longitude": "",
"Main group": "",
"Main language content": "",
"Main product category": "",
"Managing": "",
"Max click": "",
"Max click zero is unlimited": "",
"Medias": "",
"Menus": "",
"Message": "",
"Message replay": "",
"Mobile": "",
"Model": "",
"Name": "",
"Name and lastname": "",
"Need process orders": "",
"Next": "",
"No parent": "",
"Not required": "",
"Orders": "",
"Password": "",
"Pending": "",
"Pending tickets": "",
"Pin": "",
"Please confirm your password before continuing.": "",
"Please upload file": "",
"Post": "",
"Post Text": "",
"Post reply": "",
"Posts": "",
"Posts list": "",
"Preview": "",
"Previous": "",
"Price": "",
"Product": "",
"Products": "",
"Products list": "",
"Properties meta": "",
"Props list": "",
"Publish": "",
"Published": "",
"Purchase price": "",
"Question": "",
"Question for:": "",
"Question\/Message": "",
"Questions": "",
"Questions list": "",
"RTL": "",
"Read more": "",
"Recommends": "",
"Register": "",
"Reject": "",
"Rejected": "",
"Remember Me": "",
"Remove": "",
"Reply": "",
"Reply comment": "",
"Reply message...": "",
"Reports": "",
"Required": "",
"Reset Password": "",
"Restore": "",
"Role": "",
"Role filter": "",
"SKU": "",
"Save": "",
"Save all settings": "",
"Search": "",
"Search & Filter": "",
"Searchable": "",
"Section": "",
"Sections": "",
"Send Answer": "",
"Send Answer and close": "",
"Send Password Reset Link": "",
"Set": "",
"Setting": "",
"Setting added to website": "",
"Setting of website updated": "",
"Shopping card": "",
"Show": "",
"Show list": "",
"Size": "",
"Slider": "",
"Slider data": "",
"Sliders list": "",
"Slug": "",
"Sort": "",
"State": "",
"States": "",
"States list": "",
"Status": "",
"Stock quantity": "",
"Subject": "",
"Subtitle": "",
"Tag": "",
"Tags": "",
"Tags, Press enter": "",
"The first and\/or second image will be index image": "",
"Theme": "",
"Theme part created successfully: [blade, js, json, scss, php, assets, screenshot]": "",
"There is nothing to show!": "",
"There is noting file to show!": "",
"Tickets": "",
"Tickets list": "",
"Tips": "",
"Title": "",
"Titles updated": "",
"Toggle navigation": "",
"Toggle selection": "",
"Totol": "",
"Translate": "",
"Translate model": "",
"Translate updated": "",
"Translate with AI": "",
"Translated by ai xstack service :TAG": "",
"Transports": "",
"Transports list": "",
"Trashed": "",
"Trashed items": "",
"True": "",
"Type": "",
"Unit": "",
"Unknown bulk action : :ACTION": "",
"Upload file": "",
"Upload images": "",
"Upload new images": "",
"User filter": "",
"Users": "",
"Users list": "",
"Value": "",
"Verify Your Email Address": "",
"Video clip": "",
"Video clips": "",
"Visitors": "",
"Visits": "",
"We recommending add title each images": "",
"Welcome back": "",
"Width": "",
"You can add images after create gallery": "",
"You can choose more than image to upload": "",
"You can choose one or more image together": "",
"You can create \/ edit clip as draft, publish it when you want": "",
"You can leave the slug empty; it will be generated automatically.": "",
"Your Email sent": "",
"a minute ago": "",
"address updated": "",
"an hour ago": "",
"approved": "",
"area :NAME of website updated": "",
"click here to request another": "",
"emoji": "",
"image": "",
"jpg": "",
"last month visits": "",
"minute": "",
"not searchable": "",
"one second ago": "",
"password repeat": "",
"pending": "",
"rejected": "",
"webp": "",
"xShop": "",
"yesterday": "أمس"
}

@ -3,6 +3,7 @@
" hours ago": "ساعت قبل",
" minutes ago": "دقیقه قبل",
" seconds ago": "ثانیه قبل",
"!": "",
"$role": "",
":ADDRESS removed": ":ADDRESS حذف شد",
":COUNT Images uploaded successfully": ":COUNT تصویر بارگزاری شد",
@ -16,6 +17,7 @@
":COUNT items restored successfully": ":COUNT مورد بازیافت شد",
":COUNT users role changed to :NEWROLE successfully": ":COUNT کاربر نقش‌شان به :NEWROLE تغییر داده شد ",
"A fresh verification link has been sent to your email address.": "یک پیوند تازه به رایانه شما جهت تایید ارسال شد",
"ACL": "",
"AI translate form original source": "ترجمه به کمک هوش مصنوعی از منبع اصلی",
"API error!": "خطای API",
"Add": "افزودن",
@ -33,6 +35,7 @@
"Add new gallery": "افزودن یک گالری",
"Add new group": "افزودن یک سرفصل",
"Add new language": "افزودن یک زبان جدید",
"Add new menu": "",
"Add new post": "افزودن یک نوشته",
"Add new product": "افزودن یک محصول",
"Add new prop": "افزودن یک ویژگی",
@ -45,6 +48,7 @@
"Add new user": "افزودن یک کاربر",
"Add to setting": "به تنظیم اضافه کن",
"Added by:": "اضافه شده توسط",
"Added items view depends on theme part": "",
"Additional data": "اطلاعات تکمیلی",
"Address added to :CUSTOMER": "نشانی به :CUSTOMER اضافه شد",
"Addresses": "نشانی‌ها",
@ -79,6 +83,7 @@
"Category": "دسته",
"Category name": "نام دسته",
"Category slug": "نامک دسته",
"Change items sort": "",
"Change latitude and longitude": "تغییر طول و عرض جغرافیایی",
"Check all": "انتخاب همه",
"Cities list": "فهرست شهرها",
@ -136,6 +141,7 @@
"Edit gallery": "ویرایش گالری",
"Edit group": "ویرایش سرفصل",
"Edit language": "ویرایش زبان",
"Edit menu": "",
"Edit post": "ویرایش نوشته",
"Edit product": "ویرایش محصول",
"Edit prop": "ویرایش ویژگی",
@ -161,6 +167,7 @@
"Flag": "پرچم",
"Forgot Your Password?": "آیا گذرواژه خود را فراموش کردید",
"From - To": "از - تا",
"GFX": "",
"GFX of website updated": "گرافیک سایت به روز شد",
"Galleries": "گالری‌ها",
"Galleries list": "فهرست گالری‌ها",
@ -194,6 +201,7 @@
"Languages": "زبان‌ها",
"Languages list": "فهرست زبان‌ها",
"Last month visitors devices": "",
"Last month visits": "بازدیدها واپسین ماه",
"Last week orders": "سفارشات هفته پیشین",
"Latitude": "عرض جغرافیایی",
"Link": "پیوند",
@ -209,7 +217,9 @@
"Max click": "حداکثر کلیک",
"Max click zero is unlimited": "حداکثر کلیک 0 به معنای بی‌نهایت است",
"Medias": "رسانه‌ها",
"Menu items": "",
"Menus": "فهرست‌ها",
"Menus list": "",
"Message": "پیام",
"Message replay": "پاسخ پیام",
"Mobile": "شماره همراه",
@ -341,10 +351,12 @@
"Welcome back": "خوش آمدید",
"Width": "عرض",
"You can add images after create gallery": "شما می‌توانید بعد از ساختن گالری به آن تصویر اضافه کنید",
"You can add item after create menu": "",
"You can choose more than image to upload": "شما متوانید تصاویری بیشتری برای بارگزاری انتخاب کنید",
"You can choose one or more image together": "شما می‌توانی یک یا چند عکس را همزمان انتخاب کنید",
"You can create \/ edit clip as draft, publish it when you want": "شما میتوانید کلیپ را ایجاد و ویرایش کنید، هر زمان که خواستید آن را منتشر کنید",
"You can leave the slug empty; it will be generated automatically.": "شما می‌توانید نامک را خالی بگذارید به صورت خودکار ساخته شود",
"You dont't have acccess this action": "",
"Your Email sent": "ایمیل شما ارسال شد",
"a minute ago": "یک دقیقه پیش",
"address updated": "نشانی به روز شد",
@ -355,7 +367,6 @@
"emoji": "ایموجی",
"image": "تصویر",
"jpg": "",
"Last month visits": "بازدیدها واپسین ماه",
"minute": "دقیق",
"not searchable": "غیرقابل جستجو",
"one second ago": "یک ثانیه پیش",
@ -365,4 +376,4 @@
"webp": "",
"xShop": "",
"yesterday": "دیروز"
}
}

@ -0,0 +1,30 @@
<nav id='RecetMenu'>
<ul>
<li>
<a href="#" id="rect-toggle">
<i class="ri-menu-line"></i>
</a>
</li>
@foreach(getMenuBySetting($data->area->name.'_'.$data->part.'_menu')->items as $item)
<li>
@if($item->meta == null)
<a href="{{$item->dest->webUrl()}}">
{{$item->title}}
</a>
@else
<a href="{{$item->meta}}">
{{$item->title}}
</a>
@endif
</li>
@endforeach
<li class="float-end">
@foreach(\App\Models\XLang::all() as $lang)
<a href="" class="d-inline-block px-1">
{{$lang->emoji}}
</a>
@endforeach
</li>
</ul>
</nav>

@ -0,0 +1,4 @@
document.querySelector('#rect-toggle').addEventListener('click',function (e) {
e.preventDefault();
document.querySelector('#RecetMenu').classList.toggle('show-menu');
})

@ -0,0 +1,10 @@
{
"name": "RecetMenu",
"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,31 @@
<?php
namespace Resources\Views\Segments;
use App\Models\Menu;
use App\Models\Part;
use App\Models\Setting;
class RecetMenu
{
public static function onAdd(Part $part = null)
{
$setting = new Setting();
$setting->section = 'theme';
$setting->key = $part->area->name . '_' . $part->part.'_menu';
$setting->value = Menu::first()->id;
$setting->type = 'MENU';
$setting->size = 12;
$setting->title = $part->area->name . ' ' . $part->part .' menu';
$setting->save();
}
public static function onRemove(Part $part = null)
{
Setting::where('key',$part->area->name . '_' . $part->part.'_menu')->first()?->delete();
}
public static function onMount(Part $part = null)
{
return $part;
}
}

@ -0,0 +1,65 @@
#RecetMenu {
// scss
position: fixed;
inset-inline-start: 1rem;
inset-inline-end: 1rem;
top: 1rem;
background: #ffffff77;
backdrop-filter: blur(5px);
z-index: 88;
border-radius: var(--xshop-border-radius);
ul {
margin: 0;
padding-right: 1rem;
padding-left: 1rem;
li {
display: inline-block;
a,a:visited {
display: block;
padding: 1rem;
color: black;
&:hover{
color: var(--xshop-primary);
}
}
&:first-child{
display: none;
}
}
}
}
/*-768px width*/
@media (max-width: 768px) {
#RecetMenu{
ul {
li {
display: none ;
&:first-child, &:last-child {
display: inline-block;
}
}
}
&.show-menu{
ul{
li {
display: flex !important;
float: none !important;
a{
padding-bottom: 0;
}
&:last-child{
padding-bottom: 1rem;
justify-content: space-evenly;
}
}
}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

@ -9,6 +9,7 @@
color: black;
bottom:5%;
padding: 10px;
border-radius: var(--xshop-border-radius);
p{
margin-bottom: 0;
}

Loading…
Cancel
Save