Initial commit
This commit is contained in:
18
.editorconfig
Normal file
18
.editorconfig
Normal file
@ -0,0 +1,18 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
[*.{yml,yaml}]
|
||||
indent_size = 2
|
||||
|
||||
[docker-compose.yml]
|
||||
indent_size = 4
|
60
.env.example
Normal file
60
.env.example
Normal file
@ -0,0 +1,60 @@
|
||||
APP_NAME=Clara
|
||||
APP_ENV=local
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost:8000
|
||||
|
||||
METHOD_AUTH=
|
||||
IP_USER_MANAGER=
|
||||
PORT_USER_MANAGER=
|
||||
APP_ID=
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
LOG_DEPRECATIONS_CHANNEL=null
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=clara
|
||||
DB_USERNAME=root
|
||||
DB_PASSWORD=
|
||||
|
||||
BROADCAST_DRIVER=log
|
||||
CACHE_DRIVER=file
|
||||
FILESYSTEM_DISK=local
|
||||
QUEUE_CONNECTION=sync
|
||||
SESSION_DRIVER=file
|
||||
SESSION_LIFETIME=120
|
||||
|
||||
MEMCACHED_HOST=127.0.0.1
|
||||
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_PASSWORD=null
|
||||
REDIS_PORT=6379
|
||||
|
||||
MAIL_MAILER=smtp
|
||||
MAIL_HOST=mailhog
|
||||
MAIL_PORT=1025
|
||||
MAIL_USERNAME=null
|
||||
MAIL_PASSWORD=null
|
||||
MAIL_ENCRYPTION=null
|
||||
MAIL_FROM_ADDRESS="hello@example.com"
|
||||
MAIL_FROM_NAME="${APP_NAME}"
|
||||
|
||||
AWS_ACCESS_KEY_ID=
|
||||
AWS_SECRET_ACCESS_KEY=
|
||||
AWS_DEFAULT_REGION=us-east-1
|
||||
AWS_BUCKET=
|
||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||
|
||||
PUSHER_APP_ID=
|
||||
PUSHER_APP_KEY=
|
||||
PUSHER_APP_SECRET=
|
||||
PUSHER_HOST=
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
11
.gitattributes
vendored
Normal file
11
.gitattributes
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
* text=auto
|
||||
|
||||
*.blade.php diff=html
|
||||
*.css diff=css
|
||||
*.html diff=html
|
||||
*.md diff=markdown
|
||||
*.php diff=php
|
||||
|
||||
/.github export-ignore
|
||||
CHANGELOG.md export-ignore
|
||||
.styleci.yml export-ignore
|
20
.gitignore
vendored
Normal file
20
.gitignore
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/public/assets
|
||||
/public/mix-manifest.json
|
||||
/storage/*.key
|
||||
/vendor
|
||||
/Modules/*
|
||||
.env
|
||||
.env.backup
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
composer.lock
|
66
README.md
Normal file
66
README.md
Normal file
@ -0,0 +1,66 @@
|
||||
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400" alt="Laravel Logo"></a></p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
|
||||
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
|
||||
</p>
|
||||
|
||||
## About Laravel
|
||||
|
||||
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
|
||||
|
||||
- [Simple, fast routing engine](https://laravel.com/docs/routing).
|
||||
- [Powerful dependency injection container](https://laravel.com/docs/container).
|
||||
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
|
||||
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
|
||||
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
|
||||
- [Robust background job processing](https://laravel.com/docs/queues).
|
||||
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
|
||||
|
||||
Laravel is accessible, powerful, and provides tools required for large, robust applications.
|
||||
|
||||
## Learning Laravel
|
||||
|
||||
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
|
||||
|
||||
You may also try the [Laravel Bootcamp](https://bootcamp.laravel.com), where you will be guided through building a modern Laravel application from scratch.
|
||||
|
||||
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
|
||||
|
||||
## Laravel Sponsors
|
||||
|
||||
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
|
||||
|
||||
### Premium Partners
|
||||
|
||||
- **[Vehikl](https://vehikl.com/)**
|
||||
- **[Tighten Co.](https://tighten.co)**
|
||||
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
|
||||
- **[64 Robots](https://64robots.com)**
|
||||
- **[Cubet Techno Labs](https://cubettech.com)**
|
||||
- **[Cyber-Duck](https://cyber-duck.co.uk)**
|
||||
- **[Many](https://www.many.co.uk)**
|
||||
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
|
||||
- **[DevSquad](https://devsquad.com)**
|
||||
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
|
||||
- **[OP.GG](https://op.gg)**
|
||||
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
|
||||
- **[Lendio](https://lendio.com)**
|
||||
|
||||
## Contributing
|
||||
|
||||
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
|
||||
|
||||
## Security Vulnerabilities
|
||||
|
||||
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
|
||||
|
||||
## License
|
||||
|
||||
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).
|
32
app/Console/Kernel.php
Normal file
32
app/Console/Kernel.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
/**
|
||||
* Define the application's command schedule.
|
||||
*
|
||||
* @param \Illuminate\Console\Scheduling\Schedule $schedule
|
||||
* @return void
|
||||
*/
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
// $schedule->command('inspire')->hourly();
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the commands for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function commands()
|
||||
{
|
||||
$this->load(__DIR__.'/Commands');
|
||||
|
||||
require base_path('routes/console.php');
|
||||
}
|
||||
}
|
13
app/Core/Bootstrap/BootstrapAuth.php
Normal file
13
app/Core/Bootstrap/BootstrapAuth.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Bootstrap;
|
||||
|
||||
class BootstrapAuth
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// See also starterkit/app/View/Components/SystemLayout.php to change the layout
|
||||
|
||||
addHtmlClass('body', 'app-blank');
|
||||
}
|
||||
}
|
87
app/Core/Bootstrap/BootstrapDefault.php
Normal file
87
app/Core/Bootstrap/BootstrapDefault.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Bootstrap;
|
||||
|
||||
class BootstrapDefault
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// 1) Light sidebar layout (default.html)
|
||||
// $this->initLightSidebarLayout();
|
||||
|
||||
// 2) Dark sidebar layout (default.html)
|
||||
$this->initDarkSidebarLayout();
|
||||
|
||||
// 3) Dark header layout (default_header_layout.html)
|
||||
// $this->initDarkHeaderLayout();
|
||||
|
||||
// 4) Light header layout (default_header_layout.html)
|
||||
// $this->initLightHeaderLayout();
|
||||
|
||||
# Init global assets for default layout
|
||||
$this->initAssets();
|
||||
}
|
||||
|
||||
public function initAssets()
|
||||
{
|
||||
# Include global vendors
|
||||
addVendors(['datatables', 'fullcalendar']);
|
||||
|
||||
# Include global javascript files
|
||||
addJavascriptFile('assets/js/custom/widgets.js');
|
||||
addJavascriptFile('assets/js/custom/apps/chat/chat.js');
|
||||
addJavascriptFile('assets/js/custom/utilities/modals/upgrade-plan.js');
|
||||
addJavascriptFile('assets/js/custom/utilities/modals/create-app.js');
|
||||
addJavascriptFile('assets/js/custom/utilities/modals/users-search.js');
|
||||
addJavascriptFile('assets/js/custom/utilities/modals/new-target.js');
|
||||
}
|
||||
|
||||
public function initDarkSidebarLayout()
|
||||
{
|
||||
addHtmlAttribute('body', 'data-kt-app-layout', 'dark-sidebar');
|
||||
addHtmlAttribute('body', 'data-kt-app-header-fixed', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-enabled', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-fixed', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-hoverable', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-header', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-toolbar', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-footer', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-toolbar-enabled', 'true');
|
||||
|
||||
addHtmlClass('body', 'app-default');
|
||||
}
|
||||
|
||||
public function initLightSidebarLayout()
|
||||
{
|
||||
addHtmlAttribute('body', 'data-kt-app-layout', 'light-sidebar');
|
||||
addHtmlAttribute('body', 'data-kt-app-header-fixed', 'false');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-enabled', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-fixed', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-hoverable', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-header', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-toolbar', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-sidebar-push-footer', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-toolbar-enabled', 'true');
|
||||
|
||||
addHtmlClass('body', 'app-default');
|
||||
}
|
||||
|
||||
public function initDarkHeaderLayout()
|
||||
{
|
||||
addHtmlAttribute('body', 'data-kt-app-layout', 'dark-header');
|
||||
addHtmlAttribute('body', 'data-kt-app-header-fixed', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-toolbar-enabled', 'true');
|
||||
|
||||
addHtmlClass('body', 'app-default');
|
||||
}
|
||||
|
||||
public function initLightHeaderLayout()
|
||||
{
|
||||
addHtmlAttribute('body', 'data-kt-app-layout', 'light-header');
|
||||
addHtmlAttribute('body', 'data-kt-app-header-fixed', 'true');
|
||||
addHtmlAttribute('body', 'data-kt-app-toolbar-enabled', 'true');
|
||||
|
||||
addHtmlClass('body', 'app-default');
|
||||
}
|
||||
|
||||
}
|
13
app/Core/Bootstrap/BootstrapSystem.php
Normal file
13
app/Core/Bootstrap/BootstrapSystem.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core\Bootstrap;
|
||||
|
||||
class BootstrapSystem
|
||||
{
|
||||
public function init()
|
||||
{
|
||||
// See also starterkit/app/View/Components/SystemLayout.php to change the layout
|
||||
|
||||
addHtmlClass('body', 'app-blank');
|
||||
}
|
||||
}
|
420
app/Core/Theme.php
Normal file
420
app/Core/Theme.php
Normal file
@ -0,0 +1,420 @@
|
||||
<?php
|
||||
|
||||
namespace App\Core;
|
||||
|
||||
class Theme
|
||||
{
|
||||
/**
|
||||
* Variables
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public static $modeSwitchEnabled = false;
|
||||
public static $modeDefault = 'light';
|
||||
|
||||
public static $direction = 'ltr';
|
||||
|
||||
public static $htmlAttributes = [];
|
||||
public static $htmlClasses = [];
|
||||
|
||||
|
||||
/**
|
||||
* Keep page level assets
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $javascriptFiles = [];
|
||||
public static $cssFiles = [];
|
||||
public static $vendorFiles = [];
|
||||
|
||||
/**
|
||||
* Get product name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function getName()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HTML attributes by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $name
|
||||
* @param $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlAttribute($scope, $name, $value)
|
||||
{
|
||||
self::$htmlAttributes[$scope][$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add multiple HTML attributes by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $attributes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlAttributes($scope, $attributes)
|
||||
{
|
||||
foreach ($attributes as $key => $value) {
|
||||
self::$htmlAttributes[$scope][$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add HTML class by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlClass($scope, $value)
|
||||
{
|
||||
self::$htmlClasses[$scope][] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove HTML class by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function removeHtmlClass($scope, $value)
|
||||
{
|
||||
$key = array_search($value, self::$htmlClasses[$scope]);
|
||||
unset(self::$htmlClasses[$scope][$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print HTML attributes for the HTML template
|
||||
*
|
||||
* @param $scope
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function printHtmlAttributes($scope)
|
||||
{
|
||||
$attributes = [];
|
||||
if (isset(self::$htmlAttributes[$scope])) {
|
||||
foreach (self::$htmlAttributes[$scope] as $key => $value) {
|
||||
$attributes[] = sprintf('%s="%s"', $key, $value);
|
||||
}
|
||||
}
|
||||
|
||||
return join(' ', $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Print HTML classes for the HTML template
|
||||
*
|
||||
* @param $scope
|
||||
* @param $full
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function printHtmlClasses($scope, $full = true)
|
||||
{
|
||||
if (empty(self::$htmlClasses)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$classes = [];
|
||||
if (isset(self::$htmlClasses[$scope])) {
|
||||
$classes = self::$htmlClasses[$scope];
|
||||
}
|
||||
|
||||
if ($full) {
|
||||
return sprintf('class="%s"', implode(' ', (array) $classes));
|
||||
}
|
||||
|
||||
return $classes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get SVG icon content
|
||||
*
|
||||
* @param $path
|
||||
* @param $classNames
|
||||
* @param $folder
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getSvgIcon($path, $classNames = 'svg-icon')
|
||||
{
|
||||
if (file_exists(public_path('assets/media/icons/'.$path))) {
|
||||
return sprintf('<span class="%s">%s</span>', $classNames, file_get_contents(public_path('assets/media/icons/'.$path)));
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set dark mode enabled status
|
||||
*
|
||||
* @param $flag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setModeSwitch($flag)
|
||||
{
|
||||
self::$modeSwitchEnabled = $flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check dark mode status
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isModeSwitchEnabled()
|
||||
{
|
||||
return self::$modeSwitchEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the mode to dark or light
|
||||
*
|
||||
* @param $mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setModeDefault($mode)
|
||||
{
|
||||
self::$modeDefault = $mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current mode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getModeDefault()
|
||||
{
|
||||
return self::$modeDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set style direction
|
||||
*
|
||||
* @param $direction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setDirection($direction)
|
||||
{
|
||||
self::$direction = $direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get style direction
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getDirection()
|
||||
{
|
||||
return self::$direction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extend CSS file name with RTL or dark mode
|
||||
*
|
||||
* @param $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function extendCssFilename($path)
|
||||
{
|
||||
if ($this->isRtlDirection()) {
|
||||
$path = str_replace('.css', '.rtl.css');
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if style direction is RTL
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
function isRtlDirection()
|
||||
{
|
||||
return self::$direction === 'rtl';
|
||||
}
|
||||
|
||||
/**
|
||||
* Include favicon from settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function includeFavicon()
|
||||
{
|
||||
return sprintf('<link rel="shortcut icon" href="%s" />', asset(config('settings.KT_THEME_ASSETS.favicon')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Include the fonts from settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function includeFonts()
|
||||
{
|
||||
$content = '';
|
||||
|
||||
foreach (config('settings.KT_THEME_ASSETS.fonts') as $url) {
|
||||
$content .= sprintf('<link rel="stylesheet" href="%s">', asset($url));
|
||||
}
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the global assets
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getGlobalAssets($type = 'js')
|
||||
{
|
||||
// $this->extendCssFilename()
|
||||
return config('settings.KT_THEME_ASSETS.global.'.$type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add multiple vendors to the page by name. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $vendors
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function addVendors($vendors)
|
||||
{
|
||||
foreach ($vendors as $value) {
|
||||
self::$vendorFiles[] = $value;
|
||||
}
|
||||
|
||||
return array_unique(self::$vendorFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add single vendor to the page by name. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $vendor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addVendor($vendor)
|
||||
{
|
||||
self::$vendorFiles[] = $vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom javascript file to the page
|
||||
*
|
||||
* @param $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addJavascriptFile($file)
|
||||
{
|
||||
self::$javascriptFiles[] = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add custom CSS file to the page
|
||||
*
|
||||
* @param $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addCssFile($file)
|
||||
{
|
||||
self::$cssFiles[] = $file;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vendor files from settings. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getVendors($type)
|
||||
{
|
||||
$files = [];
|
||||
foreach (self::$vendorFiles as $vendor) {
|
||||
$vendors = config('settings.KT_THEME_VENDORS.'.$vendor);
|
||||
if (isset($vendors[$type])) {
|
||||
foreach ($vendors[$type] as $path) {
|
||||
$files[] = $path;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_unique($files);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom js files from the settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCustomJs()
|
||||
{
|
||||
return self::$javascriptFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get custom css files from the settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCustomCss()
|
||||
{
|
||||
return self::$cssFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get HTML attribute based on the scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $attribute
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getHtmlAttribute($scope, $attribute)
|
||||
{
|
||||
return self::$htmlAttributes[$scope][$attribute] ?? [];
|
||||
}
|
||||
|
||||
function getIcon($name, $class = '', $type = '')
|
||||
{
|
||||
$type = config('settings.KT_THEME_ICONS', 'duotone');
|
||||
|
||||
$tag = 'span';
|
||||
|
||||
if ($type === 'duotone') {
|
||||
$icons = cache()->remember('duotone-icons', 3600, function () {
|
||||
return json_decode(file_get_contents(public_path('icons.json')), true);
|
||||
});
|
||||
|
||||
$pathsNumber = data_get($icons, 'duotone-paths.'.$name, 0);
|
||||
|
||||
$output = '<'.$tag.' class="ki-'.$type.' ki-'.$name.(!empty($class) ? " ".$class : '').'">';
|
||||
|
||||
for ($i = 0; $i < $pathsNumber; $i++) {
|
||||
$output .= '<'.$tag.' class="path'.($i + 1).'"></'.$tag.'>';
|
||||
}
|
||||
|
||||
$output .= '</'.$tag.'>';
|
||||
} else {
|
||||
$output = '<'.$tag.' class="ki-'.$type.' ki-'.$name.(!empty($class) ? " ".$class : '').'"></'.$tag.'>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
60
app/Exceptions/Handler.php
Normal file
60
app/Exceptions/Handler.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
use Throwable;
|
||||
|
||||
class Handler extends ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* A list of exception types with their corresponding custom log levels.
|
||||
*
|
||||
* @var array<class-string<\Throwable>, \Psr\Log\LogLevel::*>
|
||||
*/
|
||||
protected $levels = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the exception types that are not reported.
|
||||
*
|
||||
* @var array<int, class-string<\Throwable>>
|
||||
*/
|
||||
protected $dontReport = [
|
||||
//
|
||||
];
|
||||
|
||||
/**
|
||||
* A list of the inputs that are never flashed to the session on validation exceptions.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $dontFlash = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register the exception handling callbacks for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->reportable(function (Throwable $e) {
|
||||
//
|
||||
});
|
||||
|
||||
$this->renderable(function (NotFoundHttpException $e, $request) {
|
||||
if ($request->is('api/*')) {
|
||||
return response()->json([
|
||||
'message' => 'Not found.'
|
||||
], 404);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
545
app/Helpers/Helpers.php
Normal file
545
app/Helpers/Helpers.php
Normal file
@ -0,0 +1,545 @@
|
||||
<?php
|
||||
|
||||
if (!function_exists('theme')) {
|
||||
function theme()
|
||||
{
|
||||
return app(App\Core\Theme::class);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getName')) {
|
||||
/**
|
||||
* Get product name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function getName()
|
||||
{
|
||||
return config('settings.KT_THEME');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addHtmlAttribute')) {
|
||||
/**
|
||||
* Add HTML attributes by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $name
|
||||
* @param $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlAttribute($scope, $name, $value)
|
||||
{
|
||||
theme()->addHtmlAttribute($scope, $name, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addHtmlAttributes')) {
|
||||
/**
|
||||
* Add multiple HTML attributes by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $attributes
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlAttributes($scope, $attributes)
|
||||
{
|
||||
theme()->addHtmlAttributes($scope, $attributes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addHtmlClass')) {
|
||||
/**
|
||||
* Add HTML class by scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addHtmlClass($scope, $value)
|
||||
{
|
||||
theme()->addHtmlClass($scope, $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('printHtmlAttributes')) {
|
||||
/**
|
||||
* Print HTML attributes for the HTML template
|
||||
*
|
||||
* @param $scope
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function printHtmlAttributes($scope)
|
||||
{
|
||||
return theme()->printHtmlAttributes($scope);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('printHtmlClasses')) {
|
||||
/**
|
||||
* Print HTML classes for the HTML template
|
||||
*
|
||||
* @param $scope
|
||||
* @param $full
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function printHtmlClasses($scope, $full = true)
|
||||
{
|
||||
return theme()->printHtmlClasses($scope, $full);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getSvgIcon')) {
|
||||
/**
|
||||
* Get SVG icon content
|
||||
*
|
||||
* @param $path
|
||||
* @param $classNames
|
||||
* @param $folder
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getSvgIcon($path, $classNames = 'svg-icon', $folder = 'assets/media/icons/')
|
||||
{
|
||||
return theme()->getSvgIcon($path, $classNames, $folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('setModeSwitch')) {
|
||||
/**
|
||||
* Set dark mode enabled status
|
||||
*
|
||||
* @param $flag
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setModeSwitch($flag)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('isModeSwitchEnabled')) {
|
||||
/**
|
||||
* Check dark mode status
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function isModeSwitchEnabled()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('setModeDefault')) {
|
||||
/**
|
||||
* Set the mode to dark or light
|
||||
*
|
||||
* @param $mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setModeDefault($mode)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getModeDefault')) {
|
||||
/**
|
||||
* Get current mode
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function getModeDefault()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('setDirection')) {
|
||||
/**
|
||||
* Set style direction
|
||||
*
|
||||
* @param $direction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function setDirection($direction)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getDirection')) {
|
||||
/**
|
||||
* Get style direction
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function getDirection()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('isRtlDirection')) {
|
||||
/**
|
||||
* Check if style direction is RTL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function isRtlDirection()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('extendCssFilename')) {
|
||||
/**
|
||||
* Extend CSS file name with RTL or dark mode
|
||||
*
|
||||
* @param $path
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function extendCssFilename($path)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('includeFavicon')) {
|
||||
/**
|
||||
* Include favicon from settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function includeFavicon()
|
||||
{
|
||||
return theme()->includeFavicon();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('includeFonts')) {
|
||||
/**
|
||||
* Include the fonts from settings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function includeFonts()
|
||||
{
|
||||
return theme()->includeFonts();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getGlobalAssets')) {
|
||||
/**
|
||||
* Get the global assets
|
||||
*
|
||||
* @param $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getGlobalAssets($type = 'js')
|
||||
{
|
||||
return theme()->getGlobalAssets($type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addVendors')) {
|
||||
/**
|
||||
* Add multiple vendors to the page by name. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $vendors
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addVendors($vendors)
|
||||
{
|
||||
theme()->addVendors($vendors);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addVendor')) {
|
||||
/**
|
||||
* Add single vendor to the page by name. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $vendor
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addVendor($vendor)
|
||||
{
|
||||
theme()->addVendor($vendor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addJavascriptFile')) {
|
||||
/**
|
||||
* Add custom javascript file to the page
|
||||
*
|
||||
* @param $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addJavascriptFile($file)
|
||||
{
|
||||
theme()->addJavascriptFile($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('addCssFile')) {
|
||||
/**
|
||||
* Add custom CSS file to the page
|
||||
*
|
||||
* @param $file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function addCssFile($file)
|
||||
{
|
||||
theme()->addCssFile($file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getVendors')) {
|
||||
/**
|
||||
* Get vendor files from settings. Refer to settings KT_THEME_VENDORS
|
||||
*
|
||||
* @param $type
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getVendors($type)
|
||||
{
|
||||
return theme()->getVendors($type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getCustomJs')) {
|
||||
/**
|
||||
* Get custom js files from the settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCustomJs()
|
||||
{
|
||||
return theme()->getCustomJs();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getCustomCss')) {
|
||||
/**
|
||||
* Get custom css files from the settings
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getCustomCss()
|
||||
{
|
||||
return theme()->getCustomCss();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getHtmlAttribute')) {
|
||||
/**
|
||||
* Get HTML attribute based on the scope
|
||||
*
|
||||
* @param $scope
|
||||
* @param $attribute
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getHtmlAttribute($scope, $attribute)
|
||||
{
|
||||
return theme()->getHtmlAttribute($scope, $attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('isUrl')) {
|
||||
/**
|
||||
* Get HTML attribute based on the scope
|
||||
*
|
||||
* @param $url
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function isUrl($url)
|
||||
{
|
||||
return filter_var($url, FILTER_VALIDATE_URL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('image')) {
|
||||
/**
|
||||
* Get image url by path
|
||||
*
|
||||
* @param $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function image($path)
|
||||
{
|
||||
return asset('assets/media/' . $path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!function_exists('getIcon')) {
|
||||
/**
|
||||
* Get icon
|
||||
*
|
||||
* @param $path
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getIcon($name, $class = '', $type = '')
|
||||
{
|
||||
return theme()->getIcon($name, $class, $type);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function verify_user($id, $passwd, $SERVER_ADDR, $IPUserManager, $portUserManager, $appId)
|
||||
{
|
||||
|
||||
$USERMANPROG = "user_verification.php";
|
||||
$sock = fsockopen("tcp://" . $IPUserManager, $portUserManager, $errno, $errstr, 30);
|
||||
|
||||
|
||||
if (!$sock) die("$errstr ($errno)\n");
|
||||
|
||||
$data = "appsid=" . urlencode($appId) . "&loginid=" . urlencode($id) . "&passwd=" . urlencode($passwd) . "&addr=" . $SERVER_ADDR . "&version=2";
|
||||
|
||||
//echo "data: $data <BR>";
|
||||
|
||||
fwrite($sock, "POST /user_verification_dev.php HTTP/1.0\r\n");
|
||||
fwrite($sock, "Host: $IPUserManager\r\n");
|
||||
fwrite($sock, "Content-type: application/x-www-form-urlencoded\r\n");
|
||||
fwrite($sock, "Content-length: " . strlen($data) . "\r\n");
|
||||
fwrite($sock, "Accept: */*\r\n");
|
||||
fwrite($sock, "\r\n");
|
||||
fwrite($sock, "$data\r\n");
|
||||
fwrite($sock, "\r\n");
|
||||
|
||||
$headers = "";
|
||||
while ($str = trim(fgets($sock, 4096))) $headers .= "$str\n";
|
||||
|
||||
$body = "";
|
||||
while (!feof($sock)) $body .= fgets($sock, 4096);
|
||||
|
||||
|
||||
fclose($sock);
|
||||
|
||||
return decompress($body);
|
||||
}
|
||||
|
||||
|
||||
function getAllowableScript($sessionMenu)
|
||||
{
|
||||
//$sessionMenu = $_SESSION['MENU'];
|
||||
|
||||
if (!empty($sessionMenu)) {
|
||||
$tempMenuArrayLine = explode('-', $sessionMenu);
|
||||
//print_r($tempMenuArrayLine);
|
||||
if (count($tempMenuArrayLine) > 0) {
|
||||
foreach ($tempMenuArrayLine as $tkey => $tval) {
|
||||
$tempMenuArray = explode('|', $tval);
|
||||
if (count($tempMenuArray) > 0) {
|
||||
foreach ($tempMenuArray as $mkey => $mval) {
|
||||
[$menukey, $menuval] = explode('>', $mval);
|
||||
if ($menukey === 'LINK') {
|
||||
$SCRIPT_ALLOW[$menuval] = 1;
|
||||
}
|
||||
//$menu[$menuCounter][$menukey] = $menuval;
|
||||
}
|
||||
//$menuCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $SCRIPT_ALLOW;
|
||||
}
|
||||
|
||||
function decompress($data)
|
||||
{
|
||||
$text = '';
|
||||
$total = strlen($data);
|
||||
for ($j = 0; $j < $total; $j = $j + 2) {
|
||||
$text .= chr(hexdec(substr($data, $j, 2)));
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function compress($data)
|
||||
{
|
||||
$text = '';
|
||||
$total = strlen($data);
|
||||
for ($i = 0; $i < $total; $i++) {
|
||||
$temp = dechex(ord(substr($data, $i, 1)));
|
||||
if (strlen($temp) < 2) {
|
||||
$temp = '0' . $temp;
|
||||
}
|
||||
$text .= $temp;
|
||||
}
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
function jsonToView($jsonText = '')
|
||||
{
|
||||
$arr = json_decode($jsonText, true);
|
||||
$html = "";
|
||||
if ($arr && is_array($arr)) {
|
||||
$html .= _arrayToHtmlTableRecursive($arr);
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
function _arrayToHtmlTableRecursive($arr)
|
||||
{
|
||||
$str = "<table><tbody>";
|
||||
foreach ($arr as $key => $val) {
|
||||
$str .= "<tr>";
|
||||
$str .= "<td>$key</td>";
|
||||
$str .= "<td>";
|
||||
if (is_array($val)) {
|
||||
if (!empty($val)) {
|
||||
$str .= _arrayToHtmlTableRecursive($val);
|
||||
}
|
||||
} else {
|
||||
$str .= "<strong>$val</strong>";
|
||||
}
|
||||
$str .= "</td></tr>";
|
||||
}
|
||||
$str .= "</tbody></table>";
|
||||
|
||||
return $str;
|
||||
}
|
43
app/Http/Controllers/ApiController.php
Normal file
43
app/Http/Controllers/ApiController.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller as Controller;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* success response method.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sendResponse($result, $message, $code = 200)
|
||||
{
|
||||
$response = [
|
||||
'success' => true,
|
||||
'data' => $result,
|
||||
'message' => $message,
|
||||
];
|
||||
|
||||
return response()->json($response, $code);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return error response.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function sendError($error, $errorMessages = [], $code = 404)
|
||||
{
|
||||
$response = [
|
||||
'success' => false,
|
||||
'message' => $error,
|
||||
];
|
||||
|
||||
if (!empty($errorMessages)) {
|
||||
$response['data'] = $errorMessages;
|
||||
}
|
||||
|
||||
return response()->json($response, $code);
|
||||
}
|
||||
}
|
13
app/Http/Controllers/Controller.php
Normal file
13
app/Http/Controllers/Controller.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
13
app/Http/Controllers/DashboardController.php
Normal file
13
app/Http/Controllers/DashboardController.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
addVendors(['amcharts', 'amcharts-maps', 'amcharts-stock']);
|
||||
|
||||
return view('pages.dashboards.index');
|
||||
}
|
||||
}
|
67
app/Http/Kernel.php
Normal file
67
app/Http/Kernel.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
/**
|
||||
* The application's global HTTP middleware stack.
|
||||
*
|
||||
* These middleware are run during every request to your application.
|
||||
*
|
||||
* @var array<int, class-string|string>
|
||||
*/
|
||||
protected $middleware = [
|
||||
// \App\Http\Middleware\TrustHosts::class,
|
||||
\App\Http\Middleware\TrustProxies::class,
|
||||
\Illuminate\Http\Middleware\HandleCors::class,
|
||||
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
|
||||
\App\Http\Middleware\TrimStrings::class,
|
||||
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware groups.
|
||||
*
|
||||
* @var array<string, array<int, class-string|string>>
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
\Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class,
|
||||
'throttle:api',
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* The application's route middleware.
|
||||
*
|
||||
* These middleware may be assigned to groups or used individually.
|
||||
*
|
||||
* @var array<string, class-string|string>
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class,
|
||||
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class,
|
||||
'signed' => \App\Http\Middleware\ValidateSignature::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
|
||||
];
|
||||
}
|
21
app/Http/Middleware/Authenticate.php
Normal file
21
app/Http/Middleware/Authenticate.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Auth\Middleware\Authenticate as Middleware;
|
||||
|
||||
class Authenticate extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the path the user should be redirected to when they are not authenticated.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return string|null
|
||||
*/
|
||||
protected function redirectTo($request)
|
||||
{
|
||||
if (! $request->expectsJson()) {
|
||||
return route('login');
|
||||
}
|
||||
}
|
||||
}
|
20
app/Http/Middleware/EncryptCookies.php
Normal file
20
app/Http/Middleware/EncryptCookies.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
|
||||
|
||||
class EncryptCookies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the cookies that should not be encrypted.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
"sidebar_minimize_state",
|
||||
"kt_aside_toggle_state",
|
||||
"kt_aside_menu",
|
||||
"data-kt-app-sidebar-minimize",
|
||||
];
|
||||
}
|
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
17
app/Http/Middleware/PreventRequestsDuringMaintenance.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
|
||||
|
||||
class PreventRequestsDuringMaintenance extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be reachable while maintenance mode is enabled.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
32
app/Http/Middleware/RedirectIfAuthenticated.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class RedirectIfAuthenticated
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next
|
||||
* @param string|null ...$guards
|
||||
* @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function handle(Request $request, Closure $next, ...$guards)
|
||||
{
|
||||
$guards = empty($guards) ? [null] : $guards;
|
||||
|
||||
foreach ($guards as $guard) {
|
||||
if (Auth::guard($guard)->check()) {
|
||||
return redirect(RouteServiceProvider::HOME);
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
19
app/Http/Middleware/TrimStrings.php
Normal file
19
app/Http/Middleware/TrimStrings.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\TrimStrings as Middleware;
|
||||
|
||||
class TrimStrings extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the attributes that should not be trimmed.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
'current_password',
|
||||
'password',
|
||||
'password_confirmation',
|
||||
];
|
||||
}
|
20
app/Http/Middleware/TrustHosts.php
Normal file
20
app/Http/Middleware/TrustHosts.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustHosts as Middleware;
|
||||
|
||||
class TrustHosts extends Middleware
|
||||
{
|
||||
/**
|
||||
* Get the host patterns that should be trusted.
|
||||
*
|
||||
* @return array<int, string|null>
|
||||
*/
|
||||
public function hosts()
|
||||
{
|
||||
return [
|
||||
$this->allSubdomainsOfApplicationUrl(),
|
||||
];
|
||||
}
|
||||
}
|
28
app/Http/Middleware/TrustProxies.php
Normal file
28
app/Http/Middleware/TrustProxies.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Http\Middleware\TrustProxies as Middleware;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class TrustProxies extends Middleware
|
||||
{
|
||||
/**
|
||||
* The trusted proxies for this application.
|
||||
*
|
||||
* @var array<int, string>|string|null
|
||||
*/
|
||||
protected $proxies;
|
||||
|
||||
/**
|
||||
* The headers that should be used to detect proxies.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $headers =
|
||||
Request::HEADER_X_FORWARDED_FOR |
|
||||
Request::HEADER_X_FORWARDED_HOST |
|
||||
Request::HEADER_X_FORWARDED_PORT |
|
||||
Request::HEADER_X_FORWARDED_PROTO |
|
||||
Request::HEADER_X_FORWARDED_AWS_ELB;
|
||||
}
|
22
app/Http/Middleware/ValidateSignature.php
Normal file
22
app/Http/Middleware/ValidateSignature.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Routing\Middleware\ValidateSignature as Middleware;
|
||||
|
||||
class ValidateSignature extends Middleware
|
||||
{
|
||||
/**
|
||||
* The names of the query string parameters that should be ignored.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
// 'fbclid',
|
||||
// 'utm_campaign',
|
||||
// 'utm_content',
|
||||
// 'utm_medium',
|
||||
// 'utm_source',
|
||||
// 'utm_term',
|
||||
];
|
||||
}
|
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
17
app/Http/Middleware/VerifyCsrfToken.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
|
||||
|
||||
class VerifyCsrfToken extends Middleware
|
||||
{
|
||||
/**
|
||||
* The URIs that should be excluded from CSRF verification.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $except = [
|
||||
//
|
||||
];
|
||||
}
|
30
app/Providers/AppServiceProvider.php
Normal file
30
app/Providers/AppServiceProvider.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Database\Schema\Builder;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
// Update defaultStringLength
|
||||
Builder::defaultStringLength(191);
|
||||
}
|
||||
}
|
27
app/Providers/AuthServiceProvider.php
Normal file
27
app/Providers/AuthServiceProvider.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
// use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
|
||||
class AuthServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The model to policy mappings for the application.
|
||||
*
|
||||
* @var array<class-string, class-string>
|
||||
*/
|
||||
protected $policies = [// 'App\Models\Model' => 'App\Policies\ModelPolicy',
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any authentication / authorization services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
21
app/Providers/BroadcastServiceProvider.php
Normal file
21
app/Providers/BroadcastServiceProvider.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class BroadcastServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap any application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
Broadcast::routes();
|
||||
|
||||
require base_path('routes/channels.php');
|
||||
}
|
||||
}
|
42
app/Providers/EventServiceProvider.php
Normal file
42
app/Providers/EventServiceProvider.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Auth\Events\Registered;
|
||||
use Illuminate\Auth\Listeners\SendEmailVerificationNotification;
|
||||
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
|
||||
class EventServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The event to listener mappings for the application.
|
||||
*
|
||||
* @var array<class-string, array<int, class-string>>
|
||||
*/
|
||||
protected $listen = [
|
||||
Registered::class => [
|
||||
SendEmailVerificationNotification::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Register any events for your application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if events and listeners should be automatically discovered.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldDiscoverEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
31
app/Providers/HelperServiceProvider.php
Normal file
31
app/Providers/HelperServiceProvider.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class HelperServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$helperFiles = glob(app_path('Helpers').'/*.php');
|
||||
foreach ($helperFiles as $file) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
52
app/Providers/RouteServiceProvider.php
Normal file
52
app/Providers/RouteServiceProvider.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Cache\RateLimiting\Limit;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\RateLimiter;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The path to the "home" route for your application.
|
||||
*
|
||||
* Typically, users are redirected here after authentication.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public const HOME = '/dashboard';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, and other route configuration.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->configureRateLimiting();
|
||||
|
||||
$this->routes(function () {
|
||||
Route::middleware('api')
|
||||
->prefix('api')
|
||||
->group(base_path('routes/api.php'));
|
||||
|
||||
Route::middleware('web')
|
||||
->group(base_path('routes/web.php'));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the rate limiters for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRateLimiting()
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
}
|
||||
}
|
29
app/View/Components/AuthLayout.php
Normal file
29
app/View/Components/AuthLayout.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class AuthLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Init layout file
|
||||
app(config('settings.KT_THEME_BOOTSTRAP.auth'))->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view(config('settings.KT_THEME_LAYOUT_DIR').'._auth');
|
||||
}
|
||||
}
|
30
app/View/Components/DefaultLayout.php
Normal file
30
app/View/Components/DefaultLayout.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class DefaultLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Init layout file
|
||||
app(config('settings.KT_THEME_BOOTSTRAP.default'))->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\View|\Closure|string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
// See also starterkit/app/Core/Bootstrap/BootstrapDefault.php
|
||||
return view(config('settings.KT_THEME_LAYOUT_DIR').'._default');
|
||||
}
|
||||
}
|
30
app/View/Components/SystemLayout.php
Normal file
30
app/View/Components/SystemLayout.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class SystemLayout extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Init layout file
|
||||
app(config('settings.KT_THEME_BOOTSTRAP.system'))->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represents the component.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
return view(config('settings.KT_THEME_LAYOUT_DIR').'._system');
|
||||
}
|
||||
}
|
53
artisan
Normal file
53
artisan
Normal file
@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader
|
||||
| for our application. We just need to utilize it! We'll require it
|
||||
| into the script here so that we do not have to worry about the
|
||||
| loading of any of our classes manually. It's great to relax.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
$app = require_once __DIR__.'/bootstrap/app.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Artisan Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When we run the console application, the current CLI command will be
|
||||
| executed in this console and the response sent back to a terminal
|
||||
| or another output device for the developers. Here goes nothing!
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class);
|
||||
|
||||
$status = $kernel->handle(
|
||||
$input = new Symfony\Component\Console\Input\ArgvInput,
|
||||
new Symfony\Component\Console\Output\ConsoleOutput
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shutdown The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once Artisan has finished running, we will fire off the shutdown events
|
||||
| so that any final work may be done by the application before we shut
|
||||
| down the process. This is the last thing to happen to the request.
|
||||
|
|
||||
*/
|
||||
|
||||
$kernel->terminate($input, $status);
|
||||
|
||||
exit($status);
|
55
bootstrap/app.php
Normal file
55
bootstrap/app.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Create The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The first thing we will do is create a new Laravel application instance
|
||||
| which serves as the "glue" for all the components of Laravel, and is
|
||||
| the IoC container for the system binding all of the various parts.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = new Illuminate\Foundation\Application(
|
||||
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bind Important Interfaces
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, we need to bind some important interfaces into the container so
|
||||
| we will be able to resolve them when needed. The kernels serve the
|
||||
| incoming requests to this application from both the web and CLI.
|
||||
|
|
||||
*/
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Http\Kernel::class,
|
||||
App\Http\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Console\Kernel::class,
|
||||
App\Console\Kernel::class
|
||||
);
|
||||
|
||||
$app->singleton(
|
||||
Illuminate\Contracts\Debug\ExceptionHandler::class,
|
||||
App\Exceptions\Handler::class
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Return The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This script returns the application instance. The instance is given to
|
||||
| the calling script so we can separate the building of the instances
|
||||
| from the actual running of the application and sending responses.
|
||||
|
|
||||
*/
|
||||
|
||||
return $app;
|
2
bootstrap/cache/.gitignore
vendored
Normal file
2
bootstrap/cache/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
106
composer.json
Normal file
106
composer.json
Normal file
@ -0,0 +1,106 @@
|
||||
{
|
||||
"name": "iat/clara",
|
||||
"type": "project",
|
||||
"description": "Core Laravel Modular",
|
||||
"keywords": [
|
||||
"framework",
|
||||
"laravel"
|
||||
],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.0.2",
|
||||
"anlutro/l4-settings": "^1.3",
|
||||
"dompdf/dompdf": "^2.0",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"haruncpi/laravel-id-generator": "^1.1",
|
||||
"jackiedo/log-reader": "2.*",
|
||||
"joshbrw/laravel-module-installer": "^2.0",
|
||||
"laracasts/flash": "^3.2",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/octane": "^1.5",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.7",
|
||||
"laravelcollective/html": "^6.4",
|
||||
"nwidart/laravel-modules": "^10.0",
|
||||
"putrakuningan/logs-module": "dev-master",
|
||||
"putrakuningan/usermanager-module": "dev-master",
|
||||
"putrakuningan/master-module": "dev-master",
|
||||
"simplesoftwareio/simple-qrcode": "^4.2",
|
||||
"spatie/laravel-activitylog": "^4.7",
|
||||
"spatie/laravel-permission": "^5.10",
|
||||
"wildside/userstamps": "^2.3",
|
||||
"yajra/laravel-datatables": "^10.0",
|
||||
"yajra/laravel-datatables-oracle": "^10.3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/breeze": "^1.14",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"spatie/laravel-ignition": "^2.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "app/",
|
||||
"Database\\Factories\\": "database/factories/",
|
||||
"Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Tests\\": "tests/",
|
||||
"Modules\\": "Modules/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-autoload-dump": [
|
||||
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
|
||||
"@php artisan package:discover --ansi"
|
||||
],
|
||||
"post-update-cmd": [
|
||||
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
|
||||
],
|
||||
"post-root-package-install": [
|
||||
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
|
||||
],
|
||||
"post-create-project-cmd": [
|
||||
"@php artisan key:generate --ansi"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"dont-discover": []
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"optimize-autoloader": true,
|
||||
"preferred-install": "dist",
|
||||
"sort-packages": true,
|
||||
"allow-plugins": {
|
||||
"pestphp/pest-plugin": true,
|
||||
"joshbrw/laravel-module-installer": true
|
||||
}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"repositories": [
|
||||
{
|
||||
"name": "putrakuningan/logs-module",
|
||||
"type": "vcs",
|
||||
"url": "https://git.putrakuningan.com/putrakuningan/Logs"
|
||||
},
|
||||
{
|
||||
"name": "putrakuningan/usermanager-module",
|
||||
"type": "vcs",
|
||||
"url": "https://git.putrakuningan.com/putrakuningan/Usermanager"
|
||||
},
|
||||
{
|
||||
"name": "putrakuningan/master-module",
|
||||
"type": "vcs",
|
||||
"url": "https://git.putrakuningan.com/putrakuningan/Master"
|
||||
}
|
||||
]
|
||||
}
|
52
config/activitylog.php
Normal file
52
config/activitylog.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
* If set to false, no activities will be saved to the database.
|
||||
*/
|
||||
'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),
|
||||
|
||||
/*
|
||||
* When the clean-command is executed, all recording activities older than
|
||||
* the number of days specified here will be deleted.
|
||||
*/
|
||||
'delete_records_older_than_days' => 365,
|
||||
|
||||
/*
|
||||
* If no log name is passed to the activity() helper
|
||||
* we use this default log name.
|
||||
*/
|
||||
'default_log_name' => 'default',
|
||||
|
||||
/*
|
||||
* You can specify an auth driver here that gets user models.
|
||||
* If this is null we'll use the current Laravel auth driver.
|
||||
*/
|
||||
'default_auth_driver' => null,
|
||||
|
||||
/*
|
||||
* If set to true, the subject returns soft deleted models.
|
||||
*/
|
||||
'subject_returns_soft_deleted_models' => false,
|
||||
|
||||
/*
|
||||
* This model will be used to log activity.
|
||||
* It should implement the Spatie\Activitylog\Contracts\Activity interface
|
||||
* and extend Illuminate\Database\Eloquent\Model.
|
||||
*/
|
||||
'activity_model' => \Spatie\Activitylog\Models\Activity::class,
|
||||
|
||||
/*
|
||||
* This is the name of the table that will be created by the migration and
|
||||
* used by the Activity model shipped with this package.
|
||||
*/
|
||||
'table_name' => 'activity_log',
|
||||
|
||||
/*
|
||||
* This is the database connection that will be used by the migration and
|
||||
* the Activity model shipped with this package. In case it's not set
|
||||
* Laravel's database.default will be used instead.
|
||||
*/
|
||||
'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION'),
|
||||
];
|
221
config/app.php
Normal file
221
config/app.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value is the name of your application. This value is used when the
|
||||
| framework needs to place the application's name in a notification or
|
||||
| any other location as required by the application or its packages.
|
||||
|
|
||||
*/
|
||||
|
||||
'name' => env('APP_NAME', 'Laravel'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Environment
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the "environment" your application is currently
|
||||
| running in. This may determine how you prefer to configure various
|
||||
| services the application utilizes. Set this in your ".env" file.
|
||||
|
|
||||
*/
|
||||
|
||||
'env' => env('APP_ENV', 'production'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Debug Mode
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When your application is in debug mode, detailed error messages with
|
||||
| stack traces will be shown on every error that occurs within your
|
||||
| application. If disabled, a simple generic error page is shown.
|
||||
|
|
||||
*/
|
||||
|
||||
'debug' => (bool) env('APP_DEBUG', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application URL
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This URL is used by the console to properly generate URLs when using
|
||||
| the Artisan command line tool. You should set this to the root of
|
||||
| your application so that it is used when running Artisan tasks.
|
||||
|
|
||||
*/
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'asset_url' => env('ASSET_URL'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Timezone
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default timezone for your application, which
|
||||
| will be used by the PHP date and date-time functions. We have gone
|
||||
| ahead and set this to a sensible default for you out of the box.
|
||||
|
|
||||
*/
|
||||
|
||||
'timezone' => 'UTC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Locale Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The application locale determines the default locale that will be used
|
||||
| by the translation service provider. You are free to set this value
|
||||
| to any of the locales which will be supported by the application.
|
||||
|
|
||||
*/
|
||||
|
||||
'locale' => 'id',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Fallback Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The fallback locale determines the locale to use when the current one
|
||||
| is not available. You may change the value to correspond to any of
|
||||
| the language folders that are provided through your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'fallback_locale' => 'en',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Faker Locale
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This locale will be used by the Faker PHP library when generating fake
|
||||
| data for your database seeds. For example, this will be used to get
|
||||
| localized telephone numbers, street address information and more.
|
||||
|
|
||||
*/
|
||||
|
||||
'faker_locale' => 'en_US',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Encryption Key
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This key is used by the Illuminate encrypter service and should be set
|
||||
| to a random, 32 character string, otherwise these encrypted strings
|
||||
| will not be safe. Please do this before deploying an application!
|
||||
|
|
||||
*/
|
||||
|
||||
'key' => env('APP_KEY'),
|
||||
|
||||
'cipher' => 'AES-256-CBC',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maintenance Mode Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These configuration options determine the driver used to determine and
|
||||
| manage Laravel's "maintenance mode" status. The "cache" driver will
|
||||
| allow maintenance mode to be controlled across multiple machines.
|
||||
|
|
||||
| Supported drivers: "file", "cache"
|
||||
|
|
||||
*/
|
||||
|
||||
'maintenance' => [
|
||||
'driver' => 'file',
|
||||
// 'store' => 'redis',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Autoloaded Service Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The service providers listed here will be automatically loaded on the
|
||||
| request to your application. Feel free to add your own services to
|
||||
| this array to grant expanded functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
|
||||
/*
|
||||
* Laravel Framework Service Providers...
|
||||
*/
|
||||
Illuminate\Auth\AuthServiceProvider::class,
|
||||
Illuminate\Broadcasting\BroadcastServiceProvider::class,
|
||||
Illuminate\Bus\BusServiceProvider::class,
|
||||
Illuminate\Cache\CacheServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class,
|
||||
Illuminate\Cookie\CookieServiceProvider::class,
|
||||
Illuminate\Database\DatabaseServiceProvider::class,
|
||||
Illuminate\Encryption\EncryptionServiceProvider::class,
|
||||
Illuminate\Filesystem\FilesystemServiceProvider::class,
|
||||
Illuminate\Foundation\Providers\FoundationServiceProvider::class,
|
||||
Illuminate\Hashing\HashServiceProvider::class,
|
||||
Illuminate\Mail\MailServiceProvider::class,
|
||||
Illuminate\Notifications\NotificationServiceProvider::class,
|
||||
Illuminate\Pagination\PaginationServiceProvider::class,
|
||||
Illuminate\Pipeline\PipelineServiceProvider::class,
|
||||
Illuminate\Queue\QueueServiceProvider::class,
|
||||
Illuminate\Redis\RedisServiceProvider::class,
|
||||
Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
|
||||
Illuminate\Session\SessionServiceProvider::class,
|
||||
Illuminate\Translation\TranslationServiceProvider::class,
|
||||
Illuminate\Validation\ValidationServiceProvider::class,
|
||||
Illuminate\View\ViewServiceProvider::class,
|
||||
/*
|
||||
* Package Service Providers...
|
||||
*/
|
||||
|
||||
/*
|
||||
* Application Service Providers...
|
||||
*/
|
||||
App\Providers\HelperServiceProvider::class,
|
||||
App\Providers\AppServiceProvider::class,
|
||||
\App\Providers\AuthServiceProvider::class,
|
||||
// App\Providers\BroadcastServiceProvider::class,
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
Yajra\DataTables\DataTablesServiceProvider::class,
|
||||
Jackiedo\LogReader\LogReaderServiceProvider::class,
|
||||
|
||||
Spatie\Permission\PermissionServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Class Aliases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array of class aliases will be registered when this application
|
||||
| is started. However, feel free to register as many as you wish as
|
||||
| the aliases are "lazy" loaded so they don't hinder performance.
|
||||
|
|
||||
*/
|
||||
|
||||
'aliases' => Facade::defaultAliases()->merge([
|
||||
// 'ExampleClass' => App\Example\ExampleClass::class,
|
||||
'LogReader' => Jackiedo\LogReader\Facades\LogReader::class,
|
||||
])->toArray(),
|
||||
|
||||
];
|
111
config/auth.php
Normal file
111
config/auth.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Defaults
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default authentication "guard" and password
|
||||
| reset options for your application. You may change these defaults
|
||||
| as required, but they're a perfect start for most applications.
|
||||
|
|
||||
*/
|
||||
|
||||
'defaults' => [
|
||||
'guard' => 'web',
|
||||
'passwords' => 'users',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Next, you may define every authentication guard for your application.
|
||||
| Of course, a great default configuration has been defined for you
|
||||
| here which uses session storage and the Eloquent user provider.
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| Supported: "session"
|
||||
|
|
||||
*/
|
||||
|
||||
'guards' => [
|
||||
'web' => [
|
||||
'driver' => 'session',
|
||||
'provider' => 'users',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| User Providers
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All authentication drivers have a user provider. This defines how the
|
||||
| users are actually retrieved out of your database or other storage
|
||||
| mechanisms used by this application to persist your user's data.
|
||||
|
|
||||
| If you have multiple user tables or models you may configure multiple
|
||||
| sources which represent each model / table. These sources may then
|
||||
| be assigned to any extra authentication guards you have defined.
|
||||
|
|
||||
| Supported: "database", "eloquent"
|
||||
|
|
||||
*/
|
||||
|
||||
'providers' => [
|
||||
'users' => [
|
||||
'driver' => 'eloquent',
|
||||
'model' => \Modules\Usermanager\Entities\User::class,
|
||||
],
|
||||
|
||||
// 'users' => [
|
||||
// 'driver' => 'database',
|
||||
// 'table' => 'users',
|
||||
// ],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Resetting Passwords
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may specify multiple password reset configurations if you have more
|
||||
| than one user table or model in the application and you want to have
|
||||
| separate password reset settings based on the specific user types.
|
||||
|
|
||||
| The expire time is the number of minutes that each reset token will be
|
||||
| considered valid. This security feature keeps tokens short-lived so
|
||||
| they have less time to be guessed. You may change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'passwords' => [
|
||||
'users' => [
|
||||
'provider' => 'users',
|
||||
'table' => 'password_resets',
|
||||
'expire' => 60,
|
||||
'throttle' => 60,
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Confirmation Timeout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define the amount of seconds before a password confirmation
|
||||
| times out and the user is prompted to re-enter their password via the
|
||||
| confirmation screen. By default, the timeout lasts for three hours.
|
||||
|
|
||||
*/
|
||||
|
||||
'password_timeout' => 10800,
|
||||
|
||||
];
|
70
config/broadcasting.php
Normal file
70
config/broadcasting.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Broadcaster
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default broadcaster that will be used by the
|
||||
| framework when an event needs to be broadcast. You may set this to
|
||||
| any of the connections defined in the "connections" array below.
|
||||
|
|
||||
| Supported: "pusher", "ably", "redis", "log", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('BROADCAST_DRIVER', 'null'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the broadcast connections that will be used
|
||||
| to broadcast events to other systems or over websockets. Samples of
|
||||
| each available type of connection are provided inside this array.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'pusher' => [
|
||||
'driver' => 'pusher',
|
||||
'key' => env('PUSHER_APP_KEY'),
|
||||
'secret' => env('PUSHER_APP_SECRET'),
|
||||
'app_id' => env('PUSHER_APP_ID'),
|
||||
'options' => [
|
||||
'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com',
|
||||
'port' => env('PUSHER_PORT', 443),
|
||||
'scheme' => env('PUSHER_SCHEME', 'https'),
|
||||
'encrypted' => true,
|
||||
'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
|
||||
],
|
||||
'client_options' => [
|
||||
// Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
],
|
||||
],
|
||||
|
||||
'ably' => [
|
||||
'driver' => 'ably',
|
||||
'key' => env('ABLY_KEY'),
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'driver' => 'log',
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'null',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
110
config/cache.php
Normal file
110
config/cache.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default cache connection that gets used while
|
||||
| using this caching library. This connection is used when another is
|
||||
| not explicitly specified when executing a given caching function.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('CACHE_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Stores
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of the cache "stores" for your application as
|
||||
| well as their drivers. You may even define multiple stores for the
|
||||
| same cache driver to group types of items stored in your caches.
|
||||
|
|
||||
| Supported drivers: "apc", "array", "database", "file",
|
||||
| "memcached", "redis", "dynamodb", "octane", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'stores' => [
|
||||
|
||||
'apc' => [
|
||||
'driver' => 'apc',
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'driver' => 'array',
|
||||
'serialize' => false,
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'cache',
|
||||
'connection' => null,
|
||||
'lock_connection' => null,
|
||||
],
|
||||
|
||||
'file' => [
|
||||
'driver' => 'file',
|
||||
'path' => storage_path('framework/cache/data'),
|
||||
],
|
||||
|
||||
'memcached' => [
|
||||
'driver' => 'memcached',
|
||||
'persistent_id' => env('MEMCACHED_PERSISTENT_ID'),
|
||||
'sasl' => [
|
||||
env('MEMCACHED_USERNAME'),
|
||||
env('MEMCACHED_PASSWORD'),
|
||||
],
|
||||
'options' => [
|
||||
// Memcached::OPT_CONNECT_TIMEOUT => 2000,
|
||||
],
|
||||
'servers' => [
|
||||
[
|
||||
'host' => env('MEMCACHED_HOST', '127.0.0.1'),
|
||||
'port' => env('MEMCACHED_PORT', 11211),
|
||||
'weight' => 100,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'cache',
|
||||
'lock_connection' => 'default',
|
||||
],
|
||||
|
||||
'dynamodb' => [
|
||||
'driver' => 'dynamodb',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'table' => env('DYNAMODB_CACHE_TABLE', 'cache'),
|
||||
'endpoint' => env('DYNAMODB_ENDPOINT'),
|
||||
],
|
||||
|
||||
'octane' => [
|
||||
'driver' => 'octane',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache Key Prefix
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When utilizing the APC, database, memcached, Redis, or DynamoDB cache
|
||||
| stores there might be other applications using the same cache. For
|
||||
| that reason, you may prefix every cache key to avoid collisions.
|
||||
|
|
||||
*/
|
||||
|
||||
'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'),
|
||||
|
||||
];
|
34
config/cors.php
Normal file
34
config/cors.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cross-Origin Resource Sharing (CORS) Configuration
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure your settings for cross-origin resource sharing
|
||||
| or "CORS". This determines what cross-origin operations may execute
|
||||
| in web browsers. You are free to adjust these settings as needed.
|
||||
|
|
||||
| To learn more: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => ['api/*', 'sanctum/csrf-cookie'],
|
||||
|
||||
'allowed_methods' => ['*'],
|
||||
|
||||
'allowed_origins' => ['*'],
|
||||
|
||||
'allowed_origins_patterns' => [],
|
||||
|
||||
'allowed_headers' => ['*'],
|
||||
|
||||
'exposed_headers' => [],
|
||||
|
||||
'max_age' => 0,
|
||||
|
||||
'supports_credentials' => false,
|
||||
|
||||
];
|
151
config/database.php
Normal file
151
config/database.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Database Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify which of the database connections below you wish
|
||||
| to use as your default connection for all database work. Of course
|
||||
| you may use many connections at once using the Database library.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('DB_CONNECTION', 'mysql'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here are each of the database connections setup for your application.
|
||||
| Of course, examples of configuring each database platform that is
|
||||
| supported by Laravel is shown below to make development simple.
|
||||
|
|
||||
|
|
||||
| All database work in Laravel is done through the PHP PDO facilities
|
||||
| so make sure you have the driver for your particular database of
|
||||
| choice installed on your machine before you begin development.
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sqlite' => [
|
||||
'driver' => 'sqlite',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
||||
'prefix' => '',
|
||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||
],
|
||||
|
||||
'mysql' => [
|
||||
'driver' => 'mysql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '3306'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'unix_socket' => env('DB_SOCKET', ''),
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_unicode_ci',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'strict' => true,
|
||||
'engine' => null,
|
||||
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
||||
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
||||
]) : [],
|
||||
],
|
||||
|
||||
'pgsql' => [
|
||||
'driver' => 'pgsql',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', '127.0.0.1'),
|
||||
'port' => env('DB_PORT', '5432'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
'search_path' => 'public',
|
||||
'sslmode' => 'prefer',
|
||||
],
|
||||
|
||||
'sqlsrv' => [
|
||||
'driver' => 'sqlsrv',
|
||||
'url' => env('DATABASE_URL'),
|
||||
'host' => env('DB_HOST', 'localhost'),
|
||||
'port' => env('DB_PORT', '1433'),
|
||||
'database' => env('DB_DATABASE', 'forge'),
|
||||
'username' => env('DB_USERNAME', 'forge'),
|
||||
'password' => env('DB_PASSWORD', ''),
|
||||
'charset' => 'utf8',
|
||||
'prefix' => '',
|
||||
'prefix_indexes' => true,
|
||||
// 'encrypt' => env('DB_ENCRYPT', 'yes'),
|
||||
// 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Migration Repository Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This table keeps track of all the migrations that have already run for
|
||||
| your application. Using this information, we can determine which of
|
||||
| the migrations on disk haven't actually been run in the database.
|
||||
|
|
||||
*/
|
||||
|
||||
'migrations' => 'migrations',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Redis Databases
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Redis is an open source, fast, and advanced key-value store that also
|
||||
| provides a richer body of commands than a typical key-value system
|
||||
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
||||
|
|
||||
*/
|
||||
|
||||
'redis' => [
|
||||
|
||||
'client' => env('REDIS_CLIENT', 'phpredis'),
|
||||
|
||||
'options' => [
|
||||
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
||||
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_DB', '0'),
|
||||
],
|
||||
|
||||
'cache' => [
|
||||
'url' => env('REDIS_URL'),
|
||||
'host' => env('REDIS_HOST', '127.0.0.1'),
|
||||
'username' => env('REDIS_USERNAME'),
|
||||
'password' => env('REDIS_PASSWORD'),
|
||||
'port' => env('REDIS_PORT', '6379'),
|
||||
'database' => env('REDIS_CACHE_DB', '1'),
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
127
config/datatables.php
Normal file
127
config/datatables.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
* DataTables search options.
|
||||
*/
|
||||
'search' => [
|
||||
/*
|
||||
* Smart search will enclose search keyword with wildcard string "%keyword%".
|
||||
* SQL: column LIKE "%keyword%"
|
||||
*/
|
||||
'smart' => true,
|
||||
|
||||
/*
|
||||
* Multi-term search will explode search keyword using spaces resulting into multiple term search.
|
||||
*/
|
||||
'multi_term' => true,
|
||||
|
||||
/*
|
||||
* Case insensitive will search the keyword in lower case format.
|
||||
* SQL: LOWER(column) LIKE LOWER(keyword)
|
||||
*/
|
||||
'case_insensitive' => true,
|
||||
|
||||
/*
|
||||
* Wild card will add "%" in between every characters of the keyword.
|
||||
* SQL: column LIKE "%k%e%y%w%o%r%d%"
|
||||
*/
|
||||
'use_wildcards' => false,
|
||||
|
||||
/*
|
||||
* Perform a search which starts with the given keyword.
|
||||
* SQL: column LIKE "keyword%"
|
||||
*/
|
||||
'starts_with' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
* DataTables internal index id response column name.
|
||||
*/
|
||||
'index_column' => 'DT_RowIndex',
|
||||
|
||||
/*
|
||||
* List of available builders for DataTables.
|
||||
* This is where you can register your custom dataTables builder.
|
||||
*/
|
||||
'engines' => [
|
||||
'eloquent' => Yajra\DataTables\EloquentDataTable::class,
|
||||
'query' => Yajra\DataTables\QueryDataTable::class,
|
||||
'collection' => Yajra\DataTables\CollectionDataTable::class,
|
||||
'resource' => Yajra\DataTables\ApiResourceDataTable::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* DataTables accepted builder to engine mapping.
|
||||
* This is where you can override which engine a builder should use
|
||||
* Note, only change this if you know what you are doing!
|
||||
*/
|
||||
'builders' => [
|
||||
//Illuminate\Database\Eloquent\Relations\Relation::class => 'eloquent',
|
||||
//Illuminate\Database\Eloquent\Builder::class => 'eloquent',
|
||||
//Illuminate\Database\Query\Builder::class => 'query',
|
||||
//Illuminate\Support\Collection::class => 'collection',
|
||||
],
|
||||
|
||||
/*
|
||||
* Nulls last sql pattern for PostgreSQL & Oracle.
|
||||
* For MySQL, use 'CASE WHEN :column IS NULL THEN 1 ELSE 0 END, :column :direction'
|
||||
*/
|
||||
'nulls_last_sql' => ':column :direction NULLS LAST',
|
||||
|
||||
/*
|
||||
* User friendly message to be displayed on user if error occurs.
|
||||
* Possible values:
|
||||
* null - The exception message will be used on error response.
|
||||
* 'throw' - Throws a \Yajra\DataTables\Exceptions\Exception. Use your custom error handler if needed.
|
||||
* 'custom message' - Any friendly message to be displayed to the user. You can also use translation key.
|
||||
*/
|
||||
'error' => env('DATATABLES_ERROR', null),
|
||||
|
||||
/*
|
||||
* Default columns definition of dataTable utility functions.
|
||||
*/
|
||||
'columns' => [
|
||||
/*
|
||||
* List of columns hidden/removed on json response.
|
||||
*/
|
||||
'excess' => ['rn', 'row_num'],
|
||||
|
||||
/*
|
||||
* List of columns to be escaped. If set to *, all columns are escape.
|
||||
* Note: You can set the value to empty array to disable XSS protection.
|
||||
*/
|
||||
'escape' => '*',
|
||||
|
||||
/*
|
||||
* List of columns that are allowed to display html content.
|
||||
* Note: Adding columns to list will make us available to XSS attacks.
|
||||
*/
|
||||
'raw' => ['action'],
|
||||
|
||||
/*
|
||||
* List of columns are forbidden from being searched/sorted.
|
||||
*/
|
||||
'blacklist' => ['password', 'remember_token'],
|
||||
|
||||
/*
|
||||
* List of columns that are only allowed fo search/sort.
|
||||
* If set to *, all columns are allowed.
|
||||
*/
|
||||
'whitelist' => '*',
|
||||
],
|
||||
|
||||
/*
|
||||
* JsonResponse header and options config.
|
||||
*/
|
||||
'json' => [
|
||||
'header' => [],
|
||||
'options' => 0,
|
||||
],
|
||||
|
||||
/*
|
||||
* Default condition to determine if a parameter is a callback or not.
|
||||
* Callbacks needs to start by those terms, or they will be cast to string.
|
||||
*/
|
||||
'callback' => ['$', '$.', 'function'],
|
||||
];
|
76
config/filesystems.php
Normal file
76
config/filesystems.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Filesystem Disk
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the default filesystem disk that should be used
|
||||
| by the framework. The "local" disk, as well as a variety of cloud
|
||||
| based disks are available to your application. Just store away!
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('FILESYSTEM_DISK', 'local'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Filesystem Disks
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure as many filesystem "disks" as you wish, and you
|
||||
| may even configure multiple disks of the same driver. Defaults have
|
||||
| been set up for each driver as an example of the required values.
|
||||
|
|
||||
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
||||
|
|
||||
*/
|
||||
|
||||
'disks' => [
|
||||
|
||||
'local' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app'),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
'public' => [
|
||||
'driver' => 'local',
|
||||
'root' => storage_path('app/public'),
|
||||
'url' => env('APP_URL').'/storage',
|
||||
'visibility' => 'public',
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
's3' => [
|
||||
'driver' => 's3',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION'),
|
||||
'bucket' => env('AWS_BUCKET'),
|
||||
'url' => env('AWS_URL'),
|
||||
'endpoint' => env('AWS_ENDPOINT'),
|
||||
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
|
||||
'throw' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Symbolic Links
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the symbolic links that will be created when the
|
||||
| `storage:link` Artisan command is executed. The array keys should be
|
||||
| the locations of the links and the values should be their targets.
|
||||
|
|
||||
*/
|
||||
|
||||
'links' => [
|
||||
public_path('storage') => storage_path('app/public'),
|
||||
],
|
||||
|
||||
];
|
52
config/hashing.php
Normal file
52
config/hashing.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Hash Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default hash driver that will be used to hash
|
||||
| passwords for your application. By default, the bcrypt algorithm is
|
||||
| used; however, you remain free to modify this option if you wish.
|
||||
|
|
||||
| Supported: "bcrypt", "argon", "argon2id"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => 'bcrypt',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Bcrypt Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Bcrypt algorithm. This will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'bcrypt' => [
|
||||
'rounds' => env('BCRYPT_ROUNDS', 10),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Argon Options
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the configuration options that should be used when
|
||||
| passwords are hashed using the Argon algorithm. These will allow you
|
||||
| to control the amount of time it takes to hash the given password.
|
||||
|
|
||||
*/
|
||||
|
||||
'argon' => [
|
||||
'memory' => 65536,
|
||||
'threads' => 1,
|
||||
'time' => 4,
|
||||
],
|
||||
|
||||
];
|
91
config/log-reader.php
Normal file
91
config/log-reader.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Path to directory for storing log files
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is path to directory storing your log files
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => storage_path('logs'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default log filename
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is default log filename that you want read from
|
||||
| automatically. In Laravel, normally this name is 'laravel.log'.
|
||||
| This string is compatible with format string in sprintf()
|
||||
| function in PHP, it's mean you can set '*.*' to read all log
|
||||
| files
|
||||
|
|
||||
*/
|
||||
|
||||
'filename' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Environment's log to read
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is information to limit reading logs entry on specify
|
||||
| environment. Example: local, product... You can set null if want
|
||||
| read from all environment
|
||||
|
|
||||
*/
|
||||
|
||||
'environment' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Level's log to read
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array is information to limit reading logs entry from
|
||||
| specify levels. Example: ['error', 'warning']. You can set null
|
||||
| if want read from all levels.
|
||||
|
|
||||
*/
|
||||
|
||||
'level' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default sort field
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is default field to sort by when reading
|
||||
|
|
||||
*/
|
||||
|
||||
'order_by_field' => 'date',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default sort direction
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is default direction to sort by when reading
|
||||
|
|
||||
*/
|
||||
|
||||
'order_by_direction' => 'asc',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default log parser
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This is the default class used to parse log entries.
|
||||
|
|
||||
| If this setting is not set, the 'Jackiedo\LogReader\LogParser' class will
|
||||
| be used.
|
||||
|
|
||||
*/
|
||||
|
||||
'default_log_parser' => null,
|
||||
];
|
122
config/logging.php
Normal file
122
config/logging.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
use Monolog\Handler\NullHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Handler\SyslogUdpHandler;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option defines the default log channel that gets used when writing
|
||||
| messages to the logs. The name specified in this option should match
|
||||
| one of the channels defined in the "channels" configuration array.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('LOG_CHANNEL', 'stack'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Deprecations Log Channel
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the log channel that should be used to log warnings
|
||||
| regarding deprecated PHP and library features. This allows you to get
|
||||
| your application ready for upcoming major versions of dependencies.
|
||||
|
|
||||
*/
|
||||
|
||||
'deprecations' => [
|
||||
'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
|
||||
'trace' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Log Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the log channels for your application. Out of
|
||||
| the box, Laravel uses the Monolog PHP logging library. This gives
|
||||
| you a variety of powerful log handlers / formatters to utilize.
|
||||
|
|
||||
| Available Drivers: "single", "daily", "slack", "syslog",
|
||||
| "errorlog", "monolog",
|
||||
| "custom", "stack"
|
||||
|
|
||||
*/
|
||||
|
||||
'channels' => [
|
||||
'stack' => [
|
||||
'driver' => 'stack',
|
||||
'channels' => ['single'],
|
||||
'ignore_exceptions' => false,
|
||||
],
|
||||
|
||||
'single' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'daily' => [
|
||||
'driver' => 'daily',
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'days' => 14,
|
||||
],
|
||||
|
||||
'slack' => [
|
||||
'driver' => 'slack',
|
||||
'url' => env('LOG_SLACK_WEBHOOK_URL'),
|
||||
'username' => 'Laravel Log',
|
||||
'emoji' => ':boom:',
|
||||
'level' => env('LOG_LEVEL', 'critical'),
|
||||
],
|
||||
|
||||
'papertrail' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class),
|
||||
'handler_with' => [
|
||||
'host' => env('PAPERTRAIL_URL'),
|
||||
'port' => env('PAPERTRAIL_PORT'),
|
||||
'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'),
|
||||
],
|
||||
],
|
||||
|
||||
'stderr' => [
|
||||
'driver' => 'monolog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
'handler' => StreamHandler::class,
|
||||
'formatter' => env('LOG_STDERR_FORMATTER'),
|
||||
'with' => [
|
||||
'stream' => 'php://stderr',
|
||||
],
|
||||
],
|
||||
|
||||
'syslog' => [
|
||||
'driver' => 'syslog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'errorlog' => [
|
||||
'driver' => 'errorlog',
|
||||
'level' => env('LOG_LEVEL', 'debug'),
|
||||
],
|
||||
|
||||
'null' => [
|
||||
'driver' => 'monolog',
|
||||
'handler' => NullHandler::class,
|
||||
],
|
||||
|
||||
'emergency' => [
|
||||
'path' => storage_path('logs/laravel.log'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
118
config/mail.php
Normal file
118
config/mail.php
Normal file
@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Mailer
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default mailer that is used to send any email
|
||||
| messages sent by your application. Alternative mailers may be setup
|
||||
| and used as needed; however, this mailer will be used by default.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('MAIL_MAILER', 'smtp'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mailer Configurations
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure all of the mailers used by your application plus
|
||||
| their respective settings. Several examples have been configured for
|
||||
| you and you are free to add your own as your application requires.
|
||||
|
|
||||
| Laravel supports a variety of mail "transport" drivers to be used while
|
||||
| sending an e-mail. You will specify which one you are using for your
|
||||
| mailers below. You are free to add additional mailers as required.
|
||||
|
|
||||
| Supported: "smtp", "sendmail", "mailgun", "ses",
|
||||
| "postmark", "log", "array", "failover"
|
||||
|
|
||||
*/
|
||||
|
||||
'mailers' => [
|
||||
'smtp' => [
|
||||
'transport' => 'smtp',
|
||||
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
|
||||
'port' => env('MAIL_PORT', 587),
|
||||
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
|
||||
'username' => env('MAIL_USERNAME'),
|
||||
'password' => env('MAIL_PASSWORD'),
|
||||
'timeout' => null,
|
||||
'local_domain' => env('MAIL_EHLO_DOMAIN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'transport' => 'ses',
|
||||
],
|
||||
|
||||
'mailgun' => [
|
||||
'transport' => 'mailgun',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'transport' => 'postmark',
|
||||
],
|
||||
|
||||
'sendmail' => [
|
||||
'transport' => 'sendmail',
|
||||
'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'),
|
||||
],
|
||||
|
||||
'log' => [
|
||||
'transport' => 'log',
|
||||
'channel' => env('MAIL_LOG_CHANNEL'),
|
||||
],
|
||||
|
||||
'array' => [
|
||||
'transport' => 'array',
|
||||
],
|
||||
|
||||
'failover' => [
|
||||
'transport' => 'failover',
|
||||
'mailers' => [
|
||||
'smtp',
|
||||
'log',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global "From" Address
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You may wish for all e-mails sent by your application to be sent from
|
||||
| the same address. Here, you may specify a name and address that is
|
||||
| used globally for all e-mails that are sent by your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'from' => [
|
||||
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
|
||||
'name' => env('MAIL_FROM_NAME', 'Example'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Markdown Mail Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you are using Markdown based email rendering, you may configure your
|
||||
| theme and component paths here, allowing you to customize the design
|
||||
| of the emails. Or, you may simply stick with the Laravel defaults!
|
||||
|
|
||||
*/
|
||||
|
||||
'markdown' => [
|
||||
'theme' => 'default',
|
||||
|
||||
'paths' => [
|
||||
resource_path('views/vendor/mail'),
|
||||
],
|
||||
],
|
||||
|
||||
];
|
277
config/modules.php
Normal file
277
config/modules.php
Normal file
@ -0,0 +1,277 @@
|
||||
<?php
|
||||
|
||||
use Nwidart\Modules\Activators\FileActivator;
|
||||
use Nwidart\Modules\Commands;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Namespace
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module namespace.
|
||||
|
|
||||
*/
|
||||
|
||||
'namespace' => 'Modules',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Module Stubs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Default module stubs.
|
||||
|
|
||||
*/
|
||||
|
||||
'stubs' => [
|
||||
'enabled' => false,
|
||||
'path' => base_path('vendor/nwidart/laravel-modules/src/Commands/stubs'),
|
||||
'files' => [
|
||||
'routes/web' => 'Routes/web.php',
|
||||
'routes/api' => 'Routes/api.php',
|
||||
'views/index' => 'Resources/views/index.blade.php',
|
||||
'views/master' => 'Resources/views/layouts/master.blade.php',
|
||||
'scaffold/config' => 'Config/config.php',
|
||||
'composer' => 'composer.json',
|
||||
'assets/js/app' => 'Resources/assets/js/app.js',
|
||||
'assets/sass/app' => 'Resources/assets/sass/app.scss',
|
||||
'vite' => 'vite.config.js',
|
||||
'package' => 'package.json',
|
||||
],
|
||||
'replacements' => [
|
||||
'routes/web' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'routes/api' => ['LOWER_NAME'],
|
||||
'vite' => ['LOWER_NAME'],
|
||||
'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
|
||||
'views/index' => ['LOWER_NAME'],
|
||||
'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
|
||||
'scaffold/config' => ['STUDLY_NAME'],
|
||||
'composer' => [
|
||||
'LOWER_NAME',
|
||||
'STUDLY_NAME',
|
||||
'VENDOR',
|
||||
'AUTHOR_NAME',
|
||||
'AUTHOR_EMAIL',
|
||||
'MODULE_NAMESPACE',
|
||||
'PROVIDER_NAMESPACE',
|
||||
],
|
||||
],
|
||||
'gitkeep' => true,
|
||||
],
|
||||
'paths' => [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This path used for save the generated module. This path also will be added
|
||||
| automatically to list of scanned folders.
|
||||
|
|
||||
*/
|
||||
|
||||
'modules' => base_path('Modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Modules assets path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may update the modules assets path.
|
||||
|
|
||||
*/
|
||||
|
||||
'assets' => public_path('modules'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| The migrations path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Where you run 'module:publish-migration' command, where do you publish the
|
||||
| the migration files?
|
||||
|
|
||||
*/
|
||||
|
||||
'migration' => base_path('database/migrations'),
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Generator path
|
||||
|--------------------------------------------------------------------------
|
||||
| Customise the paths where the folders will be generated.
|
||||
| Set the generate key to false to not generate that folder
|
||||
*/
|
||||
'generator' => [
|
||||
'config' => ['path' => 'Config', 'generate' => true],
|
||||
'command' => ['path' => 'Console', 'generate' => true],
|
||||
'migration' => ['path' => 'Database/Migrations', 'generate' => true],
|
||||
'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
|
||||
'factory' => ['path' => 'Database/factories', 'generate' => true],
|
||||
'model' => ['path' => 'Entities', 'generate' => true],
|
||||
'routes' => ['path' => 'Routes', 'generate' => true],
|
||||
'controller' => ['path' => 'Http/Controllers', 'generate' => true],
|
||||
'filter' => ['path' => 'Http/Middleware', 'generate' => true],
|
||||
'request' => ['path' => 'Http/Requests', 'generate' => true],
|
||||
'provider' => ['path' => 'Providers', 'generate' => true],
|
||||
'assets' => ['path' => 'Resources/assets', 'generate' => true],
|
||||
'lang' => ['path' => 'Resources/lang', 'generate' => true],
|
||||
'views' => ['path' => 'Resources/views', 'generate' => true],
|
||||
'test' => ['path' => 'Tests/Unit', 'generate' => true],
|
||||
'test-feature' => ['path' => 'Tests/Feature', 'generate' => true],
|
||||
'repository' => ['path' => 'Repositories', 'generate' => false],
|
||||
'event' => ['path' => 'Events', 'generate' => false],
|
||||
'listener' => ['path' => 'Listeners', 'generate' => false],
|
||||
'policies' => ['path' => 'Policies', 'generate' => false],
|
||||
'rules' => ['path' => 'Rules', 'generate' => false],
|
||||
'jobs' => ['path' => 'Jobs', 'generate' => false],
|
||||
'emails' => ['path' => 'Emails', 'generate' => false],
|
||||
'notifications' => ['path' => 'Notifications', 'generate' => false],
|
||||
'resource' => ['path' => 'Transformers', 'generate' => false],
|
||||
'component-view' => ['path' => 'Resources/views/components', 'generate' => false],
|
||||
'component-class' => ['path' => 'View/Components', 'generate' => false],
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Package commands
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can define which commands will be visible and used in your
|
||||
| application. If for example you don't use some of the commands provided
|
||||
| you can simply comment them out.
|
||||
|
|
||||
*/
|
||||
'commands' => [
|
||||
Commands\CommandMakeCommand::class,
|
||||
Commands\ComponentClassMakeCommand::class,
|
||||
Commands\ComponentViewMakeCommand::class,
|
||||
Commands\ControllerMakeCommand::class,
|
||||
Commands\DisableCommand::class,
|
||||
Commands\DumpCommand::class,
|
||||
Commands\EnableCommand::class,
|
||||
Commands\EventMakeCommand::class,
|
||||
Commands\JobMakeCommand::class,
|
||||
Commands\ListenerMakeCommand::class,
|
||||
Commands\MailMakeCommand::class,
|
||||
Commands\MiddlewareMakeCommand::class,
|
||||
Commands\NotificationMakeCommand::class,
|
||||
Commands\ProviderMakeCommand::class,
|
||||
Commands\RouteProviderMakeCommand::class,
|
||||
Commands\InstallCommand::class,
|
||||
Commands\ListCommand::class,
|
||||
Commands\ModuleDeleteCommand::class,
|
||||
Commands\ModuleMakeCommand::class,
|
||||
Commands\FactoryMakeCommand::class,
|
||||
Commands\PolicyMakeCommand::class,
|
||||
Commands\RequestMakeCommand::class,
|
||||
Commands\RuleMakeCommand::class,
|
||||
Commands\MigrateCommand::class,
|
||||
Commands\MigrateFreshCommand::class,
|
||||
Commands\MigrateRefreshCommand::class,
|
||||
Commands\MigrateResetCommand::class,
|
||||
Commands\MigrateRollbackCommand::class,
|
||||
Commands\MigrateStatusCommand::class,
|
||||
Commands\MigrationMakeCommand::class,
|
||||
Commands\ModelMakeCommand::class,
|
||||
Commands\PublishCommand::class,
|
||||
Commands\PublishConfigurationCommand::class,
|
||||
Commands\PublishMigrationCommand::class,
|
||||
Commands\PublishTranslationCommand::class,
|
||||
Commands\SeedCommand::class,
|
||||
Commands\SeedMakeCommand::class,
|
||||
Commands\SetupCommand::class,
|
||||
Commands\UnUseCommand::class,
|
||||
Commands\UpdateCommand::class,
|
||||
Commands\UseCommand::class,
|
||||
Commands\ResourceMakeCommand::class,
|
||||
Commands\TestMakeCommand::class,
|
||||
Commands\LaravelModulesV6Migrator::class,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Scan Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you define which folder will be scanned. By default will scan vendor
|
||||
| directory. This is useful if you host the package in packagist website.
|
||||
|
|
||||
*/
|
||||
|
||||
'scan' => [
|
||||
'enabled' => false,
|
||||
'paths' => [
|
||||
base_path('vendor/*/*'),
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Composer File Template
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for composer.json file, generated by this package
|
||||
|
|
||||
*/
|
||||
|
||||
'composer' => [
|
||||
'vendor' => 'putrakuningan',
|
||||
'author' => [
|
||||
'name' => 'Daeng Deni Mardaeni',
|
||||
'email' => 'ddeni05@gmail.com',
|
||||
],
|
||||
'composer-output' => false,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Caching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is the config for setting up caching feature.
|
||||
|
|
||||
*/
|
||||
'cache' => [
|
||||
'enabled' => false,
|
||||
'driver' => 'file',
|
||||
'key' => 'laravel-modules',
|
||||
'lifetime' => 60,
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Choose what laravel-modules will register as custom namespaces.
|
||||
| Setting one to false will require you to register that part
|
||||
| in your own Service Provider class.
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
'register' => [
|
||||
'translations' => true,
|
||||
/**
|
||||
* load files on boot or register method
|
||||
*
|
||||
* Note: boot not compatible with asgardcms
|
||||
*
|
||||
* @example boot|register
|
||||
*/
|
||||
'files' => 'register',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Activators
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| You can define new types of activators here, file, database etc. The only
|
||||
| required parameter is 'class'.
|
||||
| The file activator will store the activation status in storage/installed_modules
|
||||
*/
|
||||
'activators' => [
|
||||
'file' => [
|
||||
'class' => FileActivator::class,
|
||||
'statuses-file' => base_path('modules_statuses.json'),
|
||||
'cache-key' => 'activator.installed',
|
||||
'cache-lifetime' => 604800,
|
||||
],
|
||||
],
|
||||
|
||||
'activator' => 'file',
|
||||
];
|
228
config/octane.php
Normal file
228
config/octane.php
Normal file
@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Octane\Contracts\OperationTerminated;
|
||||
use Laravel\Octane\Events\RequestHandled;
|
||||
use Laravel\Octane\Events\RequestReceived;
|
||||
use Laravel\Octane\Events\RequestTerminated;
|
||||
use Laravel\Octane\Events\TaskReceived;
|
||||
use Laravel\Octane\Events\TaskTerminated;
|
||||
use Laravel\Octane\Events\TickReceived;
|
||||
use Laravel\Octane\Events\TickTerminated;
|
||||
use Laravel\Octane\Events\WorkerErrorOccurred;
|
||||
use Laravel\Octane\Events\WorkerStarting;
|
||||
use Laravel\Octane\Events\WorkerStopping;
|
||||
use Laravel\Octane\Listeners\CollectGarbage;
|
||||
use Laravel\Octane\Listeners\DisconnectFromDatabases;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesAreValid;
|
||||
use Laravel\Octane\Listeners\EnsureUploadedFilesCanBeMoved;
|
||||
use Laravel\Octane\Listeners\FlushTemporaryContainerInstances;
|
||||
use Laravel\Octane\Listeners\FlushUploadedFiles;
|
||||
use Laravel\Octane\Listeners\ReportException;
|
||||
use Laravel\Octane\Listeners\StopWorkerIfNecessary;
|
||||
use Laravel\Octane\Octane;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Server
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value determines the default "server" that will be used by Octane
|
||||
| when starting, restarting, or stopping your server via the CLI. You
|
||||
| are free to change this to the supported server of your choosing.
|
||||
|
|
||||
| Supported: "roadrunner", "swoole"
|
||||
|
|
||||
*/
|
||||
|
||||
'server' => env('OCTANE_SERVER', 'roadrunner'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Force HTTPS
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this configuration value is set to "true", Octane will inform the
|
||||
| framework that all absolute links must be generated using the HTTPS
|
||||
| protocol. Otherwise your links may be generated using plain HTTP.
|
||||
|
|
||||
*/
|
||||
|
||||
'https' => env('OCTANE_HTTPS', false),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Listeners
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| All of the event listeners for Octane's events are defined below. These
|
||||
| listeners are responsible for resetting your application's state for
|
||||
| the next request. You may even add your own listeners to the list.
|
||||
|
|
||||
*/
|
||||
|
||||
'listeners' => [
|
||||
WorkerStarting::class => [
|
||||
EnsureUploadedFilesAreValid::class,
|
||||
EnsureUploadedFilesCanBeMoved::class,
|
||||
],
|
||||
|
||||
RequestReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
...Octane::prepareApplicationForNextRequest(),
|
||||
//
|
||||
],
|
||||
|
||||
RequestHandled::class => [
|
||||
//
|
||||
],
|
||||
|
||||
RequestTerminated::class => [
|
||||
// FlushUploadedFiles::class,
|
||||
],
|
||||
|
||||
TaskReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TaskTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
TickReceived::class => [
|
||||
...Octane::prepareApplicationForNextOperation(),
|
||||
//
|
||||
],
|
||||
|
||||
TickTerminated::class => [
|
||||
//
|
||||
],
|
||||
|
||||
OperationTerminated::class => [
|
||||
FlushTemporaryContainerInstances::class,
|
||||
// DisconnectFromDatabases::class,
|
||||
// CollectGarbage::class,
|
||||
],
|
||||
|
||||
WorkerErrorOccurred::class => [
|
||||
ReportException::class,
|
||||
StopWorkerIfNecessary::class,
|
||||
],
|
||||
|
||||
WorkerStopping::class => [
|
||||
//
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Warm / Flush Bindings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The bindings listed below will either be pre-warmed when a worker boots
|
||||
| or they will be flushed before every new request. Flushing a binding
|
||||
| will force the container to resolve that binding again when asked.
|
||||
|
|
||||
*/
|
||||
|
||||
'warm' => [
|
||||
...Octane::defaultServicesToWarm(),
|
||||
],
|
||||
|
||||
'flush' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Cache Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may leverage the Octane cache, which is powered
|
||||
| by a Swoole table. You may set the maximum number of rows as well as
|
||||
| the number of bytes per row using the configuration options below.
|
||||
|
|
||||
*/
|
||||
|
||||
'cache' => [
|
||||
'rows' => 1000,
|
||||
'bytes' => 10000,
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Octane Swoole Tables
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using Swoole, you may define additional tables as required by the
|
||||
| application. These tables can be used to store data that needs to be
|
||||
| quickly accessed by other workers on the particular Swoole server.
|
||||
|
|
||||
*/
|
||||
|
||||
'tables' => [
|
||||
'example:1000' => [
|
||||
'name' => 'string:1000',
|
||||
'votes' => 'int',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| File Watching
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following list of files and directories will be watched when using
|
||||
| the --watch option offered by Octane. If any of the directories and
|
||||
| files are changed, Octane will automatically reload your workers.
|
||||
|
|
||||
*/
|
||||
|
||||
'watch' => [
|
||||
'app',
|
||||
'bootstrap',
|
||||
'config',
|
||||
'database',
|
||||
'public/**/*.php',
|
||||
'resources/**/*.php',
|
||||
'routes',
|
||||
'composer.lock',
|
||||
'.env',
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Garbage Collection Threshold
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When executing long-lived PHP scripts such as Octane, memory can build
|
||||
| up before being cleared by PHP. You can force Octane to run garbage
|
||||
| collection if your application consumes this amount of megabytes.
|
||||
|
|
||||
*/
|
||||
|
||||
'garbage' => 50,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Maximum Execution Time
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following setting configures the maximum execution time for requests
|
||||
| being handled by Octane. You may set this value to 0 to indicate that
|
||||
| there isn't a specific time limit on Octane request execution time.
|
||||
|
|
||||
*/
|
||||
|
||||
'max_execution_time' => 30,
|
||||
|
||||
'swoole' => [
|
||||
'options' => [
|
||||
'log_file' => storage_path('logs/swoole_http.log'),
|
||||
'package_max_length' => 10 * 1024 * 1024,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
161
config/permission.php
Normal file
161
config/permission.php
Normal file
@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false, if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true the package implements teams using the 'team_foreign_key'. If you want
|
||||
* the migrations to register the 'team_foreign_key', you must set this to true
|
||||
* before doing the migration. If you already did the migration then you must make a new
|
||||
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
|
||||
* 'model_has_permissions'(view the latest version of package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
93
config/queue.php
Normal file
93
config/queue.php
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Queue Connection Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Laravel's queue API supports an assortment of back-ends via a single
|
||||
| API, giving you convenient access to each back-end using the same
|
||||
| syntax for every one. Here you may define a default connection.
|
||||
|
|
||||
*/
|
||||
|
||||
'default' => env('QUEUE_CONNECTION', 'sync'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Queue Connections
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may configure the connection information for each server that
|
||||
| is used by your application. A default configuration has been added
|
||||
| for each back-end shipped with Laravel. You are free to add more.
|
||||
|
|
||||
| Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null"
|
||||
|
|
||||
*/
|
||||
|
||||
'connections' => [
|
||||
|
||||
'sync' => [
|
||||
'driver' => 'sync',
|
||||
],
|
||||
|
||||
'database' => [
|
||||
'driver' => 'database',
|
||||
'table' => 'jobs',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'beanstalkd' => [
|
||||
'driver' => 'beanstalkd',
|
||||
'host' => 'localhost',
|
||||
'queue' => 'default',
|
||||
'retry_after' => 90,
|
||||
'block_for' => 0,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'sqs' => [
|
||||
'driver' => 'sqs',
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
|
||||
'queue' => env('SQS_QUEUE', 'default'),
|
||||
'suffix' => env('SQS_SUFFIX'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
'redis' => [
|
||||
'driver' => 'redis',
|
||||
'connection' => 'default',
|
||||
'queue' => env('REDIS_QUEUE', 'default'),
|
||||
'retry_after' => 90,
|
||||
'block_for' => null,
|
||||
'after_commit' => false,
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Failed Queue Jobs
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| These options configure the behavior of failed queue job logging so you
|
||||
| can control which database and table are used to store the jobs that
|
||||
| have failed. You may change them to any database / table you wish.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => [
|
||||
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
|
||||
'database' => env('DB_CONNECTION', 'mysql'),
|
||||
'table' => 'failed_jobs',
|
||||
],
|
||||
|
||||
];
|
67
config/sanctum.php
Normal file
67
config/sanctum.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
use Laravel\Sanctum\Sanctum;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Stateful Domains
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Requests from the following domains / hosts will receive stateful API
|
||||
| authentication cookies. Typically, these should include your local
|
||||
| and production domains which access your API via a frontend SPA.
|
||||
|
|
||||
*/
|
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
|
||||
'%s%s',
|
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
|
||||
Sanctum::currentApplicationUrlWithPort()
|
||||
))),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Guards
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This array contains the authentication guards that will be checked when
|
||||
| Sanctum is trying to authenticate a request. If none of these guards
|
||||
| are able to authenticate the request, Sanctum will use the bearer
|
||||
| token that's present on an incoming request for authentication.
|
||||
|
|
||||
*/
|
||||
|
||||
'guard' => ['web'],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Expiration Minutes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This value controls the number of minutes until an issued token will be
|
||||
| considered expired. If this value is null, personal access tokens do
|
||||
| not expire. This won't tweak the lifetime of first-party sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'expiration' => null,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Sanctum Middleware
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When authenticating your first-party SPA with Sanctum you may need to
|
||||
| customize some of the middleware Sanctum uses while processing the
|
||||
| request. You may change the middleware listed below as required.
|
||||
|
|
||||
*/
|
||||
|
||||
'middleware' => [
|
||||
'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class,
|
||||
'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class,
|
||||
],
|
||||
|
||||
];
|
34
config/services.php
Normal file
34
config/services.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Third Party Services
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is for storing the credentials for third party services such
|
||||
| as Mailgun, Postmark, AWS and more. This file provides the de facto
|
||||
| location for this type of information, allowing packages to have
|
||||
| a conventional file to locate the various service credentials.
|
||||
|
|
||||
*/
|
||||
|
||||
'mailgun' => [
|
||||
'domain' => env('MAILGUN_DOMAIN'),
|
||||
'secret' => env('MAILGUN_SECRET'),
|
||||
'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'),
|
||||
'scheme' => 'https',
|
||||
],
|
||||
|
||||
'postmark' => [
|
||||
'token' => env('POSTMARK_TOKEN'),
|
||||
],
|
||||
|
||||
'ses' => [
|
||||
'key' => env('AWS_ACCESS_KEY_ID'),
|
||||
'secret' => env('AWS_SECRET_ACCESS_KEY'),
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
];
|
201
config/session.php
Normal file
201
config/session.php
Normal file
@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Session Driver
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default session "driver" that will be used on
|
||||
| requests. By default, we will use the lightweight native driver but
|
||||
| you may specify any of the other wonderful drivers provided here.
|
||||
|
|
||||
| Supported: "file", "cookie", "database", "apc",
|
||||
| "memcached", "redis", "dynamodb", "array"
|
||||
|
|
||||
*/
|
||||
|
||||
'driver' => env('SESSION_DRIVER', 'file'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Lifetime
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify the number of minutes that you wish the session
|
||||
| to be allowed to remain idle before it expires. If you want them
|
||||
| to immediately expire on the browser closing, set that option.
|
||||
|
|
||||
*/
|
||||
|
||||
'lifetime' => env('SESSION_LIFETIME', 120),
|
||||
|
||||
'expire_on_close' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Encryption
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option allows you to easily specify that all of your session data
|
||||
| should be encrypted before it is stored. All encryption will be run
|
||||
| automatically by Laravel and you can use the Session like normal.
|
||||
|
|
||||
*/
|
||||
|
||||
'encrypt' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session File Location
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the native session driver, we need a location where session
|
||||
| files may be stored. A default has been set for you but a different
|
||||
| location may be specified. This is only needed for file sessions.
|
||||
|
|
||||
*/
|
||||
|
||||
'files' => storage_path('framework/sessions'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Connection
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" or "redis" session drivers, you may specify a
|
||||
| connection that should be used to manage these sessions. This should
|
||||
| correspond to a connection in your database configuration options.
|
||||
|
|
||||
*/
|
||||
|
||||
'connection' => env('SESSION_CONNECTION'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Database Table
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When using the "database" session driver, you may specify the table we
|
||||
| should use to manage the sessions. Of course, a sensible default is
|
||||
| provided for you; however, you are free to change this as needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'table' => 'sessions',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cache Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| While using one of the framework's cache driven session backends you may
|
||||
| list a cache store that should be used for these sessions. This value
|
||||
| must match with one of the application's configured cache "stores".
|
||||
|
|
||||
| Affects: "apc", "dynamodb", "memcached", "redis"
|
||||
|
|
||||
*/
|
||||
|
||||
'store' => env('SESSION_STORE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Sweeping Lottery
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Some session drivers must manually sweep their storage location to get
|
||||
| rid of old sessions from storage. Here are the chances that it will
|
||||
| happen on a given request. By default, the odds are 2 out of 100.
|
||||
|
|
||||
*/
|
||||
|
||||
'lottery' => [2, 100],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Name
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the name of the cookie used to identify a session
|
||||
| instance by ID. The name specified here will get used every time a
|
||||
| new session cookie is created by the framework for every driver.
|
||||
|
|
||||
*/
|
||||
|
||||
'cookie' => env(
|
||||
'SESSION_COOKIE',
|
||||
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
|
||||
),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The session cookie path determines the path for which the cookie will
|
||||
| be regarded as available. Typically, this will be the root path of
|
||||
| your application but you are free to change this when necessary.
|
||||
|
|
||||
*/
|
||||
|
||||
'path' => '/',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Session Cookie Domain
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may change the domain of the cookie used to identify a session
|
||||
| in your application. This will determine which domains the cookie is
|
||||
| available to in your application. A sensible default has been set.
|
||||
|
|
||||
*/
|
||||
|
||||
'domain' => env('SESSION_DOMAIN'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTPS Only Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| By setting this option to true, session cookies will only be sent back
|
||||
| to the server if the browser has a HTTPS connection. This will keep
|
||||
| the cookie from being sent to you when it can't be done securely.
|
||||
|
|
||||
*/
|
||||
|
||||
'secure' => env('SESSION_SECURE_COOKIE'),
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| HTTP Access Only
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Setting this value to true will prevent JavaScript from accessing the
|
||||
| value of the cookie and the cookie will only be accessible through
|
||||
| the HTTP protocol. You are free to modify this option if needed.
|
||||
|
|
||||
*/
|
||||
|
||||
'http_only' => true,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Same-Site Cookies
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines how your cookies behave when cross-site requests
|
||||
| take place, and can be used to mitigate CSRF attacks. By default, we
|
||||
| will set this value to "lax" since this is a secure default value.
|
||||
|
|
||||
| Supported: "lax", "strict", "none", null
|
||||
|
|
||||
*/
|
||||
|
||||
'same_site' => 'lax',
|
||||
|
||||
];
|
310
config/settings.php
Normal file
310
config/settings.php
Normal file
@ -0,0 +1,310 @@
|
||||
<?php
|
||||
|
||||
use App\Core\Bootstrap\BootstrapAuth;
|
||||
use App\Core\Bootstrap\BootstrapDefault;
|
||||
use App\Core\Bootstrap\BootstrapSystem;
|
||||
|
||||
return [
|
||||
|
||||
'KT_THEME_BOOTSTRAP' => [
|
||||
'default' => BootstrapDefault::class,
|
||||
'auth' => BootstrapAuth::class,
|
||||
'system' => BootstrapSystem::class,
|
||||
],
|
||||
|
||||
'KT_THEME' => 'metronic',
|
||||
|
||||
# Theme layout templates directory
|
||||
|
||||
'KT_THEME_LAYOUT_DIR' => 'layout',
|
||||
|
||||
|
||||
# Theme Mode
|
||||
# Value: light | dark | system
|
||||
|
||||
'KT_THEME_MODE_DEFAULT' => 'light',
|
||||
'KT_THEME_MODE_SWITCH_ENABLED' => true,
|
||||
|
||||
|
||||
# Theme Direction
|
||||
# Value: ltr | rtl
|
||||
|
||||
'KT_THEME_DIRECTION' => 'ltr',
|
||||
|
||||
|
||||
# Keenicons
|
||||
# Value: duotone | outline | bold
|
||||
|
||||
'KT_THEME_ICONS' => 'duotone',
|
||||
|
||||
|
||||
# Theme Assets
|
||||
|
||||
'KT_THEME_ASSETS' => [
|
||||
'favicon' => 'assets/media/logos/favicon.ico',
|
||||
'fonts' => [
|
||||
'https://fonts.googleapis.com/css?family=Inter:300,400,500,600,700',
|
||||
],
|
||||
'global' => [
|
||||
'css' => [
|
||||
'assets/plugins/global/plugins.bundle.css',
|
||||
'assets/css/style.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/global/plugins.bundle.js',
|
||||
'assets/js/scripts.bundle.js',
|
||||
'assets/js/widgets.bundle.js',
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
|
||||
# Theme Vendors
|
||||
|
||||
'KT_THEME_VENDORS' => [
|
||||
'datatables' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/datatables/datatables.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/datatables/datatables.bundle.js',
|
||||
],
|
||||
],
|
||||
'formrepeater' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/formrepeater/formrepeater.bundle.js',
|
||||
],
|
||||
],
|
||||
'fullcalendar' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/fullcalendar/fullcalendar.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/fullcalendar/fullcalendar.bundle.js',
|
||||
],
|
||||
],
|
||||
'flotcharts' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/flotcharts/flotcharts.bundle.js',
|
||||
],
|
||||
],
|
||||
'google-jsapi' => [
|
||||
'js' => [
|
||||
'//www.google.com/jsapi',
|
||||
],
|
||||
],
|
||||
'tinymce' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/tinymce/tinymce.bundle.js',
|
||||
],
|
||||
],
|
||||
'ckeditor-classic' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js',
|
||||
],
|
||||
],
|
||||
'ckeditor-inline' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/ckeditor/ckeditor-inline.bundle.js',
|
||||
],
|
||||
],
|
||||
'ckeditor-balloon' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/ckeditor/ckeditor-balloon.bundle.js',
|
||||
],
|
||||
],
|
||||
'ckeditor-balloon-block' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/ckeditor/ckeditor-balloon-block.bundle.js',
|
||||
],
|
||||
],
|
||||
'ckeditor-document' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/ckeditor/ckeditor-document.bundle.js',
|
||||
],
|
||||
],
|
||||
'draggable' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/draggable/draggable.bundle.js',
|
||||
],
|
||||
],
|
||||
'fslightbox' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/fslightbox/fslightbox.bundle.js',
|
||||
],
|
||||
],
|
||||
'jkanban' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/jkanban/jkanban.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/jkanban/jkanban.bundle.js',
|
||||
],
|
||||
],
|
||||
'typedjs' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/typedjs/typedjs.bundle.js',
|
||||
],
|
||||
],
|
||||
'cookiealert' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/cookiealert/cookiealert.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/cookiealert/cookiealert.bundle.js',
|
||||
],
|
||||
],
|
||||
'cropper' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/cropper/cropper.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/cropper/cropper.bundle.js',
|
||||
],
|
||||
],
|
||||
'vis-timeline' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/vis-timeline/vis-timeline.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/vis-timeline/vis-timeline.bundle.js',
|
||||
],
|
||||
],
|
||||
'jstree' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/jstree/jstree.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/jstree/jstree.bundle.js',
|
||||
],
|
||||
],
|
||||
'prismjs' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/prismjs/prismjs.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/prismjs/prismjs.bundle.js',
|
||||
],
|
||||
],
|
||||
'leaflet' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/leaflet/leaflet.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/leaflet/leaflet.bundle.js',
|
||||
],
|
||||
],
|
||||
'amcharts' => [
|
||||
'js' => [
|
||||
'https://cdn.amcharts.com/lib/5/index.js',
|
||||
'https://cdn.amcharts.com/lib/5/xy.js',
|
||||
'https://cdn.amcharts.com/lib/5/percent.js',
|
||||
'https://cdn.amcharts.com/lib/5/radar.js',
|
||||
'https://cdn.amcharts.com/lib/5/themes/Animated.js',
|
||||
],
|
||||
],
|
||||
'amcharts-maps' => [
|
||||
'js' => [
|
||||
'https://cdn.amcharts.com/lib/5/index.js',
|
||||
'https://cdn.amcharts.com/lib/5/map.js',
|
||||
'https://cdn.amcharts.com/lib/5/geodata/worldLow.js',
|
||||
'https://cdn.amcharts.com/lib/5/geodata/continentsLow.js',
|
||||
'https://cdn.amcharts.com/lib/5/geodata/usaLow.js',
|
||||
'https://cdn.amcharts.com/lib/5/geodata/worldTimeZonesLow.js',
|
||||
'https://cdn.amcharts.com/lib/5/geodata/worldTimeZoneAreasLow.js',
|
||||
'https://cdn.amcharts.com/lib/5/themes/Animated.js',
|
||||
],
|
||||
],
|
||||
'amcharts-stock' => [
|
||||
'js' => [
|
||||
'https://cdn.amcharts.com/lib/5/index.js',
|
||||
'https://cdn.amcharts.com/lib/5/xy.js',
|
||||
'https://cdn.amcharts.com/lib/5/themes/Animated.js',
|
||||
],
|
||||
],
|
||||
'bootstrap-select' => [
|
||||
'css' => [
|
||||
'assets/plugins/custom/bootstrap-select/bootstrap-select.bundle.css',
|
||||
],
|
||||
'js' => [
|
||||
'assets/plugins/custom/bootstrap-select/bootstrap-select.bundle.js',
|
||||
],
|
||||
],
|
||||
'chained-select' => [
|
||||
'js' => [
|
||||
'assets/plugins/custom/jquery-chained/jquery.chained.js',
|
||||
'assets/plugins/custom/jquery-chained/jquery.chained.remote.js',
|
||||
],
|
||||
],
|
||||
],
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Settings Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option controls the default settings store that gets used while
|
||||
| using this settings library.
|
||||
|
|
||||
| Supported: "json", "database"
|
||||
|
|
||||
*/
|
||||
'store' => 'database',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| JSON Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If the store is set to "json", settings are stored in the defined
|
||||
| file path in JSON format. Use full path to file.
|
||||
|
|
||||
*/
|
||||
'path' => storage_path() . '/settings.json',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Database Store
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The settings are stored in the defined file path in JSON format.
|
||||
| Use full path to JSON file.
|
||||
|
|
||||
*/
|
||||
// If set to null, the default connection will be used.
|
||||
'connection' => null,
|
||||
// Name of the table used.
|
||||
'table' => 'settings',
|
||||
// If you want to use custom column names in database store you could
|
||||
// set them in this configuration
|
||||
'keyColumn' => 'key',
|
||||
'valueColumn' => 'value',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Cache settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If you want all setting calls to go through Laravel's cache system.
|
||||
|
|
||||
*/
|
||||
'enableCache' => false,
|
||||
// Whether to reset the cache when changing a setting.
|
||||
'forgetCacheByWrite' => true,
|
||||
// TTL in seconds.
|
||||
'cacheTtl' => 15,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default Settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Define all default settings that will be used before any settings are set,
|
||||
| this avoids all settings being set to false to begin with and avoids
|
||||
| hardcoding the same defaults in all 'Settings::get()' calls
|
||||
|
|
||||
*/
|
||||
'defaults' => [
|
||||
'foo' => 'bar',
|
||||
]
|
||||
|
||||
];
|
36
config/view.php
Normal file
36
config/view.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| View Storage Paths
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Most templating systems load templates from disk. Here you may specify
|
||||
| an array of paths that should be checked for your views. Of course
|
||||
| the usual Laravel view path has already been registered for you.
|
||||
|
|
||||
*/
|
||||
|
||||
'paths' => [
|
||||
resource_path('views'),
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Compiled View Path
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This option determines where all the compiled Blade templates will be
|
||||
| stored for your application. Typically, this is within the storage
|
||||
| directory. However, as usual, you are free to change this value.
|
||||
|
|
||||
*/
|
||||
|
||||
'compiled' => env(
|
||||
'VIEW_COMPILED_PATH',
|
||||
realpath(storage_path('framework/views'))
|
||||
),
|
||||
|
||||
];
|
1
database/.gitignore
vendored
Normal file
1
database/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.sqlite*
|
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
if (version_compare(Application::VERSION, '5.0', '>=')) {
|
||||
$this->tablename = Config::get('settings.table');
|
||||
$this->keyColumn = Config::get('settings.keyColumn');
|
||||
$this->valueColumn = Config::get('settings.valueColumn');
|
||||
} else {
|
||||
$this->tablename = Config::get('anlutro/l4-settings::table');
|
||||
$this->keyColumn = Config::get('anlutro/l4-settings::keyColumn');
|
||||
$this->valueColumn = Config::get('anlutro/l4-settings::valueColumn');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create($this->tablename, function(Blueprint $table)
|
||||
{
|
||||
$table->increments('id');
|
||||
$table->string($this->keyColumn)->index();
|
||||
$table->text($this->valueColumn);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop($this->tablename);
|
||||
}
|
||||
}
|
20
database/seeders/DatabaseSeeder.php
Normal file
20
database/seeders/DatabaseSeeder.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Modules\Usermanager\Database\Seeders\UsersSeeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed the application's database.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
20
lang/en/auth.php
Normal file
20
lang/en/auth.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Authentication Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used during authentication for various
|
||||
| messages that we need to display to the user. You are free to modify
|
||||
| these language lines according to your application's requirements.
|
||||
|
|
||||
*/
|
||||
|
||||
'failed' => 'These credentials do not match our records.',
|
||||
'password' => 'The provided password is incorrect.',
|
||||
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
|
||||
|
||||
];
|
19
lang/en/pagination.php
Normal file
19
lang/en/pagination.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pagination Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used by the paginator library to build
|
||||
| the simple pagination links. You are free to change them to anything
|
||||
| you want to customize your views to better match your application.
|
||||
|
|
||||
*/
|
||||
|
||||
'previous' => '« Previous',
|
||||
'next' => 'Next »',
|
||||
|
||||
];
|
22
lang/en/passwords.php
Normal file
22
lang/en/passwords.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are the default lines which match reasons
|
||||
| that are given by the password broker for a password update attempt
|
||||
| has failed, such as for an invalid token or invalid new password.
|
||||
|
|
||||
*/
|
||||
|
||||
'reset' => 'Your password has been reset!',
|
||||
'sent' => 'We have emailed your password reset link!',
|
||||
'throttled' => 'Please wait before retrying.',
|
||||
'token' => 'This password reset token is invalid.',
|
||||
'user' => "We can't find a user with that email address.",
|
||||
|
||||
];
|
174
lang/en/validation.php
Normal file
174
lang/en/validation.php
Normal file
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines contain the default error messages used by
|
||||
| the validator class. Some of these rules have multiple versions such
|
||||
| as the size rules. Feel free to tweak each of these messages here.
|
||||
|
|
||||
*/
|
||||
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'accepted_if' => 'The :attribute must be accepted when :other is :value.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'after_or_equal' => 'The :attribute must be a date after or equal to :date.',
|
||||
'alpha' => 'The :attribute must only contain letters.',
|
||||
'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.',
|
||||
'alpha_num' => 'The :attribute must only contain letters and numbers.',
|
||||
'array' => 'The :attribute must be an array.',
|
||||
'before' => 'The :attribute must be a date before :date.',
|
||||
'before_or_equal' => 'The :attribute must be a date before or equal to :date.',
|
||||
'between' => [
|
||||
'array' => 'The :attribute must have between :min and :max items.',
|
||||
'file' => 'The :attribute must be between :min and :max kilobytes.',
|
||||
'numeric' => 'The :attribute must be between :min and :max.',
|
||||
'string' => 'The :attribute must be between :min and :max characters.',
|
||||
],
|
||||
'boolean' => 'The :attribute field must be true or false.',
|
||||
'confirmed' => 'The :attribute confirmation does not match.',
|
||||
'current_password' => 'The password is incorrect.',
|
||||
'date' => 'The :attribute is not a valid date.',
|
||||
'date_equals' => 'The :attribute must be a date equal to :date.',
|
||||
'date_format' => 'The :attribute does not match the format :format.',
|
||||
'declined' => 'The :attribute must be declined.',
|
||||
'declined_if' => 'The :attribute must be declined when :other is :value.',
|
||||
'different' => 'The :attribute and :other must be different.',
|
||||
'digits' => 'The :attribute must be :digits digits.',
|
||||
'digits_between' => 'The :attribute must be between :min and :max digits.',
|
||||
'dimensions' => 'The :attribute has invalid image dimensions.',
|
||||
'distinct' => 'The :attribute field has a duplicate value.',
|
||||
'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.',
|
||||
'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.',
|
||||
'email' => 'The :attribute must be a valid email address.',
|
||||
'ends_with' => 'The :attribute must end with one of the following: :values.',
|
||||
'enum' => 'The selected :attribute is invalid.',
|
||||
'exists' => 'The selected :attribute is invalid.',
|
||||
'file' => 'The :attribute must be a file.',
|
||||
'filled' => 'The :attribute field must have a value.',
|
||||
'gt' => [
|
||||
'array' => 'The :attribute must have more than :value items.',
|
||||
'file' => 'The :attribute must be greater than :value kilobytes.',
|
||||
'numeric' => 'The :attribute must be greater than :value.',
|
||||
'string' => 'The :attribute must be greater than :value characters.',
|
||||
],
|
||||
'gte' => [
|
||||
'array' => 'The :attribute must have :value items or more.',
|
||||
'file' => 'The :attribute must be greater than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute must be greater than or equal to :value.',
|
||||
'string' => 'The :attribute must be greater than or equal to :value characters.',
|
||||
],
|
||||
'image' => 'The :attribute must be an image.',
|
||||
'in' => 'The selected :attribute is invalid.',
|
||||
'in_array' => 'The :attribute field does not exist in :other.',
|
||||
'integer' => 'The :attribute must be an integer.',
|
||||
'ip' => 'The :attribute must be a valid IP address.',
|
||||
'ipv4' => 'The :attribute must be a valid IPv4 address.',
|
||||
'ipv6' => 'The :attribute must be a valid IPv6 address.',
|
||||
'json' => 'The :attribute must be a valid JSON string.',
|
||||
'lt' => [
|
||||
'array' => 'The :attribute must have less than :value items.',
|
||||
'file' => 'The :attribute must be less than :value kilobytes.',
|
||||
'numeric' => 'The :attribute must be less than :value.',
|
||||
'string' => 'The :attribute must be less than :value characters.',
|
||||
],
|
||||
'lte' => [
|
||||
'array' => 'The :attribute must not have more than :value items.',
|
||||
'file' => 'The :attribute must be less than or equal to :value kilobytes.',
|
||||
'numeric' => 'The :attribute must be less than or equal to :value.',
|
||||
'string' => 'The :attribute must be less than or equal to :value characters.',
|
||||
],
|
||||
'mac_address' => 'The :attribute must be a valid MAC address.',
|
||||
'max' => [
|
||||
'array' => 'The :attribute must not have more than :max items.',
|
||||
'file' => 'The :attribute must not be greater than :max kilobytes.',
|
||||
'numeric' => 'The :attribute must not be greater than :max.',
|
||||
'string' => 'The :attribute must not be greater than :max characters.',
|
||||
],
|
||||
'max_digits' => 'The :attribute must not have more than :max digits.',
|
||||
'mimes' => 'The :attribute must be a file of type: :values.',
|
||||
'mimetypes' => 'The :attribute must be a file of type: :values.',
|
||||
'min' => [
|
||||
'array' => 'The :attribute must have at least :min items.',
|
||||
'file' => 'The :attribute must be at least :min kilobytes.',
|
||||
'numeric' => 'The :attribute must be at least :min.',
|
||||
'string' => 'The :attribute must be at least :min characters.',
|
||||
],
|
||||
'min_digits' => 'The :attribute must have at least :min digits.',
|
||||
'multiple_of' => 'The :attribute must be a multiple of :value.',
|
||||
'not_in' => 'The selected :attribute is invalid.',
|
||||
'not_regex' => 'The :attribute format is invalid.',
|
||||
'numeric' => 'The :attribute must be a number.',
|
||||
'password' => [
|
||||
'letters' => 'The :attribute must contain at least one letter.',
|
||||
'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.',
|
||||
'numbers' => 'The :attribute must contain at least one number.',
|
||||
'symbols' => 'The :attribute must contain at least one symbol.',
|
||||
'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.',
|
||||
],
|
||||
'present' => 'The :attribute field must be present.',
|
||||
'prohibited' => 'The :attribute field is prohibited.',
|
||||
'prohibited_if' => 'The :attribute field is prohibited when :other is :value.',
|
||||
'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.',
|
||||
'prohibits' => 'The :attribute field prohibits :other from being present.',
|
||||
'regex' => 'The :attribute format is invalid.',
|
||||
'required' => 'The :attribute field is required.',
|
||||
'required_array_keys' => 'The :attribute field must contain entries for: :values.',
|
||||
'required_if' => 'The :attribute field is required when :other is :value.',
|
||||
'required_if_accepted' => 'The :attribute field is required when :other is accepted.',
|
||||
'required_unless' => 'The :attribute field is required unless :other is in :values.',
|
||||
'required_with' => 'The :attribute field is required when :values is present.',
|
||||
'required_with_all' => 'The :attribute field is required when :values are present.',
|
||||
'required_without' => 'The :attribute field is required when :values is not present.',
|
||||
'required_without_all' => 'The :attribute field is required when none of :values are present.',
|
||||
'same' => 'The :attribute and :other must match.',
|
||||
'size' => [
|
||||
'array' => 'The :attribute must contain :size items.',
|
||||
'file' => 'The :attribute must be :size kilobytes.',
|
||||
'numeric' => 'The :attribute must be :size.',
|
||||
'string' => 'The :attribute must be :size characters.',
|
||||
],
|
||||
'starts_with' => 'The :attribute must start with one of the following: :values.',
|
||||
'string' => 'The :attribute must be a string.',
|
||||
'timezone' => 'The :attribute must be a valid timezone.',
|
||||
'unique' => 'The :attribute has already been taken.',
|
||||
'uploaded' => 'The :attribute failed to upload.',
|
||||
'url' => 'The :attribute must be a valid URL.',
|
||||
'uuid' => 'The :attribute must be a valid UUID.',
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Language Lines
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may specify custom validation messages for attributes using the
|
||||
| convention "attribute.rule" to name the lines. This makes it quick to
|
||||
| specify a specific custom language line for a given attribute rule.
|
||||
|
|
||||
*/
|
||||
|
||||
'custom' => [
|
||||
'attribute-name' => [
|
||||
'rule-name' => 'custom-message',
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Custom Validation Attributes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The following language lines are used to swap our attribute placeholder
|
||||
| with something more reader friendly such as "E-Mail Address" instead
|
||||
| of "email". This simply helps us make our message more expressive.
|
||||
|
|
||||
*/
|
||||
|
||||
'attributes' => [],
|
||||
|
||||
];
|
6
modules_statuses.json
Normal file
6
modules_statuses.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"Usermanager": true,
|
||||
"Master": true,
|
||||
"Logs": true
|
||||
|
||||
}
|
18257
package-lock.json
generated
Normal file
18257
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
116
package.json
Normal file
116
package.json
Normal file
@ -0,0 +1,116 @@
|
||||
{
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "npm run development",
|
||||
"development": "mix",
|
||||
"watch": "mix watch",
|
||||
"watch-poll": "mix watch -- --watch-options-poll=1000",
|
||||
"hot": "mix watch --hot",
|
||||
"prod": "npm run production",
|
||||
"production": "mix --production"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ckeditor/ckeditor5-alignment": "^35.2.1",
|
||||
"@ckeditor/ckeditor5-build-balloon": "^35.2.1",
|
||||
"@ckeditor/ckeditor5-build-balloon-block": "^35.2.1",
|
||||
"@ckeditor/ckeditor5-build-classic": "^35.2.1",
|
||||
"@ckeditor/ckeditor5-build-decoupled-document": "^35.2.1",
|
||||
"@ckeditor/ckeditor5-build-inline": "^35.2.1",
|
||||
"@eonasdan/tempus-dominus": "^6.2.10",
|
||||
"@fortawesome/fontawesome-free": "^6.1.1",
|
||||
"@popperjs/core": "2.11.6",
|
||||
"@shopify/draggable": "^1.0.0-beta.12",
|
||||
"@yaireo/tagify": "^4.9.2",
|
||||
"acorn": "^8.0.4",
|
||||
"apexcharts": "^3.36.3",
|
||||
"autosize": "^5.0.1",
|
||||
"axios": "^0.21.1",
|
||||
"bootstrap": "5.3.0-alpha1",
|
||||
"bootstrap-cookie-alert": "^1.2.1",
|
||||
"bootstrap-daterangepicker": "^3.1.0",
|
||||
"bootstrap-icons": "^1.5.0",
|
||||
"bootstrap-maxlength": "^1.10.1",
|
||||
"bootstrap-multiselectsplitter": "^1.0.4",
|
||||
"chalk": "^4.1.0",
|
||||
"chart.js": "^3.6.0",
|
||||
"clipboard": "^2.0.8",
|
||||
"countup.js": "^2.0.7",
|
||||
"cropperjs": "^1.5.12",
|
||||
"datatables.net": "^1.12.1",
|
||||
"datatables.net-bs5": "^1.12.1",
|
||||
"datatables.net-buttons": "^2.2.3",
|
||||
"datatables.net-buttons-bs5": "^2.2.3",
|
||||
"datatables.net-colreorder": "^1.5.6",
|
||||
"datatables.net-colreorder-bs5": "^1.5.6",
|
||||
"datatables.net-datetime": "^1.1.2",
|
||||
"datatables.net-fixedcolumns": "^4.1.0",
|
||||
"datatables.net-fixedcolumns-bs5": "^4.1.0",
|
||||
"datatables.net-fixedheader": "^3.2.3",
|
||||
"datatables.net-fixedheader-bs5": "^3.2.3",
|
||||
"datatables.net-plugins": "^1.11.5",
|
||||
"datatables.net-responsive": "^2.3.0",
|
||||
"datatables.net-responsive-bs5": "^2.3.0",
|
||||
"datatables.net-rowgroup": "^1.2.0",
|
||||
"datatables.net-rowgroup-bs5": "^1.2.0",
|
||||
"datatables.net-rowreorder": "^1.2.8",
|
||||
"datatables.net-rowreorder-bs5": "^1.2.8",
|
||||
"datatables.net-scroller": "^2.0.6",
|
||||
"datatables.net-scroller-bs5": "^2.0.6",
|
||||
"datatables.net-select": "^1.4.0",
|
||||
"datatables.net-select-bs5": "^1.4.0",
|
||||
"dropzone": "^5.9.2",
|
||||
"es6-promise": "^4.2.8",
|
||||
"es6-promise-polyfill": "^1.2.0",
|
||||
"es6-shim": "^0.35.5",
|
||||
"esri-leaflet": "^3.0.2",
|
||||
"esri-leaflet-geocoder": "^3.0.0",
|
||||
"flatpickr": "^4.6.9",
|
||||
"flot": "^4.2.2",
|
||||
"fslightbox": "^3.3.0-2",
|
||||
"fullcalendar": "^5.8.0",
|
||||
"handlebars": "^4.7.7",
|
||||
"inputmask": "^5.0.6",
|
||||
"jkanban": "^1.3.1",
|
||||
"jquery": "3.6.0",
|
||||
"jquery-chained": "^2.0.0-beta.2",
|
||||
"jquery.repeater": "^1.2.1",
|
||||
"jstree": "^3.3.11",
|
||||
"jszip": "^3.6.0",
|
||||
"leaflet": "^1.7.1",
|
||||
"line-awesome": "^1.3.0",
|
||||
"lozad": "^1.16.0",
|
||||
"moment": "^2.29.1",
|
||||
"nouislider": "^15.2.0",
|
||||
"npm": "^7.19.1",
|
||||
"pdfmake": "^0.2.0",
|
||||
"prism-themes": "^1.7.0",
|
||||
"prismjs": "^1.24.1",
|
||||
"quill": "^1.3.7",
|
||||
"select2": "^4.1.0-rc.0",
|
||||
"smooth-scroll": "^16.1.3",
|
||||
"sweetalert2": "11.4.8",
|
||||
"tiny-slider": "^2.9.3",
|
||||
"tinymce": "^5.8.2",
|
||||
"toastr": "^2.1.4",
|
||||
"typed.js": "2.0.12",
|
||||
"vis-timeline": "^7.4.9",
|
||||
"wnumb": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"alpinejs": "^3.7.1",
|
||||
"autoprefixer": "^10.4.2",
|
||||
"axios": "^1.1.3",
|
||||
"del": "^6.0.0",
|
||||
"laravel-mix": "^6.0.39",
|
||||
"laravel-mix-purgecss": "^6.0.0",
|
||||
"lodash": "^4.17.19",
|
||||
"postcss": "^8.4.5",
|
||||
"postcss-import": "^14.0.2",
|
||||
"replace-in-file-webpack-plugin": "^1.0.6",
|
||||
"resolve-url-loader": "^4.0.0",
|
||||
"rtlcss": "^3.5.0",
|
||||
"sass": "1.55.0",
|
||||
"sass-loader": "13.2.0",
|
||||
"webpack-rtl-plugin": "^2.0.0"
|
||||
}
|
||||
}
|
26
phpunit.xml
Normal file
26
phpunit.xml
Normal file
@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
<directory suffix="Test.php">./tests/Unit</directory>
|
||||
</testsuite>
|
||||
<testsuite name="Feature">
|
||||
<directory suffix="Test.php">./tests/Feature</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<php>
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
<env name="TELESCOPE_ENABLED" value="false"/>
|
||||
</php>
|
||||
</phpunit>
|
21
public/.htaccess
Normal file
21
public/.htaccess
Normal file
@ -0,0 +1,21 @@
|
||||
<IfModule mod_rewrite.c>
|
||||
<IfModule mod_negotiation.c>
|
||||
Options -MultiViews -Indexes
|
||||
</IfModule>
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# Handle Authorization Header
|
||||
RewriteCond %{HTTP:Authorization} .
|
||||
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
|
||||
|
||||
# Redirect Trailing Slashes If Not A Folder...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_URI} (.+)/$
|
||||
RewriteRule ^ %1 [L,R=301]
|
||||
|
||||
# Send Requests To Front Controller...
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^ index.php [L]
|
||||
</IfModule>
|
0
public/favicon.ico
Normal file
0
public/favicon.ico
Normal file
1
public/icons.json
Normal file
1
public/icons.json
Normal file
File diff suppressed because one or more lines are too long
55
public/index.php
Normal file
55
public/index.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
define('LARAVEL_START', microtime(true));
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Check If The Application Is Under Maintenance
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| If the application is in maintenance / demo mode via the "down" command
|
||||
| we will load this file so that any pre-rendered content can be shown
|
||||
| instead of starting the framework, which could cause an exception.
|
||||
|
|
||||
*/
|
||||
|
||||
if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) {
|
||||
require $maintenance;
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Register The Auto Loader
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Composer provides a convenient, automatically generated class loader for
|
||||
| this application. We just need to utilize it! We'll simply require it
|
||||
| into the script here so we don't need to manually load our classes.
|
||||
|
|
||||
*/
|
||||
|
||||
require __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Run The Application
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Once we have the application, we can handle the incoming request using
|
||||
| the application's HTTP kernel. Then, we will send the response back
|
||||
| to this client's browser, allowing them to enjoy our application.
|
||||
|
|
||||
*/
|
||||
|
||||
$app = require_once __DIR__.'/../bootstrap/app.php';
|
||||
|
||||
$kernel = $app->make(Kernel::class);
|
||||
|
||||
$response = $kernel->handle(
|
||||
$request = Request::capture()
|
||||
)->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
2
public/robots.txt
Normal file
2
public/robots.txt
Normal file
@ -0,0 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
42
resources/_keenthemes/src/js/components/_init.js
Normal file
42
resources/_keenthemes/src/js/components/_init.js
Normal file
@ -0,0 +1,42 @@
|
||||
//
|
||||
// Global init of core components
|
||||
//
|
||||
|
||||
// Init components
|
||||
var KTComponents = function () {
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
KTApp.init();
|
||||
KTDrawer.init();
|
||||
KTMenu.init();
|
||||
KTScroll.init();
|
||||
KTSticky.init();
|
||||
KTSwapper.init();
|
||||
KTToggle.init();
|
||||
KTScrolltop.init();
|
||||
KTDialer.init();
|
||||
KTImageInput.init();
|
||||
KTPasswordMeter.init();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
KTComponents.init();
|
||||
});
|
||||
} else {
|
||||
KTComponents.init();
|
||||
}
|
||||
|
||||
// Init page loader
|
||||
window.addEventListener("load", function() {
|
||||
KTApp.hidePageLoading();
|
||||
});
|
||||
|
||||
// Declare KTApp for Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
window.KTComponents = module.exports = KTComponents;
|
||||
}
|
684
resources/_keenthemes/src/js/components/app.js
Normal file
684
resources/_keenthemes/src/js/components/app.js
Normal file
@ -0,0 +1,684 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTApp = function () {
|
||||
var initialized = false;
|
||||
var select2FocusFixInitialized = false;
|
||||
var countUpInitialized = false;
|
||||
|
||||
var createBootstrapTooltip = function (el, options) {
|
||||
if (el.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var delay = {};
|
||||
|
||||
// Handle delay options
|
||||
if (el.hasAttribute('data-bs-delay-hide')) {
|
||||
delay['hide'] = el.getAttribute('data-bs-delay-hide');
|
||||
}
|
||||
|
||||
if (el.hasAttribute('data-bs-delay-show')) {
|
||||
delay['show'] = el.getAttribute('data-bs-delay-show');
|
||||
}
|
||||
|
||||
if (delay) {
|
||||
options['delay'] = delay;
|
||||
}
|
||||
|
||||
// Check dismiss options
|
||||
if (el.hasAttribute('data-bs-dismiss') && el.getAttribute('data-bs-dismiss') == 'click') {
|
||||
options['dismiss'] = 'click';
|
||||
}
|
||||
|
||||
// Initialize popover
|
||||
var tp = new bootstrap.Tooltip(el, options);
|
||||
|
||||
// Handle dismiss
|
||||
if (options['dismiss'] && options['dismiss'] === 'click') {
|
||||
// Hide popover on element click
|
||||
el.addEventListener("click", function (e) {
|
||||
tp.hide();
|
||||
});
|
||||
}
|
||||
|
||||
el.setAttribute("data-kt-initialized", "1");
|
||||
|
||||
return tp;
|
||||
}
|
||||
|
||||
var createBootstrapTooltips = function () {
|
||||
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
|
||||
|
||||
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
|
||||
createBootstrapTooltip(tooltipTriggerEl, {});
|
||||
});
|
||||
}
|
||||
|
||||
var createBootstrapPopover = function (el, options) {
|
||||
if (el.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var delay = {};
|
||||
|
||||
// Handle delay options
|
||||
if (el.hasAttribute('data-bs-delay-hide')) {
|
||||
delay['hide'] = el.getAttribute('data-bs-delay-hide');
|
||||
}
|
||||
|
||||
if (el.hasAttribute('data-bs-delay-show')) {
|
||||
delay['show'] = el.getAttribute('data-bs-delay-show');
|
||||
}
|
||||
|
||||
if (delay) {
|
||||
options['delay'] = delay;
|
||||
}
|
||||
|
||||
// Handle dismiss option
|
||||
if (el.getAttribute('data-bs-dismiss') == 'true') {
|
||||
options['dismiss'] = true;
|
||||
}
|
||||
|
||||
if (options['dismiss'] === true) {
|
||||
options['template'] = '<div class="popover" role="tooltip"><div class="popover-arrow"></div><span class="popover-dismiss btn btn-icon"></span><h3 class="popover-header"></h3><div class="popover-body"></div></div>'
|
||||
}
|
||||
|
||||
// Initialize popover
|
||||
var popover = new bootstrap.Popover(el, options);
|
||||
|
||||
// Handle dismiss click
|
||||
if (options['dismiss'] === true) {
|
||||
var dismissHandler = function (e) {
|
||||
popover.hide();
|
||||
}
|
||||
|
||||
el.addEventListener('shown.bs.popover', function () {
|
||||
var dismissEl = document.getElementById(el.getAttribute('aria-describedby'));
|
||||
dismissEl.addEventListener('click', dismissHandler);
|
||||
});
|
||||
|
||||
el.addEventListener('hide.bs.popover', function () {
|
||||
var dismissEl = document.getElementById(el.getAttribute('aria-describedby'));
|
||||
dismissEl.removeEventListener('click', dismissHandler);
|
||||
});
|
||||
}
|
||||
|
||||
el.setAttribute("data-kt-initialized", "1");
|
||||
|
||||
return popover;
|
||||
}
|
||||
|
||||
var createBootstrapPopovers = function () {
|
||||
var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
|
||||
|
||||
var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
|
||||
createBootstrapPopover(popoverTriggerEl, {});
|
||||
});
|
||||
}
|
||||
|
||||
var createBootstrapToasts = function () {
|
||||
var toastElList = [].slice.call(document.querySelectorAll('.toast'));
|
||||
var toastList = toastElList.map(function (toastEl) {
|
||||
if (toastEl.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
toastEl.setAttribute("data-kt-initialized", "1");
|
||||
|
||||
return new bootstrap.Toast(toastEl, {})
|
||||
});
|
||||
}
|
||||
|
||||
var createButtons = function () {
|
||||
var buttonsGroup = [].slice.call(document.querySelectorAll('[data-kt-buttons="true"]'));
|
||||
|
||||
buttonsGroup.map(function (group) {
|
||||
if (group.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var selector = group.hasAttribute('data-kt-buttons-target') ? group.getAttribute('data-kt-buttons-target') : '.btn';
|
||||
var activeButtons = [].slice.call(group.querySelectorAll(selector));
|
||||
|
||||
// Toggle Handler
|
||||
KTUtil.on(group, selector, 'click', function (e) {
|
||||
activeButtons.map(function (button) {
|
||||
button.classList.remove('active');
|
||||
});
|
||||
|
||||
this.classList.add('active');
|
||||
});
|
||||
|
||||
group.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
}
|
||||
|
||||
var createDateRangePickers = function() {
|
||||
// Check if jQuery included
|
||||
if (typeof jQuery == 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if daterangepicker included
|
||||
if (typeof $.fn.daterangepicker === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = [].slice.call(document.querySelectorAll('[data-kt-daterangepicker="true"]'));
|
||||
var start = moment().subtract(29, 'days');
|
||||
var end = moment();
|
||||
|
||||
elements.map(function (element) {
|
||||
if (element.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var display = element.querySelector('div');
|
||||
var attrOpens = element.hasAttribute('data-kt-daterangepicker-opens') ? element.getAttribute('data-kt-daterangepicker-opens') : 'left';
|
||||
var range = element.getAttribute('data-kt-daterangepicker-range');
|
||||
|
||||
var cb = function(start, end) {
|
||||
var current = moment();
|
||||
|
||||
if (display) {
|
||||
if ( current.isSame(start, "day") && current.isSame(end, "day") ) {
|
||||
display.innerHTML = start.format('D MMM YYYY');
|
||||
} else {
|
||||
display.innerHTML = start.format('D MMM YYYY') + ' - ' + end.format('D MMM YYYY');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( range === "today" ) {
|
||||
start = moment();
|
||||
end = moment();
|
||||
}
|
||||
|
||||
$(element).daterangepicker({
|
||||
startDate: start,
|
||||
endDate: end,
|
||||
opens: attrOpens,
|
||||
ranges: {
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
}
|
||||
}, cb);
|
||||
|
||||
cb(start, end);
|
||||
|
||||
element.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
}
|
||||
|
||||
var createSelect2 = function () {
|
||||
// Check if jQuery included
|
||||
if (typeof jQuery == 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if select2 included
|
||||
if (typeof $.fn.select2 === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = [].slice.call(document.querySelectorAll('[data-control="select2"], [data-kt-select2="true"]'));
|
||||
|
||||
elements.map(function (element) {
|
||||
if (element.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var options = {
|
||||
dir: document.body.getAttribute('direction')
|
||||
};
|
||||
|
||||
if (element.getAttribute('data-hide-search') == 'true') {
|
||||
options.minimumResultsForSearch = Infinity;
|
||||
}
|
||||
|
||||
$(element).select2(options);
|
||||
|
||||
element.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
|
||||
/*
|
||||
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
|
||||
* see: https://github.com/select2/select2/issues/5993
|
||||
* see: https://github.com/jquery/jquery/issues/4382
|
||||
*
|
||||
* TODO: Recheck with the select2 GH issue and remove once this is fixed on their side
|
||||
*/
|
||||
|
||||
if (select2FocusFixInitialized === false) {
|
||||
select2FocusFixInitialized = true;
|
||||
|
||||
$(document).on('select2:open', function(e) {
|
||||
var elements = document.querySelectorAll('.select2-container--open .select2-search__field');
|
||||
if (elements.length > 0) {
|
||||
elements[elements.length - 1].focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var createAutosize = function () {
|
||||
if (typeof autosize === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var inputs = [].slice.call(document.querySelectorAll('[data-kt-autosize="true"]'));
|
||||
|
||||
inputs.map(function (input) {
|
||||
if (input.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
autosize(input);
|
||||
|
||||
input.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
}
|
||||
|
||||
var createCountUp = function () {
|
||||
if (typeof countUp === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var elements = [].slice.call(document.querySelectorAll('[data-kt-countup="true"]:not(.counted)'));
|
||||
|
||||
elements.map(function (element) {
|
||||
if (KTUtil.isInViewport(element) && KTUtil.visible(element)) {
|
||||
if (element.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
var options = {};
|
||||
|
||||
var value = element.getAttribute('data-kt-countup-value');
|
||||
value = parseFloat(value.replace(/,/g, ""));
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-start-val')) {
|
||||
options.startVal = parseFloat(element.getAttribute('data-kt-countup-start-val'));
|
||||
}
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-duration')) {
|
||||
options.duration = parseInt(element.getAttribute('data-kt-countup-duration'));
|
||||
}
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-decimal-places')) {
|
||||
options.decimalPlaces = parseInt(element.getAttribute('data-kt-countup-decimal-places'));
|
||||
}
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-prefix')) {
|
||||
options.prefix = element.getAttribute('data-kt-countup-prefix');
|
||||
}
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-separator')) {
|
||||
options.separator = element.getAttribute('data-kt-countup-separator');
|
||||
}
|
||||
|
||||
if (element.hasAttribute('data-kt-countup-suffix')) {
|
||||
options.suffix = element.getAttribute('data-kt-countup-suffix');
|
||||
}
|
||||
|
||||
var count = new countUp.CountUp(element, value, options);
|
||||
|
||||
count.start();
|
||||
|
||||
element.classList.add('counted');
|
||||
|
||||
element.setAttribute("data-kt-initialized", "1");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var createCountUpTabs = function () {
|
||||
if (typeof countUp === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
if (countUpInitialized === false) {
|
||||
// Initial call
|
||||
createCountUp();
|
||||
|
||||
// Window scroll event handler
|
||||
window.addEventListener('scroll', createCountUp);
|
||||
}
|
||||
|
||||
// Tabs shown event handler
|
||||
var tabs = [].slice.call(document.querySelectorAll('[data-kt-countup-tabs="true"][data-bs-toggle="tab"]'));
|
||||
tabs.map(function (tab) {
|
||||
if (tab.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
tab.addEventListener('shown.bs.tab', createCountUp);
|
||||
|
||||
tab.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
|
||||
countUpInitialized = true;
|
||||
}
|
||||
|
||||
var createTinySliders = function () {
|
||||
if (typeof tns === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Sliders
|
||||
const elements = Array.prototype.slice.call(document.querySelectorAll('[data-tns="true"]'), 0);
|
||||
|
||||
if (!elements && elements.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
elements.forEach(function (el) {
|
||||
if (el.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
initTinySlider(el);
|
||||
|
||||
el.setAttribute("data-kt-initialized", "1");
|
||||
});
|
||||
}
|
||||
|
||||
var initTinySlider = function (el) {
|
||||
if (!el) {
|
||||
return;
|
||||
}
|
||||
|
||||
const tnsOptions = {};
|
||||
|
||||
// Convert string boolean
|
||||
const checkBool = function (val) {
|
||||
if (val === 'true') {
|
||||
return true;
|
||||
}
|
||||
if (val === 'false') {
|
||||
return false;
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
// get extra options via data attributes
|
||||
el.getAttributeNames().forEach(function (attrName) {
|
||||
// more options; https://github.com/ganlanyuan/tiny-slider#options
|
||||
if ((/^data-tns-.*/g).test(attrName)) {
|
||||
let optionName = attrName.replace('data-tns-', '').toLowerCase().replace(/(?:[\s-])\w/g, function (match) {
|
||||
return match.replace('-', '').toUpperCase();
|
||||
});
|
||||
|
||||
if (attrName === 'data-tns-responsive') {
|
||||
// fix string with a valid json
|
||||
const jsonStr = el.getAttribute(attrName).replace(/(\w+:)|(\w+ :)/g, function (matched) {
|
||||
return '"' + matched.substring(0, matched.length - 1) + '":';
|
||||
});
|
||||
try {
|
||||
// convert json string to object
|
||||
tnsOptions[optionName] = JSON.parse(jsonStr);
|
||||
}
|
||||
catch (e) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
tnsOptions[optionName] = checkBool(el.getAttribute(attrName));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const opt = Object.assign({}, {
|
||||
container: el,
|
||||
slideBy: 'page',
|
||||
autoplay: true,
|
||||
center: true,
|
||||
autoplayButtonOutput: false,
|
||||
}, tnsOptions);
|
||||
|
||||
if (el.closest('.tns')) {
|
||||
KTUtil.addClass(el.closest('.tns'), 'tns-initiazlied');
|
||||
}
|
||||
|
||||
return tns(opt);
|
||||
}
|
||||
|
||||
var initSmoothScroll = function () {
|
||||
if (initialized === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof SmoothScroll === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
new SmoothScroll('a[data-kt-scroll-toggle][href*="#"]', {
|
||||
speed: 1000,
|
||||
speedAsDuration: true,
|
||||
offset: function (anchor, toggle) {
|
||||
// Integer or Function returning an integer. How far to offset the scrolling anchor location in pixels
|
||||
// This example is a function, but you could do something as simple as `offset: 25`
|
||||
|
||||
// An example returning different values based on whether the clicked link was in the header nav or not
|
||||
if (anchor.hasAttribute('data-kt-scroll-offset')) {
|
||||
var val = KTUtil.getResponsiveValue(anchor.getAttribute('data-kt-scroll-offset'));
|
||||
|
||||
return val;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var initCard = function() {
|
||||
// Toggle Handler
|
||||
KTUtil.on(document.body, '[data-kt-card-action="remove"]', 'click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
const card = this.closest('.card');
|
||||
|
||||
if (!card) {
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmMessage = this.getAttribute("data-kt-card-confirm-message");
|
||||
const confirm = this.getAttribute("data-kt-card-confirm") === "true";
|
||||
|
||||
if (confirm) {
|
||||
// Show message popup. For more info check the plugin's official documentation: https://sweetalert2.github.io/
|
||||
Swal.fire({
|
||||
text: confirmMessage ? confirmMessage : "Are you sure to remove ?",
|
||||
icon: "warning",
|
||||
buttonsStyling: false,
|
||||
confirmButtonText: "Confirm",
|
||||
denyButtonText: "Cancel",
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary",
|
||||
denyButton: "btn btn-danger"
|
||||
}
|
||||
}).then(function (result) {
|
||||
if (result.isConfirmed) {
|
||||
card.remove();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
card.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var initModal = function() {
|
||||
var elements = Array.prototype.slice.call(document.querySelectorAll("[data-bs-stacked-modal]"));
|
||||
|
||||
if (elements && elements.length > 0) {
|
||||
elements.forEach((element) => {
|
||||
if (element.getAttribute("data-kt-initialized") === "1") {
|
||||
return;
|
||||
}
|
||||
|
||||
element.setAttribute("data-kt-initialized", "1");
|
||||
|
||||
element.addEventListener("click", function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
const modalEl = document.querySelector(this.getAttribute("data-bs-stacked-modal"));
|
||||
|
||||
if (modalEl) {
|
||||
const modal = new bootstrap.Modal(modalEl);
|
||||
modal.show();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var initCheck = function () {
|
||||
if (initialized === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Toggle Handler
|
||||
KTUtil.on(document.body, '[data-kt-check="true"]', 'change', function (e) {
|
||||
var check = this;
|
||||
var targets = document.querySelectorAll(check.getAttribute('data-kt-check-target'));
|
||||
|
||||
KTUtil.each(targets, function (target) {
|
||||
if (target.type == 'checkbox') {
|
||||
target.checked = check.checked;
|
||||
} else {
|
||||
target.classList.toggle('active');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var initBootstrapCollapse = function() {
|
||||
if (initialized === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
KTUtil.on(document.body, '.collapsible[data-bs-toggle="collapse"]', 'click', function(e) {
|
||||
if (this.classList.contains('collapsed')) {
|
||||
this.classList.remove('active');
|
||||
this.blur();
|
||||
} else {
|
||||
this.classList.add('active');
|
||||
}
|
||||
|
||||
if (this.hasAttribute('data-kt-toggle-text')) {
|
||||
var text = this.getAttribute('data-kt-toggle-text');
|
||||
var target = this.querySelector('[data-kt-toggle-text-target="true"]');
|
||||
var target = target ? target : this;
|
||||
|
||||
this.setAttribute('data-kt-toggle-text', target.innerText);
|
||||
target.innerText = text;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var initBootstrapRotate = function() {
|
||||
if (initialized === true) {
|
||||
return;
|
||||
}
|
||||
|
||||
KTUtil.on(document.body, '[data-kt-rotate="true"]', 'click', function(e) {
|
||||
if (this.classList.contains('active')) {
|
||||
this.classList.remove('active');
|
||||
this.blur();
|
||||
} else {
|
||||
this.classList.add('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var initLozad = function() {
|
||||
// Check if lozad included
|
||||
if (typeof lozad === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
const observer = lozad(); // lazy loads elements with default selector as '.lozad'
|
||||
observer.observe();
|
||||
}
|
||||
|
||||
var showPageLoading = function() {
|
||||
document.body.classList.add('page-loading');
|
||||
document.body.setAttribute('data-kt-app-page-loading', "on");
|
||||
}
|
||||
|
||||
var hidePageLoading = function() {
|
||||
// CSS3 Transitions only after page load(.page-loading or .app-page-loading class added to body tag and remove with JS on page load)
|
||||
document.body.classList.remove('page-loading');
|
||||
document.body.removeAttribute('data-kt-app-page-loading');
|
||||
}
|
||||
|
||||
return {
|
||||
init: function () {
|
||||
initLozad();
|
||||
|
||||
initSmoothScroll();
|
||||
|
||||
initCard();
|
||||
|
||||
initModal();
|
||||
|
||||
initCheck();
|
||||
|
||||
initBootstrapCollapse();
|
||||
|
||||
initBootstrapRotate();
|
||||
|
||||
createBootstrapTooltips();
|
||||
|
||||
createBootstrapPopovers();
|
||||
|
||||
createBootstrapToasts();
|
||||
|
||||
createDateRangePickers();
|
||||
|
||||
createButtons();
|
||||
|
||||
createSelect2();
|
||||
|
||||
createCountUp();
|
||||
|
||||
createCountUpTabs();
|
||||
|
||||
createAutosize();
|
||||
|
||||
createTinySliders();
|
||||
|
||||
initialized = true;
|
||||
},
|
||||
|
||||
initTinySlider: function(el) {
|
||||
initTinySlider(el);
|
||||
},
|
||||
|
||||
showPageLoading: function () {
|
||||
showPageLoading();
|
||||
},
|
||||
|
||||
hidePageLoading: function () {
|
||||
hidePageLoading();
|
||||
},
|
||||
|
||||
createBootstrapPopover: function(el, options) {
|
||||
return createBootstrapPopover(el, options);
|
||||
},
|
||||
|
||||
createBootstrapTooltip: function(el, options) {
|
||||
return createBootstrapTooltip(el, options);
|
||||
}
|
||||
};
|
||||
}();
|
||||
|
||||
// Declare KTApp for Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTApp;
|
||||
}
|
177
resources/_keenthemes/src/js/components/blockui.js
Normal file
177
resources/_keenthemes/src/js/components/blockui.js
Normal file
@ -0,0 +1,177 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTBlockUI = function(element, options) {
|
||||
//////////////////////////////
|
||||
// ** Private variables ** //
|
||||
//////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
zIndex: false,
|
||||
overlayClass: '',
|
||||
overflow: 'hidden',
|
||||
message: '<span class="spinner-border text-primary"></span>'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('blockui') ) {
|
||||
the = KTUtil.data(element).get('blockui');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.element = element;
|
||||
the.overlayElement = null;
|
||||
the.blocked = false;
|
||||
the.positionChanged = false;
|
||||
the.overflowChanged = false;
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('blockui', the);
|
||||
}
|
||||
|
||||
var _block = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.blockui.block', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var isPage = (the.element.tagName === 'BODY');
|
||||
|
||||
var position = KTUtil.css(the.element, 'position');
|
||||
var overflow = KTUtil.css(the.element, 'overflow');
|
||||
var zIndex = isPage ? 10000 : 1;
|
||||
|
||||
if (the.options.zIndex > 0) {
|
||||
zIndex = the.options.zIndex;
|
||||
} else {
|
||||
if (KTUtil.css(the.element, 'z-index') != 'auto') {
|
||||
zIndex = KTUtil.css(the.element, 'z-index');
|
||||
}
|
||||
}
|
||||
|
||||
the.element.classList.add('blockui');
|
||||
|
||||
if (position === "absolute" || position === "relative" || position === "fixed") {
|
||||
KTUtil.css(the.element, 'position', 'relative');
|
||||
the.positionChanged = true;
|
||||
}
|
||||
|
||||
if (the.options.overflow === 'hidden' && overflow === 'visible') {
|
||||
KTUtil.css(the.element, 'overflow', 'hidden');
|
||||
the.overflowChanged = true;
|
||||
}
|
||||
|
||||
the.overlayElement = document.createElement('DIV');
|
||||
the.overlayElement.setAttribute('class', 'blockui-overlay ' + the.options.overlayClass);
|
||||
|
||||
the.overlayElement.innerHTML = the.options.message;
|
||||
|
||||
KTUtil.css(the.overlayElement, 'z-index', zIndex);
|
||||
|
||||
the.element.append(the.overlayElement);
|
||||
the.blocked = true;
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.blockui.after.blocked', the)
|
||||
}
|
||||
|
||||
var _release = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.blockui.release', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the.element.classList.add('blockui');
|
||||
|
||||
if (the.positionChanged) {
|
||||
KTUtil.css(the.element, 'position', '');
|
||||
}
|
||||
|
||||
if (the.overflowChanged) {
|
||||
KTUtil.css(the.element, 'overflow', '');
|
||||
}
|
||||
|
||||
if (the.overlayElement) {
|
||||
KTUtil.remove(the.overlayElement);
|
||||
}
|
||||
|
||||
the.blocked = false;
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.blockui.released', the);
|
||||
}
|
||||
|
||||
var _isBlocked = function() {
|
||||
return the.blocked;
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('blockui');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.block = function() {
|
||||
_block();
|
||||
}
|
||||
|
||||
the.release = function() {
|
||||
_release();
|
||||
}
|
||||
|
||||
the.isBlocked = function() {
|
||||
return _isBlocked();
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTBlockUI.getInstance = function(element) {
|
||||
if (element !== null && KTUtil.data(element).has('blockui')) {
|
||||
return KTUtil.data(element).get('blockui');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTBlockUI;
|
||||
}
|
62
resources/_keenthemes/src/js/components/cookie.js
Normal file
62
resources/_keenthemes/src/js/components/cookie.js
Normal file
@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
// DOCS: https://javascript.info/cookie
|
||||
|
||||
// Class definition
|
||||
var KTCookie = function() {
|
||||
return {
|
||||
// returns the cookie with the given name,
|
||||
// or undefined if not found
|
||||
get: function(name) {
|
||||
var matches = document.cookie.match(new RegExp(
|
||||
"(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
|
||||
));
|
||||
|
||||
return matches ? decodeURIComponent(matches[1]) : null;
|
||||
},
|
||||
|
||||
// Please note that a cookie value is encoded,
|
||||
// so getCookie uses a built-in decodeURIComponent function to decode it.
|
||||
set: function(name, value, options) {
|
||||
if ( typeof options === "undefined" || options === null ) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
options = Object.assign({}, {
|
||||
path: '/'
|
||||
}, options);
|
||||
|
||||
if ( options.expires instanceof Date ) {
|
||||
options.expires = options.expires.toUTCString();
|
||||
}
|
||||
|
||||
var updatedCookie = encodeURIComponent(name) + "=" + encodeURIComponent(value);
|
||||
|
||||
for ( var optionKey in options ) {
|
||||
if ( options.hasOwnProperty(optionKey) === false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
updatedCookie += "; " + optionKey;
|
||||
var optionValue = options[optionKey];
|
||||
|
||||
if ( optionValue !== true ) {
|
||||
updatedCookie += "=" + optionValue;
|
||||
}
|
||||
}
|
||||
|
||||
document.cookie = updatedCookie;
|
||||
},
|
||||
|
||||
// To remove a cookie, we can call it with a negative expiration date:
|
||||
remove: function(name) {
|
||||
this.set(name, "", {
|
||||
'max-age': -1
|
||||
});
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTCookie;
|
||||
}
|
289
resources/_keenthemes/src/js/components/dialer.js
Normal file
289
resources/_keenthemes/src/js/components/dialer.js
Normal file
@ -0,0 +1,289 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTDialer = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
min: null,
|
||||
max: null,
|
||||
step: 1,
|
||||
decimals: 0,
|
||||
prefix: "",
|
||||
suffix: ""
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
// Constructor
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('dialer') === true ) {
|
||||
the = KTUtil.data(element).get('dialer');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
the.incElement = the.element.querySelector('[data-kt-dialer-control="increase"]');
|
||||
the.decElement = the.element.querySelector('[data-kt-dialer-control="decrease"]');
|
||||
the.inputElement = the.element.querySelector('input[type]');
|
||||
|
||||
// Set Values
|
||||
if (_getOption('decimals')) {
|
||||
the.options.decimals = parseInt(_getOption('decimals'));
|
||||
}
|
||||
|
||||
if (_getOption('prefix')) {
|
||||
the.options.prefix = _getOption('prefix');
|
||||
}
|
||||
|
||||
if (_getOption('suffix')) {
|
||||
the.options.suffix = _getOption('suffix');
|
||||
}
|
||||
|
||||
if (_getOption('step')) {
|
||||
the.options.step = parseFloat(_getOption('step'));
|
||||
}
|
||||
|
||||
if (_getOption('min')) {
|
||||
the.options.min = parseFloat(_getOption('min'));
|
||||
}
|
||||
|
||||
if (_getOption('max')) {
|
||||
the.options.max = parseFloat(_getOption('max'));
|
||||
}
|
||||
|
||||
the.value = parseFloat(the.inputElement.value.replace(/[^\d.]/g, ''));
|
||||
|
||||
_setValue();
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('dialer', the);
|
||||
}
|
||||
|
||||
// Handlers
|
||||
var _handlers = function() {
|
||||
KTUtil.addEvent(the.incElement, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_increase();
|
||||
});
|
||||
|
||||
KTUtil.addEvent(the.decElement, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_decrease();
|
||||
});
|
||||
|
||||
KTUtil.addEvent(the.inputElement, 'input', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_setValue();
|
||||
});
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
var _increase = function() {
|
||||
// Trigger "after.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.increase', the);
|
||||
|
||||
the.inputElement.value = the.value + the.options.step;
|
||||
_setValue();
|
||||
|
||||
// Trigger "before.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.increased', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _decrease = function() {
|
||||
// Trigger "after.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.decrease', the);
|
||||
|
||||
the.inputElement.value = the.value - the.options.step;
|
||||
|
||||
_setValue();
|
||||
|
||||
// Trigger "before.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.decreased', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
// Set Input Value
|
||||
var _setValue = function(value) {
|
||||
// Trigger "after.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.change', the);
|
||||
|
||||
if (value !== undefined) {
|
||||
the.value = value;
|
||||
} else {
|
||||
the.value = _parse(the.inputElement.value);
|
||||
}
|
||||
|
||||
if (the.options.min !== null && the.value < the.options.min) {
|
||||
the.value = the.options.min;
|
||||
}
|
||||
|
||||
if (the.options.max !== null && the.value > the.options.max) {
|
||||
the.value = the.options.max;
|
||||
}
|
||||
|
||||
the.inputElement.value = _format(the.value);
|
||||
|
||||
// Trigger input change event
|
||||
the.inputElement.dispatchEvent(new Event('change'));
|
||||
|
||||
// Trigger "after.dialer" event
|
||||
KTEventHandler.trigger(the.element, 'kt.dialer.changed', the);
|
||||
}
|
||||
|
||||
var _parse = function(val) {
|
||||
val = val
|
||||
.replace(/[^0-9.-]/g, '') // remove chars except number, hyphen, point.
|
||||
.replace(/(\..*)\./g, '$1') // remove multiple points.
|
||||
.replace(/(?!^)-/g, '') // remove middle hyphen.
|
||||
.replace(/^0+(\d)/gm, '$1'); // remove multiple leading zeros. <-- I added this.
|
||||
|
||||
val = parseFloat(val);
|
||||
|
||||
if (isNaN(val)) {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
// Format
|
||||
var _format = function(val){
|
||||
return the.options.prefix + parseFloat(val).toFixed(the.options.decimals) + the.options.suffix;
|
||||
}
|
||||
|
||||
// Get option
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-dialer-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-dialer-' + name);
|
||||
var value = attr;
|
||||
|
||||
return value;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('dialer');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.setMinValue = function(value) {
|
||||
the.options.min = value;
|
||||
}
|
||||
|
||||
the.setMaxValue = function(value) {
|
||||
the.options.max = value;
|
||||
}
|
||||
|
||||
the.setValue = function(value) {
|
||||
_setValue(value);
|
||||
}
|
||||
|
||||
the.getValue = function() {
|
||||
return the.inputElement.value;
|
||||
}
|
||||
|
||||
the.update = function() {
|
||||
_setValue();
|
||||
}
|
||||
|
||||
the.increase = function() {
|
||||
return _increase();
|
||||
}
|
||||
|
||||
the.decrease = function() {
|
||||
return _decrease();
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTDialer.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('dialer') ) {
|
||||
return KTUtil.data(element).get('dialer');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTDialer.createInstances = function(selector = '[data-kt-dialer="true"]') {
|
||||
// Get instances
|
||||
var elements = document.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
new KTDialer(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTDialer.init = function() {
|
||||
KTDialer.createInstances();
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTDialer;
|
||||
}
|
463
resources/_keenthemes/src/js/components/drawer.js
Normal file
463
resources/_keenthemes/src/js/components/drawer.js
Normal file
@ -0,0 +1,463 @@
|
||||
"use strict";
|
||||
|
||||
var KTDrawerHandlersInitialized = false;
|
||||
|
||||
// Class definition
|
||||
var KTDrawer = function(element, options) {
|
||||
//////////////////////////////
|
||||
// ** Private variables ** //
|
||||
//////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
overlay: true,
|
||||
direction: 'end',
|
||||
baseClass: 'drawer',
|
||||
overlayClass: 'drawer-overlay'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('drawer') ) {
|
||||
the = KTUtil.data(element).get('drawer');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('drawer');
|
||||
the.element = element;
|
||||
the.overlayElement = null;
|
||||
the.name = the.element.getAttribute('data-kt-drawer-name');
|
||||
the.shown = false;
|
||||
the.lastWidth;
|
||||
the.toggleElement = null;
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-drawer', 'true');
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Update Instance
|
||||
_update();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('drawer', the);
|
||||
}
|
||||
|
||||
var _handlers = function() {
|
||||
var togglers = _getOption('toggle');
|
||||
var closers = _getOption('close');
|
||||
|
||||
if ( togglers !== null && togglers.length > 0 ) {
|
||||
KTUtil.on(document.body, togglers, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
the.toggleElement = this;
|
||||
_toggle();
|
||||
});
|
||||
}
|
||||
|
||||
if ( closers !== null && closers.length > 0 ) {
|
||||
KTUtil.on(document.body, closers, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
the.closeElement = this;
|
||||
_hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var _toggle = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.drawer.toggle', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( the.shown === true ) {
|
||||
_hide();
|
||||
} else {
|
||||
_show();
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.drawer.toggled', the);
|
||||
}
|
||||
|
||||
var _hide = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.drawer.hide', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the.shown = false;
|
||||
|
||||
_deleteOverlay();
|
||||
|
||||
document.body.removeAttribute('data-kt-drawer-' + the.name, 'on');
|
||||
document.body.removeAttribute('data-kt-drawer');
|
||||
|
||||
KTUtil.removeClass(the.element, the.options.baseClass + '-on');
|
||||
|
||||
if ( the.toggleElement !== null ) {
|
||||
KTUtil.removeClass(the.toggleElement, 'active');
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.drawer.after.hidden', the) === false
|
||||
}
|
||||
|
||||
var _show = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.drawer.show', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the.shown = true;
|
||||
|
||||
_createOverlay();
|
||||
document.body.setAttribute('data-kt-drawer-' + the.name, 'on');
|
||||
document.body.setAttribute('data-kt-drawer', 'on');
|
||||
|
||||
KTUtil.addClass(the.element, the.options.baseClass + '-on');
|
||||
|
||||
if ( the.toggleElement !== null ) {
|
||||
KTUtil.addClass(the.toggleElement, 'active');
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.drawer.shown', the);
|
||||
}
|
||||
|
||||
var _update = function() {
|
||||
var width = _getWidth();
|
||||
var direction = _getOption('direction');
|
||||
|
||||
var top = _getOption('top');
|
||||
var bottom = _getOption('bottom');
|
||||
var start = _getOption('start');
|
||||
var end = _getOption('end');
|
||||
|
||||
// Reset state
|
||||
if ( KTUtil.hasClass(the.element, the.options.baseClass + '-on') === true && String(document.body.getAttribute('data-kt-drawer-' + the.name + '-')) === 'on' ) {
|
||||
the.shown = true;
|
||||
} else {
|
||||
the.shown = false;
|
||||
}
|
||||
|
||||
// Activate/deactivate
|
||||
if ( _getOption('activate') === true ) {
|
||||
KTUtil.addClass(the.element, the.options.baseClass);
|
||||
KTUtil.addClass(the.element, the.options.baseClass + '-' + direction);
|
||||
|
||||
KTUtil.css(the.element, 'width', width, true);
|
||||
the.lastWidth = width;
|
||||
|
||||
if (top) {
|
||||
KTUtil.css(the.element, 'top', top);
|
||||
}
|
||||
|
||||
if (bottom) {
|
||||
KTUtil.css(the.element, 'bottom', bottom);
|
||||
}
|
||||
|
||||
if (start) {
|
||||
if (KTUtil.isRTL()) {
|
||||
KTUtil.css(the.element, 'right', start);
|
||||
} else {
|
||||
KTUtil.css(the.element, 'left', start);
|
||||
}
|
||||
}
|
||||
|
||||
if (end) {
|
||||
if (KTUtil.isRTL()) {
|
||||
KTUtil.css(the.element, 'left', end);
|
||||
} else {
|
||||
KTUtil.css(the.element, 'right', end);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
KTUtil.removeClass(the.element, the.options.baseClass);
|
||||
KTUtil.removeClass(the.element, the.options.baseClass + '-' + direction);
|
||||
|
||||
KTUtil.css(the.element, 'width', '');
|
||||
|
||||
if (top) {
|
||||
KTUtil.css(the.element, 'top', '');
|
||||
}
|
||||
|
||||
if (bottom) {
|
||||
KTUtil.css(the.element, 'bottom', '');
|
||||
}
|
||||
|
||||
if (start) {
|
||||
if (KTUtil.isRTL()) {
|
||||
KTUtil.css(the.element, 'right', '');
|
||||
} else {
|
||||
KTUtil.css(the.element, 'left', '');
|
||||
}
|
||||
}
|
||||
|
||||
if (end) {
|
||||
if (KTUtil.isRTL()) {
|
||||
KTUtil.css(the.element, 'left', '');
|
||||
} else {
|
||||
KTUtil.css(the.element, 'right', '');
|
||||
}
|
||||
}
|
||||
|
||||
_hide();
|
||||
}
|
||||
}
|
||||
|
||||
var _createOverlay = function() {
|
||||
if ( _getOption('overlay') === true ) {
|
||||
the.overlayElement = document.createElement('DIV');
|
||||
|
||||
KTUtil.css(the.overlayElement, 'z-index', KTUtil.css(the.element, 'z-index') - 1); // update
|
||||
|
||||
document.body.append(the.overlayElement);
|
||||
|
||||
KTUtil.addClass(the.overlayElement, _getOption('overlay-class'));
|
||||
|
||||
KTUtil.addEvent(the.overlayElement, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( _getOption('permanent') !== true ) {
|
||||
_hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var _deleteOverlay = function() {
|
||||
if ( the.overlayElement !== null ) {
|
||||
KTUtil.remove(the.overlayElement);
|
||||
}
|
||||
}
|
||||
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-drawer-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-drawer-' + name);
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _getWidth = function() {
|
||||
var width = _getOption('width');
|
||||
|
||||
if ( width === 'auto') {
|
||||
width = KTUtil.css(the.element, 'width');
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('drawer');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.toggle = function() {
|
||||
return _toggle();
|
||||
}
|
||||
|
||||
the.show = function() {
|
||||
return _show();
|
||||
}
|
||||
|
||||
the.hide = function() {
|
||||
return _hide();
|
||||
}
|
||||
|
||||
the.isShown = function() {
|
||||
return the.shown;
|
||||
}
|
||||
|
||||
the.update = function() {
|
||||
_update();
|
||||
}
|
||||
|
||||
the.goElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTDrawer.getInstance = function(element) {
|
||||
if (element !== null && KTUtil.data(element).has('drawer')) {
|
||||
return KTUtil.data(element).get('drawer');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide all drawers and skip one if provided
|
||||
KTDrawer.hideAll = function(skip = null, selector = '[data-kt-drawer="true"]') {
|
||||
var items = document.querySelectorAll(selector);
|
||||
|
||||
if (items && items.length > 0) {
|
||||
for (var i = 0, len = items.length; i < len; i++) {
|
||||
var item = items[i];
|
||||
var drawer = KTDrawer.getInstance(item);
|
||||
|
||||
if (!drawer) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( skip ) {
|
||||
if ( item !== skip ) {
|
||||
drawer.hide();
|
||||
}
|
||||
} else {
|
||||
drawer.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update all drawers
|
||||
KTDrawer.updateAll = function(selector = '[data-kt-drawer="true"]') {
|
||||
var items = document.querySelectorAll(selector);
|
||||
|
||||
if (items && items.length > 0) {
|
||||
for (var i = 0, len = items.length; i < len; i++) {
|
||||
var drawer = KTDrawer.getInstance(items[i]);
|
||||
|
||||
if (drawer) {
|
||||
drawer.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTDrawer.createInstances = function(selector = '[data-kt-drawer="true"]') {
|
||||
// Initialize Menus
|
||||
var elements = document.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
new KTDrawer(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Toggle instances
|
||||
KTDrawer.handleShow = function() {
|
||||
// External drawer toggle handler
|
||||
KTUtil.on(document.body, '[data-kt-drawer-show="true"][data-kt-drawer-target]', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var element = document.querySelector(this.getAttribute('data-kt-drawer-target'));
|
||||
|
||||
if (element) {
|
||||
KTDrawer.getInstance(element).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Dismiss instances
|
||||
KTDrawer.handleDismiss = function() {
|
||||
// External drawer toggle handler
|
||||
KTUtil.on(document.body, '[data-kt-drawer-dismiss="true"]', 'click', function(e) {
|
||||
var element = this.closest('[data-kt-drawer="true"]');
|
||||
|
||||
if (element) {
|
||||
var drawer = KTDrawer.getInstance(element);
|
||||
if (drawer.isShown()) {
|
||||
drawer.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Handle resize
|
||||
KTDrawer.handleResize = function() {
|
||||
// Window resize Handling
|
||||
window.addEventListener('resize', function() {
|
||||
var timer;
|
||||
|
||||
KTUtil.throttle(timer, function() {
|
||||
// Locate and update drawer instances on window resize
|
||||
var elements = document.querySelectorAll('[data-kt-drawer="true"]');
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
var drawer = KTDrawer.getInstance(elements[i]);
|
||||
if (drawer) {
|
||||
drawer.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTDrawer.init = function() {
|
||||
KTDrawer.createInstances();
|
||||
|
||||
if (KTDrawerHandlersInitialized === false) {
|
||||
KTDrawer.handleResize();
|
||||
KTDrawer.handleShow();
|
||||
KTDrawer.handleDismiss();
|
||||
|
||||
KTDrawerHandlersInitialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTDrawer;
|
||||
}
|
121
resources/_keenthemes/src/js/components/event-handler.js
Normal file
121
resources/_keenthemes/src/js/components/event-handler.js
Normal file
@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTEventHandler = function() {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var _handlers = {};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private Methods ** //
|
||||
////////////////////////////
|
||||
var _triggerEvent = function(element, name, target) {
|
||||
var returnValue = true;
|
||||
var eventValue;
|
||||
|
||||
if ( KTUtil.data(element).has(name) === true ) {
|
||||
var handlerIds = KTUtil.data(element).get(name);
|
||||
var handlerId;
|
||||
|
||||
for (var i = 0; i < handlerIds.length; i++) {
|
||||
handlerId = handlerIds[i];
|
||||
|
||||
if ( _handlers[name] && _handlers[name][handlerId] ) {
|
||||
var handler = _handlers[name][handlerId];
|
||||
var value;
|
||||
|
||||
if ( handler.name === name ) {
|
||||
if ( handler.one == true ) {
|
||||
if ( handler.fired == false ) {
|
||||
_handlers[name][handlerId].fired = true;
|
||||
|
||||
eventValue = handler.callback.call(this, target);
|
||||
}
|
||||
} else {
|
||||
eventValue = handler.callback.call(this, target);
|
||||
}
|
||||
|
||||
if ( eventValue === false ) {
|
||||
returnValue = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
var _addEvent = function(element, name, callback, one) {
|
||||
var handlerId = KTUtil.getUniqueId('event');
|
||||
var handlerIds = KTUtil.data(element).get(name);
|
||||
|
||||
if ( !handlerIds ) {
|
||||
handlerIds = [];
|
||||
}
|
||||
|
||||
handlerIds.push(handlerId);
|
||||
|
||||
KTUtil.data(element).set(name, handlerIds);
|
||||
|
||||
if ( !_handlers[name] ) {
|
||||
_handlers[name] = {};
|
||||
}
|
||||
|
||||
_handlers[name][handlerId] = {
|
||||
name: name,
|
||||
callback: callback,
|
||||
one: one,
|
||||
fired: false
|
||||
};
|
||||
|
||||
return handlerId;
|
||||
}
|
||||
|
||||
var _removeEvent = function(element, name, handlerId) {
|
||||
var handlerIds = KTUtil.data(element).get(name);
|
||||
var index = handlerIds && handlerIds.indexOf(handlerId);
|
||||
|
||||
if (index !== -1) {
|
||||
handlerIds.splice(index, 1);
|
||||
KTUtil.data(element).set(name, handlerIds);
|
||||
}
|
||||
|
||||
if (_handlers[name] && _handlers[name][handlerId]) {
|
||||
delete _handlers[name][handlerId];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
// ** Public Methods ** //
|
||||
////////////////////////////
|
||||
return {
|
||||
trigger: function(element, name, target) {
|
||||
return _triggerEvent(element, name, target);
|
||||
},
|
||||
|
||||
on: function(element, name, handler) {
|
||||
return _addEvent(element, name, handler);
|
||||
},
|
||||
|
||||
one: function(element, name, handler) {
|
||||
return _addEvent(element, name, handler, true);
|
||||
},
|
||||
|
||||
off: function(element, name, handlerId) {
|
||||
return _removeEvent(element, name, handlerId);
|
||||
},
|
||||
|
||||
debug: function() {
|
||||
for (var b in _handlers) {
|
||||
if ( _handlers.hasOwnProperty(b) ) console.log(b);
|
||||
}
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTEventHandler;
|
||||
}
|
163
resources/_keenthemes/src/js/components/feedback.js
Normal file
163
resources/_keenthemes/src/js/components/feedback.js
Normal file
@ -0,0 +1,163 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTFeedback = function(options) {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
'width' : 100,
|
||||
'placement' : 'top-center',
|
||||
'content' : '',
|
||||
'type': 'popup'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
_init();
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('feedback');
|
||||
the.element;
|
||||
the.shown = false;
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('feedback', the);
|
||||
}
|
||||
|
||||
var _handlers = function() {
|
||||
KTUtil.addEvent(the.element, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_go();
|
||||
});
|
||||
}
|
||||
|
||||
var _show = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.feedback.show', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( the.options.type === 'popup') {
|
||||
_showPopup();
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.feedback.shown', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _hide = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.feedback.hide', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( the.options.type === 'popup') {
|
||||
_hidePopup();
|
||||
}
|
||||
|
||||
the.shown = false;
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.feedback.hidden', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _showPopup = function() {
|
||||
the.element = document.createElement("DIV");
|
||||
|
||||
KTUtil.addClass(the.element, 'feedback feedback-popup');
|
||||
KTUtil.setHTML(the.element, the.options.content);
|
||||
|
||||
if (the.options.placement == 'top-center') {
|
||||
_setPopupTopCenterPosition();
|
||||
}
|
||||
|
||||
document.body.appendChild(the.element);
|
||||
|
||||
KTUtil.addClass(the.element, 'feedback-shown');
|
||||
|
||||
the.shown = true;
|
||||
}
|
||||
|
||||
var _setPopupTopCenterPosition = function() {
|
||||
var width = KTUtil.getResponsiveValue(the.options.width);
|
||||
var height = KTUtil.css(the.element, 'height');
|
||||
|
||||
KTUtil.addClass(the.element, 'feedback-top-center');
|
||||
|
||||
KTUtil.css(the.element, 'width', width);
|
||||
KTUtil.css(the.element, 'left', '50%');
|
||||
KTUtil.css(the.element, 'top', '-' + height);
|
||||
}
|
||||
|
||||
var _hidePopup = function() {
|
||||
the.element.remove();
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('feedback');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.show = function() {
|
||||
return _show();
|
||||
}
|
||||
|
||||
the.hide = function() {
|
||||
return _hide();
|
||||
}
|
||||
|
||||
the.isShown = function() {
|
||||
return the.shown;
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTFeedback;
|
||||
}
|
209
resources/_keenthemes/src/js/components/image-input.js
Normal file
209
resources/_keenthemes/src/js/components/image-input.js
Normal file
@ -0,0 +1,209 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTImageInput = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private Methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('image-input') === true ) {
|
||||
the = KTUtil.data(element).get('image-input');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('image-input');
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
the.inputElement = KTUtil.find(element, 'input[type="file"]');
|
||||
the.wrapperElement = KTUtil.find(element, '.image-input-wrapper');
|
||||
the.cancelElement = KTUtil.find(element, '[data-kt-image-input-action="cancel"]');
|
||||
the.removeElement = KTUtil.find(element, '[data-kt-image-input-action="remove"]');
|
||||
the.hiddenElement = KTUtil.find(element, 'input[type="hidden"]');
|
||||
the.src = KTUtil.css(the.wrapperElement, 'backgroundImage');
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-image-input', 'true');
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('image-input', the);
|
||||
}
|
||||
|
||||
// Init Event Handlers
|
||||
var _handlers = function() {
|
||||
KTUtil.addEvent(the.inputElement, 'change', _change);
|
||||
KTUtil.addEvent(the.cancelElement, 'click', _cancel);
|
||||
KTUtil.addEvent(the.removeElement, 'click', _remove);
|
||||
}
|
||||
|
||||
// Event Handlers
|
||||
var _change = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( the.inputElement !== null && the.inputElement.files && the.inputElement.files[0] ) {
|
||||
// Fire change event
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.imageinput.change', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function(e) {
|
||||
KTUtil.css(the.wrapperElement, 'background-image', 'url('+ e.target.result +')');
|
||||
}
|
||||
|
||||
reader.readAsDataURL(the.inputElement.files[0]);
|
||||
|
||||
the.element.classList.add('image-input-changed');
|
||||
the.element.classList.remove('image-input-empty');
|
||||
|
||||
// Fire removed event
|
||||
KTEventHandler.trigger(the.element, 'kt.imageinput.changed', the);
|
||||
}
|
||||
}
|
||||
|
||||
var _cancel = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Fire cancel event
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.imageinput.cancel', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the.element.classList.remove('image-input-changed');
|
||||
the.element.classList.remove('image-input-empty');
|
||||
|
||||
if (the.src === 'none') {
|
||||
KTUtil.css(the.wrapperElement, 'background-image', '');
|
||||
the.element.classList.add('image-input-empty');
|
||||
} else {
|
||||
KTUtil.css(the.wrapperElement, 'background-image', the.src);
|
||||
}
|
||||
|
||||
the.inputElement.value = "";
|
||||
|
||||
if ( the.hiddenElement !== null ) {
|
||||
the.hiddenElement.value = "0";
|
||||
}
|
||||
|
||||
// Fire canceled event
|
||||
KTEventHandler.trigger(the.element, 'kt.imageinput.canceled', the);
|
||||
}
|
||||
|
||||
var _remove = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Fire remove event
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.imageinput.remove', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
the.element.classList.remove('image-input-changed');
|
||||
the.element.classList.add('image-input-empty');
|
||||
|
||||
KTUtil.css(the.wrapperElement, 'background-image', "none");
|
||||
the.inputElement.value = "";
|
||||
|
||||
if ( the.hiddenElement !== null ) {
|
||||
the.hiddenElement.value = "1";
|
||||
}
|
||||
|
||||
// Fire removed event
|
||||
KTEventHandler.trigger(the.element, 'kt.imageinput.removed', the);
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('image-input');
|
||||
}
|
||||
|
||||
// Construct Class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.getInputElement = function() {
|
||||
return the.inputElement;
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTImageInput.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('image-input') ) {
|
||||
return KTUtil.data(element).get('image-input');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTImageInput.createInstances = function(selector = '[data-kt-image-input]') {
|
||||
// Initialize Menus
|
||||
var elements = document.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
new KTImageInput(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTImageInput.init = function() {
|
||||
KTImageInput.createInstances();
|
||||
};
|
||||
|
||||
// Webpack Support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTImageInput;
|
||||
}
|
1134
resources/_keenthemes/src/js/components/menu.js
Normal file
1134
resources/_keenthemes/src/js/components/menu.js
Normal file
File diff suppressed because it is too large
Load Diff
253
resources/_keenthemes/src/js/components/password-meter.js
Normal file
253
resources/_keenthemes/src/js/components/password-meter.js
Normal file
@ -0,0 +1,253 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTPasswordMeter = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
minLength: 8,
|
||||
checkUppercase: true,
|
||||
checkLowercase: true,
|
||||
checkDigit: true,
|
||||
checkChar: true,
|
||||
scoreHighlightClass: 'active'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
// Constructor
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('password-meter') === true ) {
|
||||
the = KTUtil.data(element).get('password-meter');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.score = 0;
|
||||
the.checkSteps = 5;
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
the.inputElement = the.element.querySelector('input[type]');
|
||||
the.visibilityElement = the.element.querySelector('[data-kt-password-meter-control="visibility"]');
|
||||
the.highlightElement = the.element.querySelector('[data-kt-password-meter-control="highlight"]');
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-password-meter', 'true');
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('password-meter', the);
|
||||
}
|
||||
|
||||
// Handlers
|
||||
var _handlers = function() {
|
||||
if (the.highlightElement) {
|
||||
the.inputElement.addEventListener('input', function() {
|
||||
_check();
|
||||
});
|
||||
}
|
||||
|
||||
if (the.visibilityElement) {
|
||||
the.visibilityElement.addEventListener('click', function() {
|
||||
_visibility();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
var _check = function() {
|
||||
var score = 0;
|
||||
var checkScore = _getCheckScore();
|
||||
|
||||
if (_checkLength() === true) {
|
||||
score = score + checkScore;
|
||||
}
|
||||
|
||||
if (the.options.checkUppercase === true && _checkLowercase() === true) {
|
||||
score = score + checkScore;
|
||||
}
|
||||
|
||||
if (the.options.checkLowercase === true && _checkUppercase() === true ) {
|
||||
score = score + checkScore;
|
||||
}
|
||||
|
||||
if (the.options.checkDigit === true && _checkDigit() === true ) {
|
||||
score = score + checkScore;
|
||||
}
|
||||
|
||||
if (the.options.checkChar === true && _checkChar() === true ) {
|
||||
score = score + checkScore;
|
||||
}
|
||||
|
||||
the.score = score;
|
||||
|
||||
_highlight();
|
||||
}
|
||||
|
||||
var _checkLength = function() {
|
||||
return the.inputElement.value.length >= the.options.minLength; // 20 score
|
||||
}
|
||||
|
||||
var _checkLowercase = function() {
|
||||
return /[a-z]/.test(the.inputElement.value); // 20 score
|
||||
}
|
||||
|
||||
var _checkUppercase = function() {
|
||||
return /[A-Z]/.test(the.inputElement.value); // 20 score
|
||||
}
|
||||
|
||||
var _checkDigit = function() {
|
||||
return /[0-9]/.test(the.inputElement.value); // 20 score
|
||||
}
|
||||
|
||||
var _checkChar = function() {
|
||||
return /[~`!#@$%\^&*+=\-\[\]\\';,/{}|\\":<>\?]/g.test(the.inputElement.value); // 20 score
|
||||
}
|
||||
|
||||
var _getCheckScore = function() {
|
||||
var count = 1;
|
||||
|
||||
if (the.options.checkUppercase === true) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (the.options.checkLowercase === true) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (the.options.checkDigit === true) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (the.options.checkChar === true) {
|
||||
count++;
|
||||
}
|
||||
|
||||
the.checkSteps = count;
|
||||
|
||||
return 100 / the.checkSteps;
|
||||
}
|
||||
|
||||
var _highlight = function() {
|
||||
var items = [].slice.call(the.highlightElement.querySelectorAll('div'));
|
||||
var total = items.length;
|
||||
var index = 0;
|
||||
var checkScore = _getCheckScore();
|
||||
var score = _getScore();
|
||||
|
||||
items.map(function (item) {
|
||||
index++;
|
||||
|
||||
if ( (checkScore * index * (the.checkSteps / total)) <= score ) {
|
||||
item.classList.add('active');
|
||||
} else {
|
||||
item.classList.remove('active');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var _visibility = function() {
|
||||
var visibleIcon = the.visibilityElement.querySelector(':scope > i:not(.d-none)');
|
||||
var hiddenIcon = the.visibilityElement.querySelector(':scope > i.d-none');
|
||||
|
||||
if (the.inputElement.getAttribute('type').toLowerCase() === 'password' ) {
|
||||
the.inputElement.setAttribute('type', 'text');
|
||||
} else {
|
||||
the.inputElement.setAttribute('type', 'password');
|
||||
}
|
||||
|
||||
visibleIcon.classList.add('d-none');
|
||||
hiddenIcon.classList.remove('d-none');
|
||||
|
||||
the.inputElement.focus();
|
||||
}
|
||||
|
||||
var _reset = function() {
|
||||
the.score = 0;
|
||||
|
||||
_highlight();
|
||||
}
|
||||
|
||||
// Gets current password score
|
||||
var _getScore = function() {
|
||||
return the.score;
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('password-meter');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.check = function() {
|
||||
return _check();
|
||||
}
|
||||
|
||||
the.getScore = function() {
|
||||
return _getScore();
|
||||
}
|
||||
|
||||
the.reset = function() {
|
||||
return _reset();
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTPasswordMeter.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('password-meter') ) {
|
||||
return KTUtil.data(element).get('password-meter');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTPasswordMeter.createInstances = function(selector = '[data-kt-password-meter]') {
|
||||
// Get instances
|
||||
var elements = document.body.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
// Initialize instances
|
||||
new KTPasswordMeter(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTPasswordMeter.init = function() {
|
||||
KTPasswordMeter.createInstances();
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTPasswordMeter;
|
||||
}
|
358
resources/_keenthemes/src/js/components/scroll.js
Normal file
358
resources/_keenthemes/src/js/components/scroll.js
Normal file
@ -0,0 +1,358 @@
|
||||
"use strict";
|
||||
|
||||
var KTScrollHandlersInitialized = false;
|
||||
|
||||
// Class definition
|
||||
var KTScroll = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
saveState: true
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private Methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('scroll') ) {
|
||||
the = KTUtil.data(element).get('scroll');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
the.id = the.element.getAttribute('id');
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-scroll', 'true');
|
||||
|
||||
// Update
|
||||
_update();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('scroll', the);
|
||||
}
|
||||
|
||||
var _setupHeight = function() {
|
||||
var heightType = _getHeightType();
|
||||
var height = _getHeight();
|
||||
|
||||
// Set height
|
||||
if ( height !== null && height.length > 0 ) {
|
||||
KTUtil.css(the.element, heightType, height);
|
||||
} else {
|
||||
KTUtil.css(the.element, heightType, '');
|
||||
}
|
||||
}
|
||||
|
||||
var _setupState = function () {
|
||||
var namespace = _getStorageNamespace();
|
||||
|
||||
if ( _getOption('save-state') === true && the.id ) {
|
||||
if ( localStorage.getItem(namespace + the.id + 'st') ) {
|
||||
var pos = parseInt(localStorage.getItem(namespace + the.id + 'st'));
|
||||
|
||||
if ( pos > 0 ) {
|
||||
the.element.scroll({
|
||||
top: pos,
|
||||
behavior: 'instant'
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _getStorageNamespace = function(postfix) {
|
||||
return document.body.hasAttribute("data-kt-name") ? document.body.getAttribute("data-kt-name") + "_" : "";
|
||||
}
|
||||
|
||||
var _setupScrollHandler = function() {
|
||||
if ( _getOption('save-state') === true && the.id ) {
|
||||
the.element.addEventListener('scroll', _scrollHandler);
|
||||
} else {
|
||||
the.element.removeEventListener('scroll', _scrollHandler);
|
||||
}
|
||||
}
|
||||
|
||||
var _destroyScrollHandler = function() {
|
||||
the.element.removeEventListener('scroll', _scrollHandler);
|
||||
}
|
||||
|
||||
var _resetHeight = function() {
|
||||
KTUtil.css(the.element, _getHeightType(), '');
|
||||
}
|
||||
|
||||
var _scrollHandler = function () {
|
||||
var namespace = _getStorageNamespace();
|
||||
localStorage.setItem(namespace + the.id + 'st', the.element.scrollTop);
|
||||
}
|
||||
|
||||
var _update = function() {
|
||||
// Activate/deactivate
|
||||
if ( _getOption('activate') === true || the.element.hasAttribute('data-kt-scroll-activate') === false ) {
|
||||
_setupHeight();
|
||||
_setupStretchHeight();
|
||||
_setupScrollHandler();
|
||||
_setupState();
|
||||
} else {
|
||||
_resetHeight()
|
||||
_destroyScrollHandler();
|
||||
}
|
||||
}
|
||||
|
||||
var _setupStretchHeight = function() {
|
||||
var stretch = _getOption('stretch');
|
||||
|
||||
// Stretch
|
||||
if ( stretch !== null ) {
|
||||
var elements = document.querySelectorAll(stretch);
|
||||
|
||||
if ( elements && elements.length == 2 ) {
|
||||
var element1 = elements[0];
|
||||
var element2 = elements[1];
|
||||
var diff = _getElementHeight(element2) - _getElementHeight(element1);
|
||||
|
||||
if (diff > 0) {
|
||||
var height = parseInt(KTUtil.css(the.element, _getHeightType())) + diff;
|
||||
|
||||
KTUtil.css(the.element, _getHeightType(), String(height) + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _getHeight = function() {
|
||||
var height = _getOption(_getHeightType());
|
||||
|
||||
if ( height instanceof Function ) {
|
||||
return height.call();
|
||||
} else if ( height !== null && typeof height === 'string' && height.toLowerCase() === 'auto' ) {
|
||||
return _getAutoHeight();
|
||||
} else {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
||||
var _getAutoHeight = function() {
|
||||
var height = KTUtil.getViewPort().height;
|
||||
var dependencies = _getOption('dependencies');
|
||||
var wrappers = _getOption('wrappers');
|
||||
var offset = _getOption('offset');
|
||||
|
||||
// Spacings
|
||||
height = height - _getElementSpacing(the.element);
|
||||
|
||||
// Height dependencies
|
||||
//console.log('Q:' + JSON.stringify(dependencies));
|
||||
|
||||
if ( dependencies !== null ) {
|
||||
var elements = document.querySelectorAll(dependencies);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for ( var i = 0, len = elements.length; i < len; i++ ) {
|
||||
if ( KTUtil.visible(elements[i]) === false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
height = height - _getElementHeight(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wrappers
|
||||
if ( wrappers !== null ) {
|
||||
var elements = document.querySelectorAll(wrappers);
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for ( var i = 0, len = elements.length; i < len; i++ ) {
|
||||
if ( KTUtil.visible(elements[i]) === false ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
height = height - _getElementSpacing(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Custom offset
|
||||
if ( offset !== null && typeof offset !== 'object') {
|
||||
height = height - parseInt(offset);
|
||||
}
|
||||
|
||||
return String(height) + 'px';
|
||||
}
|
||||
|
||||
var _getElementHeight = function(element) {
|
||||
var height = 0;
|
||||
|
||||
if (element !== null) {
|
||||
height = height + parseInt(KTUtil.css(element, 'height'));
|
||||
height = height + parseInt(KTUtil.css(element, 'margin-top'));
|
||||
height = height + parseInt(KTUtil.css(element, 'margin-bottom'));
|
||||
|
||||
if (KTUtil.css(element, 'border-top')) {
|
||||
height = height + parseInt(KTUtil.css(element, 'border-top'));
|
||||
}
|
||||
|
||||
if (KTUtil.css(element, 'border-bottom')) {
|
||||
height = height + parseInt(KTUtil.css(element, 'border-bottom'));
|
||||
}
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
var _getElementSpacing = function(element) {
|
||||
var spacing = 0;
|
||||
|
||||
if (element !== null) {
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'margin-top'));
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'margin-bottom'));
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'padding-top'));
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'padding-bottom'));
|
||||
|
||||
if (KTUtil.css(element, 'border-top')) {
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'border-top'));
|
||||
}
|
||||
|
||||
if (KTUtil.css(element, 'border-bottom')) {
|
||||
spacing = spacing + parseInt(KTUtil.css(element, 'border-bottom'));
|
||||
}
|
||||
}
|
||||
|
||||
return spacing;
|
||||
}
|
||||
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-scroll-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-scroll-' + name);
|
||||
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _getHeightType = function() {
|
||||
if (_getOption('height')) {
|
||||
return 'height';
|
||||
} if (_getOption('min-height')) {
|
||||
return 'min-height';
|
||||
} if (_getOption('max-height')) {
|
||||
return 'max-height';
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('scroll');
|
||||
}
|
||||
|
||||
// Construct Class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
the.update = function() {
|
||||
return _update();
|
||||
}
|
||||
|
||||
the.getHeight = function() {
|
||||
return _getHeight();
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTScroll.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('scroll') ) {
|
||||
return KTUtil.data(element).get('scroll');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTScroll.createInstances = function(selector = '[data-kt-scroll="true"]') {
|
||||
// Initialize Menus
|
||||
var elements = document.body.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
new KTScroll(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window resize handling
|
||||
KTScroll.handleResize = function() {
|
||||
window.addEventListener('resize', function() {
|
||||
var timer;
|
||||
|
||||
KTUtil.throttle(timer, function() {
|
||||
// Locate and update Offcanvas instances on window resize
|
||||
var elements = document.body.querySelectorAll('[data-kt-scroll="true"]');
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
var scroll = KTScroll.getInstance(elements[i]);
|
||||
if (scroll) {
|
||||
scroll.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTScroll.init = function() {
|
||||
KTScroll.createInstances();
|
||||
|
||||
if (KTScrollHandlersInitialized === false) {
|
||||
KTScroll.handleResize();
|
||||
|
||||
KTScrollHandlersInitialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Webpack Support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTScroll;
|
||||
}
|
164
resources/_keenthemes/src/js/components/scrolltop.js
Normal file
164
resources/_keenthemes/src/js/components/scrolltop.js
Normal file
@ -0,0 +1,164 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTScrolltop = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default options
|
||||
var defaultOptions = {
|
||||
offset: 300,
|
||||
speed: 600
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if (KTUtil.data(element).has('scrolltop')) {
|
||||
the = KTUtil.data(element).get('scrolltop');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('scrolltop');
|
||||
the.element = element;
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-scrolltop', 'true');
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('scrolltop', the);
|
||||
}
|
||||
|
||||
var _handlers = function() {
|
||||
var timer;
|
||||
|
||||
window.addEventListener('scroll', function() {
|
||||
KTUtil.throttle(timer, function() {
|
||||
_scroll();
|
||||
}, 200);
|
||||
});
|
||||
|
||||
KTUtil.addEvent(the.element, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
_go();
|
||||
});
|
||||
}
|
||||
|
||||
var _scroll = function() {
|
||||
var offset = parseInt(_getOption('offset'));
|
||||
|
||||
var pos = KTUtil.getScrollTop(); // current vertical position
|
||||
|
||||
if ( pos > offset ) {
|
||||
if ( document.body.hasAttribute('data-kt-scrolltop') === false ) {
|
||||
document.body.setAttribute('data-kt-scrolltop', 'on');
|
||||
}
|
||||
} else {
|
||||
if ( document.body.hasAttribute('data-kt-scrolltop') === true ) {
|
||||
document.body.removeAttribute('data-kt-scrolltop');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _go = function() {
|
||||
var speed = parseInt(_getOption('speed'));
|
||||
|
||||
window.scrollTo({top: 0, behavior: 'smooth'});
|
||||
//KTUtil.scrollTop(0, speed);
|
||||
}
|
||||
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-scrolltop-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-scrolltop-' + name);
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('scrolltop');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.go = function() {
|
||||
return _go();
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTScrolltop.getInstance = function(element) {
|
||||
if (element && KTUtil.data(element).has('scrolltop')) {
|
||||
return KTUtil.data(element).get('scrolltop');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTScrolltop.createInstances = function(selector = '[data-kt-scrolltop="true"]') {
|
||||
// Initialize Menus
|
||||
var elements = document.body.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
new KTScrolltop(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTScrolltop.init = function() {
|
||||
KTScrolltop.createInstances();
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTScrolltop;
|
||||
}
|
439
resources/_keenthemes/src/js/components/search.js
Normal file
439
resources/_keenthemes/src/js/components/search.js
Normal file
@ -0,0 +1,439 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTSearch = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
minLength: 2, // Miniam text lenght to query search
|
||||
keypress: true, // Enable search on keypress
|
||||
enter: true, // Enable search on enter key press
|
||||
layout: 'menu', // Use 'menu' or 'inline' layout options to display search results
|
||||
responsive: null, // Pass integer value or bootstrap compatible breakpoint key(sm,md,lg,xl,xxl) to enable reponsive form mode for device width below the breakpoint value
|
||||
showOnFocus: true // Always show menu on input focus
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
// Construct
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('search') === true ) {
|
||||
the = KTUtil.data(element).get('search');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
// Init
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.processing = false;
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
the.contentElement = _getElement('content');
|
||||
the.formElement = _getElement('form');
|
||||
the.inputElement = _getElement('input');
|
||||
the.spinnerElement = _getElement('spinner');
|
||||
the.clearElement = _getElement('clear');
|
||||
the.toggleElement = _getElement('toggle');
|
||||
the.submitElement = _getElement('submit');
|
||||
the.toolbarElement = _getElement('toolbar');
|
||||
|
||||
the.resultsElement = _getElement('results');
|
||||
the.suggestionElement = _getElement('suggestion');
|
||||
the.emptyElement = _getElement('empty');
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-search', 'true');
|
||||
|
||||
// Layout
|
||||
the.layout = _getOption('layout');
|
||||
|
||||
// Menu
|
||||
if ( the.layout === 'menu' ) {
|
||||
the.menuObject = new KTMenu(the.contentElement);
|
||||
} else {
|
||||
the.menuObject = null;
|
||||
}
|
||||
|
||||
// Update
|
||||
_update();
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('search', the);
|
||||
}
|
||||
|
||||
// Handlera
|
||||
var _handlers = function() {
|
||||
// Focus
|
||||
the.inputElement.addEventListener('focus', _focus);
|
||||
|
||||
// Blur
|
||||
the.inputElement.addEventListener('blur', _blur);
|
||||
|
||||
// Keypress
|
||||
if ( _getOption('keypress') === true ) {
|
||||
the.inputElement.addEventListener('input', _input);
|
||||
}
|
||||
|
||||
// Submit
|
||||
if ( the.submitElement ) {
|
||||
the.submitElement.addEventListener('click', _search);
|
||||
}
|
||||
|
||||
// Enter
|
||||
if ( _getOption('enter') === true ) {
|
||||
the.inputElement.addEventListener('keypress', _enter);
|
||||
}
|
||||
|
||||
// Clear
|
||||
if ( the.clearElement ) {
|
||||
the.clearElement.addEventListener('click', _clear);
|
||||
}
|
||||
|
||||
// Menu
|
||||
if ( the.menuObject ) {
|
||||
// Toggle menu
|
||||
if ( the.toggleElement ) {
|
||||
the.toggleElement.addEventListener('click', _show);
|
||||
|
||||
the.menuObject.on('kt.menu.dropdown.show', function(item) {
|
||||
if (KTUtil.visible(the.toggleElement)) {
|
||||
the.toggleElement.classList.add('active');
|
||||
the.toggleElement.classList.add('show');
|
||||
}
|
||||
});
|
||||
|
||||
the.menuObject.on('kt.menu.dropdown.hide', function(item) {
|
||||
if (KTUtil.visible(the.toggleElement)) {
|
||||
the.toggleElement.classList.remove('active');
|
||||
the.toggleElement.classList.remove('show');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
the.menuObject.on('kt.menu.dropdown.shown', function() {
|
||||
the.inputElement.focus();
|
||||
});
|
||||
}
|
||||
|
||||
// Window resize handling
|
||||
window.addEventListener('resize', function() {
|
||||
var timer;
|
||||
|
||||
KTUtil.throttle(timer, function() {
|
||||
_update();
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
// Focus
|
||||
var _focus = function() {
|
||||
the.element.classList.add('focus');
|
||||
|
||||
if ( _getOption('show-on-focus') === true || the.inputElement.value.length >= minLength ) {
|
||||
_show();
|
||||
}
|
||||
}
|
||||
|
||||
// Blur
|
||||
var _blur = function() {
|
||||
the.element.classList.remove('focus');
|
||||
}
|
||||
|
||||
// Enter
|
||||
var _enter = function(e) {
|
||||
var key = e.charCode || e.keyCode || 0;
|
||||
|
||||
if (key == 13) {
|
||||
e.preventDefault();
|
||||
|
||||
_search();
|
||||
}
|
||||
}
|
||||
|
||||
// Input
|
||||
var _input = function() {
|
||||
if ( _getOption('min-length') ) {
|
||||
var minLength = parseInt(_getOption('min-length'));
|
||||
|
||||
if ( the.inputElement.value.length >= minLength ) {
|
||||
_search();
|
||||
} else if ( the.inputElement.value.length === 0 ) {
|
||||
_clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Search
|
||||
var _search = function() {
|
||||
if (the.processing === false) {
|
||||
// Show search spinner
|
||||
if (the.spinnerElement) {
|
||||
the.spinnerElement.classList.remove("d-none");
|
||||
}
|
||||
|
||||
// Hide search clear button
|
||||
if (the.clearElement) {
|
||||
the.clearElement.classList.add("d-none");
|
||||
}
|
||||
|
||||
// Hide search toolbar
|
||||
if (the.toolbarElement && the.formElement.contains(the.toolbarElement)) {
|
||||
the.toolbarElement.classList.add("d-none");
|
||||
}
|
||||
|
||||
// Focus input
|
||||
the.inputElement.focus();
|
||||
|
||||
the.processing = true;
|
||||
KTEventHandler.trigger(the.element, 'kt.search.process', the);
|
||||
}
|
||||
}
|
||||
|
||||
// Complete
|
||||
var _complete = function() {
|
||||
if (the.spinnerElement) {
|
||||
the.spinnerElement.classList.add("d-none");
|
||||
}
|
||||
|
||||
// Show search toolbar
|
||||
if (the.clearElement) {
|
||||
the.clearElement.classList.remove("d-none");
|
||||
}
|
||||
|
||||
if ( the.inputElement.value.length === 0 ) {
|
||||
_clear();
|
||||
}
|
||||
|
||||
// Focus input
|
||||
the.inputElement.focus();
|
||||
|
||||
_show();
|
||||
|
||||
the.processing = false;
|
||||
}
|
||||
|
||||
// Clear
|
||||
var _clear = function() {
|
||||
if ( KTEventHandler.trigger(the.element, 'kt.search.clear', the) === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear and focus input
|
||||
the.inputElement.value = "";
|
||||
the.inputElement.focus();
|
||||
|
||||
// Hide clear icon
|
||||
if (the.clearElement) {
|
||||
the.clearElement.classList.add("d-none");
|
||||
}
|
||||
|
||||
// Show search toolbar
|
||||
if (the.toolbarElement && the.formElement.contains(the.toolbarElement)) {
|
||||
the.toolbarElement.classList.remove("d-none");
|
||||
}
|
||||
|
||||
// Hide menu
|
||||
if ( _getOption('show-on-focus') === false ) {
|
||||
_hide();
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.search.cleared', the);
|
||||
}
|
||||
|
||||
// Update
|
||||
var _update = function() {
|
||||
// Handle responsive form
|
||||
if (the.layout === 'menu') {
|
||||
var responsiveFormMode = _getResponsiveFormMode();
|
||||
|
||||
if ( responsiveFormMode === 'on' && the.contentElement.contains(the.formElement) === false ) {
|
||||
the.contentElement.prepend(the.formElement);
|
||||
the.formElement.classList.remove('d-none');
|
||||
} else if ( responsiveFormMode === 'off' && the.contentElement.contains(the.formElement) === true ) {
|
||||
the.element.prepend(the.formElement);
|
||||
the.formElement.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Show menu
|
||||
var _show = function() {
|
||||
if ( the.menuObject ) {
|
||||
_update();
|
||||
|
||||
the.menuObject.show(the.element);
|
||||
}
|
||||
}
|
||||
|
||||
// Hide menu
|
||||
var _hide = function() {
|
||||
if ( the.menuObject ) {
|
||||
_update();
|
||||
|
||||
the.menuObject.hide(the.element);
|
||||
}
|
||||
}
|
||||
|
||||
// Get option
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-search-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-search-' + name);
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get element
|
||||
var _getElement = function(name) {
|
||||
return the.element.querySelector('[data-kt-search-element="' + name + '"]');
|
||||
}
|
||||
|
||||
// Check if responsive form mode is enabled
|
||||
var _getResponsiveFormMode = function() {
|
||||
var responsive = _getOption('responsive');
|
||||
var width = KTUtil.getViewPort().width;
|
||||
|
||||
if (!responsive) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var breakpoint = KTUtil.getBreakpoint(responsive);
|
||||
|
||||
if (!breakpoint ) {
|
||||
breakpoint = parseInt(responsive);
|
||||
}
|
||||
|
||||
if (width < breakpoint) {
|
||||
return "on";
|
||||
} else {
|
||||
return "off";
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('search');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.show = function() {
|
||||
return _show();
|
||||
}
|
||||
|
||||
the.hide = function() {
|
||||
return _hide();
|
||||
}
|
||||
|
||||
the.update = function() {
|
||||
return _update();
|
||||
}
|
||||
|
||||
the.search = function() {
|
||||
return _search();
|
||||
}
|
||||
|
||||
the.complete = function() {
|
||||
return _complete();
|
||||
}
|
||||
|
||||
the.clear = function() {
|
||||
return _clear();
|
||||
}
|
||||
|
||||
the.isProcessing = function() {
|
||||
return the.processing;
|
||||
}
|
||||
|
||||
the.getQuery = function() {
|
||||
return the.inputElement.value;
|
||||
}
|
||||
|
||||
the.getMenu = function() {
|
||||
return the.menuObject;
|
||||
}
|
||||
|
||||
the.getFormElement = function() {
|
||||
return the.formElement;
|
||||
}
|
||||
|
||||
the.getInputElement = function() {
|
||||
return the.inputElement;
|
||||
}
|
||||
|
||||
the.getContentElement = function() {
|
||||
return the.contentElement;
|
||||
}
|
||||
|
||||
the.getElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTSearch.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('search') ) {
|
||||
return KTUtil.data(element).get('search');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTSearch;
|
||||
}
|
347
resources/_keenthemes/src/js/components/stepper.js
Normal file
347
resources/_keenthemes/src/js/components/stepper.js
Normal file
@ -0,0 +1,347 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTStepper = function(element, options) {
|
||||
//////////////////////////////
|
||||
// ** Private variables ** //
|
||||
//////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
startIndex: 1,
|
||||
animation: false,
|
||||
animationSpeed: '0.3s',
|
||||
animationNextClass: 'animate__animated animate__slideInRight animate__fast',
|
||||
animationPreviousClass: 'animate__animated animate__slideInLeft animate__fast'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('stepper') === true ) {
|
||||
the = KTUtil.data(element).get('stepper');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('stepper');
|
||||
|
||||
the.element = element;
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-stepper', 'true');
|
||||
|
||||
// Elements
|
||||
the.steps = KTUtil.findAll(the.element, '[data-kt-stepper-element="nav"]');
|
||||
the.btnNext = KTUtil.find(the.element, '[data-kt-stepper-action="next"]');
|
||||
the.btnPrevious = KTUtil.find(the.element, '[data-kt-stepper-action="previous"]');
|
||||
the.btnSubmit = KTUtil.find(the.element, '[data-kt-stepper-action="submit"]');
|
||||
|
||||
// Variables
|
||||
the.totalStepsNumber = the.steps.length;
|
||||
the.passedStepIndex = 0;
|
||||
the.currentStepIndex = 1;
|
||||
the.clickedStepIndex = 0;
|
||||
|
||||
// Set Current Step
|
||||
if ( the.options.startIndex > 1 ) {
|
||||
_goTo(the.options.startIndex);
|
||||
}
|
||||
|
||||
// Event listeners
|
||||
the.nextListener = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.stepper.next', the);
|
||||
};
|
||||
|
||||
the.previousListener = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.stepper.previous', the);
|
||||
};
|
||||
|
||||
the.stepListener = function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( the.steps && the.steps.length > 0 ) {
|
||||
for (var i = 0, len = the.steps.length; i < len; i++) {
|
||||
if ( the.steps[i] === this ) {
|
||||
the.clickedStepIndex = i + 1;
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.stepper.click', the);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Event Handlers
|
||||
KTUtil.addEvent(the.btnNext, 'click', the.nextListener);
|
||||
|
||||
KTUtil.addEvent(the.btnPrevious, 'click', the.previousListener);
|
||||
|
||||
the.stepListenerId = KTUtil.on(the.element, '[data-kt-stepper-action="step"]', 'click', the.stepListener);
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('stepper', the);
|
||||
}
|
||||
|
||||
var _goTo = function(index) {
|
||||
// Trigger "change" event
|
||||
KTEventHandler.trigger(the.element, 'kt.stepper.change', the);
|
||||
|
||||
// Skip if this step is already shown
|
||||
if ( index === the.currentStepIndex || index > the.totalStepsNumber || index < 0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Validate step number
|
||||
index = parseInt(index);
|
||||
|
||||
// Set current step
|
||||
the.passedStepIndex = the.currentStepIndex;
|
||||
the.currentStepIndex = index;
|
||||
|
||||
// Refresh elements
|
||||
_refreshUI();
|
||||
|
||||
// Trigger "changed" event
|
||||
KTEventHandler.trigger(the.element, 'kt.stepper.changed', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _goNext = function() {
|
||||
return _goTo( _getNextStepIndex() );
|
||||
}
|
||||
|
||||
var _goPrevious = function() {
|
||||
return _goTo( _getPreviousStepIndex() );
|
||||
}
|
||||
|
||||
var _goLast = function() {
|
||||
return _goTo( _getLastStepIndex() );
|
||||
}
|
||||
|
||||
var _goFirst = function() {
|
||||
return _goTo( _getFirstStepIndex() );
|
||||
}
|
||||
|
||||
var _refreshUI = function() {
|
||||
var state = '';
|
||||
|
||||
if ( _isLastStep() ) {
|
||||
state = 'last';
|
||||
} else if ( _isFirstStep() ) {
|
||||
state = 'first';
|
||||
} else {
|
||||
state = 'between';
|
||||
}
|
||||
|
||||
// Set state class
|
||||
KTUtil.removeClass(the.element, 'last');
|
||||
KTUtil.removeClass(the.element, 'first');
|
||||
KTUtil.removeClass(the.element, 'between');
|
||||
|
||||
KTUtil.addClass(the.element, state);
|
||||
|
||||
// Step Items
|
||||
var elements = KTUtil.findAll(the.element, '[data-kt-stepper-element="nav"], [data-kt-stepper-element="content"], [data-kt-stepper-element="info"]');
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
var element = elements[i];
|
||||
var index = KTUtil.index(element) + 1;
|
||||
|
||||
KTUtil.removeClass(element, 'current');
|
||||
KTUtil.removeClass(element, 'completed');
|
||||
KTUtil.removeClass(element, 'pending');
|
||||
|
||||
if ( index == the.currentStepIndex ) {
|
||||
KTUtil.addClass(element, 'current');
|
||||
|
||||
if ( the.options.animation !== false && element.getAttribute('data-kt-stepper-element') == 'content' ) {
|
||||
KTUtil.css(element, 'animationDuration', the.options.animationSpeed);
|
||||
|
||||
var animation = _getStepDirection(the.passedStepIndex) === 'previous' ? the.options.animationPreviousClass : the.options.animationNextClass;
|
||||
KTUtil.animateClass(element, animation);
|
||||
}
|
||||
} else {
|
||||
if ( index < the.currentStepIndex ) {
|
||||
KTUtil.addClass(element, 'completed');
|
||||
} else {
|
||||
KTUtil.addClass(element, 'pending');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _isLastStep = function() {
|
||||
return the.currentStepIndex === the.totalStepsNumber;
|
||||
}
|
||||
|
||||
var _isFirstStep = function() {
|
||||
return the.currentStepIndex === 1;
|
||||
}
|
||||
|
||||
var _isBetweenStep = function() {
|
||||
return _isLastStep() === false && _isFirstStep() === false;
|
||||
}
|
||||
|
||||
var _getNextStepIndex = function() {
|
||||
if ( the.totalStepsNumber >= ( the.currentStepIndex + 1 ) ) {
|
||||
return the.currentStepIndex + 1;
|
||||
} else {
|
||||
return the.totalStepsNumber;
|
||||
}
|
||||
}
|
||||
|
||||
var _getPreviousStepIndex = function() {
|
||||
if ( ( the.currentStepIndex - 1 ) > 1 ) {
|
||||
return the.currentStepIndex - 1;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
var _getFirstStepIndex = function(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
var _getLastStepIndex = function() {
|
||||
return the.totalStepsNumber;
|
||||
}
|
||||
|
||||
var _getTotalStepsNumber = function() {
|
||||
return the.totalStepsNumber;
|
||||
}
|
||||
|
||||
var _getStepDirection = function(index) {
|
||||
if ( index > the.currentStepIndex ) {
|
||||
return 'next';
|
||||
} else {
|
||||
return 'previous';
|
||||
}
|
||||
}
|
||||
|
||||
var _getStepContent = function(index) {
|
||||
var content = KTUtil.findAll(the.element, '[data-kt-stepper-element="content"]');
|
||||
|
||||
if ( content[index-1] ) {
|
||||
return content[index-1];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
// Event Handlers
|
||||
KTUtil.removeEvent(the.btnNext, 'click', the.nextListener);
|
||||
|
||||
KTUtil.removeEvent(the.btnPrevious, 'click', the.previousListener);
|
||||
|
||||
KTUtil.off(the.element, 'click', the.stepListenerId);
|
||||
|
||||
KTUtil.data(the.element).remove('stepper');
|
||||
}
|
||||
|
||||
// Construct Class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.getElement = function(index) {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.goTo = function(index) {
|
||||
return _goTo(index);
|
||||
}
|
||||
|
||||
the.goPrevious = function() {
|
||||
return _goPrevious();
|
||||
}
|
||||
|
||||
the.goNext = function() {
|
||||
return _goNext();
|
||||
}
|
||||
|
||||
the.goFirst = function() {
|
||||
return _goFirst();
|
||||
}
|
||||
|
||||
the.goLast = function() {
|
||||
return _goLast();
|
||||
}
|
||||
|
||||
the.getCurrentStepIndex = function() {
|
||||
return the.currentStepIndex;
|
||||
}
|
||||
|
||||
the.getNextStepIndex = function() {
|
||||
return _getNextStepIndex();
|
||||
}
|
||||
|
||||
the.getPassedStepIndex = function() {
|
||||
return the.passedStepIndex;
|
||||
}
|
||||
|
||||
the.getClickedStepIndex = function() {
|
||||
return the.clickedStepIndex;
|
||||
}
|
||||
|
||||
the.getPreviousStepIndex = function() {
|
||||
return _getPreviousStepIndex();
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTStepper.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('stepper') ) {
|
||||
return KTUtil.data(element).get('stepper');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTStepper;
|
||||
}
|
409
resources/_keenthemes/src/js/components/sticky.js
Normal file
409
resources/_keenthemes/src/js/components/sticky.js
Normal file
@ -0,0 +1,409 @@
|
||||
"use strict";
|
||||
|
||||
var KTStickyHandlersInitialized = false;
|
||||
|
||||
// Class definition
|
||||
var KTSticky = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
offset: 200,
|
||||
reverse: false,
|
||||
release: null,
|
||||
animation: true,
|
||||
animationSpeed: '0.3s',
|
||||
animationClass: 'animation-slide-in-down'
|
||||
};
|
||||
////////////////////////////
|
||||
// ** Private Methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('sticky') === true ) {
|
||||
the = KTUtil.data(element).get('sticky');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
the.element = element;
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('sticky');
|
||||
the.name = the.element.getAttribute('data-kt-sticky-name');
|
||||
the.attributeName = 'data-kt-sticky-' + the.name;
|
||||
the.attributeName2 = 'data-kt-' + the.name;
|
||||
the.eventTriggerState = true;
|
||||
the.lastScrollTop = 0;
|
||||
the.scrollHandler;
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-sticky', 'true');
|
||||
|
||||
// Event Handlers
|
||||
window.addEventListener('scroll', _scroll);
|
||||
|
||||
// Initial Launch
|
||||
_scroll();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('sticky', the);
|
||||
}
|
||||
|
||||
var _scroll = function(e) {
|
||||
var offset = _getOption('offset');
|
||||
var release = _getOption('release');
|
||||
var reverse = _getOption('reverse');
|
||||
var st;
|
||||
var attrName;
|
||||
var diff;
|
||||
|
||||
// Exit if false
|
||||
if ( offset === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
offset = parseInt(offset);
|
||||
release = release ? document.querySelector(release) : null;
|
||||
|
||||
st = KTUtil.getScrollTop();
|
||||
diff = document.documentElement.scrollHeight - window.innerHeight - KTUtil.getScrollTop();
|
||||
|
||||
var proceed = (!release || (release.offsetTop - release.clientHeight) > st);
|
||||
|
||||
if ( reverse === true ) { // Release on reverse scroll mode
|
||||
if ( st > offset && proceed ) {
|
||||
if ( document.body.hasAttribute(the.attributeName) === false) {
|
||||
|
||||
if (_enable() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.setAttribute(the.attributeName, 'on');
|
||||
document.body.setAttribute(the.attributeName2, 'on');
|
||||
the.element.setAttribute("data-kt-sticky-enabled", "true");
|
||||
}
|
||||
|
||||
if ( the.eventTriggerState === true ) {
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.on', the);
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.change', the);
|
||||
|
||||
the.eventTriggerState = false;
|
||||
}
|
||||
} else { // Back scroll mode
|
||||
if ( document.body.hasAttribute(the.attributeName) === true) {
|
||||
_disable();
|
||||
document.body.removeAttribute(the.attributeName);
|
||||
document.body.removeAttribute(the.attributeName2);
|
||||
the.element.removeAttribute("data-kt-sticky-enabled");
|
||||
}
|
||||
|
||||
if ( the.eventTriggerState === false ) {
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.off', the);
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.change', the);
|
||||
the.eventTriggerState = true;
|
||||
}
|
||||
}
|
||||
|
||||
the.lastScrollTop = st;
|
||||
} else { // Classic scroll mode
|
||||
if ( st > offset && proceed ) {
|
||||
if ( document.body.hasAttribute(the.attributeName) === false) {
|
||||
|
||||
if (_enable() === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
document.body.setAttribute(the.attributeName, 'on');
|
||||
document.body.setAttribute(the.attributeName2, 'on');
|
||||
the.element.setAttribute("data-kt-sticky-enabled", "true");
|
||||
}
|
||||
|
||||
if ( the.eventTriggerState === true ) {
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.on', the);
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.change', the);
|
||||
the.eventTriggerState = false;
|
||||
}
|
||||
} else { // back scroll mode
|
||||
if ( document.body.hasAttribute(the.attributeName) === true ) {
|
||||
_disable();
|
||||
document.body.removeAttribute(the.attributeName);
|
||||
document.body.removeAttribute(the.attributeName2);
|
||||
the.element.removeAttribute("data-kt-sticky-enabled");
|
||||
}
|
||||
|
||||
if ( the.eventTriggerState === false ) {
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.off', the);
|
||||
KTEventHandler.trigger(the.element, 'kt.sticky.change', the);
|
||||
the.eventTriggerState = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (release) {
|
||||
if ( release.offsetTop - release.clientHeight > st ) {
|
||||
the.element.setAttribute('data-kt-sticky-released', 'true');
|
||||
} else {
|
||||
the.element.removeAttribute('data-kt-sticky-released');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _enable = function(update) {
|
||||
var top = _getOption('top');
|
||||
top = top ? parseInt(top) : 0;
|
||||
|
||||
var left = _getOption('left');
|
||||
var right = _getOption('right');
|
||||
var width = _getOption('width');
|
||||
var zindex = _getOption('zindex');
|
||||
var dependencies = _getOption('dependencies');
|
||||
var classes = _getOption('class');
|
||||
|
||||
var height = _calculateHeight();
|
||||
var heightOffset = _getOption('height-offset');
|
||||
heightOffset = heightOffset ? parseInt(heightOffset) : 0;
|
||||
|
||||
if (height + heightOffset + top > KTUtil.getViewPort().height) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( update !== true && _getOption('animation') === true ) {
|
||||
KTUtil.css(the.element, 'animationDuration', _getOption('animationSpeed'));
|
||||
KTUtil.animateClass(the.element, 'animation ' + _getOption('animationClass'));
|
||||
}
|
||||
|
||||
if ( classes !== null ) {
|
||||
KTUtil.addClass(the.element, classes);
|
||||
}
|
||||
|
||||
if ( zindex !== null ) {
|
||||
KTUtil.css(the.element, 'z-index', zindex);
|
||||
KTUtil.css(the.element, 'position', 'fixed');
|
||||
}
|
||||
|
||||
if ( top >= 0 ) {
|
||||
KTUtil.css(the.element, 'top', String(top) + 'px');
|
||||
}
|
||||
|
||||
if ( width !== null ) {
|
||||
if (width['target']) {
|
||||
var targetElement = document.querySelector(width['target']);
|
||||
if (targetElement) {
|
||||
width = KTUtil.css(targetElement, 'width');
|
||||
}
|
||||
}
|
||||
|
||||
KTUtil.css(the.element, 'width', width);
|
||||
}
|
||||
|
||||
if ( left !== null ) {
|
||||
if ( String(left).toLowerCase() === 'auto' ) {
|
||||
var offsetLeft = KTUtil.offset(the.element).left;
|
||||
|
||||
if ( offsetLeft >= 0 ) {
|
||||
KTUtil.css(the.element, 'left', String(offsetLeft) + 'px');
|
||||
}
|
||||
} else {
|
||||
KTUtil.css(the.element, 'left', left);
|
||||
}
|
||||
}
|
||||
|
||||
if ( right !== null ) {
|
||||
KTUtil.css(the.element, 'right', right);
|
||||
}
|
||||
|
||||
// Height dependencies
|
||||
if ( dependencies !== null ) {
|
||||
var dependencyElements = document.querySelectorAll(dependencies);
|
||||
|
||||
if ( dependencyElements && dependencyElements.length > 0 ) {
|
||||
for ( var i = 0, len = dependencyElements.length; i < len; i++ ) {
|
||||
KTUtil.css(dependencyElements[i], 'padding-top', String(height) + 'px');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _disable = function() {
|
||||
KTUtil.css(the.element, 'top', '');
|
||||
KTUtil.css(the.element, 'width', '');
|
||||
KTUtil.css(the.element, 'left', '');
|
||||
KTUtil.css(the.element, 'right', '');
|
||||
KTUtil.css(the.element, 'z-index', '');
|
||||
KTUtil.css(the.element, 'position', '');
|
||||
|
||||
var dependencies = _getOption('dependencies');
|
||||
var classes = _getOption('class');
|
||||
|
||||
if ( classes !== null ) {
|
||||
KTUtil.removeClass(the.element, classes);
|
||||
}
|
||||
|
||||
// Height dependencies
|
||||
if ( dependencies !== null ) {
|
||||
var dependencyElements = document.querySelectorAll(dependencies);
|
||||
|
||||
if ( dependencyElements && dependencyElements.length > 0 ) {
|
||||
for ( var i = 0, len = dependencyElements.length; i < len; i++ ) {
|
||||
KTUtil.css(dependencyElements[i], 'padding-top', '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _check = function() {
|
||||
|
||||
}
|
||||
|
||||
var _calculateHeight = function() {
|
||||
var height = parseFloat(KTUtil.css(the.element, 'height'));
|
||||
|
||||
height = height + parseFloat(KTUtil.css(the.element, 'margin-top'));
|
||||
height = height + parseFloat(KTUtil.css(the.element, 'margin-bottom'));
|
||||
|
||||
if (KTUtil.css(element, 'border-top')) {
|
||||
height = height + parseFloat(KTUtil.css(the.element, 'border-top'));
|
||||
}
|
||||
|
||||
if (KTUtil.css(element, 'border-bottom')) {
|
||||
height = height + parseFloat(KTUtil.css(the.element, 'border-bottom'));
|
||||
}
|
||||
|
||||
return height;
|
||||
}
|
||||
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-sticky-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-sticky-' + name);
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
window.removeEventListener('scroll', _scroll);
|
||||
KTUtil.data(the.element).remove('sticky');
|
||||
}
|
||||
|
||||
// Construct Class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Methods
|
||||
the.update = function() {
|
||||
if ( document.body.hasAttribute(the.attributeName) === true ) {
|
||||
_disable();
|
||||
document.body.removeAttribute(the.attributeName);
|
||||
document.body.removeAttribute(the.attributeName2);
|
||||
_enable(true);
|
||||
document.body.setAttribute(the.attributeName, 'on');
|
||||
document.body.setAttribute(the.attributeName2, 'on');
|
||||
}
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTSticky.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('sticky') ) {
|
||||
return KTUtil.data(element).get('sticky');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTSticky.createInstances = function(selector = '[data-kt-sticky="true"]') {
|
||||
// Initialize Menus
|
||||
var elements = document.body.querySelectorAll(selector);
|
||||
var sticky;
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
sticky = new KTSticky(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window resize handler
|
||||
KTSticky.handleResize = function() {
|
||||
window.addEventListener('resize', function() {
|
||||
var timer;
|
||||
|
||||
KTUtil.throttle(timer, function() {
|
||||
// Locate and update Offcanvas instances on window resize
|
||||
var elements = document.body.querySelectorAll('[data-kt-sticky="true"]');
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
var sticky = KTSticky.getInstance(elements[i]);
|
||||
if (sticky) {
|
||||
sticky.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTSticky.init = function() {
|
||||
KTSticky.createInstances();
|
||||
|
||||
if (KTStickyHandlersInitialized === false) {
|
||||
KTSticky.handleResize();
|
||||
KTStickyHandlersInitialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTSticky;
|
||||
}
|
180
resources/_keenthemes/src/js/components/swapper.js
Normal file
180
resources/_keenthemes/src/js/components/swapper.js
Normal file
@ -0,0 +1,180 @@
|
||||
"use strict";
|
||||
|
||||
var KTSwapperHandlersInitialized = false;
|
||||
|
||||
// Class definition
|
||||
var KTSwapper = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private Variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if ( typeof element === "undefined" || element === null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
mode: 'append'
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private Methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('swapper') === true ) {
|
||||
the = KTUtil.data(element).get('swapper');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
the.element = element;
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
|
||||
// Set initialized
|
||||
the.element.setAttribute('data-kt-swapper', 'true');
|
||||
|
||||
// Initial update
|
||||
_update();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('swapper', the);
|
||||
}
|
||||
|
||||
var _update = function(e) {
|
||||
var parentSelector = _getOption('parent');
|
||||
|
||||
var mode = _getOption('mode');
|
||||
var parentElement = parentSelector ? document.querySelector(parentSelector) : null;
|
||||
|
||||
|
||||
if (parentElement && element.parentNode !== parentElement) {
|
||||
if (mode === 'prepend') {
|
||||
parentElement.prepend(element);
|
||||
} else if (mode === 'append') {
|
||||
parentElement.append(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _getOption = function(name) {
|
||||
if ( the.element.hasAttribute('data-kt-swapper-' + name) === true ) {
|
||||
var attr = the.element.getAttribute('data-kt-swapper-' + name);
|
||||
var value = KTUtil.getResponsiveValue(attr);
|
||||
|
||||
if ( value !== null && String(value) === 'true' ) {
|
||||
value = true;
|
||||
} else if ( value !== null && String(value) === 'false' ) {
|
||||
value = false;
|
||||
}
|
||||
|
||||
return value;
|
||||
} else {
|
||||
var optionName = KTUtil.snakeToCamel(name);
|
||||
|
||||
if ( the.options[optionName] ) {
|
||||
return KTUtil.getResponsiveValue(the.options[optionName]);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('swapper');
|
||||
}
|
||||
|
||||
// Construct Class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Methods
|
||||
the.update = function() {
|
||||
_update();
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTSwapper.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('swapper') ) {
|
||||
return KTUtil.data(element).get('swapper');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTSwapper.createInstances = function(selector = '[data-kt-swapper="true"]') {
|
||||
// Initialize Menus
|
||||
var elements = document.querySelectorAll(selector);
|
||||
var swapper;
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
swapper = new KTSwapper(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Window resize handler
|
||||
KTSwapper.handleResize = function() {
|
||||
window.addEventListener('resize', function() {
|
||||
var timer;
|
||||
|
||||
KTUtil.throttle(timer, function() {
|
||||
// Locate and update Offcanvas instances on window resize
|
||||
var elements = document.querySelectorAll('[data-kt-swapper="true"]');
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
var swapper = KTSwapper.getInstance(elements[i]);
|
||||
if (swapper) {
|
||||
swapper.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 200);
|
||||
});
|
||||
};
|
||||
|
||||
// Global initialization
|
||||
KTSwapper.init = function() {
|
||||
KTSwapper.createInstances();
|
||||
|
||||
if (KTSwapperHandlersInitialized === false) {
|
||||
KTSwapper.handleResize();
|
||||
KTSwapperHandlersInitialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTSwapper;
|
||||
}
|
216
resources/_keenthemes/src/js/components/toggle.js
Normal file
216
resources/_keenthemes/src/js/components/toggle.js
Normal file
@ -0,0 +1,216 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTToggle = function(element, options) {
|
||||
////////////////////////////
|
||||
// ** Private variables ** //
|
||||
////////////////////////////
|
||||
var the = this;
|
||||
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Default Options
|
||||
var defaultOptions = {
|
||||
saveState: true
|
||||
};
|
||||
|
||||
////////////////////////////
|
||||
// ** Private methods ** //
|
||||
////////////////////////////
|
||||
|
||||
var _construct = function() {
|
||||
if ( KTUtil.data(element).has('toggle') === true ) {
|
||||
the = KTUtil.data(element).get('toggle');
|
||||
} else {
|
||||
_init();
|
||||
}
|
||||
}
|
||||
|
||||
var _init = function() {
|
||||
// Variables
|
||||
the.options = KTUtil.deepExtend({}, defaultOptions, options);
|
||||
the.uid = KTUtil.getUniqueId('toggle');
|
||||
|
||||
// Elements
|
||||
the.element = element;
|
||||
|
||||
the.target = document.querySelector(the.element.getAttribute('data-kt-toggle-target')) ? document.querySelector(the.element.getAttribute('data-kt-toggle-target')) : the.element;
|
||||
the.state = the.element.hasAttribute('data-kt-toggle-state') ? the.element.getAttribute('data-kt-toggle-state') : '';
|
||||
the.mode = the.element.hasAttribute('data-kt-toggle-mode') ? the.element.getAttribute('data-kt-toggle-mode') : '';
|
||||
the.attribute = 'data-kt-' + the.element.getAttribute('data-kt-toggle-name');
|
||||
|
||||
// Event Handlers
|
||||
_handlers();
|
||||
|
||||
// Bind Instance
|
||||
KTUtil.data(the.element).set('toggle', the);
|
||||
}
|
||||
|
||||
var _handlers = function() {
|
||||
KTUtil.addEvent(the.element, 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( the.mode !== '' ) {
|
||||
if ( the.mode === 'off' && _isEnabled() === false ) {
|
||||
_toggle();
|
||||
} else if ( the.mode === 'on' && _isEnabled() === true ) {
|
||||
_toggle();
|
||||
}
|
||||
} else {
|
||||
_toggle();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Event handlers
|
||||
var _toggle = function() {
|
||||
// Trigger "after.toggle" event
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.change', the);
|
||||
|
||||
if ( _isEnabled() ) {
|
||||
_disable();
|
||||
} else {
|
||||
_enable();
|
||||
}
|
||||
|
||||
// Trigger "before.toggle" event
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.changed', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _enable = function() {
|
||||
if ( _isEnabled() === true ) {
|
||||
return;
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.enable', the);
|
||||
|
||||
the.target.setAttribute(the.attribute, 'on');
|
||||
|
||||
if (the.state.length > 0) {
|
||||
the.element.classList.add(the.state);
|
||||
}
|
||||
|
||||
if ( typeof KTCookie !== 'undefined' && the.options.saveState === true ) {
|
||||
KTCookie.set(the.attribute, 'on');
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.enabled', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _disable = function() {
|
||||
if ( _isEnabled() === false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.disable', the);
|
||||
|
||||
the.target.removeAttribute(the.attribute);
|
||||
|
||||
if (the.state.length > 0) {
|
||||
the.element.classList.remove(the.state);
|
||||
}
|
||||
|
||||
if ( typeof KTCookie !== 'undefined' && the.options.saveState === true ) {
|
||||
KTCookie.remove(the.attribute);
|
||||
}
|
||||
|
||||
KTEventHandler.trigger(the.element, 'kt.toggle.disabled', the);
|
||||
|
||||
return the;
|
||||
}
|
||||
|
||||
var _isEnabled = function() {
|
||||
return (String(the.target.getAttribute(the.attribute)).toLowerCase() === 'on');
|
||||
}
|
||||
|
||||
var _destroy = function() {
|
||||
KTUtil.data(the.element).remove('toggle');
|
||||
}
|
||||
|
||||
// Construct class
|
||||
_construct();
|
||||
|
||||
///////////////////////
|
||||
// ** Public API ** //
|
||||
///////////////////////
|
||||
|
||||
// Plugin API
|
||||
the.toggle = function() {
|
||||
return _toggle();
|
||||
}
|
||||
|
||||
the.enable = function() {
|
||||
return _enable();
|
||||
}
|
||||
|
||||
the.disable = function() {
|
||||
return _disable();
|
||||
}
|
||||
|
||||
the.isEnabled = function() {
|
||||
return _isEnabled();
|
||||
}
|
||||
|
||||
the.goElement = function() {
|
||||
return the.element;
|
||||
}
|
||||
|
||||
the.destroy = function() {
|
||||
return _destroy();
|
||||
}
|
||||
|
||||
// Event API
|
||||
the.on = function(name, handler) {
|
||||
return KTEventHandler.on(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.one = function(name, handler) {
|
||||
return KTEventHandler.one(the.element, name, handler);
|
||||
}
|
||||
|
||||
the.off = function(name, handlerId) {
|
||||
return KTEventHandler.off(the.element, name, handlerId);
|
||||
}
|
||||
|
||||
the.trigger = function(name, event) {
|
||||
return KTEventHandler.trigger(the.element, name, event, the, event);
|
||||
}
|
||||
};
|
||||
|
||||
// Static methods
|
||||
KTToggle.getInstance = function(element) {
|
||||
if ( element !== null && KTUtil.data(element).has('toggle') ) {
|
||||
return KTUtil.data(element).get('toggle');
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Create instances
|
||||
KTToggle.createInstances = function(selector = '[data-kt-toggle]') {
|
||||
// Get instances
|
||||
var elements = document.body.querySelectorAll(selector);
|
||||
|
||||
if ( elements && elements.length > 0 ) {
|
||||
for (var i = 0, len = elements.length; i < len; i++) {
|
||||
// Initialize instances
|
||||
new KTToggle(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Global initialization
|
||||
KTToggle.init = function() {
|
||||
KTToggle.createInstances();
|
||||
};
|
||||
|
||||
// Webpack support
|
||||
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
|
||||
module.exports = KTToggle;
|
||||
}
|
1602
resources/_keenthemes/src/js/components/util.js
Normal file
1602
resources/_keenthemes/src/js/components/util.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountAPIKeys = function () {
|
||||
// Private functions
|
||||
var initLicenceCopy = function() {
|
||||
KTUtil.each(document.querySelectorAll('#kt_api_keys_table [data-action="copy"]'), function(button) {
|
||||
var tr = button.closest('tr');
|
||||
var license = KTUtil.find(tr, '[data-bs-target="license"]');
|
||||
|
||||
var clipboard = new ClipboardJS(button, {
|
||||
target: license,
|
||||
text: function() {
|
||||
return license.innerHTML;
|
||||
}
|
||||
});
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
// Icons
|
||||
var copyIcon = button.querySelector('.ki-copy');
|
||||
var checkIcon = button.querySelector('.ki-check');
|
||||
|
||||
// exit if check icon is already shown
|
||||
if (checkIcon) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create check icon
|
||||
checkIcon = document.createElement('i');
|
||||
checkIcon.classList.add('ki-solid');
|
||||
checkIcon.classList.add('ki-check');
|
||||
checkIcon.classList.add('fs-2');
|
||||
|
||||
// Append check icon
|
||||
button.appendChild(checkIcon);
|
||||
|
||||
// Highlight target
|
||||
license.classList.add('text-success');
|
||||
|
||||
// Hide copy icon
|
||||
copyIcon.classList.add('d-none');
|
||||
|
||||
// Set 3 seconds timeout to hide the check icon and show copy icon back
|
||||
setTimeout(function() {
|
||||
// Remove check icon
|
||||
copyIcon.classList.remove('d-none');
|
||||
// Show check icon back
|
||||
button.removeChild(checkIcon);
|
||||
|
||||
// Remove highlight
|
||||
license.classList.remove('text-success');
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
initLicenceCopy();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTAccountAPIKeys.init();
|
||||
});
|
138
resources/_keenthemes/src/js/custom/account/billing/general.js
Normal file
138
resources/_keenthemes/src/js/custom/account/billing/general.js
Normal file
@ -0,0 +1,138 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountBillingGeneral = function () {
|
||||
// Private variables
|
||||
var cancelSubscriptionButton;
|
||||
|
||||
// Private functions
|
||||
var handlePlan = function () {
|
||||
cancelSubscriptionButton.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
swal.fire({
|
||||
text: "Are you sure you would like to cancel your subscription ?",
|
||||
icon: "warning",
|
||||
buttonsStyling: false,
|
||||
showDenyButton: true,
|
||||
confirmButtonText: "Yes",
|
||||
denyButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary",
|
||||
denyButton: "btn btn-light-danger"
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
Swal.fire({
|
||||
text: 'Your subscription has been canceled.',
|
||||
icon: 'success',
|
||||
confirmButtonText: "Ok",
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: "btn btn-light-primary"
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var handleCardDelete = function() {
|
||||
KTUtil.on(document.body, '[data-kt-billing-action="card-delete"]', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var el = this;
|
||||
|
||||
swal.fire({
|
||||
text: "Are you sure you would like to delete selected card ?",
|
||||
icon: "warning",
|
||||
buttonsStyling: false,
|
||||
showDenyButton: true,
|
||||
confirmButtonText: "Yes",
|
||||
denyButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary",
|
||||
denyButton: "btn btn-light-danger"
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
el.setAttribute('data-kt-indicator', 'on');
|
||||
el.disabled = true;
|
||||
|
||||
setTimeout(function() {
|
||||
Swal.fire({
|
||||
text: 'Your selected card has been successfully deleted',
|
||||
icon: 'success',
|
||||
confirmButtonText: "Ok",
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: "btn btn-light-primary"
|
||||
}
|
||||
}).then((result) => {
|
||||
el.closest('[data-kt-billing-element="card"]').remove();
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var handleAddressDelete = function() {
|
||||
KTUtil.on(document.body, '[data-kt-billing-action="address-delete"]', 'click', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var el = this;
|
||||
|
||||
swal.fire({
|
||||
text: "Are you sure you would like to delete selected address ?",
|
||||
icon: "warning",
|
||||
buttonsStyling: false,
|
||||
showDenyButton: true,
|
||||
confirmButtonText: "Yes",
|
||||
denyButtonText: 'No',
|
||||
customClass: {
|
||||
confirmButton: "btn btn-primary",
|
||||
denyButton: "btn btn-light-danger"
|
||||
}
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
el.setAttribute('data-kt-indicator', 'on');
|
||||
el.disabled = true;
|
||||
|
||||
setTimeout(function() {
|
||||
Swal.fire({
|
||||
text: 'Your selected address has been successfully deleted',
|
||||
icon: 'success',
|
||||
confirmButtonText: "Ok",
|
||||
buttonsStyling: false,
|
||||
customClass: {
|
||||
confirmButton: "btn btn-light-primary"
|
||||
}
|
||||
}).then((result) => {
|
||||
el.closest('[data-kt-billing-element="address"]').remove();
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
cancelSubscriptionButton = document.querySelector('#kt_account_billing_cancel_subscription_btn');
|
||||
|
||||
if ( cancelSubscriptionButton ) {
|
||||
handlePlan();
|
||||
}
|
||||
|
||||
handleCardDelete();
|
||||
handleAddressDelete();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTAccountBillingGeneral.init();
|
||||
});
|
108
resources/_keenthemes/src/js/custom/account/orders/classic.js
Normal file
108
resources/_keenthemes/src/js/custom/account/orders/classic.js
Normal file
@ -0,0 +1,108 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTDatatablesClassic = function () {
|
||||
// Private functions
|
||||
|
||||
var initClassic = function () {
|
||||
|
||||
// Set date data order
|
||||
const table = document.getElementById('kt_orders_classic');
|
||||
const tableRows = table.querySelectorAll('tbody tr');
|
||||
|
||||
tableRows.forEach(row => {
|
||||
const dateRow = row.querySelectorAll('td');
|
||||
const realDate = moment(dateRow[1].innerHTML, "MMM D, YYYY").format('x');
|
||||
dateRow[1].setAttribute('data-order', realDate);
|
||||
});
|
||||
|
||||
// Init datatable --- more info on datatables: https://datatables.net/manual/
|
||||
const datatable = $(table).DataTable({
|
||||
"info": false,
|
||||
'order': []
|
||||
});
|
||||
|
||||
// Filter dropdown elements
|
||||
const filterOrders = document.getElementById('kt_filter_orders');
|
||||
const filterYear = document.getElementById('kt_filter_year');
|
||||
|
||||
// Filter by order status --- official docs reference: https://datatables.net/reference/api/search()
|
||||
filterOrders.addEventListener('change', function (e) {
|
||||
datatable.column(3).search(e.target.value).draw();
|
||||
});
|
||||
|
||||
// Filter by date --- official docs reference: https://momentjs.com/docs/
|
||||
var minDate;
|
||||
var maxDate;
|
||||
filterYear.addEventListener('change', function (e) {
|
||||
const value = e.target.value;
|
||||
switch (value) {
|
||||
case 'thisyear': {
|
||||
minDate = moment().startOf('year').format('x');
|
||||
maxDate = moment().endOf('year').format('x');
|
||||
datatable.draw();
|
||||
break;
|
||||
}
|
||||
case 'thismonth': {
|
||||
minDate = moment().startOf('month').format('x');
|
||||
maxDate = moment().endOf('month').format('x');
|
||||
datatable.draw();
|
||||
break;
|
||||
}
|
||||
case 'lastmonth': {
|
||||
minDate = moment().subtract(1, 'months').startOf('month').format('x');
|
||||
maxDate = moment().subtract(1, 'months').endOf('month').format('x');
|
||||
datatable.draw();
|
||||
break;
|
||||
}
|
||||
case 'last90days': {
|
||||
minDate = moment().subtract(30, 'days').format('x');
|
||||
maxDate = moment().format('x');
|
||||
datatable.draw();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
minDate = moment().subtract(100, 'years').startOf('month').format('x');
|
||||
maxDate = moment().add(1, 'months').endOf('month').format('x');
|
||||
datatable.draw();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Date range filter --- offical docs reference: https://datatables.net/examples/plug-ins/range_filtering.html
|
||||
$.fn.dataTable.ext.search.push(
|
||||
function (settings, data, dataIndex) {
|
||||
var min = minDate;
|
||||
var max = maxDate;
|
||||
var date = parseFloat(moment(data[1]).format('x')) || 0; // use data for the age column
|
||||
|
||||
if ((isNaN(min) && isNaN(max)) ||
|
||||
(isNaN(min) && date <= max) ||
|
||||
(min <= date && isNaN(max)) ||
|
||||
(min <= date && date <= max)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
// Search --- official docs reference: https://datatables.net/reference/api/search()
|
||||
var filterSearch = document.getElementById('kt_filter_search');
|
||||
filterSearch.addEventListener('keyup', function (e) {
|
||||
datatable.search(e.target.value).draw();
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
initClassic();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTDatatablesClassic.init();
|
||||
});
|
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountReferralsReferralProgram = function () {
|
||||
// Private functions
|
||||
|
||||
var initReferralProgrammClipboard = function() {
|
||||
var button = document.querySelector('#kt_referral_program_link_copy_btn');
|
||||
var input = document.querySelector('#kt_referral_link_input');
|
||||
var clipboard = new ClipboardJS(button);
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
var buttonCaption = button.innerHTML;
|
||||
//Add bgcolor
|
||||
input.classList.add('bg-success');
|
||||
input.classList.add('text-inverse-success');
|
||||
|
||||
button.innerHTML = 'Copied!';
|
||||
|
||||
setTimeout(function() {
|
||||
button.innerHTML = buttonCaption;
|
||||
|
||||
// Remove bgcolor
|
||||
input.classList.remove('bg-success');
|
||||
input.classList.remove('text-inverse-success');
|
||||
}, 3000); // 3seconds
|
||||
|
||||
e.clearSelection();
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
initReferralProgrammClipboard();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTAccountReferralsReferralProgram.init();
|
||||
});
|
@ -0,0 +1,68 @@
|
||||
"use strict";
|
||||
|
||||
// Class definition
|
||||
var KTAccountSecurityLicenseUsage = function () {
|
||||
// Private functions
|
||||
var initLicenceCopy = function() {
|
||||
KTUtil.each(document.querySelectorAll('#kt_security_license_usage_table [data-action="copy"]'), function(button) {
|
||||
var tr = button.closest('tr');
|
||||
var license = KTUtil.find(tr, '[data-bs-target="license"]');
|
||||
|
||||
var clipboard = new ClipboardJS(button, {
|
||||
target: license,
|
||||
text: function() {
|
||||
return license.innerHTML;
|
||||
}
|
||||
});
|
||||
|
||||
clipboard.on('success', function(e) {
|
||||
// Icons
|
||||
var copyIcon = button.querySelector('.ki-copy');
|
||||
var checkIcon = button.querySelector('.ki-check');
|
||||
|
||||
// exit if check icon is already shown
|
||||
if (checkIcon) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Create check icon
|
||||
checkIcon = document.createElement('i');
|
||||
checkIcon.classList.add('ki-solid');
|
||||
checkIcon.classList.add('ki-check');
|
||||
checkIcon.classList.add('fs-2');
|
||||
|
||||
// Append check icon
|
||||
button.appendChild(checkIcon);
|
||||
|
||||
// Highlight target
|
||||
license.classList.add('text-success');
|
||||
|
||||
// Hide copy icon
|
||||
copyIcon.classList.add('d-none');
|
||||
|
||||
// Set 3 seconds timeout to hide the check icon and show copy icon back
|
||||
setTimeout(function() {
|
||||
// Remove check icon
|
||||
copyIcon.classList.remove('d-none');
|
||||
// Show check icon back
|
||||
button.removeChild(checkIcon);
|
||||
|
||||
// Remove highlight
|
||||
license.classList.remove('text-success');
|
||||
}, 3000);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Public methods
|
||||
return {
|
||||
init: function () {
|
||||
initLicenceCopy();
|
||||
}
|
||||
}
|
||||
}();
|
||||
|
||||
// On document ready
|
||||
KTUtil.onDOMContentLoaded(function() {
|
||||
KTAccountSecurityLicenseUsage.init();
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user