Compare commits

..

5 Commits

Author SHA1 Message Date
vasya 469ebc8aaf скрипты с сообщениями на eng для различных отображений в процессе работы с платформой. Во первых, требуетсяЮ скорее, реализовывать ру локализацию этих скриптов, а во вторых, без этих скриптов все должно работать. При необходимости, их отдельно можно опубликовать через publish 2026-03-29 18:56:02 +03:00
vasya d53a9e6274 см initial commit 2026-03-24 20:47:46 +03:00
vasya ec04ae8d69 см initial commit 2026-03-24 20:36:44 +03:00
vasya feb2b840eb вообще подобные скрипты создаются в рамках каждого модуля модульной структуры от ndiwart, но конкретно этот, вроде бы, отвечает за модуль Test (у модуля Taxi свой скрипт такой же). Поэтому, предполагаю, что можно попробовать выкинуть этот скрипт и проверить все ли ок 2026-03-24 19:53:08 +03:00
vasya 9766a1afad INITIAL COMMIT - в эту ветку складываю скрипты, необходимость которых сомнительна для нового проекта ларавель. Можно добавить их скопом в новый проект, потом попробовать удалять и смотреть будет что-то ломаться или нет 2026-03-22 19:53:13 +03:00
24 changed files with 436 additions and 708 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;
class Handler extends ExceptionHandler
{
/**
* The 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.
*/
public function register(): void
{
$this->reportable(function (Throwable $e) {
//
});
}
}
-133
View File
@@ -1,133 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models;
class MenuController extends Controller
{
public function __construct()
{
$this->userLogin = 'dgavrilov';
}
/**
* Получение всех записей из таблицы с приложениями для меню
* TODO
* передавай флаг isActive и используй его для получения записей с приложениями меню архивных и не архивных
*
* @return mixed
*/
public function getApps()
{
//Приложения старого мэджик из скрипта Config_AD
$oldApps = $this->getOldApps();
#Гаврилов
//НОВЫЕ ПРИЛОЖЕНИЯ НЕ ИСПОЛЬЗУЕШЬ
//Приложения нового мэджик из базы данных
#Гаврилов
//отрисовывать только то, что может видеть пользователь
$newApps = Models\MagicApps::get()->toArray();
return response()->json($oldApps);
}
/**
* Метод получает конфиг со старыми приложениями Magic
*
* @return string
*/
public function getOldApps()
{
$oldAppConf = json_decode(file_get_contents('http://cs/magic/return_config.AD.php'));
return $oldAppConf;
}
/**
* Метод должен проверить есть ли избранные приложения у пользователя. Если есть, их необходимо обновить либо добавив, либо убрав то приложение, по которому кликнул пользователь. Если избранных приложений нет - вставить новую запись
*
* @return boolean
*/
public function updateUserFavApp(Request $rqst)
{
#Гаврилов
//ВНИЗУ ИСПОЛЬЗУЕТСЯ ЛОГИН DGAVRILOV, ПЕРЕПИШИ НА ЛОГИН ПОЛЬЗОВАТЕЛЯ MAGIC
$userFavApp = $this->getUserFavApp('dgavrilov');
$appName = $rqst->all()['appName'];
$newFavAppList = null;
//Если массив с избранными приложениями пустой - пользователь не добавил ни 1 приложения мэджик в избранное
if (!$userFavApp) {
$newFavAppList = $appName;
} else {
$currentFavApp = $userFavApp;
if (in_array($appName, $currentFavApp) !== false) {
$newFavAppList = implode(';', array_filter($currentFavApp, function($el) use($appName) {return $el !== $appName;}));
} else {
$newFavAppList = implode(';', array_merge($currentFavApp, [$appName]));
}
}
if ($newFavAppList) {
#Гаврилов
//ПРИ ВЫЗОВЕ ИЗ REACT НЕ ОБНОВЛЯЕТСЯ ПОЛЕ UPDATE_AT
$this->insertFavApp($newFavAppList);
//Если список приложений пуст - просто удаляем запись с избранными приложениями пользователя
} else {
$this->delAllUserFavApp('dgavrilov');
}
return $this->getUserFavApp('dgavrilov');
}
#Гаврилов
//try catch для отслеживания ошибок вставки записей в БД?
/**
* Метод вставки новой записи с избранными приложениями
*
* @return boolean
*/
public function insertFavApp($appName)
{
Models\UserFavApp::updateOrCreate(
['user_login' => $this->userLogin],
['fav_apps' => $appName]
);
return true;
}
/**
* Метод удаляет запись с избранными приложениями пользователя
*
* @param string $userLogin логин пользователя
* @return boolean
*/
public function delAllUserFavApp($userLogin)
{
Models\UserFavApp::where('user_login', $userLogin)->delete();
return true;
}
/**
* Метод получает избранные приложения пользователя
*
* @param string $userLogin логин пользователя
* @return array
*/
public function getUserFavApp(string $userLogin): array
{
#Гаврилов
//ЗДЕСЬ ВМЕСТО DGAVRILOV ДОЛЖНО БЫТЬ ОБРАЩЕНИЕ К КУКАСАМ, ЧТОБЫ БРАТЬ ЛОГИН ОТТУДА
$userFavApp = Models\UserFavApp::where('user_login', $userLogin)->first();
return $userFavApp ? explode(';', $userFavApp['fav_apps']) : [];
}
}
-18
View File
@@ -1,18 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\MagicApps;
class AppRoles extends Model
{
protected $table = 'app_roles';
use HasFactory;
public function magicApp()
{
return $this->belongsTo(MagicApps::class, 'app_id', 'id');
}
}
-19
View File
@@ -1,19 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\AppRoles;
class MagicApps extends Model
{
protected $table = 'magic_apps';
use HasFactory;
public function appRoles()
{
return $this->hasMany(AppRoles::class, 'app_id', 'id')
->orderBy('role_priority', 'asc');
}
}
-17
View File
@@ -1,17 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UserFavApp extends Model
{
use HasFactory;
public $incrementing = true;
public $timestamps = true;
protected $table = 'user_fav_app';
protected $connection = "mysql";
protected $fillable = ['user_login', 'fav_apps'];
}
+40
View File
@@ -0,0 +1,40 @@
<?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 your application's "home" route.
*
* Typically, users are redirected here after authentication.
*
* @var string
*/
public const HOME = '/home';
/**
* Define your route model bindings, pattern filters, and other route configuration.
*/
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
});
}
}
+71
View File
@@ -0,0 +1,71 @@
<?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' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'host' => env('PUSHER_HOST') ?: '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',
],
],
];
+34
View 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,
];
@@ -1,13 +0,0 @@
-- custom.app_roles definition
CREATE TABLE `app_roles` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`app_id` bigint(20) unsigned NOT NULL COMMENT 'id приложения (связь с таблицей magic_apps)',
`app_role` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Роль в приложении',
`app_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Название роли на русском',
`role_priority` smallint(6) NOT NULL COMMENT 'Приоритет роли',
`role_access` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Кому доступна роль (зависит от драйвера в magic_apps)',
PRIMARY KEY (`id`),
KEY `app_roles_app_id_foreign` (`app_id`),
CONSTRAINT `app_roles_app_id_foreign` FOREIGN KEY (`app_id`) REFERENCES `magic_apps` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Ролевая модель приложений';
@@ -1,3 +0,0 @@
INSERT INTO custom.app_roles (app_id,app_role,app_title,role_priority,role_access) VALUES
(4,'admin','Администратор',1,'# Magic_admins'),
(4,'user','Пользователь',2,'# Test');
@@ -1,13 +0,0 @@
-- custom.magic_apps definition
CREATE TABLE `magic_apps` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`app_name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Имя приложения',
`app_title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'Название приложения на русском',
`app_link` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL,
`role_driver` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Драйвер определения ролей: по группам AD, по почтовым рассылкам, по логинам. NULL, если ролевая модель не предусмотрена',
`access_groups_email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Доступ к приложениям по почтовым рассылкам',
`access_groups_ad` text COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Доступ к приложениям по группам AD',
`is_active` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Активно ли приложение',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
@@ -1,5 +0,0 @@
INSERT INTO custom.magic_apps (app_name,app_title,app_link,role_driver,access_groups_email,access_groups_ad,is_active) VALUES
('Test','','test.index',NULL,NULL,'CTXAL.CryptoPRO',1),
('About','','about',NULL,NULL,'CTXAL.CryptoPRO',1),
('Test create','','test.create',NULL,NULL,'CTXAL.CryptoPRO',1),
('taxi','Реестр заказа такси','test','email','# Magic_admins',NULL,1);
@@ -1,10 +0,0 @@
-- custom.user_fav_app definition
CREATE TABLE `user_fav_app` (
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL,
`user_login` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL,
`fav_apps` text COLLATE utf8mb4_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Избранные приложения пользователя из меню Magic';
@@ -1,2 +0,0 @@
INSERT INTO custom.user_fav_app (created_at,updated_at,user_login,fav_apps) VALUES
('2025-03-28 18:16:10','2025-11-14 10:35:04','dgavrilov','reestr_send_app;dadata;amlpor;accext;prlog;anketa;pilotIVI;limcut;nsr;minjust;mcocardreporting;taxi');
+20
View 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
View 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' => '&laquo; Previous',
'next' => 'Next &raquo;',
];
+22
View 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.",
];
+191
View File
@@ -0,0 +1,191 @@
<?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 field must be accepted.',
'accepted_if' => 'The :attribute field must be accepted when :other is :value.',
'active_url' => 'The :attribute field must be a valid URL.',
'after' => 'The :attribute field must be a date after :date.',
'after_or_equal' => 'The :attribute field must be a date after or equal to :date.',
'alpha' => 'The :attribute field must only contain letters.',
'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.',
'alpha_num' => 'The :attribute field must only contain letters and numbers.',
'array' => 'The :attribute field must be an array.',
'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.',
'before' => 'The :attribute field must be a date before :date.',
'before_or_equal' => 'The :attribute field must be a date before or equal to :date.',
'between' => [
'array' => 'The :attribute field must have between :min and :max items.',
'file' => 'The :attribute field must be between :min and :max kilobytes.',
'numeric' => 'The :attribute field must be between :min and :max.',
'string' => 'The :attribute field must be between :min and :max characters.',
],
'boolean' => 'The :attribute field must be true or false.',
'can' => 'The :attribute field contains an unauthorized value.',
'confirmed' => 'The :attribute field confirmation does not match.',
'current_password' => 'The password is incorrect.',
'date' => 'The :attribute field must be a valid date.',
'date_equals' => 'The :attribute field must be a date equal to :date.',
'date_format' => 'The :attribute field must match the format :format.',
'decimal' => 'The :attribute field must have :decimal decimal places.',
'declined' => 'The :attribute field must be declined.',
'declined_if' => 'The :attribute field must be declined when :other is :value.',
'different' => 'The :attribute field and :other must be different.',
'digits' => 'The :attribute field must be :digits digits.',
'digits_between' => 'The :attribute field must be between :min and :max digits.',
'dimensions' => 'The :attribute field has invalid image dimensions.',
'distinct' => 'The :attribute field has a duplicate value.',
'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.',
'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.',
'email' => 'The :attribute field must be a valid email address.',
'ends_with' => 'The :attribute field must end with one of the following: :values.',
'enum' => 'The selected :attribute is invalid.',
'exists' => 'The selected :attribute is invalid.',
'extensions' => 'The :attribute field must have one of the following extensions: :values.',
'file' => 'The :attribute field must be a file.',
'filled' => 'The :attribute field must have a value.',
'gt' => [
'array' => 'The :attribute field must have more than :value items.',
'file' => 'The :attribute field must be greater than :value kilobytes.',
'numeric' => 'The :attribute field must be greater than :value.',
'string' => 'The :attribute field must be greater than :value characters.',
],
'gte' => [
'array' => 'The :attribute field must have :value items or more.',
'file' => 'The :attribute field must be greater than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be greater than or equal to :value.',
'string' => 'The :attribute field must be greater than or equal to :value characters.',
],
'hex_color' => 'The :attribute field must be a valid hexadecimal color.',
'image' => 'The :attribute field must be an image.',
'in' => 'The selected :attribute is invalid.',
'in_array' => 'The :attribute field must exist in :other.',
'integer' => 'The :attribute field must be an integer.',
'ip' => 'The :attribute field must be a valid IP address.',
'ipv4' => 'The :attribute field must be a valid IPv4 address.',
'ipv6' => 'The :attribute field must be a valid IPv6 address.',
'json' => 'The :attribute field must be a valid JSON string.',
'lowercase' => 'The :attribute field must be lowercase.',
'lt' => [
'array' => 'The :attribute field must have less than :value items.',
'file' => 'The :attribute field must be less than :value kilobytes.',
'numeric' => 'The :attribute field must be less than :value.',
'string' => 'The :attribute field must be less than :value characters.',
],
'lte' => [
'array' => 'The :attribute field must not have more than :value items.',
'file' => 'The :attribute field must be less than or equal to :value kilobytes.',
'numeric' => 'The :attribute field must be less than or equal to :value.',
'string' => 'The :attribute field must be less than or equal to :value characters.',
],
'mac_address' => 'The :attribute field must be a valid MAC address.',
'max' => [
'array' => 'The :attribute field must not have more than :max items.',
'file' => 'The :attribute field must not be greater than :max kilobytes.',
'numeric' => 'The :attribute field must not be greater than :max.',
'string' => 'The :attribute field must not be greater than :max characters.',
],
'max_digits' => 'The :attribute field must not have more than :max digits.',
'mimes' => 'The :attribute field must be a file of type: :values.',
'mimetypes' => 'The :attribute field must be a file of type: :values.',
'min' => [
'array' => 'The :attribute field must have at least :min items.',
'file' => 'The :attribute field must be at least :min kilobytes.',
'numeric' => 'The :attribute field must be at least :min.',
'string' => 'The :attribute field must be at least :min characters.',
],
'min_digits' => 'The :attribute field must have at least :min digits.',
'missing' => 'The :attribute field must be missing.',
'missing_if' => 'The :attribute field must be missing when :other is :value.',
'missing_unless' => 'The :attribute field must be missing unless :other is :value.',
'missing_with' => 'The :attribute field must be missing when :values is present.',
'missing_with_all' => 'The :attribute field must be missing when :values are present.',
'multiple_of' => 'The :attribute field must be a multiple of :value.',
'not_in' => 'The selected :attribute is invalid.',
'not_regex' => 'The :attribute field format is invalid.',
'numeric' => 'The :attribute field must be a number.',
'password' => [
'letters' => 'The :attribute field must contain at least one letter.',
'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.',
'numbers' => 'The :attribute field must contain at least one number.',
'symbols' => 'The :attribute field 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.',
'present_if' => 'The :attribute field must be present when :other is :value.',
'present_unless' => 'The :attribute field must be present unless :other is :value.',
'present_with' => 'The :attribute field must be present when :values is present.',
'present_with_all' => 'The :attribute field must be present when :values are 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 field 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 field must match :other.',
'size' => [
'array' => 'The :attribute field must contain :size items.',
'file' => 'The :attribute field must be :size kilobytes.',
'numeric' => 'The :attribute field must be :size.',
'string' => 'The :attribute field must be :size characters.',
],
'starts_with' => 'The :attribute field must start with one of the following: :values.',
'string' => 'The :attribute field must be a string.',
'timezone' => 'The :attribute field must be a valid timezone.',
'unique' => 'The :attribute has already been taken.',
'uploaded' => 'The :attribute failed to upload.',
'uppercase' => 'The :attribute field must be uppercase.',
'url' => 'The :attribute field must be a valid URL.',
'ulid' => 'The :attribute field must be a valid ULID.',
'uuid' => 'The :attribute field 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' => [],
];
+9 -187
View File
@@ -1,189 +1,11 @@
/* ГАВРИЛОВ. ВЫЯСНИТЬ, ГДЕ ИСПОЛЬЗУЮТСЯ */ @import 'tailwindcss';
html { @source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
overflow-y: scroll; @source '../../storage/framework/views/*.php';
} @source '../**/*.blade.php';
@source '../**/*.js';
#root{
--color_ruby: #ff0078; @theme {
} --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji';
.container {
background-color: lightblue;
padding: 20px;
}
#menu-container{
display: flex;
&>#menu__left-block{
flex-basis: 15%;
&>.menu__left-block__call-app{
display: flex;
&>.fa{
flex-basis: 20%;
}
}
}
}
.switcher-container{
position: fixed;
top: 0;
right: 0;
display: flex;
justify-content: flex-end;
align-items: center;
&>.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
margin: 9px;
&>.switcher__favorite-app {
opacity: 0;
width: 0;
height: 0;
&.showFav + .slider{
background-color: var(--color_ruby);
&:before{
transform: translateX(26px);
color: var(--color_ruby);
padding: 2px 0 0 0;
align-content: baseline;
}
}
}
&>.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s cubic-bezier(0,1,0.5,1);
border-radius: 4px;
@import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css');
&:before {
position: absolute;
content: "\f006";
font-family: FontAwesome;
text-align: center;
font-size: 1.2rem;
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s cubic-bezier(0,1,0.5,1);
border-radius: 3px;
}
&.round {
border-radius: 34px;
&:before {
border-radius: 50%;
}
}
}
}
}
.switcher__favorite-app.showFav + .slider {
background-color: var(--color_ruby);
}
.switcher__favorite-app.showFav + .slider:before {
transform: translateX(26px);
}
/* Rounded sliders */
/* .slider.round {
border-radius: 34px;
&:before {
border-radius: 50%;
}
} */
#round {
border-radius: 34px;
&:before {
border-radius: 50%;
}
}
#menu__app-container__app-block{
/* display: grid;
grid-template-columns: 50% 50%; */
column-count: 2;
>.apps-block__proc{
margin-bottom: 20px;
>.proc__title{
font-size: 1.1rem;
padding: 10px 0;
font-weight: 600;
}
>.proc__title.proc-hide{
display: none;
}
}
.script-list__el{
display: flex;
>.script-list__el__script-name{
margin-bottom: 5px;
transition: 0.2s;
&:hover{
transform: translateY(-1px);
}
>a{
text-decoration: none;
color: black;
&:hover{
color: var(--color_ruby);
}
}
}
>.fa-star{
margin-left: 5px;
cursor: pointer;
opacity: 0.2;
transition: 0.3s;
}
>.fa-star:hover{
opacity: 1;
}
>.fa-star.favorite{
opacity: 1;
color: var(--color_ruby);
}
}
.script-list__el.script-hide{
display: none;
}
} }
-14
View File
@@ -1,14 +0,0 @@
import { createRoot } from 'react-dom/client';
import '@SharePoint/rencredit_uikit/dist/static/fonts/mont/Mont.css';
import '@fortawesome/fontawesome-free/css/all.css';
import { UIKitThemeProvider } from '@SharePoint/rencredit_uikit';
import MenuApp from './components/MenuApp.tsx'; // Создайте этот файл, если используете React
import React from 'react';
const container:HTMLElement = document.getElementById('root')!;
const root = createRoot(container);
root.render(
<UIKitThemeProvider>
<MenuApp />
</UIKitThemeProvider>
);
-231
View File
@@ -1,231 +0,0 @@
import { Button } from '@SharePoint/rencredit_uikit';
import React, { useEffect, useState } from "react";
function MenuApp ()
{
//Приложения и процессы Magic для отображения в меню
const [menuApps, setMenuApps] = useState<{
'proccesses': object,
'scripts': object
}>({
'proccesses': {},
'scripts': {}
});
//TODO
//ВНЕДРИ В КОНТРОЛЛЕРЕ ПРОВЕРКУ ДОСТУПОВ, А НЕ ВОЗВРАЩАЙ ВСЕ ПОДРЯД ПРИЛОЖЕНИЯ
//Избранные приложения пользователя
const [favApps, setFavApps] = useState<string[]>([]);
//Массив избраннных процессов, в приложениях которых есть хотя бы одно избранное
const [favProcs, setFavProcs] = useState<string[]>([]);
//Состояния видимости скрипта
const [hideScriptClass, setHideScriptClass] = useState('');
//const [sanctumToken, setSanctumToken] = useState('');
const sanctumToken = () => {
const metaTag = document.getElementById('sanctum_token_block') as HTMLMetaElement;
return metaTag.dataset.token;
}
//Получаем при рендере страницы все приложения Magic и все избранные приложения пользователя
useEffect( () => {
Promise.all(
[
fetch('api/magic_apps').then(menuAppsRes => menuAppsRes.json()),
//TODO
//СЮДА ПОТЯГИВАЙ ЛОГИН ПОЛЬЗОВАТЕЛЯ, А НЕ DGAVRILOV
fetch('api/user_fav_app/dgavrilov').then(favAppsRes => favAppsRes.json())
]
).then(
([
responseMenuApp,
responseFavApp
]) => {
setMenuApps(responseMenuApp);
setFavApps(responseFavApp);
}
)
}, []);
//Обновление видимости процесса (собрания приложений) в зависимости от того находится ли в избранном хотя бы одно приложение
useEffect( () => {
if (menuApps === null) { return }
//Массив с процессами, в которых есть хотя бы одно избранное приложение
const favProcsArr:string[] = [];
//Мы собираем все избранные приложения в массив-состояние, чтобы при изменении состояния каждого приложения (например при переключении switcher) проверять входит ли это приложение в избранные. Если входит - его родительский процесс не прячем, так как в его дочерних приложениях есть избранные
Object.entries(menuApps.proccesses).forEach( (procData) => {
//Флаг - есть ли в приложениях процесса хотя бы 1 избранное
const hasFavorite: boolean = procData[1].tabs.split(';').some( (tab: string) => {
return favApps.includes(tab);
})
if (hideScriptClass !== 'script-hide' || hasFavorite) {
favProcsArr.push(procData[0]);
}
})
setFavProcs(favProcsArr);
}, [hideScriptClass, menuApps, favApps]);
//console.log(sanctumToken())
//ГАВРИЛОВ
//ПОЧЕМУ КОД НИЖЕ ИСПОЛНЯЕТСЯ ПОСТОЯННО ПОКА НЕ БУДЕТ ПОЛУЧЕН КОНТЕНТ ДЛЯ СТРАНИЦЫ ИЗ ПРОМИСОВ ВЫШЕ, А НЕ ОТРАБАТЫВАЕТ ТОЛЬКО ПРИ РЕНДЕРИНГЕ СТРАНИЦЫ
//Уместно ли отслеживать состояние до получения запросов fetch в подобном виде?
if (menuApps === null || favApps === null) {
return <span>прелоадер</span>
} else {
return (
<div id = 'menu-container'>
<div id = 'menu__left-block'>
<div className = 'menu__left-block__call-app'>
<i className = 'fa fa-th-large'></i>
<div className = 'mleft-block__call-app__title'>Приложения</div>
</div>
</div>
<div id = 'menu__app-container'>
<Button text='Текст' />
<div id = 'menu__app-container__app-block'>
{/* {console.log(menuApps.scripts)} */}
{Object.entries(menuApps.proccesses).map( (proc_val, proc_index) => (
<div className = "apps-block__proc" key = { proc_index } data-proc = {proc_val[0]}>
{/* В зависимости от того входит процесс в массив избранных делаем его видимым или скрываем */}
<div className = {`proc__title ${favProcs.includes(proc_val[0]) ? 'proc-visible' : 'proc-hide'}`}>{proc_val[1].title}</div>
<div className = "proc__script-list">
{proc_val[1].tabs.split(';').map( (app_el, app_index) => (
<AppElem
appIndex = { app_index }
appName = { app_el }
appTitle = { menuApps.scripts[app_el]?.title || "Неизвестный скрипт - " + app_el }
appUrl = { menuApps.scripts[app_el]?.url }
favIconClassName = { favApps.includes(app_el) ? 'favorite' : 'not_favorite' }
hideAppClass = { hideScriptClass }
//Функция обновления актуальный список избранных приложений
setUpdateFavApps = { (newFavApp) => setFavApps(newFavApp) }
/>
))}
</div>
</div>
)) }
</div>
<Switcher
toggleAppsVisible = { setHideScriptClass }
switcherId = "switcher-menu"
/>
</div>
</div>
)
}
}
//Гаврилов
//ПЕРЕПИСАТЬ АРГУМЕНТЫ ПОД ОБЪЕКТ СО СВОЙСТВАМИ, ИСПОЛЬЗОВАТЬ ...obj
/**
*
* @param {int} appIndex ключ для экземлпяра компонента
* @param {string} appName уникальное имя скрипта
* @param {string} appTitle название скрипта в меню
* @param {string} favIconClassName класс для иконки избранного
* @param {string} hideAppClass класс для видимости приложения
* @param {string} setUpdateFavApps функция для обновления состояния избранны приложений (при снятия, установки признака избранности)
* @returns
*/
function AppElem({
appIndex,
appName,
appTitle,
appUrl,
favIconClassName,
hideAppClass,
setUpdateFavApps
} : {
appIndex: string,
appName: string,
appTitle: string,
appUrl: string,
favIconClassName: string,
hideAppClass: string,
setUpdateFavApps: string
}) {
const [appElemClass, changeFav] = useState(favIconClassName);
const callChangeFav = ( changeAppName: string ) => {
fetch('api/user_fav_app', {
method: 'post',
body: JSON.stringify({ appName: changeAppName }),
headers: {
'content-type': 'application/json'
}
}
)
.then( (response) => response.json() )
.then( (response) => {
//Если скрипт был избранным - удаляем из избранного и наоборот
appElemClass == 'favorite' ? changeFav('not_favorite') : changeFav('favorite');
//Возвращаем обновленный список избранных приложений пользователя
setUpdateFavApps(response?.fav_apps?.split( ';' ) || [])
} )
}
return (
//Если приложение в избранном - оно всегда должно быть "видимо", даже если переключатель в положении Скрыть неизбранные приложения
<div key = { appIndex } className = {`script-list__el ${appElemClass == 'favorite' ? '' : hideAppClass}`} data-scriptname = { appName }>
<div className = "script-list__el__script-name"><a target="_blank" href={ appUrl }>{ appTitle }</a></div>
{/* Анонимная функция нужна для создания функции смены состояния для каждого компонента в отдельности, в противном случае вызов функции в одном экземпляре компонента вызывает функцию изменения для каждого экземпляра компонента */}
<i className = {`${(appElemClass == 'favorite' ? 'fas' : 'far')} fa-star ${appElemClass}`} onClick = { () => callChangeFav(appName) }></i>
</div>
)
}
//TODO
//ВЫНЕСИ В ПАПКУ COMPONENTS/MAIN
/**
* Компонент переключателя В ДАННОМ СЛУЧАЕ видимости скриптов (видны только избранные или все)
* @param {string} switcherId идентификатор переключателя (для стилей css), так как в будущем, на странице можно будет размещать несколько переключателей
* @param {function} toggleAppsVisible функция обновления состояния hideScriptClass
* @returns
*/
function Switcher({ switcherId, toggleAppsVisible }) {
const [favSwitcherClass, setFavSwitcherClass] = useState('showAll');
//Переключение состояния переключателя после рендеринга страницы
useEffect( () => {
//Получаем из локал сторадж состояние переключателя
const savedState = localStorage.getItem('magicMenuFavSwitcher');
if (savedState) {
setFavSwitcherClass(savedState);
}
}, []);
//При изменении состояния Переключателя изменяется состояние всех приложени (переключается их видимость в зависимости от состояния переключателя - только избранные или все)
useEffect( () => {
//Синхронизируем зависимые компоненты
toggleAppsVisible(favSwitcherClass === 'showFav' ? 'script-hide' : '');
}, [favSwitcherClass] );
const callToggleFavSwitcher = () => {
let switcherState = (favSwitcherClass === 'showFav' ? 'showAll' : 'showFav');
//favSwitcherClass => favSwitcherClass = ... - функциональное обновление. Здесь оно не особо нужно, но чтобы не забыть
//Меняем класс switcher, а также меняем состояние видимости всех приложений (в зависимости от того избранные они или нет)
setFavSwitcherClass( favSwitcherClass => {
if (favSwitcherClass === 'showFav') {
toggleAppsVisible('script-hide')
} else {
toggleAppsVisible('')
}
localStorage.setItem('magicMenuFavSwitcher', switcherState)
return switcherState;
} )
}
return (
<div id = { switcherId } className = "switcher-container">
<label className = "switch">
<input type = "checkbox" className = {`switcher__favorite-app ${favSwitcherClass}`} onChange = { callToggleFavSwitcher }/>
<span className = "slider round"></span>
</label>
</div>
)
}
export default MenuApp;
-17
View File
@@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Laravel + React</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Без команды ниже корректно не обрабатывается React скрипт -->
@viteReactRefresh
@vite(['resources/css/app.css', 'resources/js/app.jsx'])
<!-- Отрисовываем meta-тег с sanctum-токеном, чтобы на фронте его могли получить и передавать при api -->
<meta id="sanctum_token_block" data-token="{{ session('sanctum-token') ?? '' }}"/>
</head>
<body>
<div id="root"></div>
</body>
</html>
-23
View File
@@ -1,23 +0,0 @@
<?php
use Illuminate\Support\Facades\Route;
use \App\Http\Controllers;
#Гаврилов
//НАВЕРНОЕ, НУЖНО ВСЕ ТАКИ СГРУППИРОВАТЬ API РОУТЫ НИЖЕ В ГРУППУ /api/MENU/endpoint
/**
* Получение всех приложений Magic
* todo
* возвращать только приложения, доступные согласно роли
*/
Route::get('magic_apps', [Controllers\MenuController::class, 'getApps']);
/**
* Получение избранных приложений
* {userLogin} - логин пользователя, чьи приложения необходимо вернуть
*/
Route::get('user_fav_app/{userLogin}', [Controllers\MenuController::class, 'getUserFavApp']);
/**
* Обновление избранных приложений
*/
Route::post('user_fav_app', [Controllers\MenuController::class, 'updateUserFavApp']);
-3
View File
@@ -5,6 +5,3 @@ use Illuminate\Support\Facades\Route;
Route::get('/', function () { Route::get('/', function () {
return view('welcome'); return view('welcome');
}); });
Route::get('/menu', function () {
return view('menu_start');
})->name('magic_menu');