feat: add admin panel layout, dashboard, and user management

This commit is contained in:
2026-08-19 13:49:32 +03:30
parent 368fda6375
commit eebededa4d
188 changed files with 70341 additions and 7 deletions
@@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Enums\Admin\AdminStatus;
use App\Http\Controllers\Controller;
use App\Http\Requests\Admin\AuthLoginPostRequest;
use App\Models\Admin;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;
class AuthController extends Controller
{
public function login()
{
$rawLayout = true;
$title = 'ورود به حساب کاربری';
return view('admin.login', compact('rawLayout', 'title'));
}
public function loginPost(AuthLoginPostRequest $request)
{
$admin = Admin::query()
->whereUsername($request->input('username'))
->whereStatus(AdminStatus::ACTIVE)
->first();
if (!$admin) {
return back()->withErrors([
'general' => 'اطلاعات وارد شده نامعتبر است.'
]);
}
if (!Hash::check($request->input('password'), $admin->password)) {
return back()->withErrors([
'general' => 'اطلاعات وارد شده نامعتبر است.'
]);
}
Auth::guard('admin')->login($admin);
$admin->update([
'last_login_at' => now(),
]);
return redirect()->route('admin.dashboard.index');
}
public function logout()
{
Auth::guard('admin')->logout();
return redirect()->route('admin.auth.login.index');
}
}
@@ -0,0 +1,36 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Enums\OrderStatus;
use App\Http\Controllers\Controller;
use App\Models\Flight;
use App\Models\Order;
use App\Models\Product;
use App\Models\ProductCategory;
use App\Models\Tour;
use App\Models\User;
use Carbon\Carbon;
use Carbon\CarbonPeriod;
use Illuminate\Http\Request;
class DashboardController extends Controller
{
public function index()
{
$title = 'داشبورد';
$tourCount = Tour::count();
$flightCount = Flight::count();
$userCount = User::count();
return view('admin.dashboard', compact(
'title',
'tourCount',
'flightCount',
'userCount'
));
}
}
@@ -0,0 +1,18 @@
<?php
namespace App\Http\Controllers;
use App\Models\Flight;
use Illuminate\Http\Request;
class BookingController extends Controller
{
public function index()
{
}
public function store(Flight $flight)
{
}
}
@@ -0,0 +1,42 @@
<?php
namespace App\Http\Requests\Admin;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
class AuthLoginPostRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'username' =>[
'required',
'string',
'alpha_num',
'min:2',
'max:64'
],
'password' => [
'required',
'string',
'min:8',
'max:150'
]
];
}
}
+4 -4
View File
@@ -8,12 +8,12 @@ namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User;
/**
* Class Admin
*
*
* @property int $id
* @property string $first_name
* @property string $last_name
@@ -28,13 +28,13 @@ use Illuminate\Database\Eloquent\SoftDeletes;
* @property Carbon $created_at
* @property Carbon $updated_at
* @property string|null $deleted_at
*
*
* @property File|null $file
* @property Collection|Comment[] $comments
*
* @package App\Models
*/
class Admin extends Model
class Admin extends User
{
use SoftDeletes;
protected $table = 'admins';
+6 -1
View File
@@ -9,12 +9,17 @@ return Application::configure(basePath: dirname(__DIR__))
web: [
__DIR__.'/../routes/web.php',
__DIR__.'/../routes/auth.php',
__DIR__.'/../routes/admin.php',
],
commands: __DIR__.'/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
//
$middleware->redirectUsersTo(function (Illuminate\Http\Request $request) {
return $request->is('admin') || $request->is('admin/*')
? route('admin.dashboard.index')
: route('index');
});
})
->withExceptions(function (Exceptions $exceptions) {
//
+8
View File
@@ -40,6 +40,10 @@ return [
'driver' => 'session',
'provider' => 'users',
],
'admin' => [
'driver' => 'session',
'provider' => 'admins',
],
],
/*
@@ -64,6 +68,10 @@ return [
'driver' => 'eloquent',
'model' => env('AUTH_MODEL', App\Models\User::class),
],
'admins' => [
'driver' => 'eloquent',
'model' => \App\Models\Admin::class
],
// 'users' => [
// 'driver' => 'database',
+128
View File
@@ -0,0 +1,128 @@
.autoComplete_wrapper {
display: inline-block;
position: relative;
}
.autoComplete_wrapper > input {
height: 3rem;
width: 370px;
margin: 0;
padding: 0 2rem 0 3.2rem;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
font-size: 1rem;
text-overflow: ellipsis;
color: rgba(255, 122, 122, 0.3);
outline: none;
border-radius: 10rem;
border: 0.05rem solid rgba(255, 122, 122, 0.5);
background-image: url(images/search.svg);
background-size: 1.4rem;
background-position: left 1.05rem top 0.8rem;
background-repeat: no-repeat;
background-origin: border-box;
background-color: #fff;
transition: all 0.4s ease;
-webkit-transition: all -webkit-transform 0.4s ease;
}
.autoComplete_wrapper > input::placeholder {
color: rgba(255, 122, 122, 0.5);
transition: all 0.3s ease;
-webkit-transition: all -webkit-transform 0.3s ease;
}
.autoComplete_wrapper > input:hover::placeholder {
color: rgba(255, 122, 122, 0.6);
transition: all 0.3s ease;
-webkit-transition: all -webkit-transform 0.3s ease;
}
.autoComplete_wrapper > input:focus::placeholder {
padding: 0.1rem 0.6rem;
font-size: 0.95rem;
color: rgba(255, 122, 122, 0.4);
}
.autoComplete_wrapper > input:focus::selection {
background-color: rgba(255, 122, 122, 0.15);
}
.autoComplete_wrapper > input::selection {
background-color: rgba(255, 122, 122, 0.15);
}
.autoComplete_wrapper > input:hover {
color: rgba(255, 122, 122, 0.8);
transition: all 0.3s ease;
-webkit-transition: all -webkit-transform 0.3s ease;
}
.autoComplete_wrapper > input:focus {
color: rgba(255, 122, 122, 1);
border: 0.06rem solid rgba(255, 122, 122, 0.8);
}
.autoComplete_wrapper > ul {
position: absolute;
max-height: 226px;
overflow-y: scroll;
box-sizing: border-box;
left: 0;
right: 0;
margin: 0.5rem 0 0 0;
padding: 0;
z-index: 1;
list-style: none;
border-radius: 0.6rem;
background-color: #fff;
border: 1px solid rgba(33, 33, 33, 0.07);
box-shadow: 0 3px 6px rgba(149, 157, 165, 0.15);
outline: none;
transition: opacity 0.15s ease-in-out;
-moz-transition: opacity 0.15s ease-in-out;
-webkit-transition: opacity 0.15s ease-in-out;
}
.autoComplete_wrapper > ul[hidden],
.autoComplete_wrapper > ul:empty {
display: block;
opacity: 0;
transform: scale(0);
}
.autoComplete_wrapper > ul > li {
margin: 0.3rem;
padding: 0.3rem 0.5rem;
text-align: left;
font-size: 1rem;
color: #212121;
border-radius: 0.35rem;
background-color: rgba(255, 255, 255, 1);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
transition: all 0.2s ease;
}
.autoComplete_wrapper > ul > li mark {
background-color: transparent;
color: rgba(255, 122, 122, 1);
font-weight: bold;
}
.autoComplete_wrapper > ul > li:hover {
cursor: pointer;
background-color: rgba(255, 122, 122, 0.15);
}
.autoComplete_wrapper > ul > li[aria-selected="true"] {
background-color: rgba(255, 122, 122, 0.15);
}
@media only screen and (max-width: 600px) {
.autoComplete_wrapper > input {
width: 18rem;
}
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{display:none;width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:' ';display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:'';background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s .5s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition-delay:0s;transition-duration:0s}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-scrollbar:before{top:2px;bottom:2px;left:2px;right:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:0;bottom:0;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.simplebar-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll;-ms-overflow-style:scrollbar!important}.simplebar-dummy-scrollbar-size>div{width:200%;height:200%;margin:10px 0}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}
File diff suppressed because one or more lines are too long
+7
View File
@@ -0,0 +1,7 @@
/*!
* Waves v0.7.6
* http://fian.my.id/Waves
*
* Copyright 2014-2018 Alfiana E. Sibuea and other contributors
* Released under the MIT license
* https://github.com/fians/Waves/blob/master/LICENSE */.waves-effect{position:relative;cursor:pointer;display:inline-block;overflow:hidden;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}.waves-effect .waves-ripple{position:absolute;border-radius:50%;width:100px;height:100px;margin-top:-50px;margin-left:-50px;opacity:0;background:rgba(0,0,0,.2);background:-webkit-radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,rgba(255,255,255,0) 70%);background:-o-radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,rgba(255,255,255,0) 70%);background:-moz-radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,rgba(255,255,255,0) 70%);background:radial-gradient(rgba(0,0,0,.2) 0,rgba(0,0,0,.3) 40%,rgba(0,0,0,.4) 50%,rgba(0,0,0,.5) 60%,rgba(255,255,255,0) 70%);-webkit-transition:all .5s ease-out;-moz-transition:all .5s ease-out;-o-transition:all .5s ease-out;transition:all .5s ease-out;-webkit-transition-property:-webkit-transform,opacity;-moz-transition-property:-moz-transform,opacity;-o-transition-property:-o-transform,opacity;transition-property:transform,opacity;-webkit-transform:scale(0) translate(0,0);-moz-transform:scale(0) translate(0,0);-ms-transform:scale(0) translate(0,0);-o-transform:scale(0) translate(0,0);transform:scale(0) translate(0,0);pointer-events:none}.waves-effect.waves-light .waves-ripple{background:rgba(255,255,255,.4);background:-webkit-radial-gradient(rgba(255,255,255,.2) 0,rgba(255,255,255,.3) 40%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 70%);background:-o-radial-gradient(rgba(255,255,255,.2) 0,rgba(255,255,255,.3) 40%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 70%);background:-moz-radial-gradient(rgba(255,255,255,.2) 0,rgba(255,255,255,.3) 40%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 70%);background:radial-gradient(rgba(255,255,255,.2) 0,rgba(255,255,255,.3) 40%,rgba(255,255,255,.4) 50%,rgba(255,255,255,.5) 60%,rgba(255,255,255,0) 70%)}.waves-effect.waves-classic .waves-ripple{background:rgba(0,0,0,.2)}.waves-effect.waves-classic.waves-light .waves-ripple{background:rgba(255,255,255,.4)}.waves-notransition{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;transition:none!important}.waves-button,.waves-circle{-webkit-transform:translateZ(0);-moz-transform:translateZ(0);-ms-transform:translateZ(0);-o-transform:translateZ(0);transform:translateZ(0);-webkit-mask-image:-webkit-radial-gradient(circle,#fff 100%,#000 100%)}.waves-button,.waves-button-input,.waves-button:hover,.waves-button:visited{white-space:nowrap;vertical-align:middle;cursor:pointer;border:none;outline:0;color:inherit;background-color:rgba(0,0,0,0);font-size:1em;line-height:1em;text-align:center;text-decoration:none;z-index:1}.waves-button{padding:.85em 1.1em;border-radius:.2em}.waves-button-input{margin:0;padding:.85em 1.1em}.waves-input-wrapper{border-radius:.2em;vertical-align:bottom}.waves-input-wrapper.waves-button{padding:0}.waves-input-wrapper .waves-button-input{position:relative;top:0;left:0;z-index:1}.waves-circle{text-align:center;width:2.5em;height:2.5em;line-height:2.5em;border-radius:50%}.waves-float{-webkit-mask-image:none;-webkit-box-shadow:0 1px 1.5px 1px rgba(0,0,0,.12);box-shadow:0 1px 1.5px 1px rgba(0,0,0,.12);-webkit-transition:all .3s;-moz-transition:all .3s;-o-transition:all .3s;transition:all .3s}.waves-float:active{-webkit-box-shadow:0 8px 20px 1px rgba(0,0,0,.3);box-shadow:0 8px 20px 1px rgba(0,0,0,.3)}.waves-block{display:block}
@@ -0,0 +1 @@
null
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 878 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin: auto; background: none; display: block; shape-rendering: auto;" width="5rem" height="5rem" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<g transform="rotate(0 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#589bff">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8571428571428571s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(51.42857142857143 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#af6ded">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.7142857142857143s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(102.85714285714286 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#589bff">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5714285714285714s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(154.28571428571428 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#af6ded">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.42857142857142855s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(205.71428571428572 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#589bff">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.2857142857142857s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(257.14285714285717 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#af6ded">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.14285714285714285s" repeatCount="indefinite"/>
</rect>
</g><g transform="rotate(308.57142857142856 50 50)">
<rect x="40" y="21.5" rx="7.2" ry="2.5" width="20" height="5" fill="#589bff">
<animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"/>
</rect>
</g>
<!-- [ldio] generated by https://loading.io/ --></svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@@ -0,0 +1,73 @@
(function () {
'use strict';
if (localStorage.getItem("menodarktheme")) {
document.querySelector("html").setAttribute("data-theme-mode", "dark")
document.querySelector("html").setAttribute("data-menu-styles", "dark")
document.querySelector("html").setAttribute("data-header-styles", "dark")
}
if (localStorage.menortl) {
let html = document.querySelector('html');
html.setAttribute("dir", "rtl");
document.querySelector("#style")?.setAttribute("href", "/assets/libs/bootstrap/css/bootstrap.rtl.min.css");
// rtlFn();
}
if (localStorage.getItem("menolayout") == "horizontal") {
document.querySelector("html").setAttribute("data-nav-layout", "horizontal")
}
function localStorageBackup() {
// if there is a value stored, update color picker and background color
// Used to retrive the data from local storage
if (localStorage.primaryRGB) {
if (document.querySelector('.theme-container-primary')) {
document.querySelector('.theme-container-primary').value = localStorage.primaryRGB;
}
document.querySelector('html').style.setProperty('--primary-rgb', localStorage.primaryRGB);
}
if (localStorage.bodyBgRGB && localStorage.bodylightRGB) {
if (document.querySelector('.theme-container-background')) {
document.querySelector('.theme-container-background').value = localStorage.bodyBgRGB;
}
document.querySelector('html').style.setProperty('--body-bg-rgb', localStorage.bodyBgRGB);
document.querySelector('html').style.setProperty('--body-bg-rgb2', localStorage.bodylightRGB);
document.querySelector('html').style.setProperty('--light-rgb', localStorage.bodylightRGB);
document.querySelector('html').style.setProperty('--form-control-bg', `rgb(${localStorage.bodylightRGB})`);
document.querySelector('html').style.setProperty('--input-border', "rgba(255,255,255,0.1)");
let html = document.querySelector('html');
html.setAttribute('data-theme-mode', 'dark');
html.setAttribute('data-menu-styles', 'dark');
html.setAttribute('data-header-styles', 'dark');
}
if (localStorage.menodarktheme) {
let html = document.querySelector('html');
html.setAttribute('data-theme-mode', 'dark');
}
if (localStorage.menortl) {
let html = document.querySelector('html');
html.setAttribute('dir', 'rtl');
document.querySelector("#style")?.setAttribute("href", "/assets/libs/bootstrap/css/bootstrap.rtl.min.css");
setTimeout(() => {
rtlFn();
}, 10);
}
}
localStorageBackup()
})();
function ltrFn() {
let html = document.querySelector('html')
if(!document.querySelector("#style").href.includes('bootstrap.min.css')){
document.querySelector("#style")?.setAttribute("href", "/assets/libs/bootstrap/css/bootstrap.min.css");
}
html.setAttribute("dir", "ltr");
}
function rtlFn() {
let html = document.querySelector('html');
html.setAttribute("dir", "rtl");
document.querySelector("#style")?.setAttribute("href", "/assets/libs/bootstrap/css/bootstrap.rtl.min.css");
}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
+528
View File
@@ -0,0 +1,528 @@
(function () {
"use strict";
/* page loader */
function hideLoader() {
const loader = document.getElementById("loader");
loader.classList.add("d-none")
}
window.addEventListener("load", hideLoader);
/* page loader */
/* tooltip */
const tooltipTriggerList = document.querySelectorAll(
'[data-bs-toggle="tooltip"]'
);
const tooltipList = [...tooltipTriggerList].map(
(tooltipTriggerEl) => new bootstrap.Tooltip(tooltipTriggerEl)
);
/* popover */
const popoverTriggerList = document.querySelectorAll(
'[data-bs-toggle="popover"]'
);
const popoverList = [...popoverTriggerList].map(
(popoverTriggerEl) => new bootstrap.Popover(popoverTriggerEl)
);
/* breadcrumb date range picker */
// flatpickr("#daterange", {
// mode: "range",
// dateFormat: "Y-m-d",
// defaultDate: ["2024-07-01", "2024-07-30"]
// });
/* breadcrumb date range picker */
if (document.querySelector("#switcher-canvas")) {
//switcher color pickers
const pickrContainerPrimary = document.querySelector(
".pickr-container-primary"
);
const themeContainerPrimary = document.querySelector(
".theme-container-primary"
);
const pickrContainerBackground = document.querySelector(
".pickr-container-background"
);
const themeContainerBackground = document.querySelector(
".theme-container-background"
);
/* for theme primary */
const nanoThemes = [
[
"nano",
{
defaultRepresentation: "RGB",
components: {
preview: true,
opacity: false,
hue: true,
interaction: {
hex: false,
rgba: true,
hsva: false,
input: true,
clear: false,
save: false,
},
},
},
],
];
const nanoButtons = [];
let nanoPickr = null;
for (const [theme, config] of nanoThemes) {
const button = document.createElement("button");
button.innerHTML = theme;
nanoButtons.push(button);
button.addEventListener("click", () => {
const el = document.createElement("p");
pickrContainerPrimary.appendChild(el);
/* Delete previous instance */
if (nanoPickr) {
nanoPickr.destroyAndRemove();
}
/* Apply active class */
for (const btn of nanoButtons) {
btn.classList[btn === button ? "add" : "remove"]("active");
}
/* Create fresh instance */
nanoPickr = new Pickr(
Object.assign(
{
el,
theme,
default: "#589bff",
},
config
)
);
/* Set events */
nanoPickr.on("changestop", (source, instance) => {
let color = instance.getColor().toRGBA();
let html = document.querySelector("html");
html.style.setProperty(
"--primary-rgb",
`${Math.floor(color[0])}, ${Math.floor(color[1])}, ${Math.floor(
color[2]
)}`
);
/* theme color picker */
localStorage.setItem(
"primaryRGB",
`${Math.floor(color[0])}, ${Math.floor(color[1])}, ${Math.floor(
color[2]
)}`
);
// updateColors();
});
});
themeContainerPrimary.appendChild(button);
}
nanoButtons[0].click();
/* for theme primary */
/* for theme background */
const nanoThemes1 = [
[
"nano",
{
defaultRepresentation: "RGB",
components: {
preview: true,
opacity: false,
hue: true,
interaction: {
hex: false,
rgba: true,
hsva: false,
input: true,
clear: false,
save: false,
},
},
},
],
];
const nanoButtons1 = [];
let nanoPickr1 = null;
for (const [theme, config] of nanoThemes) {
const button = document.createElement("button");
button.innerHTML = theme;
nanoButtons1.push(button);
button.addEventListener("click", () => {
const el = document.createElement("p");
pickrContainerBackground.appendChild(el);
/* Delete previous instance */
if (nanoPickr1) {
nanoPickr1.destroyAndRemove();
}
/* Apply active class */
for (const btn of nanoButtons) {
btn.classList[btn === button ? "add" : "remove"]("active");
}
/* Create fresh instance */
nanoPickr1 = new Pickr(
Object.assign(
{
el,
theme,
default: "#589bff",
},
config
)
);
/* Set events */
nanoPickr1.on("changestop", (source, instance) => {
let color = instance.getColor().toRGBA();
let html = document.querySelector("html");
html.style.setProperty(
"--body-bg-rgb",
`${color[0]}, ${color[1]}, ${color[2]}`
);
document
.querySelector("html")
.style.setProperty(
"--body-bg-rgb2",
`${color[0] + 14}, ${color[1] + 14}, ${color[2] + 14}`
);
document
.querySelector("html")
.style.setProperty(
"--light-rgb",
`${color[0] + 14}, ${color[1] + 14}, ${color[2] + 14}`
);
document
.querySelector("html")
.style.setProperty(
"--form-control-bg",
`rgb(${color[0] + 14}, ${color[1] + 14}, ${color[2] + 14})`
);
document
.querySelector("html")
.style.setProperty(
"--gray-3",
`rgb(${color[0] + 14}, ${color[1] + 14}, ${color[2] + 14})`
);
localStorage.removeItem("bgtheme");
// updateColors();
html.setAttribute("data-theme-mode", "dark");
html.setAttribute("data-menu-styles", "dark");
html.setAttribute("data-header-styles", "dark");
document.querySelector("#switcher-dark-theme").checked = true;
document.querySelector("#switcher-menu-dark").checked = true;
document.querySelector("#switcher-header-dark").checked = true;
localStorage.setItem(
"bodyBgRGB",
`${color[0]}, ${color[1]}, ${color[2]}`
);
localStorage.setItem(
"bodylightRGB",
`${color[0] + 14}, ${color[1] + 14}, ${color[2] + 14}`
);
});
});
themeContainerBackground.appendChild(button);
}
nanoButtons1[0].click();
/* for theme background */
}
/* header theme toggle */
function toggleTheme() {
let html = document.querySelector("html");
if (html.getAttribute("data-theme-mode") === "dark") {
html.setAttribute("data-theme-mode", "light");
html.setAttribute("data-header-styles", "light");
html.setAttribute("data-menu-styles", "light");
if (!localStorage.getItem("primaryRGB")) {
html.setAttribute("style", "");
}
html.removeAttribute("data-bg-theme");
if (document.querySelector("#switcher-canvas")) {
document.querySelector("#switcher-light-theme").checked = true;
document.querySelector("#switcher-menu-light").checked = true;
}
document
.querySelector("html")
.style.removeProperty("--body-bg-rgb", localStorage.bodyBgRGB);
// checkOptions();
html.style.removeProperty("--body-bg-rgb2");
html.style.removeProperty("--light-rgb");
html.style.removeProperty("--form-control-bg");
html.style.removeProperty("--input-border");
if (document.querySelector("#switcher-canvas")) {
document.querySelector("#switcher-header-light").checked = true;
document.querySelector("#switcher-menu-light").checked = true;
document.querySelector("#switcher-light-theme").checked = true;
document.querySelector("#switcher-background4").checked = false;
document.querySelector("#switcher-background3").checked = false;
document.querySelector("#switcher-background2").checked = false;
document.querySelector("#switcher-background1").checked = false;
document.querySelector("#switcher-background").checked = false;
}
localStorage.removeItem("menodarktheme");
localStorage.removeItem("menoMenu");
localStorage.removeItem("menoHeader");
localStorage.removeItem("bodylightRGB");
localStorage.removeItem("bodyBgRGB");
html.setAttribute("data-header-styles", "light");
} else {
html.setAttribute("data-theme-mode", "dark");
html.setAttribute("data-header-styles", "dark");
if (!localStorage.getItem("primaryRGB")) {
html.setAttribute("style", "");
}
html.setAttribute("data-menu-styles", "dark");
if (document.querySelector("#switcher-canvas")) {
document.querySelector("#switcher-dark-theme").checked = true;
document.querySelector("#switcher-menu-dark").checked = true;
document.querySelector("#switcher-header-dark").checked = true;
// checkOptions();
document.querySelector("#switcher-menu-dark").checked = true;
document.querySelector("#switcher-header-dark").checked = true;
document.querySelector("#switcher-dark-theme").checked = true;
document.querySelector("#switcher-background4").checked = false;
document.querySelector("#switcher-background3").checked = false;
document.querySelector("#switcher-background2").checked = false;
document.querySelector("#switcher-background1").checked = false;
document.querySelector("#switcher-background").checked = false;
}
localStorage.setItem("menodarktheme", "true");
localStorage.setItem("menoMenu", "dark");
localStorage.setItem("menoHeader", "dark");
localStorage.removeItem("bodylightRGB");
localStorage.removeItem("bodyBgRGB");
}
}
let layoutSetting = document.querySelector(".layout-setting");
layoutSetting.addEventListener("click", toggleTheme);
/* header theme toggle */
/* Choices JS */
document.addEventListener("DOMContentLoaded", function () {
var genericExamples = document.querySelectorAll("[data-trigger]");
for (let i = 0; i < genericExamples.length; ++i) {
var element = genericExamples[i];
new Choices(element, {
allowHTML: true,
placeholderValue: "This is a placeholder set in the config",
searchPlaceholderValue: "جستجو",
});
}
});
/* Choices JS */
/* footer year */
document.getElementById("year").innerHTML = new Date().getFullYear();
/* footer year */
/* node waves */
Waves.attach(".btn-wave", ["waves-light"]);
Waves.init();
/* node waves */
/* card with close button */
let DIV_CARD = ".card";
let cardRemoveBtn = document.querySelectorAll(
'[data-bs-toggle="card-remove"]'
);
cardRemoveBtn.forEach((ele) => {
ele.addEventListener("click", function (e) {
e.preventDefault();
let $this = this;
let card = $this.closest(DIV_CARD);
card.remove();
return false;
});
});
/* card with close button */
/* card with fullscreen */
let cardFullscreenBtn = document.querySelectorAll(
'[data-bs-toggle="card-fullscreen"]'
);
cardFullscreenBtn.forEach((ele) => {
ele.addEventListener("click", function (e) {
let $this = this;
let card = $this.closest(DIV_CARD);
card.classList.toggle("card-fullscreen");
card.classList.remove("card-collapsed");
e.preventDefault();
return false;
});
});
/* card with fullscreen */
/* count-up */
var i = 1;
setInterval(() => {
document.querySelectorAll(".count-up").forEach((ele) => {
if (ele.getAttribute("data-count") >= i) {
i = i + 1;
ele.innerText = i;
}
});
}, 10);
/* count-up */
/* back to top */
const scrollToTop = document.querySelector(".scrollToTop");
const $rootElement = document.documentElement;
const $body = document.body;
window.onscroll = () => {
const scrollTop = window.scrollY || window.pageYOffset;
const clientHt = $rootElement.scrollHeight - $rootElement.clientHeight;
if (window.scrollY > 100) {
scrollToTop.style.display = "flex";
} else {
scrollToTop.style.display = "none";
}
};
scrollToTop.onclick = () => {
window.scrollTo(0, 0);
};
/* back to top */
})();
/* full screen */
var elem = document.documentElement;
window.openFullscreen = function () {
let open = document.querySelector(".full-screen-open");
let close = document.querySelector(".full-screen-close");
if (
!document.fullscreenElement &&
!document.webkitFullscreenElement &&
!document.msFullscreenElement
) {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) {
/* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) {
/* IE11 */
elem.msRequestFullscreen();
}
close.classList.add("d-block");
close.classList.remove("d-none");
open.classList.add("d-none");
} else {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) {
/* Safari */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
/* IE11 */
document.msExitFullscreen();
}
close.classList.remove("d-block");
open.classList.remove("d-none");
close.classList.add("d-none");
open.classList.add("d-block");
}
}
/* full screen */
/* toggle switches */
let customSwitch = document.querySelectorAll(".toggle");
customSwitch.forEach((e) =>
e.addEventListener("click", () => {
e.classList.toggle("on");
})
);
/* toggle switches */
/* header dropdown close button */
/* for cart dropdown */
const headerbtn = document.querySelectorAll(".dropdown-item-close");
headerbtn.forEach((button) => {
button.addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
button.parentNode.parentNode.parentNode.parentNode.parentNode.remove();
document.getElementById("cart-data").innerText = `${document.querySelectorAll(".dropdown-item-close").length
} مورد`;
document.getElementById("cart-icon-badge").innerText = `${document.querySelectorAll(".dropdown-item-close").length
}`;
console.log(
document.getElementById("header-cart-items-scroll").children.length
);
if (document.querySelectorAll(".dropdown-item-close").length == 0) {
let elementHide = document.querySelector(".empty-header-item");
let elementShow = document.querySelector(".empty-item");
elementHide.classList.add("d-none");
elementShow.classList.remove("d-none");
}
});
});
/* for cart dropdown */
/* for notifications dropdown */
const headerbtn1 = document.querySelectorAll(".dropdown-item-close1");
headerbtn1.forEach((button) => {
button.addEventListener("click", (e) => {
e.preventDefault();
e.stopPropagation();
button.parentNode.parentNode.parentNode.parentNode.remove();
document.getElementById("notifiation-data").innerText = `${document.querySelectorAll(".dropdown-item-close1").length
} خوانده نشده`;
if (document.querySelectorAll(".dropdown-item-close1").length == 0) {
let elementHide1 = document.querySelector(".empty-header-item1");
let elementShow1 = document.querySelector(".empty-item1");
elementHide1.classList.add("d-none");
elementShow1.classList.remove("d-none");
}
});
});
/* for notifications dropdown */
$(document).ready(function () {
$('#birth_date').persianDatepicker({
format: 'YYYY/MM/DD',
initialValueType: 'gregorian',
calendarType: 'persian',
autoClose: true
});
});
function previewAvatar(input) {
if (input.files && input.files[0]) {
const reader = new FileReader();
reader.onload = function (e) {
document.getElementById('avatarPreview').style.backgroundImage = `url(${e.target.result})`;
};
reader.readAsDataURL(input.files[0]);
}
}
File diff suppressed because it is too large Load Diff
+41
View File
@@ -0,0 +1,41 @@
(function () {
'use strict'
/* dropzone */
let myDropzone = new Dropzone(".dropzone");
myDropzone.on("addedfile", file => {
});
/* filepond */
FilePond.registerPlugin(
FilePondPluginImagePreview,
FilePondPluginImageExifOrientation,
FilePondPluginFileValidateSize,
FilePondPluginFileEncode,
FilePondPluginImageEdit,
FilePondPluginFileValidateType,
FilePondPluginImageCrop,
FilePondPluginImageResize,
FilePondPluginImageTransform
);
/* multiple upload */
const MultipleElement = document.querySelector('.multiple-filepond');
FilePond.create(MultipleElement,);
/* single upload */
FilePond.create(
document.querySelector('.single-fileupload'),
{
labelIdle: `Drag & Drop your picture or <span class="filepond--label-action">Browse</span>`,
imagePreviewHeight: 170,
imageCropAspectRatio: '1:1',
imageResizeTargetWidth: 200,
imageResizeTargetHeight: 200,
stylePanelLayout: 'compact circle',
styleLoadIndicatorPosition: 'center bottom',
styleButtonRemoveItemPosition: 'center bottom'
}
);
})();
File diff suppressed because one or more lines are too long
+373
View File
@@ -0,0 +1,373 @@
(function () {
"use strict";
if (localStorage.getItem("menodarktheme")) {
document.querySelector("html").setAttribute("data-theme-mode", "dark");
document.querySelector("html").setAttribute("data-menu-styles", "dark");
document.querySelector("html").setAttribute("data-header-styles", "dark");
}
if (localStorage.menortl) {
let html = document.querySelector("html");
html.setAttribute("dir", "rtl");
document
.querySelector("#style")
?.setAttribute(
"href",
"assets/libs/bootstrap/css/bootstrap.rtl.min.css"
);
}
if (localStorage.menolayout) {
let html = document.querySelector("html");
html.setAttribute("data-nav-layout", "horizontal");
document.querySelector("html").setAttribute("data-menu-styles", "light");
}
if (localStorage.getItem("menolayout") == "horizontal") {
document
.querySelector("html")
.setAttribute("data-nav-layout", "horizontal");
}
if (localStorage.loaderEnable == "true") {
document.querySelector("html").setAttribute("loader", "enable");
} else {
if (!document.querySelector("html").getAttribute("loader")) {
document.querySelector("html").setAttribute("loader", "disable");
}
}
function localStorageBackup() {
// if there is a value stored, update color picker and background color
// Used to retrive the data from local storage
if (localStorage.primaryRGB) {
if (document.querySelector(".theme-container-primary")) {
document.querySelector(".theme-container-primary").value =
localStorage.primaryRGB;
}
document
.querySelector("html")
.style.setProperty("--primary-rgb", localStorage.primaryRGB);
}
if (localStorage.bodyBgRGB && localStorage.bodylightRGB) {
if (document.querySelector(".theme-container-background")) {
document.querySelector(".theme-container-background").value =
localStorage.bodyBgRGB;
}
document
.querySelector("html")
.style.setProperty("--body-bg-rgb", localStorage.bodyBgRGB);
document
.querySelector("html")
.style.setProperty("--body-bg-rgb2", localStorage.bodylightRGB);
document
.querySelector("html")
.style.setProperty("--light-rgb", localStorage.bodylightRGB);
document
.querySelector("html")
.style.setProperty(
"--form-control-bg",
`rgb(${localStorage.bodylightRGB})`
);
document
.querySelector("html")
.style.setProperty("--gray-3", `rgb(${localStorage.bodylightRGB})`);
document
.querySelector("html")
.style.setProperty("--input-border", "rgba(255,255,255,0.1)");
let html = document.querySelector("html");
html.setAttribute("data-theme-mode", "dark");
html.setAttribute("data-menu-styles", "dark");
html.setAttribute("data-header-styles", "dark");
}
if (localStorage.menodarktheme) {
let html = document.querySelector("html");
html.setAttribute("data-theme-mode", "dark");
}
if (localStorage.menolayout) {
let html = document.querySelector("html");
let layoutValue = localStorage.getItem("menolayout");
html.setAttribute("data-nav-layout", "horizontal");
html.setAttribute("data-nav-style", "menu-click");
// setTimeout(() => {
// clearNavDropdown();
// }, 1000);
// setTimeout(() => {
// checkHoriMenu();
// }, 5000);
}
if (localStorage.menoverticalstyles) {
let html = document.querySelector("html");
let verticalStyles = localStorage.getItem("menoverticalstyles");
if (verticalStyles == "default") {
html.setAttribute("data-vertical-style", "default");
localStorage.removeItem("menonavstyles");
}
if (verticalStyles == "closed") {
html.setAttribute("data-vertical-style", "closed");
localStorage.removeItem("menonavstyles");
}
if (verticalStyles == "icontext") {
html.setAttribute("data-vertical-style", "icontext");
localStorage.removeItem("menonavstyles");
}
if (verticalStyles == "overlay") {
html.setAttribute("data-vertical-style", "overlay");
localStorage.removeItem("menonavstyles");
}
if (verticalStyles == "detached") {
html.setAttribute("data-vertical-style", "detached");
localStorage.removeItem("menonavstyles");
}
if (verticalStyles == "doublemenu") {
html.setAttribute("data-vertical-style", "doublemenu");
localStorage.removeItem("menonavstyles");
setTimeout(() => {
const menuSlideItem = document.querySelectorAll(
".main-menu > li > .side-menu__item"
);
// Create the tooltip element
const tooltip = document.createElement("div");
tooltip.className = "custome-tooltip";
// Set the CSS properties of the tooltip element
tooltip.style.setProperty("position", "fixed");
tooltip.style.setProperty("display", "none");
tooltip.style.setProperty("padding", "0.5rem");
tooltip.style.setProperty("font-weight", "500");
tooltip.style.setProperty("font-size", "0.75rem");
tooltip.style.setProperty("background-color", "rgb(15, 23 ,42)");
tooltip.style.setProperty("color", "rgb(255, 255 ,255)");
tooltip.style.setProperty("margin-inline-start", "48px");
tooltip.style.setProperty("border-radius", "0.25rem");
tooltip.style.setProperty("z-index", "99");
menuSlideItem.forEach((e) => {
// Add an event listener to the menu slide item to show the tooltip
e.addEventListener("mouseenter", () => {
if (localStorage.menoverticalstyles == "doublemenu") {
tooltip.style.setProperty("display", "block");
tooltip.textContent =
e.querySelector(".side-menu__label").textContent;
if (
document
.querySelector("html")
.getAttribute("data-vertical-style") == "doublemenu"
) {
e.appendChild(tooltip);
}
}
});
// Add an event listener to hide the tooltip
e.addEventListener("mouseleave", () => {
tooltip.style.setProperty("display", "none");
tooltip.textContent =
e.querySelector(".side-menu__label").textContent;
});
});
}, 1000);
}
}
if (localStorage.menonavstyles) {
let html = document.querySelector("html");
let navStyles = localStorage.getItem("menonavstyles");
if (navStyles == "menu-click") {
html.setAttribute("data-nav-style", "menu-click");
localStorage.removeItem("menoverticalstyles");
html.removeAttribute("data-vertical-style");
}
if (navStyles == "menu-hover") {
html.setAttribute("data-nav-style", "menu-hover");
localStorage.removeItem("menoverticalstyles");
html.removeAttribute("data-vertical-style");
}
if (navStyles == "icon-click") {
html.setAttribute("data-nav-style", "icon-click");
localStorage.removeItem("menoverticalstyles");
html.removeAttribute("data-vertical-style");
}
if (navStyles == "icon-hover") {
html.setAttribute("data-nav-style", "icon-hover");
localStorage.removeItem("menoverticalstyles");
html.removeAttribute("data-vertical-style");
}
}
if (localStorage.menoclassic) {
let html = document.querySelector("html");
html.setAttribute("data-page-style", "classic");
}
if (localStorage.menomodern) {
let html = document.querySelector("html");
html.setAttribute("data-page-style", "modern");
}
if (localStorage.menoboxed) {
let html = document.querySelector("html");
html.setAttribute("data-width", "boxed");
}
if (localStorage.menofullwidth) {
let html = document.querySelector("html");
html.setAttribute("data-width", "fullwidth");
}
if (localStorage.menodefaultwidth) {
let html = document.querySelector("html");
html.setAttribute("data-width", "default");
}
if (localStorage.menoheaderfixed) {
let html = document.querySelector("html");
html.setAttribute("data-header-position", "fixed");
}
if (localStorage.menoheaderscrollable) {
let html = document.querySelector("html");
html.setAttribute("data-header-position", "scrollable");
}
if (localStorage.menomenufixed) {
let html = document.querySelector("html");
html.setAttribute("data-menu-position", "fixed");
}
if (localStorage.menomenuscrollable) {
let html = document.querySelector("html");
html.setAttribute("data-menu-position", "scrollable");
}
if (localStorage.menoMenu) {
let html = document.querySelector("html");
let menuValue = localStorage.getItem("menoMenu");
switch (menuValue) {
case "light":
html.setAttribute("data-menu-styles", "light");
break;
case "dark":
html.setAttribute("data-menu-styles", "dark");
break;
case "color":
html.setAttribute("data-menu-styles", "color");
break;
case "gradient":
html.setAttribute("data-menu-styles", "gradient");
break;
case "transparent":
html.setAttribute("data-menu-styles", "transparent");
break;
default:
break;
}
}
if (localStorage.menoHeader) {
let html = document.querySelector("html");
let headerValue = localStorage.getItem("menoHeader");
html.setAttribute("data-header-styles", headerValue);
}
if (localStorage.bgimg) {
let html = document.querySelector("html");
let value = localStorage.getItem("bgimg");
html.setAttribute("data-bg-img", value);
}
}
localStorageBackup();
// keep chosen files here (useful when uploading)
let selectedFiles = [];
document.addEventListener('DOMContentLoaded', () => {
const input = document.getElementById('imageInput');
if (input) {
input.addEventListener('change', previewImages);
}
// Optional: allow dropping files onto the placeholder
const placeholder = document.getElementById('uploadPlaceholder');
if (placeholder) {
placeholder.addEventListener('dragover', e => {
e.preventDefault();
placeholder.style.borderColor = '#555';
});
placeholder.addEventListener('dragleave', e => {
placeholder.style.borderColor = '#cfcfcf';
});
placeholder.addEventListener('drop', e => {
e.preventDefault();
placeholder.style.borderColor = '#cfcfcf';
const dtFiles = Array.from(e.dataTransfer.files || []);
// Use same handler as input: create a fake event-like object with .files
previewImages({ target: { files: dtFiles } });
});
}
});
// Update the actual input.files property to match selectedFiles using DataTransfer
function updateInputFiles() {
const dataTransfer = new DataTransfer();
selectedFiles.forEach(file => dataTransfer.items.add(file));
const input = document.getElementById('imageInput');
input.files = dataTransfer.files;
}
function previewImages(event) {
const container = document.getElementById('imagePreviewContainer');
const uploadPlaceholder = document.getElementById('uploadPlaceholder');
const newFiles = Array.from(event.target.files || []);
if (!newFiles.length) return;
newFiles.forEach(file => {
if (!file.type.startsWith('image/')) return;
// avoid exact duplicates (same name + size)
if (selectedFiles.some(f => f.name === file.name && f.size === file.size)) {
return;
}
selectedFiles.push(file);
const reader = new FileReader();
reader.onload = function(e) {
const wrapper = document.createElement('div');
wrapper.className = 'preview-item';
wrapper.style.position = 'relative';
wrapper.style.width = '150px';
wrapper.style.height = '150px';
wrapper.style.marginRight = '8px';
const img = document.createElement('img');
img.src = e.target.result;
img.alt = file.name;
img.style.width = '100%';
img.style.height = '100%';
img.style.objectFit = 'cover';
img.className = 'img-fluid rounded';
const btn = document.createElement('button');
btn.type = 'button';
btn.className = 'remove-btn btn btn-sm btn-danger position-absolute top-0 end-0';
btn.innerText = '×';
btn.title = 'Remove';
btn.style.cursor = 'pointer';
// Position button at top right
btn.style.position = 'absolute';
btn.style.top = '2px';
btn.style.right = '2px';
btn.style.zIndex = '10';
btn.addEventListener('click', () => {
wrapper.remove();
selectedFiles = selectedFiles.filter(f => !(f.name === file.name && f.size === file.size));
updateInputFiles();
});
wrapper.appendChild(img);
wrapper.appendChild(btn);
// insert before the upload placeholder so the placeholder stays on the right
container.insertBefore(wrapper, uploadPlaceholder);
};
reader.readAsDataURL(file);
});
// update input.files to include all selected files
updateInputFiles();
}
// for debugging: expose selectedFiles in console
window.getSelectedFiles = () => selectedFiles;
})();
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+19
View File
@@ -0,0 +1,19 @@
(function() {
'use strict'
document.querySelectorAll(".prism-toggle").forEach((element)=>{
element.addEventListener("click",()=>{
let carElement = element.parentNode.parentNode
if(!carElement.children[1].classList.contains("d-none")){
element.firstElementChild.childNodes[1].className = "ri-code-s-slash-line ms-2 align-middle d-inline-block"
carElement.children[1].classList.add("d-none")
carElement.children[2].classList.remove("d-none")
}else{
element.firstElementChild.childNodes[1].className = "ri-code-line ms-2 align-middle d-inline-block"
carElement.children[1].classList.remove("d-none")
carElement.children[2].classList.add("d-none")
}
})
})
})();
+590
View File
@@ -0,0 +1,590 @@
(function () {
"use strict";
/* Sales Revenue */
var options = {
chart: {
height: 367,
toolbar: {
show: false,
},
zoom: {
enabled: false,
},
dropShadow: {
enabled: true,
enabledOnSeries: undefined,
top: 7,
left: 0,
blur: 1,
color: ["var(--primary-color)", "var(--primary02)", "rgb(255, 90, 41)"],
opacity: 0.05,
},
},
grid: {
show: true,
borderColor: "rgba(119, 119, 142, 0.1)",
strokeDashArray: 4,
},
dataLabels: {
enabled: false,
},
stroke: {
width: [1.5, 1.5],
curve: "straight",
},
legend: {
show: true,
position: "top",
horizontalAlign: "center",
fontWeight: 600,
fontSize: "11px",
labels: {
colors: "#74767c",
},
markers: {
size: 4,
strokeWidth: 0,
strokeColor: '#fff',
fillColors: undefined,
radius: 5,
customHTML: undefined,
onClick: undefined,
offsetX: 0,
offsetY: 0
},
},
series: [
{
name: "فروش",
data: [5,15, 21,20,15,40,55,55, 55,30,45,100,85, 85,85,130,100,56, 131,140,195,140,140,140, 85,115,106,100,100,110, 129,140,137,135,140,145, 153,157,160,220,110,100,95, 90,90,105,92,105,120,122, 150,130,117, 108,120,127,150,],
type: "area",
},
{
name:"بازاریابی",
data: [40,45, 47,49,52,50,80,86, 85,70,89,130,100, 110,110,180,130,106, 140,110,110,90,80,110, 135,145,120,110,110,120, 139,150,117,110,110,100, 123,137,110,110,130,140,135, 140,190,125,102,105,100,92, 108,120,127,150,130,117],
type: "line",
},
],
fill: {
type: ['gradient', 'solid'],
gradient: {
shadeIntensity: 1,
opacityFrom: 0.4,
opacityTo: 0.1,
stops: [0, 90, 100],
colorStops: [
[
{
offset: 0,
color: "var(--primary01)",
opacity: 0.1
},
{
offset: 75,
color: "var(--primary01)",
opacity: 1
},
{
offset: 100,
color: 'var(--primary02)',
opacity: 1
}
],
[
{
offset: 0,
color: 'rgb(255, 90, 41)',
opacity: 1
},
{
offset: 75,
color: 'rgb(255, 90, 41)',
opacity: 1
},
{
offset: 100,
color: 'rgb(255, 90, 41)',
opacity: 1
}
],
]
}
},
colors: ["var(--primary-color)", "rgb(184 ,122 ,243)"],
yaxis: {
min:0,
title: {
style: {
color: "#adb5be",
fontSize: "14px",
fontFamily: "IRANSans",
fontWeight: 600,
cssClass: "apexcharts-yaxis-label",
},
},
},
xaxis: {
type: "day",
categories: [
"فروردین",
"",
"",
"",
"",
"اردیبهشت",
"",
"",
"",
"",
"خرداد",
"",
"",
"",
"",
"تیر",
"",
"",
"",
"",
"مرداد",
"",
"",
"",
"",
"شهریور",
"",
"",
"",
"",
"مهر",
"",
"",
"",
"",
"آبان",
"",
"",
"",
"",
"آذر",
"",
"",
"",
"",
"دی",
"",
"",
"",
"",
"بهمن",
"",
"",
"",
"",
"اسفند",
],
axisBorder: {
show: true,
color: "rgba(119, 119, 142, 0.05)",
offsetX: 0,
offsetY: 0,
},
axisTicks: {
show: true,
borderType: "solid",
color: "rgba(119, 119, 142, 0.05)",
width: 6,
offsetX: 0,
offsetY: 0,
},
labels: {
rotate: -90,
style: {
colors: "#8c9097",
fontSize: "11px",
fontWeight: 600,
cssClass: "apexcharts-xaxis-label",
},
},
},
};
var chart = new ApexCharts(document.querySelector("#sales-revenue"), options);
chart.render();
/* Sales Revenue */
/* Sales Summary */
var options = {
series: [14, 18, 17, 15, 12, 10],
chart: {
type: 'polarArea',
height: 251,
},
stroke: {
colors: ['#fff'],
},
fill: {
opacity: 1
},
legend: {
show: false,
position: 'bottom',
itemMargin: {
horizontal: 5,
vertical: 5
},
fontFamily: "IRANSans",
},
labels: ['تحویل شد', 'لغو', 'در حال تعلیق', 'بازگردانده شد', 'ارسال شد', 'ناموفق'],
colors: ["var(--primary-color)", "rgba(175 ,109, 237,0.7)", "rgba(40 ,215 ,133,0.7)", "rgba(241 ,113 ,177,0.7)", "rgba(221 ,58, 82,0.7)", "rgba(253 ,126 ,20,0.7)"],
responsive: [{
breakpoint: 480,
options: {
chart: {
width: 200,
},
legend: {
position: 'bottom'
}
}
}]
};
var chart = new ApexCharts(document.querySelector("#sales-summary"), options);
chart.render();
/*Sales Summary */
/* Visitors Device */
var options = {
series: [
{
name: "هفته جاری",
data: [25, 50, 30, 55, ]
},
],
chart: {
height: 300,
type: 'bar',
offsetY: -10
},
plotOptions: {
bar: {
startAngle: -135,
endAngle: 135,
columnWidth: "40%",
dataLabels: {
name: {
fontSize: '16px',
color: undefined,
offsetY: 120
},
value: {
offsetY: 76,
fontSize: '22px',
color: undefined,
formatter: function (val) {
return val + "%";
}
}
}
}
},
stroke: {
dashArray: 4
},
labels: ['موبایل','دسکتاپ','لپ تاپ','تبلت'],
colors: ["var(--primary-color)", "rgba(175 ,109, 237,0.7)", "rgba(40 ,215 ,133,0.7)", "rgba(241 ,113 ,177,0.7)", ],
};
var chart = new ApexCharts(document.querySelector("#visitors-device"), options);
chart.render();
/* Visitors Device */
/* line-graph charts */
var options2 = {
series: [{
data: [25, 39, 15, 89, 47, 70, 44]
}],
chart: {
type: 'line',
width: 100,
height: 35,
sparkline: {
enabled: true
}
},
stroke: {
width: [1.5],
show: true,
curve: 'smooth',
lineCap: 'butt',
},
colors:["rgb(88 ,155, 255)"],
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
y: {
title: {
formatter: function (seriesName) {
return ''
}
}
},
marker: {
show: false
}
}
};
var chart2 = new ApexCharts(document.querySelector("#line-graph1"), options2);
chart2.render();
var options2 = {
series: [{
data: [5, 20, 15, 29, 17, 40, 4]
}],
chart: {
type: 'line',
width: 100,
height: 35,
sparkline: {
enabled: true
}
},
stroke: {
width: [1.5],
show: true,
curve: 'smooth',
lineCap: 'butt',
},
colors:["rgb(175 ,109, 237)"],
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
y: {
title: {
formatter: function (seriesName) {
return ''
}
}
},
marker: {
show: false
}
}
};
var chart2 = new ApexCharts(document.querySelector("#line-graph2"), options2);
chart2.render();
var options2 = {
series: [{
data: [55,9, 55, 29, 87, 70, 64]
}],
chart: {
type: 'line',
width: 100,
height: 35,
sparkline: {
enabled: true
}
},
stroke: {
width: [1.5],
show: true,
curve: 'smooth',
lineCap: 'butt',
},
colors:["rgb(40 ,215 ,133)"],
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
y: {
title: {
formatter: function (seriesName) {
return ''
}
}
},
marker: {
show: false
}
}
};
var chart2 = new ApexCharts(document.querySelector("#line-graph3"), options2);
chart2.render();
var options2 = {
series: [{
data: [2, 39, 5, 49, 37, 70, 24]
}],
chart: {
type: 'line',
width: 100,
height: 35,
sparkline: {
enabled: true
}
},
stroke: {
width: [1.5],
show: true,
curve: 'smooth',
lineCap: 'butt',
},
colors:["rgb(241 ,113 ,177)"],
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
y: {
title: {
formatter: function (seriesName) {
return ''
}
}
},
marker: {
show: false
}
}
};
var chart2 = new ApexCharts(document.querySelector("#line-graph4"), options2);
chart2.render();
var options2 = {
series: [{
data: [25, 89, 15, 89, 47, 70, 44]
}],
chart: {
type: 'line',
width: 100,
height: 35,
sparkline: {
enabled: true
}
},
stroke: {
width: [1.5],
show: true,
curve: 'smooth',
lineCap: 'butt',
},
colors:["rgb(253 ,126 ,20)"],
tooltip: {
fixed: {
enabled: false
},
x: {
show: false
},
y: {
title: {
formatter: function (seriesName) {
return ''
}
}
},
marker: {
show: false
}
}
};
var chart2 = new ApexCharts(document.querySelector("#line-graph5"), options2);
chart2.render();
/* line-graph charts */
/* Orders Summary */
var options = {
series: [1754, 834,549,234 ],
labels: ["مرد", "زن", "سایر","نامشخص"],
chart: {
height: 310,
type: 'donut',
},
dataLabels: {
enabled: false,
},
legend: {
show: false,
},
stroke: {
show: true,
curve: 'smooth',
lineCap: 'round',
colors: "#fff",
width: 2,
dashArray: 0,
},
plotOptions: {
pie: {
startAngle: -90,
endAngle: 90,
offsetY: 10,
expandOnClick: false,
donut: {
size: '75%',
background: 'transparent',
labels: {
show: true,
name: {
show: true,
fontSize: '20px',
color: '#495057',
fontFamily: "IRANSans",
offsetY: -35
},
value: {
show: true,
fontSize: '22px',
color: undefined,
offsetY: -25,
fontWeight: 600,
fontFamily: "IRANSans",
formatter: function (val) {
return val + "%"
}
},
total: {
show: true,
showAlways: true,
label: 'کل بازدیدکنندگان',
fontSize: '14px',
fontWeight: 400,
color: '#495057',
}
}
}
}
},
grid: {
padding: {
bottom: -100
}
},
colors: ["var(--primary-color)", "rgb(175 ,109, 237)", "rgb(40 ,215 ,133)", "rgb(241 ,113 ,177)"],
};
var chart = new ApexCharts(document.querySelector("#orders-summary"), options);
chart.render();
/* Orders Summary */
})();
+17
View File
@@ -0,0 +1,17 @@
"use strict"
// for show password
let createpassword = (type, ele) => {
document.getElementById(type).type = document.getElementById(type).type == "password" ? "text" : "password"
let icon = ele.childNodes[0].classList
let stringIcon = icon.toString()
if (stringIcon.includes("ri-eye-line")) {
ele.childNodes[0].classList.remove("ri-eye-line")
ele.childNodes[0].classList.add("ri-eye-off-line")
}
else {
ele.childNodes[0].classList.add("ri-eye-line")
ele.childNodes[0].classList.remove("ri-eye-off-line")
}
}
+7
View File
@@ -0,0 +1,7 @@
(function () {
"use strict";
var myElement = document.getElementById('sidebar-scroll');
new SimpleBar(myElement, { autoHide: true });
})();
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More