resolved #125, resolved #122, resolved #121, resolved #120, resolved #110, resolved #109, resolved #108, resolved #90, resolved #68
This commit is contained in:
parent
5b10141217
commit
a5b771a99a
|
@ -70,7 +70,7 @@ final class account extends core
|
||||||
// Авторизован аккаунт администратора или оператора
|
// Авторизован аккаунт администратора или оператора
|
||||||
|
|
||||||
// Инициализация данных аккаунта
|
// Инициализация данных аккаунта
|
||||||
$account = model::read('d._key == "' . $parameters['id'] . '"', return: '{ name: d.name, number: d.number, mail: d.mail, commentary: d.commentary }')->getAll();
|
$account = model::read('d._key == "' . $parameters['id'] . '"', return: '{ name: d.name, number: d.number, mail: d.mail, commentary: d.commentary, transactions: d.transactions }')->getAll();
|
||||||
|
|
||||||
if (!empty($account)) {
|
if (!empty($account)) {
|
||||||
// Найдены данные аккаунта
|
// Найдены данные аккаунта
|
||||||
|
@ -134,6 +134,12 @@ final class account extends core
|
||||||
);
|
);
|
||||||
else throw new exception('Пароль должен быть длиннее 6 символов');
|
else throw new exception('Пароль должен быть длиннее 6 символов');
|
||||||
if ($parameters['commentary'] !== $account->commentary) $account->commentary = $parameters['commentary'];
|
if ($parameters['commentary'] !== $account->commentary) $account->commentary = $parameters['commentary'];
|
||||||
|
if ($parameters['transactions'] !== $account->transactions)
|
||||||
|
$account->transactions = match ($parameters['transactions']) {
|
||||||
|
'true' => true,
|
||||||
|
'false' => false,
|
||||||
|
default => false
|
||||||
|
};
|
||||||
|
|
||||||
if (_core::update($account)) {
|
if (_core::update($account)) {
|
||||||
// Записаны данные аккаунта
|
// Записаны данные аккаунта
|
||||||
|
|
|
@ -147,8 +147,13 @@ final class administrator extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: <<<AQL
|
||||||
|
COLLECT x = account OPTIONS { method: "sorted" }
|
||||||
|
AQL,
|
||||||
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['administrators']['page'],
|
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['administrators']['page'],
|
||||||
|
sort: 'x.created DESC, x._key DESC',
|
||||||
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
||||||
|
return: '{account: x}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
|
|
@ -180,12 +180,15 @@ final class market extends core
|
||||||
FILTER account.type == 'market' && b.deleted != true
|
FILTER account.type == 'market' && b.deleted != true
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
|
COLLECT x = account, y = market OPTIONS { method: "sorted" }
|
||||||
AQL,
|
AQL,
|
||||||
empty($filters_before) ? null : "FILTER $filters_before",
|
empty($filters_before) ? null : "FILTER $filters_before",
|
||||||
empty($filters_after) ? null : "FILTER $filters_after"
|
empty($filters_after) ? null : "FILTER $filters_after"
|
||||||
),
|
),
|
||||||
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['markets']['page'],
|
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['markets']['page'],
|
||||||
|
sort: 'x.created DESC, y.created DESC, x._key DESC, y._key DESC',
|
||||||
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
||||||
|
return: '{account: x, market: y}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
|
|
@ -147,8 +147,13 @@ final class operator extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: <<<AQL
|
||||||
|
COLLECT x = account OPTIONS { method: "sorted" }
|
||||||
|
AQL,
|
||||||
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['operators']['page'],
|
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['operators']['page'],
|
||||||
|
sort: 'x.created DESC, x._key DESC',
|
||||||
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
||||||
|
return: '{account: x}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
|
|
@ -34,8 +34,8 @@ final class payments extends core
|
||||||
public function workers(array $parameters = []): void
|
public function workers(array $parameters = []): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->account->status() && ($this->account->type === 'administrator' || $this->account->type === 'operator')) {
|
if ($this->account->status() && ($this->account->type === 'administrator' || ($this->account->type === 'operator' && $this->account->transactions))) {
|
||||||
// Авторизован аккаунт администратора или оператора
|
// Авторизован аккаунт администратора или оператора (с доступом к транзакциям)
|
||||||
|
|
||||||
// Инициализация буфера ошибок
|
// Инициализация буфера ошибок
|
||||||
$this->errors['export'] ??= [];
|
$this->errors['export'] ??= [];
|
||||||
|
@ -119,8 +119,8 @@ final class payments extends core
|
||||||
public function markets(array $parameters = []): void
|
public function markets(array $parameters = []): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->account->status() && ($this->account->type === 'administrator' || $this->account->type === 'operator')) {
|
if ($this->account->status() && ($this->account->type === 'administrator' || ($this->account->type === 'operator' && $this->account->transactions))) {
|
||||||
// Авторизован аккаунт администратора или оператора
|
// Авторизован аккаунт администратора или оператора (с доступом к транзакциям)
|
||||||
|
|
||||||
// Инициализация буфера ошибок
|
// Инициализация буфера ошибок
|
||||||
$this->errors['export'] ??= [];
|
$this->errors['export'] ??= [];
|
||||||
|
@ -204,8 +204,8 @@ final class payments extends core
|
||||||
public function confirm(array $parameters = []): void
|
public function confirm(array $parameters = []): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($this->account->status() && ($this->account->type === 'administrator' || $this->account->type === 'operator')) {
|
if ($this->account->status() && ($this->account->type === 'administrator' || ($this->account->type === 'operator' && $this->account->transactions))) {
|
||||||
// Авторизован аккаунт администратора или оператора
|
// Авторизован аккаунт администратора или оператора (с доступом к транзакциям)
|
||||||
|
|
||||||
// Инициализация буфера ошибок
|
// Инициализация буфера ошибок
|
||||||
$this->errors['confirm'] ??= [];
|
$this->errors['confirm'] ??= [];
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace mirzaev\ebala\controllers;
|
||||||
|
|
||||||
|
// Файлы проекта
|
||||||
|
use mirzaev\ebala\controllers\core,
|
||||||
|
mirzaev\ebala\models\settings as model,
|
||||||
|
mirzaev\ebala\models\core as _core;
|
||||||
|
|
||||||
|
// Библиотека для ArangoDB
|
||||||
|
use ArangoDBClient\Document as _document;
|
||||||
|
|
||||||
|
// System libraries
|
||||||
|
use datetime,
|
||||||
|
datetimezone,
|
||||||
|
exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Контроллер настроек сайта
|
||||||
|
*
|
||||||
|
* @package mirzaev\ebala\controllers
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class settings extends core
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Страница настроек
|
||||||
|
*
|
||||||
|
* @param array $parameters Параметры запроса
|
||||||
|
*/
|
||||||
|
public function index(array $parameters = []): ?string
|
||||||
|
{
|
||||||
|
if ($this->account->status() && $this->account->type === 'administrator') {
|
||||||
|
// Авторизован аккаунт (администратор)
|
||||||
|
|
||||||
|
// Чтение настроек
|
||||||
|
$this->view->settings = model::search(
|
||||||
|
before: 'FILTER setting.category != null'
|
||||||
|
);
|
||||||
|
|
||||||
|
// Генерация представления
|
||||||
|
$main = $this->view->render(DIRECTORY_SEPARATOR . 'pages' . DIRECTORY_SEPARATOR . 'settings.html');
|
||||||
|
|
||||||
|
// Возврат (успех)
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'GET') return $this->view->render(DIRECTORY_SEPARATOR . 'index.html', ['main' => $main]);
|
||||||
|
else if ($_SERVER['REQUEST_METHOD'] === 'POST') return $main;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Возврат (провал)
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Записать
|
||||||
|
*
|
||||||
|
* Записывает (обновляет) в ArangoDB
|
||||||
|
*
|
||||||
|
* @param array $parameters Параметры запроса
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function write(array $parameters = []): void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($this->account->status() && $this->account->type === 'administrator') {
|
||||||
|
// Авторизован аккаунт администратора
|
||||||
|
|
||||||
|
// Инициализация инстанции настройки
|
||||||
|
$setting = model::read('d._key == "' . $parameters['id'] . '"');
|
||||||
|
|
||||||
|
if ($setting instanceof _document) {
|
||||||
|
// Найдена инстанция настройки
|
||||||
|
|
||||||
|
// Запись значения
|
||||||
|
$setting->value = $parameters['value'];
|
||||||
|
|
||||||
|
if (_core::update($setting)) {
|
||||||
|
// Записано в ArangoDB
|
||||||
|
} else throw new exception('Не удалось обновить заявку');
|
||||||
|
} else throw new exception('Не найдена заявка');
|
||||||
|
} else throw new exception('Вы не авторизованы');
|
||||||
|
} catch (exception $e) {
|
||||||
|
// Запись в реестр ошибок
|
||||||
|
$this->errors[] = [
|
||||||
|
'text' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine(),
|
||||||
|
'stack' => $e->getTrace()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -272,8 +272,10 @@ final class task extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: 'COLLECT x = worker, y = market, z = task OPTIONS { method: "sorted" }',
|
||||||
page: (int) $this->session->buffer['worker']['tasks']['page'],
|
page: (int) $this->session->buffer['worker']['tasks']['page'],
|
||||||
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
||||||
|
return: '{task: z, worker: x, market: y}',
|
||||||
binds: ['worker' => account::worker($this->account->getId())?->id] + (empty($search) ? [] : ['search' => $search])
|
binds: ['worker' => account::worker($this->account->getId())?->id] + (empty($search) ? [] : ['search' => $search])
|
||||||
);
|
);
|
||||||
} else if ($_SERVER['INTERFACE'] === 'market') {
|
} else if ($_SERVER['INTERFACE'] === 'market') {
|
||||||
|
@ -288,8 +290,10 @@ final class task extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: 'COLLECT x = worker, y = market, z = task OPTIONS { method: "sorted" }',
|
||||||
page: (int) $this->session->buffer['market']['tasks']['page'],
|
page: (int) $this->session->buffer['market']['tasks']['page'],
|
||||||
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
||||||
|
return: '{task: z, worker: x, market: y}',
|
||||||
binds: ['market' => account::market($this->account->getId())?->id] + (empty($search) ? [] : ['search' => $search])
|
binds: ['market' => account::market($this->account->getId())?->id] + (empty($search) ? [] : ['search' => $search])
|
||||||
);
|
);
|
||||||
} else if ($_SERVER['INTERFACE'] === 'operator') {
|
} else if ($_SERVER['INTERFACE'] === 'operator') {
|
||||||
|
@ -304,8 +308,10 @@ final class task extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: 'COLLECT x = worker, y = market, z = task OPTIONS { method: "sorted" }',
|
||||||
page: (int) $this->session->buffer['operator']['tasks']['page'],
|
page: (int) $this->session->buffer['operator']['tasks']['page'],
|
||||||
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
||||||
|
return: '{task: z, worker: x, market: y}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
@ -322,8 +328,11 @@ final class task extends core
|
||||||
$search_query,
|
$search_query,
|
||||||
empty($filters) ? null : " && ($filters)"
|
empty($filters) ? null : " && ($filters)"
|
||||||
),
|
),
|
||||||
|
after: 'COLLECT x = worker, y = market, z = task OPTIONS { method: "sorted" }',
|
||||||
page: (int) $this->session->buffer['administrator']['tasks']['page'],
|
page: (int) $this->session->buffer['administrator']['tasks']['page'],
|
||||||
|
sort: 'z.date DESC, z.created DESC, z._key DESC, x.created DESC, y.created DESC, x._key DESC, y._key DESC',
|
||||||
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
target: empty($search) ? model::COLLECTION : 'registry_tasks',
|
||||||
|
return: '{task: z, worker: x, market: y}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
@ -632,6 +641,7 @@ final class task extends core
|
||||||
if (($worker = worker::read('d.id == "' . $parameters['worker'] . '" && d.active == true', amount: 1)) instanceof _document) {
|
if (($worker = worker::read('d.id == "' . $parameters['worker'] . '" && d.active == true', amount: 1)) instanceof _document) {
|
||||||
// Найден сотрудник (запрашиваемый для записи сотрудник существует в базе данных)
|
// Найден сотрудник (запрашиваемый для записи сотрудник существует в базе данных)
|
||||||
|
|
||||||
|
if (!$worker->fired) {
|
||||||
if ($task->worker !== $parameters['worker']) {
|
if ($task->worker !== $parameters['worker']) {
|
||||||
// Идентификатор запрашиваемого сотрудника не равен актуальному
|
// Идентификатор запрашиваемого сотрудника не равен актуальному
|
||||||
|
|
||||||
|
@ -675,6 +685,7 @@ final class task extends core
|
||||||
flush();
|
flush();
|
||||||
} else throw new exception('Не удалось записать изменения в базу данных');
|
} else throw new exception('Не удалось записать изменения в базу данных');
|
||||||
} else throw new exception('Сотрудник уже назначен');
|
} else throw new exception('Сотрудник уже назначен');
|
||||||
|
} else throw new exception('Нельзя назначить уволенного сотрудника');
|
||||||
} else throw new exception('Не найден сотрудник');
|
} else throw new exception('Не найден сотрудник');
|
||||||
}
|
}
|
||||||
} else if (!empty($parameters['market'])) {
|
} else if (!empty($parameters['market'])) {
|
||||||
|
@ -869,7 +880,9 @@ final class task extends core
|
||||||
'worker' => 'Сотрудник',
|
'worker' => 'Сотрудник',
|
||||||
default => $key
|
default => $key
|
||||||
},
|
},
|
||||||
'value' => $value
|
'value' => [
|
||||||
|
'id' => $value
|
||||||
|
] + account::read("d._key == \"$value\"", amount: 1)?->name ?? []
|
||||||
];
|
];
|
||||||
else if (match ($key) {
|
else if (match ($key) {
|
||||||
'created', 'updated', 'confirmed', 'hided', 'completed', '_key' => true,
|
'created', 'updated', 'confirmed', 'hided', 'completed', '_key' => true,
|
||||||
|
@ -1234,7 +1247,7 @@ final class task extends core
|
||||||
// Генерация ответа
|
// Генерация ответа
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
'confirmed' => $this->view->rows[0]->task['confirmed'],
|
'confirmed' => $this->view->rows[0]->task['confirmed'] ?? null,
|
||||||
'row' => $this->view->render(DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR . 'tasks.html'),
|
'row' => $this->view->render(DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR . 'tasks.html'),
|
||||||
'errors' => self::parse_only_text($this->errors)
|
'errors' => self::parse_only_text($this->errors)
|
||||||
]
|
]
|
||||||
|
@ -1633,7 +1646,7 @@ final class task extends core
|
||||||
// Генерация ответа
|
// Генерация ответа
|
||||||
echo json_encode(
|
echo json_encode(
|
||||||
[
|
[
|
||||||
'hided' => $this->view->rows[0]->task['hided'],
|
'hided' => $this->view->rows[0]->task['hided'] ?? null,
|
||||||
'row' => $this->view->render(DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR . 'tasks.html'),
|
'row' => $this->view->render(DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR . 'tasks.html'),
|
||||||
'errors' => self::parse_only_text($this->errors)
|
'errors' => self::parse_only_text($this->errors)
|
||||||
]
|
]
|
||||||
|
@ -1926,7 +1939,8 @@ final class task extends core
|
||||||
$this->view->works = static::WORKS;
|
$this->view->works = static::WORKS;
|
||||||
|
|
||||||
// Проверка на существование записанной в задаче работы в списке существующих работ и запись об этом в глобальную переменную шаблонизатора
|
// Проверка на существование записанной в задаче работы в списке существующих работ и запись об этом в глобальную переменную шаблонизатора
|
||||||
foreach ($this->view->works as $work) if ($this->view->task->work === $work) $this->view->exist = true;
|
foreach ($this->view->works as $work)
|
||||||
|
if (in_array($work, $this->view->worker->works)) $this->view->exist = true;
|
||||||
|
|
||||||
// Запись заголовков ответа
|
// Запись заголовков ответа
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
@ -1972,7 +1986,8 @@ final class task extends core
|
||||||
$this->view->works = static::WORKS;
|
$this->view->works = static::WORKS;
|
||||||
|
|
||||||
// Проверка на существование записанной в задаче работы в списке существующих работ и запись об этом в глобальную переменную шаблонизатора
|
// Проверка на существование записанной в задаче работы в списке существующих работ и запись об этом в глобальную переменную шаблонизатора
|
||||||
foreach ($this->view->works as $work) if ($this->view->worker->work === $work) $this->view->exist = true;
|
foreach ($this->view->works as $work)
|
||||||
|
if (in_array($work, $this->view->worker->works)) $this->view->exist = true;
|
||||||
|
|
||||||
// Запись заголовков ответа
|
// Запись заголовков ответа
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
|
|
|
@ -146,58 +146,43 @@ final class worker extends core
|
||||||
? null
|
? null
|
||||||
: <<<AQL
|
: <<<AQL
|
||||||
SEARCH
|
SEARCH
|
||||||
b.commentary IN TOKENS(@search, 'text_ru')
|
a.commentary IN TOKENS(@search, 'text_ru')
|
||||||
|| b.address IN TOKENS(@search, 'text_ru')
|
|| a.address IN TOKENS(@search, 'text_ru')
|
||||||
|| b.passport IN TOKENS(@search, 'text_ru')
|
|| a.passport IN TOKENS(@search, 'text_ru')
|
||||||
|| b.department.address IN TOKENS(@search, 'text_ru')
|
|| a.department.address IN TOKENS(@search, 'text_ru')
|
||||||
|| b.requisites IN TOKENS(@search, 'text_ru')
|
|| a.requisites IN TOKENS(@search, 'text_ru')
|
||||||
|| STARTS_WITH(a._key, @search)
|
|| STARTS_WITH(a._key, @search)
|
||||||
|| STARTS_WITH(a.id, @search)
|
|| STARTS_WITH(a.id, @search)
|
||||||
|| STARTS_WITH(a.name.first, @search)
|
|| STARTS_WITH(a.name.first, @search)
|
||||||
|| STARTS_WITH(a.name.second, @search)
|
|| STARTS_WITH(a.name.second, @search)
|
||||||
|| STARTS_WITH(a.name.last, @search)
|
|| STARTS_WITH(a.name.last, @search)
|
||||||
|| STARTS_WITH(b._key, @search)
|
|| STARTS_WITH(a.address, @search)
|
||||||
|| STARTS_WITH(b.id, @search)
|
|| STARTS_WITH(a.city, @search)
|
||||||
|| STARTS_WITH(b.name.first, @search)
|
|| STARTS_WITH(a.district, @search)
|
||||||
|| STARTS_WITH(b.name.second, @search)
|
|
||||||
|| STARTS_WITH(b.name.last, @search)
|
|
||||||
|| STARTS_WITH(b.address, @search)
|
|
||||||
|| STARTS_WITH(b.city, @search)
|
|
||||||
|| STARTS_WITH(b.district, @search)
|
|
||||||
|| STARTS_WITH(a.number, @search)
|
|| STARTS_WITH(a.number, @search)
|
||||||
|| STARTS_WITH(b.number, @search)
|
|
||||||
|| STARTS_WITH(a.mail, @search)
|
|| STARTS_WITH(a.mail, @search)
|
||||||
|| STARTS_WITH(b.mail, @search)
|
|| STARTS_WITH(a.passport, @search)
|
||||||
|| STARTS_WITH(b.passport, @search)
|
|| STARTS_WITH(a.department.number, @search)
|
||||||
|| STARTS_WITH(b.department.number, @search)
|
|| STARTS_WITH(a.department.address, @search)
|
||||||
|| STARTS_WITH(b.department.address, @search)
|
|| STARTS_WITH(a.requisites, @search)
|
||||||
|| STARTS_WITH(b.requisites, @search)
|
|| STARTS_WITH(a.tax, @search)
|
||||||
|| STARTS_WITH(b.tax, @search)
|
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a._key, TOKENS(@search, 'text_en')[0], 2, true))
|
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a._key, TOKENS(@search, 'text_en')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(a.id, TOKENS(@search, 'text_en')[0], 1, true))
|
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(a.id, TOKENS(@search, 'text_en')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.first, TOKENS(@search, 'text_ru')[0], 2, true))
|
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.first, TOKENS(@search, 'text_ru')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.second, TOKENS(@search, 'text_ru')[0], 2, true))
|
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.second, TOKENS(@search, 'text_ru')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.last, TOKENS(@search, 'text_ru')[0], 2, true))
|
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(a.name.last, TOKENS(@search, 'text_ru')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(b._key, TOKENS(@search, 'text_en')[0], 2, true))
|
|| (LENGTH(@search) > 7 && LEVENSHTEIN_MATCH(a.address, TOKENS(@search, 'text_ru')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(b.id, TOKENS(@search, 'text_en')[0], 1, true))
|
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(a.city, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(b.name.first, TOKENS(@search, 'text_ru')[0], 2, true))
|
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(a.district, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(b.name.second, TOKENS(@search, 'text_ru')[0], 2, true))
|
|
||||||
|| (LENGTH(@search) > 3 && LEVENSHTEIN_MATCH(b.name.last, TOKENS(@search, 'text_ru')[0], 2, true))
|
|
||||||
|| (LENGTH(@search) > 7 && LEVENSHTEIN_MATCH(b.address, TOKENS(@search, 'text_ru')[0], 2, true))
|
|
||||||
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(b.city, TOKENS(@search, 'text_ru')[0], 1, true))
|
|
||||||
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(b.district, TOKENS(@search, 'text_ru')[0], 1, true))
|
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.number, TOKENS(@search, 'text_en')[0], 2, true))
|
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.number, TOKENS(@search, 'text_en')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(b.number, TOKENS(@search, 'text_en')[0], 2, true))
|
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.mail, TOKENS(@search, 'text_en')[0], 2, true))
|
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.mail, TOKENS(@search, 'text_en')[0], 2, true))
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(b.mail, TOKENS(@search, 'text_en')[0], 2, true))
|
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.passport, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(b.passport, TOKENS(@search, 'text_ru')[0], 1, true))
|
|| (LENGTH(@search) > 6 && LEVENSHTEIN_MATCH(a.department.number, TOKENS(@search, 'text_en')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 6 && LEVENSHTEIN_MATCH(b.department.number, TOKENS(@search, 'text_en')[0], 1, true))
|
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(a.department.address, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 5 && LEVENSHTEIN_MATCH(b.department.address, TOKENS(@search, 'text_ru')[0], 1, true))
|
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(a.requisites, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 4 && LEVENSHTEIN_MATCH(b.requisites, TOKENS(@search, 'text_ru')[0], 1, true))
|
|| (LENGTH(@search) > 7 && LEVENSHTEIN_MATCH(a.tax, TOKENS(@search, 'text_ru')[0], 1, true))
|
||||||
|| (LENGTH(@search) > 7 && LEVENSHTEIN_MATCH(b.tax, TOKENS(@search, 'text_ru')[0], 1, true))
|
|
||||||
OPTIONS { collections: ["account", "worker"] }
|
OPTIONS { collections: ["account", "worker"] }
|
||||||
AQL;
|
AQL;;
|
||||||
|
|
||||||
// Инициализация данных для генерации HTML-документа с таблицей
|
// Инициализация данных для генерации HTML-документа с таблицей
|
||||||
$this->view->rows = registry::workers(
|
$this->view->rows = registry::workers(
|
||||||
before: sprintf(
|
before: sprintf(
|
||||||
|
@ -214,12 +199,15 @@ final class worker extends core
|
||||||
FILTER account.type == 'worker' && b.deleted != true
|
FILTER account.type == 'worker' && b.deleted != true
|
||||||
%s
|
%s
|
||||||
%s
|
%s
|
||||||
|
COLLECT x = account, y = worker OPTIONS { method: "sorted" }
|
||||||
AQL,
|
AQL,
|
||||||
empty($filters_before) ? null : "FILTER $filters_before",
|
empty($filters_before) ? null : "FILTER $filters_before",
|
||||||
empty($filters_after) ? null : "FILTER $filters_after"
|
empty($filters_after) ? null : "FILTER $filters_after"
|
||||||
),
|
),
|
||||||
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['workers']['page'],
|
page: (int) $this->session->buffer[$_SERVER['INTERFACE']]['workers']['page'],
|
||||||
|
sort: 'x.created DESC, y.created DESC, x._key DESC, y._key DESC',
|
||||||
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
target: empty($search) ? account::COLLECTION : 'registry_accounts',
|
||||||
|
return: '{account: x, worker: y}',
|
||||||
binds: empty($search) ? [] : [
|
binds: empty($search) ? [] : [
|
||||||
'search' => $search
|
'search' => $search
|
||||||
]
|
]
|
||||||
|
@ -280,7 +268,7 @@ final class worker extends core
|
||||||
if (!empty($parameters['requisites']) && $parameters['worker_requisites'][-1] === '.') $parameters['worker_requisites'] .= '.';
|
if (!empty($parameters['requisites']) && $parameters['worker_requisites'][-1] === '.') $parameters['worker_requisites'] .= '.';
|
||||||
if (!empty($parameters['worker_birth'])) $parameters['worker_birth'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_birth'])->getTimestamp();
|
if (!empty($parameters['worker_birth'])) $parameters['worker_birth'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_birth'])->getTimestamp();
|
||||||
if (!empty($parameters['worker_issued'])) $parameters['worker_issued'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_issued'])->getTimestamp();
|
if (!empty($parameters['worker_issued'])) $parameters['worker_issued'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_issued'])->getTimestamp();
|
||||||
if (!empty($parameters['work'])) $parameters['work'] = in_array($parameters['work'], static::WORKS) ? $parameters['work'] : static::WORKS[0];
|
if (!empty($parameters['works'])) $parameters['works'] = in_array($parameters['works'], static::WORKS) ? $parameters['works'] : static::WORKS[0];
|
||||||
if (!empty($parameters['worker_hiring'])) $parameters['worker_hiring'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_hiring'])->getTimestamp();
|
if (!empty($parameters['worker_hiring'])) $parameters['worker_hiring'] = DateTime::createFromFormat('Y-m-d', $parameters['worker_hiring'])->getTimestamp();
|
||||||
|
|
||||||
// Создание аккаунта
|
// Создание аккаунта
|
||||||
|
@ -410,7 +398,7 @@ final class worker extends core
|
||||||
// Авторизован аккаунт администратора или оператора
|
// Авторизован аккаунт администратора или оператора
|
||||||
|
|
||||||
// Инициализация данных сотрудника
|
// Инициализация данных сотрудника
|
||||||
$worker = model::read('d.id == "' . urldecode($parameters['id']) . '"', return: '{ name: d.name, number: d.number, mail: d.mail, birth: d.birth, passport: d.passport, issued: d.issued, department: d.department, requisites: d.requisites, payment: d.payment, tax: d.tax, city: d.city, district: d.district, address: d.address, worl: d.work, hiring: d.hiring}')->getAll();
|
$worker = model::read('d.id == "' . urldecode($parameters['id']) . '"', return: '{ name: d.name, number: d.number, mail: d.mail, birth: d.birth, passport: d.passport, issued: d.issued, department: d.department, requisites: d.requisites, payment: d.payment, tax: d.tax, city: d.city, district: d.district, address: d.address, worl: d.work, hiring: d.hiring, registration: d.registration}')->getAll();
|
||||||
|
|
||||||
if (!empty($worker)) {
|
if (!empty($worker)) {
|
||||||
// Найдены данные сотрудника
|
// Найдены данные сотрудника
|
||||||
|
@ -458,8 +446,12 @@ final class worker extends core
|
||||||
// Универсализация
|
// Универсализация
|
||||||
if (!empty($parameters['birth'])) $parameters['birth'] = DateTime::createFromFormat('Y-m-d', $parameters['birth'])->getTimestamp();
|
if (!empty($parameters['birth'])) $parameters['birth'] = DateTime::createFromFormat('Y-m-d', $parameters['birth'])->getTimestamp();
|
||||||
if (!empty($parameters['issued'])) $parameters['issued'] = DateTime::createFromFormat('Y-m-d', $parameters['issued'])->getTimestamp();
|
if (!empty($parameters['issued'])) $parameters['issued'] = DateTime::createFromFormat('Y-m-d', $parameters['issued'])->getTimestamp();
|
||||||
if (!empty($parameters['work'])) $parameters['work'] = in_array($parameters['work'], static::WORKS) ? $parameters['work'] : static::WORKS[0];
|
|
||||||
if (!empty($parameters['hiring'])) $parameters['hiring'] = DateTime::createFromFormat('Y-m-d', $parameters['hiring'])->getTimestamp();
|
if (!empty($parameters['hiring'])) $parameters['hiring'] = DateTime::createFromFormat('Y-m-d', $parameters['hiring'])->getTimestamp();
|
||||||
|
if (!empty($buffer = explode(':', $parameters['works']))) {
|
||||||
|
$parameters['works'] = [];
|
||||||
|
foreach ($buffer ?? [] as $work)
|
||||||
|
if (in_array($work, static::WORKS)) array_push($parameters['works'], $work);
|
||||||
|
}
|
||||||
|
|
||||||
// Инициализация параметров (перезапись переданными значениями)
|
// Инициализация параметров (перезапись переданными значениями)
|
||||||
if ($parameters['name_first'] !== $worker->name['first']) $worker->name = ['first' => $parameters['name_first']] + $worker->name;
|
if ($parameters['name_first'] !== $worker->name['first']) $worker->name = ['first' => $parameters['name_first']] + $worker->name;
|
||||||
|
@ -480,8 +472,9 @@ final class worker extends core
|
||||||
if ($parameters['city'] !== $worker->city) $worker->city = $parameters['city'];
|
if ($parameters['city'] !== $worker->city) $worker->city = $parameters['city'];
|
||||||
if ($parameters['district'] !== $worker->district) $worker->district = $parameters['district'];
|
if ($parameters['district'] !== $worker->district) $worker->district = $parameters['district'];
|
||||||
if ($parameters['address'] !== $worker->address) $worker->address = $parameters['address'];
|
if ($parameters['address'] !== $worker->address) $worker->address = $parameters['address'];
|
||||||
if ($parameters['work'] !== $worker->work) $worker->work = $parameters['work'];
|
if ($parameters['works'] !== $worker->works) $worker->works = $parameters['works'];
|
||||||
if ($parameters['hiring'] !== $worker->hiring) $worker->hiring = $parameters['hiring'];
|
if ($parameters['hiring'] !== $worker->hiring) $worker->hiring = $parameters['hiring'];
|
||||||
|
if ($parameters['registration'] !== $worker->registration) $worker->registration = $parameters['registration'];
|
||||||
|
|
||||||
if (_core::update($worker)) {
|
if (_core::update($worker)) {
|
||||||
// Записаны данные сотрудника
|
// Записаны данные сотрудника
|
||||||
|
|
|
@ -651,72 +651,8 @@ final class payments extends core
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
match (mb_strtolower($type)) {
|
match (mb_strtolower($type)) {
|
||||||
'market', 'магазин' => match (mb_strtolower($city)) {
|
'market', 'магазин' => settings::read("d.category == 'market_hour' && d.city == '$city' && d.work == '$work'")?->value ?? 0,
|
||||||
'красноярск' => match (mb_strtolower($work)) {
|
'worker', 'сотрудник' => settings::read("d.category == 'worker_hour' && d.city == '$city' && d.work == '$work'")?->value ?? 0,
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 257.07,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 257.07,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 257.07,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 360,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 255.645,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 305,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 305,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
'железногорск', 'сосновоборск', 'тыва' => match (mb_strtolower($work)) {
|
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 263.34,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 263.34,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 263.34,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 360,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 255.645,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 305,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 305,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
'хакасия', 'иркутск' => match (mb_strtolower($work)) {
|
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 245.385,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 245.385,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 245.385,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 360,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 255.645,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 305,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 305,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
'worker', 'сотрудник' => match (mb_strtolower($city)) {
|
|
||||||
'красноярск' => match (mb_strtolower($work)) {
|
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 190.91,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 190.91,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 190.91,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 250,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 177.27,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 250,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 250,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
'железногорск', 'сосновоборск', 'тыва' => match (mb_strtolower($work)) {
|
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 190.91,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 190.91,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 190.91,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 250,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 177.27,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 250,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 250,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
'хакасия', 'иркутск' => match (mb_strtolower($work)) {
|
|
||||||
'cashiers', 'cashier', 'кассиры', 'кассир' => 181.82,
|
|
||||||
'displayers', 'displayer', 'выкладчики', 'выкладчик' => 181.82,
|
|
||||||
'gastronomes', 'gastronome', 'гастрономы', 'гастроном' => 181.82,
|
|
||||||
'brigadiers', 'brigadier', 'бригадиры', 'бригадир' => 250,
|
|
||||||
'loaders', 'loader', 'грузчики', 'грузчик' => 168.18,
|
|
||||||
'loaders_mobile', 'loader_mobile', 'мобильные грузчики', 'мобильный грузчик' => 250,
|
|
||||||
'universals_mobile', 'universal_mobile', 'мобильные универсалы', 'мобильный универсал' => 250,
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
default => 0
|
|
||||||
},
|
|
||||||
default => 0
|
default => 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -730,10 +666,7 @@ final class payments extends core
|
||||||
*/
|
*/
|
||||||
public static function bonus(int $rating): int
|
public static function bonus(int $rating): int
|
||||||
{
|
{
|
||||||
return match ($rating) {
|
return settings::read("d.category == 'worker_bonus' && d.rating == $rating")?->value ?? 0;
|
||||||
5 => 100,
|
|
||||||
default => 0
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -745,11 +678,8 @@ final class payments extends core
|
||||||
*/
|
*/
|
||||||
public static function penalty(int $rating): ?int
|
public static function penalty(int $rating): ?int
|
||||||
{
|
{
|
||||||
return match ($rating) {
|
$penalty = settings::read("d.category == 'worker_penalty' && d.rating == $rating")?->value ?? 0;
|
||||||
3 => -100,
|
|
||||||
2 => -500,
|
return $penalty === 1 ? null : $penalty;
|
||||||
1 => null,
|
|
||||||
default => 0
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,9 @@ final class registry extends core
|
||||||
* @param ?string $after Injection of AQL-code after search of edges
|
* @param ?string $after Injection of AQL-code after search of edges
|
||||||
* @param int $amount Amount of workers
|
* @param int $amount Amount of workers
|
||||||
* @param int $page Offset by amount
|
* @param int $page Offset by amount
|
||||||
|
* @param string $sort Sort
|
||||||
* @param string $target Collection or view name
|
* @param string $target Collection or view name
|
||||||
|
* @param string $return Data for return
|
||||||
* @param array $binds Binds for query
|
* @param array $binds Binds for query
|
||||||
* @param array $errors Errors registry
|
* @param array $errors Errors registry
|
||||||
*
|
*
|
||||||
|
@ -49,6 +51,7 @@ final class registry extends core
|
||||||
int $page = 1,
|
int $page = 1,
|
||||||
string $sort = 'account.created DESC, account._key DESC',
|
string $sort = 'account.created DESC, account._key DESC',
|
||||||
string $target = account::COLLECTION,
|
string $target = account::COLLECTION,
|
||||||
|
string $return = '{account, worker}',
|
||||||
array $binds = [],
|
array $binds = [],
|
||||||
array &$errors = []
|
array &$errors = []
|
||||||
): array {
|
): array {
|
||||||
|
@ -69,14 +72,15 @@ final class registry extends core
|
||||||
%s
|
%s
|
||||||
SORT %s
|
SORT %s
|
||||||
LIMIT %d, %d
|
LIMIT %d, %d
|
||||||
RETURN {account, worker}
|
RETURN %s
|
||||||
AQL,
|
AQL,
|
||||||
$target,
|
$target,
|
||||||
$before,
|
$before,
|
||||||
$after,
|
$after,
|
||||||
$sort,
|
$sort,
|
||||||
--$page <= 0 ? 0 : $amount * $page,
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
$amount
|
$amount,
|
||||||
|
$return
|
||||||
), $binds);
|
), $binds);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
@ -104,6 +108,7 @@ final class registry extends core
|
||||||
* @param int $amount Amount of markets
|
* @param int $amount Amount of markets
|
||||||
* @param int $page Offset by amount
|
* @param int $page Offset by amount
|
||||||
* @param string $target Collection or view name
|
* @param string $target Collection or view name
|
||||||
|
* @param string $return Data for return
|
||||||
* @param array $binds Binds for query
|
* @param array $binds Binds for query
|
||||||
* @param array $errors Errors registry
|
* @param array $errors Errors registry
|
||||||
*
|
*
|
||||||
|
@ -116,6 +121,7 @@ final class registry extends core
|
||||||
int $page = 1,
|
int $page = 1,
|
||||||
string $sort = 'account.created DESC, account._key DESC',
|
string $sort = 'account.created DESC, account._key DESC',
|
||||||
string $target = account::COLLECTION,
|
string $target = account::COLLECTION,
|
||||||
|
string $return = '{account, market}',
|
||||||
array $binds = [],
|
array $binds = [],
|
||||||
array &$errors = []
|
array &$errors = []
|
||||||
): array {
|
): array {
|
||||||
|
@ -136,14 +142,15 @@ final class registry extends core
|
||||||
%s
|
%s
|
||||||
SORT %s
|
SORT %s
|
||||||
LIMIT %d, %d
|
LIMIT %d, %d
|
||||||
RETURN {account, market}
|
RETURN %s
|
||||||
AQL,
|
AQL,
|
||||||
$target,
|
$target,
|
||||||
$before,
|
$before,
|
||||||
$after,
|
$after,
|
||||||
$sort,
|
$sort,
|
||||||
--$page <= 0 ? 0 : $amount * $page,
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
$amount
|
$amount,
|
||||||
|
$return
|
||||||
), $binds);
|
), $binds);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
@ -167,9 +174,11 @@ final class registry extends core
|
||||||
* Generate operators list
|
* Generate operators list
|
||||||
*
|
*
|
||||||
* @param ?string $before Injection of AQL-code before search of edges
|
* @param ?string $before Injection of AQL-code before search of edges
|
||||||
|
* @param ?string $after Injection of AQL-code after search of edges
|
||||||
* @param int $amount Amount of operators
|
* @param int $amount Amount of operators
|
||||||
* @param int $page Offset by amount
|
* @param int $page Offset by amount
|
||||||
* @param string $target Collection or view name
|
* @param string $target Collection or view name
|
||||||
|
* @param string $return Data for return
|
||||||
* @param array $binds Binds for query
|
* @param array $binds Binds for query
|
||||||
* @param array $errors Errors registry
|
* @param array $errors Errors registry
|
||||||
*
|
*
|
||||||
|
@ -177,10 +186,12 @@ final class registry extends core
|
||||||
*/
|
*/
|
||||||
public static function operators(
|
public static function operators(
|
||||||
?string $before = '',
|
?string $before = '',
|
||||||
|
?string $after = '',
|
||||||
int $amount = 100,
|
int $amount = 100,
|
||||||
int $page = 1,
|
int $page = 1,
|
||||||
string $sort = 'account.created DESC, account._key DESC',
|
string $sort = 'account.created DESC, account._key DESC',
|
||||||
string $target = account::COLLECTION,
|
string $target = account::COLLECTION,
|
||||||
|
string $return = '{account}',
|
||||||
array $binds = [],
|
array $binds = [],
|
||||||
array &$errors = []
|
array &$errors = []
|
||||||
): array {
|
): array {
|
||||||
|
@ -192,16 +203,19 @@ final class registry extends core
|
||||||
$operators = collection::search(static::$arangodb->session, sprintf(
|
$operators = collection::search(static::$arangodb->session, sprintf(
|
||||||
<<<AQL
|
<<<AQL
|
||||||
FOR account IN %s
|
FOR account IN %s
|
||||||
|
%s
|
||||||
%s
|
%s
|
||||||
SORT %s
|
SORT %s
|
||||||
LIMIT %d, %d
|
LIMIT %d, %d
|
||||||
RETURN {account}
|
RETURN %s
|
||||||
AQL,
|
AQL,
|
||||||
$target,
|
$target,
|
||||||
$before,
|
$before,
|
||||||
|
$after,
|
||||||
$sort,
|
$sort,
|
||||||
--$page <= 0 ? 0 : $amount * $page,
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
$amount
|
$amount,
|
||||||
|
$return
|
||||||
), $binds);
|
), $binds);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
@ -225,9 +239,11 @@ final class registry extends core
|
||||||
* Generate administrators list
|
* Generate administrators list
|
||||||
*
|
*
|
||||||
* @param ?string $before Injection of AQL-code before search of edges
|
* @param ?string $before Injection of AQL-code before search of edges
|
||||||
|
* @param ?string $after Injection of AQL-code after search of edges
|
||||||
* @param int $amount Amount of administrators
|
* @param int $amount Amount of administrators
|
||||||
* @param int $page Offset by amount
|
* @param int $page Offset by amount
|
||||||
* @param string $target Collection or view name
|
* @param string $target Collection or view name
|
||||||
|
* @param string $return Data for return
|
||||||
* @param array $binds Binds for query
|
* @param array $binds Binds for query
|
||||||
* @param array $errors Errors registry
|
* @param array $errors Errors registry
|
||||||
*
|
*
|
||||||
|
@ -235,10 +251,12 @@ final class registry extends core
|
||||||
*/
|
*/
|
||||||
public static function administrators(
|
public static function administrators(
|
||||||
?string $before = '',
|
?string $before = '',
|
||||||
|
?string $after = '',
|
||||||
int $amount = 100,
|
int $amount = 100,
|
||||||
int $page = 1,
|
int $page = 1,
|
||||||
string $sort = 'account.created DESC, account._key DESC',
|
string $sort = 'account.created DESC, account._key DESC',
|
||||||
string $target = account::COLLECTION,
|
string $target = account::COLLECTION,
|
||||||
|
string $return = '{account}',
|
||||||
array $binds = [],
|
array $binds = [],
|
||||||
array &$errors = []
|
array &$errors = []
|
||||||
): array {
|
): array {
|
||||||
|
@ -250,16 +268,19 @@ final class registry extends core
|
||||||
$administrators = collection::search(static::$arangodb->session, sprintf(
|
$administrators = collection::search(static::$arangodb->session, sprintf(
|
||||||
<<<AQL
|
<<<AQL
|
||||||
FOR account IN %s
|
FOR account IN %s
|
||||||
|
%s
|
||||||
%s
|
%s
|
||||||
SORT %s
|
SORT %s
|
||||||
LIMIT %d, %d
|
LIMIT %d, %d
|
||||||
RETURN {account}
|
RETURN %s
|
||||||
AQL,
|
AQL,
|
||||||
$target,
|
$target,
|
||||||
$before,
|
$before,
|
||||||
|
$after,
|
||||||
$sort,
|
$sort,
|
||||||
--$page <= 0 ? 0 : $amount * $page,
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
$amount
|
$amount,
|
||||||
|
$return
|
||||||
), $binds);
|
), $binds);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
@ -273,7 +294,6 @@ final class registry extends core
|
||||||
'line' => $e->getLine(),
|
'line' => $e->getLine(),
|
||||||
'stack' => $e->getTrace()
|
'stack' => $e->getTrace()
|
||||||
];
|
];
|
||||||
var_dump($errors);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace mirzaev\ebala\models;
|
||||||
|
|
||||||
|
// Project files
|
||||||
|
use mirzaev\ebala\models\traits\instance,
|
||||||
|
mirzaev\ebala\models\traits\status,
|
||||||
|
mirzaev\ebala\models\account,
|
||||||
|
mirzaev\ebala\models\worker,
|
||||||
|
mirzaev\ebala\models\market;
|
||||||
|
|
||||||
|
// Библиотека для ArangoDB
|
||||||
|
use ArangoDBClient\Document as _document;
|
||||||
|
|
||||||
|
// Фреймворк ArangoDB
|
||||||
|
use mirzaev\arangodb\collection,
|
||||||
|
mirzaev\arangodb\document;
|
||||||
|
|
||||||
|
// Встроенные библиотеки
|
||||||
|
use exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Модель настроек
|
||||||
|
*
|
||||||
|
* Управляет записью и чтением настроек сайта из ArangoDB
|
||||||
|
*
|
||||||
|
* @package mirzaev\ebala\models
|
||||||
|
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
|
||||||
|
*/
|
||||||
|
final class settings extends core
|
||||||
|
{
|
||||||
|
use instance, status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection name in ArangoDB
|
||||||
|
*/
|
||||||
|
final public const COLLECTION = 'settings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Инстанция документа в базе данных
|
||||||
|
*/
|
||||||
|
protected readonly _document $document;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read (search)
|
||||||
|
*
|
||||||
|
* @param ?string $before Injection of AQL-code before search of edges
|
||||||
|
* @param int $amount Amount of administrators
|
||||||
|
* @param int $page Offset by amount
|
||||||
|
* @param string $target Collection or view name
|
||||||
|
* @param array $binds Binds for query
|
||||||
|
* @param array $errors Errors registry
|
||||||
|
*
|
||||||
|
* @return array Instances from ArangoDB
|
||||||
|
*/
|
||||||
|
public static function search(
|
||||||
|
?string $before = '',
|
||||||
|
int $amount = 1000,
|
||||||
|
int $page = 1,
|
||||||
|
string $sort = 'setting.category ASC, setting.city ASC, setting.work ASC, setting.rating DESC, setting.created DESC, setting._key DESC',
|
||||||
|
string $target = settings::COLLECTION,
|
||||||
|
array $binds = [],
|
||||||
|
array &$errors = []
|
||||||
|
): array {
|
||||||
|
try {
|
||||||
|
if (collection::init(static::$arangodb->session, settings::COLLECTION)) {
|
||||||
|
// Инициализирована коллекция
|
||||||
|
|
||||||
|
// Search the session data in ArangoDB
|
||||||
|
$settings = collection::search(static::$arangodb->session, sprintf(
|
||||||
|
<<<AQL
|
||||||
|
FOR setting IN %s
|
||||||
|
%s
|
||||||
|
SORT %s
|
||||||
|
LIMIT %d, %d
|
||||||
|
LET d = setting.category
|
||||||
|
COLLECT x = setting.category INTO groups
|
||||||
|
RETURN { [x]: groups[*]['setting'] }
|
||||||
|
AQL,
|
||||||
|
$target,
|
||||||
|
$before,
|
||||||
|
$sort,
|
||||||
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
|
$amount
|
||||||
|
), $binds);
|
||||||
|
|
||||||
|
// Универсализация значений
|
||||||
|
$buffer = [];
|
||||||
|
foreach (is_array($settings) ? $settings : [$settings] as $setting) foreach ($setting->getAll() ?? [] as $category => $data) $buffer[$category] = $data;
|
||||||
|
$settings = $buffer;
|
||||||
|
|
||||||
|
// Exit (success)
|
||||||
|
return $settings;
|
||||||
|
} else throw new exception('Не удалось инициализировать коллекции');
|
||||||
|
} catch (exception $e) {
|
||||||
|
// Write to the errors registry
|
||||||
|
$errors[] = [
|
||||||
|
'text' => $e->getMessage(),
|
||||||
|
'file' => $e->getFile(),
|
||||||
|
'line' => $e->getLine(),
|
||||||
|
'stack' => $e->getTrace()
|
||||||
|
];
|
||||||
|
var_dump($errors);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exit (fail)
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
|
@ -118,6 +118,7 @@ final class task extends core
|
||||||
* @param int $amount Amount of tasks
|
* @param int $amount Amount of tasks
|
||||||
* @param int $page Offset by amount
|
* @param int $page Offset by amount
|
||||||
* @param string $target Collection or view name
|
* @param string $target Collection or view name
|
||||||
|
* @param string $return Data for return
|
||||||
* @param array $binds Binds for query
|
* @param array $binds Binds for query
|
||||||
* @param array $errors Errors registry
|
* @param array $errors Errors registry
|
||||||
*
|
*
|
||||||
|
@ -133,6 +134,7 @@ final class task extends core
|
||||||
int $page = 1,
|
int $page = 1,
|
||||||
string $sort = 'task.date DESC, task.created DESC, task._key DESC',
|
string $sort = 'task.date DESC, task.created DESC, task._key DESC',
|
||||||
string $target = self::COLLECTION,
|
string $target = self::COLLECTION,
|
||||||
|
string $return = '{task, worker, market}',
|
||||||
array $binds = [],
|
array $binds = [],
|
||||||
array &$errors = []
|
array &$errors = []
|
||||||
): array {
|
): array {
|
||||||
|
@ -154,7 +156,7 @@ final class task extends core
|
||||||
%s
|
%s
|
||||||
SORT %s
|
SORT %s
|
||||||
LIMIT %d, %d
|
LIMIT %d, %d
|
||||||
RETURN {task, worker, market}
|
RETURN %s
|
||||||
AQL,
|
AQL,
|
||||||
$target,
|
$target,
|
||||||
$before,
|
$before,
|
||||||
|
@ -163,7 +165,8 @@ final class task extends core
|
||||||
$after,
|
$after,
|
||||||
$sort,
|
$sort,
|
||||||
--$page <= 0 ? 0 : $amount * $page,
|
--$page <= 0 ? 0 : $amount * $page,
|
||||||
$amount
|
$amount,
|
||||||
|
$return
|
||||||
), $binds);
|
), $binds);
|
||||||
|
|
||||||
// Exit (success)
|
// Exit (success)
|
||||||
|
@ -291,5 +294,4 @@ final class task extends core
|
||||||
// Exit (fail)
|
// Exit (fail)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,8 @@ input[type="range"] {
|
||||||
|
|
||||||
button,
|
button,
|
||||||
input[type="submit"],
|
input[type="submit"],
|
||||||
input[type="range"] {
|
input[type="range"],
|
||||||
|
input[type="checkbox"] {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,3 +59,19 @@ section#operators.panel.list > div.row > span[data-column="commentary"] {
|
||||||
min-width: unset;
|
min-width: unset;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section#operators.panel.list>div.row[data-row="operator"]:not(:nth-of-type(1)).transactions {
|
||||||
|
--background: var(--magma);
|
||||||
|
}
|
||||||
|
|
||||||
|
section#operators.panel.list>div.row[data-row="operator"]:not(:nth-of-type(1)):nth-child(2n + 1).transactions {
|
||||||
|
--background: var(--magma-above);
|
||||||
|
}
|
||||||
|
|
||||||
|
section#operators.panel.list>div.row[data-row="operator"]:not(:nth-of-type(1)).transactions>span:is(.important, .interactive:is(:hover, :focus)) {
|
||||||
|
--background: var(--magma-important);
|
||||||
|
}
|
||||||
|
|
||||||
|
section#operators.panel.list>div.row[data-row="operator"]:not(:nth-of-type(1)):nth-child(2n + 1).transactions>span:is(.important, .interactive:is(:hover, :focus)) {
|
||||||
|
--background: var(--magma-important-above);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
@charset "UTF-8";
|
||||||
|
|
||||||
|
main>section#settings.panel {
|
||||||
|
z-index: 1000;
|
||||||
|
width: 800px;
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: calc(15vh - 45px);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 60px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 20px;
|
||||||
|
padding: 30px 40px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: var(--snow);
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>div {
|
||||||
|
padding-bottom: 6px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>div>div {
|
||||||
|
margin: 0;
|
||||||
|
margin-left: 30px;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>div>div>h2 {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>div>div>i {
|
||||||
|
position: relative;
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>div>small {
|
||||||
|
margin-left: 20px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>section.subcategory {
|
||||||
|
padding: 20px 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
border-radius: 3px;
|
||||||
|
background-color: var(--snow-deep);
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>section.subcategory>h3 {
|
||||||
|
margin: 6px 0px 3px 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>section.subcategory>label>input {
|
||||||
|
width: 90px;
|
||||||
|
}
|
||||||
|
|
||||||
|
main>section#settings.panel>section.category>section.subcategory>p.empty {
|
||||||
|
text-align: center;
|
||||||
|
padding: 0 20%;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
|
@ -141,6 +141,25 @@ div#popup>section.list>section.main>div.column>:is(div, section).row>label>input
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div#popup>section.list>section.main>div.column> :is(div, select).row:has(>label>select[multiple]) {
|
||||||
|
height: auto;
|
||||||
|
max-height: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#popup>section.list>section.main>div.column> :is(div, select).row>label>select[multiple] {
|
||||||
|
height: auto;
|
||||||
|
padding: 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div#popup>section.list>section.main>div.column> :is(div, select).row>label>select[multiple]>option {
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* div#popup>section.list>section.main>div.column> :is(div, select).row>label>select[multiple]>option[selected] {
|
||||||
|
background-color: var(--background-above-5);
|
||||||
|
} */
|
||||||
|
|
||||||
div#popup>section.list>section.main>div.column>:is(div, section).row>label> :is(input, button):only-child {
|
div#popup>section.list>section.main>div.column>:is(div, section).row>label> :is(input, button):only-child {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
@ -297,7 +316,7 @@ div#popup>section.list.errors>section.body>dl>dd {
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
div#popup > section.list .separator {
|
div#popup>section.list .separator {
|
||||||
border-top: 2px solid var(--separator, var(--cloud));
|
border-top: 2px solid var(--separator, var(--cloud));
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
|
|
@ -65,8 +65,6 @@ $router->write('/administrators', 'administrator', 'index', 'GET');
|
||||||
$router->write('/administrators', 'administrator', 'index', 'POST');
|
$router->write('/administrators', 'administrator', 'index', 'POST');
|
||||||
$router->write('/administrators/read', 'administrator', 'read', 'POST');
|
$router->write('/administrators/read', 'administrator', 'read', 'POST');
|
||||||
$router->write('/administrators/create', 'administrator', 'create', 'POST');
|
$router->write('/administrators/create', 'administrator', 'create', 'POST');
|
||||||
$router->write('/settings', 'settings', 'index', 'GET');
|
|
||||||
$router->write('/settings', 'settings', 'index', 'POST');
|
|
||||||
$router->write('/$id', 'account', 'index', 'GET');
|
$router->write('/$id', 'account', 'index', 'GET');
|
||||||
$router->write('/$id', 'account', 'index', 'POST');
|
$router->write('/$id', 'account', 'index', 'POST');
|
||||||
$router->write('/$id/fields', 'account', 'fields', 'POST');
|
$router->write('/$id/fields', 'account', 'fields', 'POST');
|
||||||
|
@ -107,6 +105,9 @@ $router->write('/elements/menu', 'index', 'menu', 'POST');
|
||||||
$router->write('/payments/workers', 'payments', 'workers', 'POST');
|
$router->write('/payments/workers', 'payments', 'workers', 'POST');
|
||||||
$router->write('/payments/markets', 'payments', 'markets', 'POST');
|
$router->write('/payments/markets', 'payments', 'markets', 'POST');
|
||||||
$router->write('/payments/confirm/$type', 'payments', 'confirm', 'POST');
|
$router->write('/payments/confirm/$type', 'payments', 'confirm', 'POST');
|
||||||
|
$router->write('/settings', 'settings', 'index', 'GET');
|
||||||
|
$router->write('/settings', 'settings', 'index', 'POST');
|
||||||
|
$router->write('/settings/$id/write', 'settings', 'write', 'POST');
|
||||||
|
|
||||||
// Инициализация ядра
|
// Инициализация ядра
|
||||||
$core = new core(namespace: __NAMESPACE__, router: $router, controller: new controller(false), model: new model(false));
|
$core = new core(namespace: __NAMESPACE__, router: $router, controller: new controller(false), model: new model(false));
|
||||||
|
|
|
@ -23,6 +23,11 @@ if (typeof window.core !== "function") {
|
||||||
: (this.subdomain === "xn--80aalqawikqchmc"
|
: (this.subdomain === "xn--80aalqawikqchmc"
|
||||||
? "administrator"
|
? "administrator"
|
||||||
: "worker")));
|
: "worker")));
|
||||||
|
|
||||||
|
static numbers(e) {
|
||||||
|
const c = (e.which) ? e.which : e.keyCode;
|
||||||
|
return !(c !== 46 && c !== 44 && c > 31 && (c < 48 || c > 57));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3261,3 +3261,7 @@
|
||||||
}));
|
}));
|
||||||
//# sourceMappingURL=imask.js.map
|
//# sourceMappingURL=imask.js.map
|
||||||
|
|
||||||
|
// Вызов события: "инициализировано"
|
||||||
|
document.dispatchEvent(
|
||||||
|
new CustomEvent("imask.initialized"),
|
||||||
|
);
|
||||||
|
|
|
@ -176,6 +176,13 @@ if (typeof window.loader !== "function") {
|
||||||
})
|
})
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
// Write path in history
|
||||||
|
history.pushState(this.storage, "/settings", "/settings");
|
||||||
|
|
||||||
|
// Write path to the current directory buffer
|
||||||
|
core.page = 'settings';
|
||||||
|
|
||||||
|
// Write content in document
|
||||||
document.body.getElementsByTagName("main")[0].innerHTML = data;
|
document.body.getElementsByTagName("main")[0].innerHTML = data;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ if (typeof window.operators !== "function") {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Обновить администратора (вызов демпфера)
|
* Обновить оператора (вызов демпфера)
|
||||||
*
|
*
|
||||||
* @param {HTMLElement} row Строка <div>
|
* @param {HTMLElement} row Строка <div>
|
||||||
* @param {HTMLElement} button Кнопка <button>
|
* @param {HTMLElement} button Кнопка <button>
|
||||||
|
@ -122,6 +122,7 @@ if (typeof window.operators !== "function") {
|
||||||
* @param {HTMLElement} account_mail Почта аккаунта<input>
|
* @param {HTMLElement} account_mail Почта аккаунта<input>
|
||||||
* @param {HTMLElement} account_password Пароль аккаунта <input>
|
* @param {HTMLElement} account_password Пароль аккаунта <input>
|
||||||
* @param {HTMLElement} account_commentary Комментарий аккаунта <textarea>
|
* @param {HTMLElement} account_commentary Комментарий аккаунта <textarea>
|
||||||
|
* @param {HTMLElement} account_transactions Предоставить доступ к транзакциям? <checkbox>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
|
@ -135,6 +136,7 @@ if (typeof window.operators !== "function") {
|
||||||
account_mail,
|
account_mail,
|
||||||
account_password,
|
account_password,
|
||||||
account_commentary,
|
account_commentary,
|
||||||
|
account_transactions
|
||||||
) {
|
) {
|
||||||
// Блокировка полей ввода
|
// Блокировка полей ввода
|
||||||
account_name_first.setAttribute("readonly", true);
|
account_name_first.setAttribute("readonly", true);
|
||||||
|
@ -144,6 +146,7 @@ if (typeof window.operators !== "function") {
|
||||||
account_mail.setAttribute("readonly", true);
|
account_mail.setAttribute("readonly", true);
|
||||||
account_password.setAttribute("readonly", true);
|
account_password.setAttribute("readonly", true);
|
||||||
account_commentary.setAttribute("readonly", true);
|
account_commentary.setAttribute("readonly", true);
|
||||||
|
account_transactions.setAttribute("readonly", true);
|
||||||
|
|
||||||
// Блокировка кнопки
|
// Блокировка кнопки
|
||||||
button.setAttribute("disabled", true);
|
button.setAttribute("disabled", true);
|
||||||
|
@ -159,11 +162,12 @@ if (typeof window.operators !== "function") {
|
||||||
account_mail,
|
account_mail,
|
||||||
account_password,
|
account_password,
|
||||||
account_commentary,
|
account_commentary,
|
||||||
|
account_transactions
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Обновить администратора (демпфер)
|
* Обновить оператора (демпфер)
|
||||||
*
|
*
|
||||||
* @param {HTMLElement} row Строка <div>
|
* @param {HTMLElement} row Строка <div>
|
||||||
* @param {HTMLElement} button Кнопка <button>
|
* @param {HTMLElement} button Кнопка <button>
|
||||||
|
@ -174,6 +178,7 @@ if (typeof window.operators !== "function") {
|
||||||
* @param {HTMLElement} account_mail Почта аккаунта<input>
|
* @param {HTMLElement} account_mail Почта аккаунта<input>
|
||||||
* @param {HTMLElement} account_password Пароль аккаунта <input>
|
* @param {HTMLElement} account_password Пароль аккаунта <input>
|
||||||
* @param {HTMLElement} account_commentary Комментарий аккаунта <textarea>
|
* @param {HTMLElement} account_commentary Комментарий аккаунта <textarea>
|
||||||
|
* @param {HTMLElement} account_transactions Предоставить доступ к транзакциям? <checkbox>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
|
@ -188,6 +193,7 @@ if (typeof window.operators !== "function") {
|
||||||
account_mail,
|
account_mail,
|
||||||
account_password,
|
account_password,
|
||||||
account_commentary,
|
account_commentary,
|
||||||
|
account_transactions
|
||||||
) => {
|
) => {
|
||||||
// Инициализация функции разблокировки
|
// Инициализация функции разблокировки
|
||||||
function unblock() {
|
function unblock() {
|
||||||
|
@ -199,6 +205,7 @@ if (typeof window.operators !== "function") {
|
||||||
account_mail.removeAttribute("readonly");
|
account_mail.removeAttribute("readonly");
|
||||||
account_password.removeAttribute("readonly");
|
account_password.removeAttribute("readonly");
|
||||||
account_commentary.removeAttribute("readonly");
|
account_commentary.removeAttribute("readonly");
|
||||||
|
account_transactions.removeAttribute("readonly");
|
||||||
|
|
||||||
// Разблокировка кнопки
|
// Разблокировка кнопки
|
||||||
button.removeAttribute("disabled");
|
button.removeAttribute("disabled");
|
||||||
|
@ -220,7 +227,7 @@ if (typeof window.operators !== "function") {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
},
|
},
|
||||||
body:
|
body:
|
||||||
`name_first=${account_name_first.value}&name_second=${account_name_second.value}&name_last=${account_name_last.value}&number=${account_number.mask.unmaskedValue}&mail=${account_mail.value}&password=${account_password.value}&commentary=${account_commentary.value}`,
|
`name_first=${account_name_first.value}&name_second=${account_name_second.value}&name_last=${account_name_last.value}&number=${account_number.mask.unmaskedValue}&mail=${account_mail.value}&password=${account_password.value}&commentary=${account_commentary.value}&transactions=${account_transactions.checked}`,
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
@ -574,6 +581,34 @@ if (typeof window.operators !== "function") {
|
||||||
);
|
);
|
||||||
account_commentary_textarea.value = data.commentary ?? "";
|
account_commentary_textarea.value = data.commentary ?? "";
|
||||||
|
|
||||||
|
// Инициализация строки
|
||||||
|
const account_transactions = document.createElement("div");
|
||||||
|
account_commentary.classList.add("row");
|
||||||
|
|
||||||
|
// Инициализация оболочки для строки
|
||||||
|
const account_transactions_label = document.createElement("label");
|
||||||
|
account_commentary_label.setAttribute("id", "account_transactions");
|
||||||
|
|
||||||
|
// Инициализация заголовка для поля ввода
|
||||||
|
const account_transactions_title = document.createElement("b");
|
||||||
|
account_transactions_title.classList.add(
|
||||||
|
"separated",
|
||||||
|
"right",
|
||||||
|
"unselectable",
|
||||||
|
);
|
||||||
|
account_transactions_title.innerText = "Транзакции:";
|
||||||
|
|
||||||
|
// Инициализация поля ввода
|
||||||
|
const account_transactions_input = document.createElement(
|
||||||
|
"input",
|
||||||
|
);
|
||||||
|
account_transactions_input.setAttribute('type', 'checkbox');
|
||||||
|
account_transactions_input.setAttribute(
|
||||||
|
"title",
|
||||||
|
"Предоставить аккаунту доступ к выплатам?",
|
||||||
|
);
|
||||||
|
if (data.transactions) account_transactions_input.setAttribute('checked', 'true');
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const account_buttons = document.createElement("div");
|
const account_buttons = document.createElement("div");
|
||||||
account_buttons.classList.add("row", "divided", "buttons");
|
account_buttons.classList.add("row", "divided", "buttons");
|
||||||
|
@ -667,6 +702,11 @@ if (typeof window.operators !== "function") {
|
||||||
account_commentary.appendChild(account_commentary_label);
|
account_commentary.appendChild(account_commentary_label);
|
||||||
account.appendChild(account_commentary);
|
account.appendChild(account_commentary);
|
||||||
|
|
||||||
|
account_transactions_label.appendChild(account_transactions_title);
|
||||||
|
account_transactions_label.appendChild(account_transactions_input);
|
||||||
|
account_transactions.appendChild(account_transactions_label);
|
||||||
|
account.appendChild(account_transactions);
|
||||||
|
|
||||||
account_buttons.appendChild(account_update_button);
|
account_buttons.appendChild(account_update_button);
|
||||||
account_buttons.appendChild(account_delete_button);
|
account_buttons.appendChild(account_delete_button);
|
||||||
account.appendChild(account_buttons);
|
account.appendChild(account_buttons);
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
if (typeof window.settings !== "function") {
|
||||||
|
// Not initialized
|
||||||
|
|
||||||
|
// Initialize of the class in global namespace
|
||||||
|
window.settings = class settings {
|
||||||
|
/**
|
||||||
|
* Записать (дампер)
|
||||||
|
*
|
||||||
|
* Отправляет запрос на сервер для записи в ArangoDB
|
||||||
|
*
|
||||||
|
* @param {string|number} id Идентификатор (_key)
|
||||||
|
* @param {string} value Значение
|
||||||
|
*
|
||||||
|
* @return {void}
|
||||||
|
*/
|
||||||
|
static write = damper((id, value) => {
|
||||||
|
if (
|
||||||
|
(typeof id === "string" || typeof id === "number") && typeof value === "string" && value.length > 0
|
||||||
|
) {
|
||||||
|
// Получены все обязательные аргументы
|
||||||
|
|
||||||
|
// Запрос к серверу
|
||||||
|
fetch(`/settings/${id}/write`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
|
},
|
||||||
|
body: `value=${value}`,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 400);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Вызов события: "инициализировано"
|
||||||
|
document.dispatchEvent(
|
||||||
|
new CustomEvent("settings.initialized", {
|
||||||
|
detail: { settings: window.settings },
|
||||||
|
}),
|
||||||
|
);
|
|
@ -2245,7 +2245,7 @@ if (typeof window.tasks !== "function") {
|
||||||
complete.innerText = "Завершить";
|
complete.innerText = "Завершить";
|
||||||
complete.setAttribute(
|
complete.setAttribute(
|
||||||
"onclick",
|
"onclick",
|
||||||
`tasks.complete(this, this.parentElement.previousElementSibling.previousElementSibling.previousElementSibling.children[0], this.parentElement.previousElementSibling.previousElementSibling, document.getElementById('${task}'))`
|
`tasks.complete(this, this.parentElement.previousElementSibling.previousElementSibling.children[0], this.parentElement.previousElementSibling, document.getElementById('${task}'))`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Инициализация окна с ошибками
|
// Инициализация окна с ошибками
|
||||||
|
|
|
@ -131,8 +131,9 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
|
* @param {HTMLElement} worker_registration Тип регистрации <select>
|
||||||
* @param {HTMLElement} account_name_first Имя аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_first Имя аккаунта сотрудника <input>
|
||||||
* @param {HTMLElement} account_name_second Фамилия аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_second Фамилия аккаунта сотрудника <input>
|
||||||
* @param {HTMLElement} account_name_last Отчество/Матчество аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_last Отчество/Матчество аккаунта сотрудника <input>
|
||||||
|
@ -162,8 +163,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
account_name_first,
|
account_name_first,
|
||||||
account_name_second,
|
account_name_second,
|
||||||
account_name_last,
|
account_name_last,
|
||||||
|
@ -190,8 +192,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.setAttribute("readonly", true);
|
worker_city.setAttribute("readonly", true);
|
||||||
worker_district.setAttribute("readonly", true);
|
worker_district.setAttribute("readonly", true);
|
||||||
worker_address.setAttribute("readonly", true);
|
worker_address.setAttribute("readonly", true);
|
||||||
worker_work.setAttribute("readonly", true);
|
worker_works.setAttribute("readonly", true);
|
||||||
worker_hiring.setAttribute("readonly", true);
|
worker_hiring.setAttribute("readonly", true);
|
||||||
|
worker_registration.setAttribute("readonly", true);
|
||||||
account_name_first.setAttribute("readonly", true);
|
account_name_first.setAttribute("readonly", true);
|
||||||
account_name_second.setAttribute("readonly", true);
|
account_name_second.setAttribute("readonly", true);
|
||||||
account_name_last.setAttribute("readonly", true);
|
account_name_last.setAttribute("readonly", true);
|
||||||
|
@ -223,8 +226,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
account_name_first,
|
account_name_first,
|
||||||
account_name_second,
|
account_name_second,
|
||||||
account_name_last,
|
account_name_last,
|
||||||
|
@ -256,8 +260,9 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
|
* @param {HTMLElement} worker_registration Тип регистрации <select>
|
||||||
* @param {HTMLElement} account_name_first Имя аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_first Имя аккаунта сотрудника <input>
|
||||||
* @param {HTMLElement} account_name_second Фамилия аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_second Фамилия аккаунта сотрудника <input>
|
||||||
* @param {HTMLElement} account_name_last Отчество/Матчество аккаунта сотрудника <input>
|
* @param {HTMLElement} account_name_last Отчество/Матчество аккаунта сотрудника <input>
|
||||||
|
@ -288,8 +293,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
account_name_first,
|
account_name_first,
|
||||||
account_name_second,
|
account_name_second,
|
||||||
account_name_last,
|
account_name_last,
|
||||||
|
@ -318,8 +324,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.removeAttribute("readonly");
|
worker_city.removeAttribute("readonly");
|
||||||
worker_district.removeAttribute("readonly");
|
worker_district.removeAttribute("readonly");
|
||||||
worker_address.removeAttribute("readonly");
|
worker_address.removeAttribute("readonly");
|
||||||
worker_work.removeAttribute("readonly");
|
worker_works.removeAttribute("readonly");
|
||||||
worker_hiring.removeAttribute("readonly");
|
worker_hiring.removeAttribute("readonly");
|
||||||
|
worker_registration.removeAttribute("readonly");
|
||||||
account_name_first.removeAttribute("readonly");
|
account_name_first.removeAttribute("readonly");
|
||||||
account_name_second.removeAttribute("readonly");
|
account_name_second.removeAttribute("readonly");
|
||||||
account_name_last.removeAttribute("readonly");
|
account_name_last.removeAttribute("readonly");
|
||||||
|
@ -345,7 +352,7 @@ if (typeof window.workers !== "function") {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
},
|
},
|
||||||
body:
|
body:
|
||||||
`worker_name_first=${worker_name_first.value}&worker_name_second=${worker_name_second.value}&worker_name_last=${worker_name_last.value}&worker_number=${worker_number.mask.unmaskedValue}&worker_mail=${worker_mail.value}&worker_id=${worker_id.value}&worker_birth=${worker_birth.value}&worker_birth=${worker_birth.value}&worker_passport=${worker_passport.value}&worker_issued=${worker_issued.value}&worker_department_number=${worker_department_number.value}&worker_department_address=${worker_department_address.value}&worker_requisites=${worker_requisites.value}&worker_payment=${worker_payment.value}&worker_tax=${worker_tax.value}&worker_city=${worker_city.value}&worker_district=${worker_district.value}&worker_address=${worker_address.value}&worker_work=${worker_work.value}&worker_hiring=${worker_hiring.value}&account_name_first=${account_name_first.value}&account_name_second=${account_name_second.value}&account_name_last=${account_name_last.value}&account_number=${account_number.mask.unmaskedValue}&account_mail=${account_mail.value}&account_password=${account_password.value}&account_commentary=${account_commentary.value}`,
|
`worker_name_first=${worker_name_first.value}&worker_name_second=${worker_name_second.value}&worker_name_last=${worker_name_last.value}&worker_number=${worker_number.mask.unmaskedValue}&worker_mail=${worker_mail.value}&worker_id=${worker_id.value}&worker_birth=${worker_birth.value}&worker_birth=${worker_birth.value}&worker_passport=${worker_passport.value}&worker_issued=${worker_issued.value}&worker_department_number=${worker_department_number.value}&worker_department_address=${worker_department_address.value}&worker_requisites=${worker_requisites.value}&worker_payment=${worker_payment.value}&worker_tax=${worker_tax.value}&worker_city=${worker_city.value}&worker_district=${worker_district.value}&worker_address=${worker_address.value}&worker_works=${Array.from(worker_works.selectedOptions).map(({ value }) => value).join(':')}&worker_hiring=${worker_hiring.value}&worker_registration=${worker_registration.value}&account_name_first=${account_name_first.value}&account_name_second=${account_name_second.value}&account_name_last=${account_name_last.value}&account_number=${account_number.mask.unmaskedValue}&account_mail=${account_mail.value}&account_password=${account_password.value}&account_commentary=${account_commentary.value}`,
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
@ -841,26 +848,26 @@ if (typeof window.workers !== "function") {
|
||||||
const worker_city_option_2 = document.createElement("option");
|
const worker_city_option_2 = document.createElement("option");
|
||||||
worker_city_option_2.setAttribute("value", "Железногорск");
|
worker_city_option_2.setAttribute("value", "Железногорск");
|
||||||
worker_city_option_2.innerText = "Железногорск";
|
worker_city_option_2.innerText = "Железногорск";
|
||||||
/*
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_3 = document.createElement("option");
|
const worker_city_option_3 = document.createElement("option");
|
||||||
worker_city_option_3.classList.add("value", "");
|
worker_city_option_3.classList.add("value", "Сосновоборск");
|
||||||
worker_city_option_3.innerText = "";
|
worker_city_option_3.innerText = "Сосновоборск";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_4 = document.createElement("option");
|
const worker_city_option_4 = document.createElement("option");
|
||||||
worker_city_option_4.classList.add("value", "");
|
worker_city_option_4.classList.add("value", "Иркутск");
|
||||||
worker_city_option_4.innerText = "";
|
worker_city_option_4.innerText = "Иркутск";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_5 = document.createElement("option");
|
const worker_city_option_5 = document.createElement("option");
|
||||||
worker_city_option_5.classList.add("value", "");
|
worker_city_option_5.classList.add("value", "Тыва");
|
||||||
worker_city_option_5.innerText = "";
|
worker_city_option_5.innerText = "Тыва";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_ = document.createElement("option");
|
const worker_city_option_6 = document.createElement("option");
|
||||||
worker_city_option_.classList.add("value", "");
|
worker_city_option_6.classList.add("value", "Хакасия");
|
||||||
worker_city_option_.innerText = ""; */
|
worker_city_option_6.innerText = "Хакасия";
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_district = document.createElement("div");
|
const worker_district = document.createElement("div");
|
||||||
|
@ -914,23 +921,25 @@ if (typeof window.workers !== "function") {
|
||||||
worker_address_input.setAttribute("placeholder", "ул. Пушкина 7");
|
worker_address_input.setAttribute("placeholder", "ул. Пушкина 7");
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_work = document.createElement("div");
|
const worker_works = document.createElement("div");
|
||||||
worker_work.classList.add("row", "merged", "divided");
|
worker_works.classList.add("row", "merged", "divided");
|
||||||
|
|
||||||
// Инициализация оболочки для строки
|
// Инициализация оболочки для строки
|
||||||
const worker_work_label = document.createElement("label");
|
const worker_works_label = document.createElement("label");
|
||||||
worker_work_label.setAttribute("id", "worker_address");
|
worker_works_label.setAttribute("id", "worker_address");
|
||||||
|
|
||||||
// Инициализация заголовка для поля ввода
|
// Инициализация заголовка для поля ввода
|
||||||
const worker_work_title = document.createElement("b");
|
const worker_works_title = document.createElement("b");
|
||||||
worker_work_title.classList.add("separated", "right");
|
worker_works_title.classList.add("separated", "right");
|
||||||
worker_work_title.innerText = "Тип работы:";
|
worker_works_title.innerText = "Тип работы:";
|
||||||
|
|
||||||
// Инициализация поля ввода
|
// Инициализация поля ввода
|
||||||
const worker_work_select = document.createElement("select");
|
const worker_works_select = document.createElement("select");
|
||||||
worker_work_select.classList.add("large");
|
worker_works_select.classList.add("large");
|
||||||
worker_work_select.setAttribute("title", "Тип работы сотрудника");
|
worker_works_select.setAttribute("title", "Тип работы сотрудника");
|
||||||
this.works().then((html) => (worker_work_select.innerHTML = html));
|
worker_works_select.setAttribute("multiple", "true");
|
||||||
|
worker_works_select.setAttribute("onclick", "alert(228)");
|
||||||
|
this.works().then((html) => (worker_works_select.innerHTML = html));
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_hiring = document.createElement("div");
|
const worker_hiring = document.createElement("div");
|
||||||
|
@ -948,12 +957,44 @@ if (typeof window.workers !== "function") {
|
||||||
// Инициализация поля ввода
|
// Инициализация поля ввода
|
||||||
const worker_hiring_input = document.createElement("input");
|
const worker_hiring_input = document.createElement("input");
|
||||||
worker_hiring_input.classList.add("large");
|
worker_hiring_input.classList.add("large");
|
||||||
worker_address_input.setAttribute("autocomplete", "off");
|
worker_hiring_input.setAttribute("autocomplete", "off");
|
||||||
worker_address_input.setAttribute("name", "hiring");
|
worker_hiring_input.setAttribute("name", "hiring");
|
||||||
worker_hiring_input.setAttribute("type", "date");
|
worker_hiring_input.setAttribute("type", "date");
|
||||||
worker_hiring_input.setAttribute("title", "Дата найма");
|
worker_hiring_input.setAttribute("title", "Дата найма");
|
||||||
worker_hiring_input.valueAsDate = new Date();
|
worker_hiring_input.valueAsDate = new Date();
|
||||||
|
|
||||||
|
// Инициализация строки
|
||||||
|
const worker_registration = document.createElement("div");
|
||||||
|
worker_registration.classList.add("row", "merged", "divided");
|
||||||
|
|
||||||
|
// Инициализация оболочки для выпадающего списка
|
||||||
|
const worker_registration_label = document.createElement("label");
|
||||||
|
worker_registration_label.setAttribute("id", "worker_registration");
|
||||||
|
|
||||||
|
// Инициализация заголовка для выпадающего списка
|
||||||
|
const worker_registration_title = document.createElement("b");
|
||||||
|
worker_registration_title.classList.add("separated", "right");
|
||||||
|
worker_registration_title.innerText = "Тип регистрации:";
|
||||||
|
|
||||||
|
// Инициализация выпадающего списка
|
||||||
|
const worker_registration_select = document.createElement("select");
|
||||||
|
worker_registration_select.classList.add("large");
|
||||||
|
worker_registration_select.setAttribute("name", "registration");
|
||||||
|
worker_registration_select.setAttribute(
|
||||||
|
"title",
|
||||||
|
"Тип регистрации сотрудника",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Инициализация варианта для выбора
|
||||||
|
const worker_registration_option_1 = document.createElement("option");
|
||||||
|
worker_registration_option_1.setAttribute("value", "ГПХ");
|
||||||
|
worker_registration_option_1.innerText = "ГПХ";
|
||||||
|
|
||||||
|
// Инициализация варианта для выбора
|
||||||
|
const worker_registration_option_2 = document.createElement("option");
|
||||||
|
worker_registration_option_2.setAttribute("value", "Самозанятый");
|
||||||
|
worker_registration_option_2.innerText = "Самозанятый";
|
||||||
|
|
||||||
// Инициализация колонки
|
// Инициализация колонки
|
||||||
const account = document.createElement("div");
|
const account = document.createElement("div");
|
||||||
account.classList.add("column");
|
account.classList.add("column");
|
||||||
|
@ -1314,6 +1355,10 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city_label.appendChild(worker_city_title);
|
worker_city_label.appendChild(worker_city_title);
|
||||||
worker_city_select.appendChild(worker_city_option_1);
|
worker_city_select.appendChild(worker_city_option_1);
|
||||||
worker_city_select.appendChild(worker_city_option_2);
|
worker_city_select.appendChild(worker_city_option_2);
|
||||||
|
worker_city_select.appendChild(worker_city_option_3);
|
||||||
|
worker_city_select.appendChild(worker_city_option_4);
|
||||||
|
worker_city_select.appendChild(worker_city_option_5);
|
||||||
|
worker_city_select.appendChild(worker_city_option_6);
|
||||||
worker_city_label.appendChild(worker_city_select);
|
worker_city_label.appendChild(worker_city_select);
|
||||||
worker_city.appendChild(worker_city_label);
|
worker_city.appendChild(worker_city_label);
|
||||||
worker.appendChild(worker_city);
|
worker.appendChild(worker_city);
|
||||||
|
@ -1328,16 +1373,23 @@ if (typeof window.workers !== "function") {
|
||||||
worker_address.appendChild(worker_address_label);
|
worker_address.appendChild(worker_address_label);
|
||||||
worker.appendChild(worker_address);
|
worker.appendChild(worker_address);
|
||||||
|
|
||||||
worker_work_label.appendChild(worker_work_title);
|
worker_works_label.appendChild(worker_works_title);
|
||||||
worker_work_label.appendChild(worker_work_select);
|
worker_works_label.appendChild(worker_works_select);
|
||||||
worker_work.appendChild(worker_work_label);
|
worker_works.appendChild(worker_works_label);
|
||||||
worker.appendChild(worker_work);
|
worker.appendChild(worker_works);
|
||||||
|
|
||||||
worker_hiring_label.appendChild(worker_hiring_title);
|
worker_hiring_label.appendChild(worker_hiring_title);
|
||||||
worker_hiring_label.appendChild(worker_hiring_input);
|
worker_hiring_label.appendChild(worker_hiring_input);
|
||||||
worker_hiring.appendChild(worker_hiring_label);
|
worker_hiring.appendChild(worker_hiring_label);
|
||||||
worker.appendChild(worker_hiring);
|
worker.appendChild(worker_hiring);
|
||||||
|
|
||||||
|
worker_registration_label.appendChild(worker_registration_title);
|
||||||
|
worker_registration_select.appendChild(worker_registration_option_1);
|
||||||
|
worker_registration_select.appendChild(worker_registration_option_2);
|
||||||
|
worker_registration_label.appendChild(worker_registration_select);
|
||||||
|
worker_registration.appendChild(worker_registration_label);
|
||||||
|
worker.appendChild(worker_registration);
|
||||||
|
|
||||||
main.appendChild(worker);
|
main.appendChild(worker);
|
||||||
|
|
||||||
account_name_first_label.appendChild(account_name_first_title);
|
account_name_first_label.appendChild(account_name_first_title);
|
||||||
|
@ -1918,8 +1970,9 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
|
* @param {HTMLElement} worker_registration Тип регистрации сотрудника <select>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
|
@ -1942,8 +1995,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
) {
|
) {
|
||||||
// Блокировка полей ввода
|
// Блокировка полей ввода
|
||||||
worker_name_first.setAttribute("readonly", true);
|
worker_name_first.setAttribute("readonly", true);
|
||||||
|
@ -1962,8 +2016,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.setAttribute("readonly", true);
|
worker_city.setAttribute("readonly", true);
|
||||||
worker_district.setAttribute("readonly", true);
|
worker_district.setAttribute("readonly", true);
|
||||||
worker_address.setAttribute("readonly", true);
|
worker_address.setAttribute("readonly", true);
|
||||||
worker_work.setAttribute("readonly", true);
|
worker_works.setAttribute("readonly", true);
|
||||||
worker_hiring.setAttribute("readonly", true);
|
worker_hiring.setAttribute("readonly", true);
|
||||||
|
worker_registration.setAttribute("readonly", true);
|
||||||
|
|
||||||
// Блокировка кнопки
|
// Блокировка кнопки
|
||||||
button.setAttribute("disabled", true);
|
button.setAttribute("disabled", true);
|
||||||
|
@ -1988,8 +2043,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2013,8 +2069,9 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
|
* @param {HTMLElement} worker_registration Тип регистрации сотрудника <select>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
|
@ -2038,8 +2095,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
|
worker_registration,
|
||||||
) => {
|
) => {
|
||||||
// Инициализация функции разблокировки
|
// Инициализация функции разблокировки
|
||||||
function unblock() {
|
function unblock() {
|
||||||
|
@ -2060,8 +2118,9 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.removeAttribute("readonly");
|
worker_city.removeAttribute("readonly");
|
||||||
worker_district.removeAttribute("readonly");
|
worker_district.removeAttribute("readonly");
|
||||||
worker_address.removeAttribute("readonly");
|
worker_address.removeAttribute("readonly");
|
||||||
worker_work.removeAttribute("readonly");
|
worker_works.removeAttribute("readonly");
|
||||||
worker_hiring.removeAttribute("readonly");
|
worker_hiring.removeAttribute("readonly");
|
||||||
|
worker_registration.removeAttribute("readonly");
|
||||||
|
|
||||||
// Разблокировка кнопки
|
// Разблокировка кнопки
|
||||||
button.removeAttribute("disabled");
|
button.removeAttribute("disabled");
|
||||||
|
@ -2083,7 +2142,7 @@ if (typeof window.workers !== "function") {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
},
|
},
|
||||||
body:
|
body:
|
||||||
`name_first=${worker_name_first.value}&name_second=${worker_name_second.value}&name_last=${worker_name_last.value}&number=${worker_number.mask.unmaskedValue}&mail=${worker_mail.value}&birth=${worker_birth.value}&passport=${worker_passport.value}&issued=${worker_issued.value}&department_number=${worker_department_number.value}&department_address=${worker_department_address.value}&requisites=${worker_requisites.value}&payment=${worker_payment.value}&tax=${worker_tax.value}&city=${worker_city.value}&district=${worker_district.value}&address=${worker_address.value}&work=${worker_work.value}&hiring=${worker_hiring.value}`,
|
`name_first=${worker_name_first.value}&name_second=${worker_name_second.value}&name_last=${worker_name_last.value}&number=${worker_number.mask.unmaskedValue}&mail=${worker_mail.value}&birth=${worker_birth.value}&passport=${worker_passport.value}&issued=${worker_issued.value}&department_number=${worker_department_number.value}&department_address=${worker_department_address.value}&requisites=${worker_requisites.value}&payment=${worker_payment.value}&tax=${worker_tax.value}&city=${worker_city.value}&district=${worker_district.value}&address=${worker_address.value}&works=${Array.from(worker_works.selectedOptions).map(({ value }) => value).join(':')}&hiring=${worker_hiring.value}®istration=${worker_registration.value}`,
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
@ -2644,7 +2703,6 @@ if (typeof window.workers !== "function") {
|
||||||
"title",
|
"title",
|
||||||
"Город проживания сотрудника",
|
"Город проживания сотрудника",
|
||||||
);
|
);
|
||||||
worker_city_select.value = data.city ?? "";
|
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_1 = document.createElement("option");
|
const worker_city_option_1 = document.createElement("option");
|
||||||
|
@ -2656,26 +2714,25 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city_option_2.setAttribute("value", "Железногорск");
|
worker_city_option_2.setAttribute("value", "Железногорск");
|
||||||
worker_city_option_2.innerText = "Железногорск";
|
worker_city_option_2.innerText = "Железногорск";
|
||||||
|
|
||||||
/*
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_3 = document.createElement("option");
|
const worker_city_option_3 = document.createElement("option");
|
||||||
worker_city_option_3.classList.add("value", "");
|
worker_city_option_3.classList.add("value", "Сосновоборск");
|
||||||
worker_city_option_3.innerText = "";
|
worker_city_option_3.innerText = "Сосновоборск";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_4 = document.createElement("option");
|
const worker_city_option_4 = document.createElement("option");
|
||||||
worker_city_option_4.classList.add("value", "");
|
worker_city_option_4.classList.add("value", "Иркутск");
|
||||||
worker_city_option_4.innerText = "";
|
worker_city_option_4.innerText = "Иркутск";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_5 = document.createElement("option");
|
const worker_city_option_5 = document.createElement("option");
|
||||||
worker_city_option_5.classList.add("value", "");
|
worker_city_option_5.classList.add("value", "Тыва");
|
||||||
worker_city_option_5.innerText = "";
|
worker_city_option_5.innerText = "Тыва";
|
||||||
|
|
||||||
// Инициализация варианта для выбора
|
// Инициализация варианта для выбора
|
||||||
const worker_city_option_ = document.createElement("option");
|
const worker_city_option_6 = document.createElement("option");
|
||||||
worker_city_option_.classList.add("value", "");
|
worker_city_option_6.classList.add("value", "Хакасия");
|
||||||
worker_city_option_.innerText = ""; */
|
worker_city_option_6.innerText = "Хакасия";
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_district = document.createElement("div");
|
const worker_district = document.createElement("div");
|
||||||
|
@ -2737,24 +2794,25 @@ if (typeof window.workers !== "function") {
|
||||||
worker_address_input.value = data.address ?? "";
|
worker_address_input.value = data.address ?? "";
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_work = document.createElement("div");
|
const worker_works = document.createElement("div");
|
||||||
worker_work.classList.add("row", "merged", "divided");
|
worker_works.classList.add("row", "merged", "divided");
|
||||||
|
|
||||||
// Инициализация оболочки для строки
|
// Инициализация оболочки для строки
|
||||||
const worker_work_label = document.createElement("label");
|
const worker_works_label = document.createElement("label");
|
||||||
worker_work_label.setAttribute("id", "worker_address");
|
worker_works_label.setAttribute("id", "worker_address");
|
||||||
|
|
||||||
// Инициализация заголовка для поля ввода
|
// Инициализация заголовка для поля ввода
|
||||||
const worker_work_title = document.createElement("b");
|
const worker_works_title = document.createElement("b");
|
||||||
worker_work_title.classList.add("separated", "right");
|
worker_works_title.classList.add("separated", "right");
|
||||||
worker_work_title.innerText = "Тип работы:";
|
worker_works_title.innerText = "Тип работы:";
|
||||||
|
|
||||||
// Инициализация поля ввода
|
// Инициализация поля ввода
|
||||||
const worker_work_select = document.createElement("select");
|
const worker_works_select = document.createElement("select");
|
||||||
worker_work_select.classList.add("large");
|
worker_works_select.classList.add("large");
|
||||||
worker_work_select.setAttribute("title", "Тип работы сотрудника");
|
worker_works_select.setAttribute("title", "Тип работы сотрудника");
|
||||||
|
worker_works_select.setAttribute("multiple", "true");
|
||||||
this.works(id).then(
|
this.works(id).then(
|
||||||
(html) => (worker_work_select.innerHTML = html),
|
(html) => (worker_works_select.innerHTML = html),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
|
@ -2782,6 +2840,42 @@ if (typeof window.workers !== "function") {
|
||||||
worker_hiring_input.valueAsDate = new Date(data.hiring * 1000);
|
worker_hiring_input.valueAsDate = new Date(data.hiring * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Инициализация строки
|
||||||
|
const worker_registration = document.createElement("div");
|
||||||
|
worker_registration.classList.add("row", "merged", "divided");
|
||||||
|
|
||||||
|
// Инициализация оболочки для выпадающего списка
|
||||||
|
const worker_registration_label = document.createElement("label");
|
||||||
|
worker_registration_label.setAttribute("id", "worker_registration");
|
||||||
|
|
||||||
|
// Инициализация заголовка для выпадающего списка
|
||||||
|
const worker_registration_title = document.createElement("b");
|
||||||
|
worker_registration_title.classList.add("separated", "right");
|
||||||
|
worker_registration_title.innerText = "Тип регистрации:";
|
||||||
|
|
||||||
|
// Инициализация выпадающего списка
|
||||||
|
const worker_registration_select = document.createElement("select");
|
||||||
|
worker_registration_select.classList.add("large");
|
||||||
|
worker_registration_select.setAttribute("name", "registration");
|
||||||
|
worker_registration_select.setAttribute(
|
||||||
|
"title",
|
||||||
|
"Тип регистрации сотрудника",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Инициализация варианта для выбора
|
||||||
|
const worker_registration_option_1 = document.createElement(
|
||||||
|
"option",
|
||||||
|
);
|
||||||
|
worker_registration_option_1.setAttribute("value", "ГПХ");
|
||||||
|
worker_registration_option_1.innerText = "ГПХ";
|
||||||
|
|
||||||
|
// Инициализация варианта для выбора
|
||||||
|
const worker_registration_option_2 = document.createElement(
|
||||||
|
"option",
|
||||||
|
);
|
||||||
|
worker_registration_option_2.setAttribute("value", "Самозанятый");
|
||||||
|
worker_registration_option_2.innerText = "Самозанятый";
|
||||||
|
|
||||||
// Инициализация строки
|
// Инициализация строки
|
||||||
const worker_buttons = document.createElement("div");
|
const worker_buttons = document.createElement("div");
|
||||||
worker_buttons.classList.add("row", "divided", "buttons");
|
worker_buttons.classList.add("row", "divided", "buttons");
|
||||||
|
@ -2940,6 +3034,10 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city_label.appendChild(worker_city_title);
|
worker_city_label.appendChild(worker_city_title);
|
||||||
worker_city_select.appendChild(worker_city_option_1);
|
worker_city_select.appendChild(worker_city_option_1);
|
||||||
worker_city_select.appendChild(worker_city_option_2);
|
worker_city_select.appendChild(worker_city_option_2);
|
||||||
|
worker_city_select.appendChild(worker_city_option_3);
|
||||||
|
worker_city_select.appendChild(worker_city_option_4);
|
||||||
|
worker_city_select.appendChild(worker_city_option_5);
|
||||||
|
worker_city_select.appendChild(worker_city_option_6);
|
||||||
worker_city_label.appendChild(worker_city_select);
|
worker_city_label.appendChild(worker_city_select);
|
||||||
worker_city.appendChild(worker_city_label);
|
worker_city.appendChild(worker_city_label);
|
||||||
worker.appendChild(worker_city);
|
worker.appendChild(worker_city);
|
||||||
|
@ -2954,16 +3052,27 @@ if (typeof window.workers !== "function") {
|
||||||
worker_address.appendChild(worker_address_label);
|
worker_address.appendChild(worker_address_label);
|
||||||
worker.appendChild(worker_address);
|
worker.appendChild(worker_address);
|
||||||
|
|
||||||
worker_work_label.appendChild(worker_work_title);
|
worker_works_label.appendChild(worker_works_title);
|
||||||
worker_work_label.appendChild(worker_work_select);
|
worker_works_label.appendChild(worker_works_select);
|
||||||
worker_work.appendChild(worker_work_label);
|
worker_works.appendChild(worker_works_label);
|
||||||
worker.appendChild(worker_work);
|
worker.appendChild(worker_works);
|
||||||
|
|
||||||
worker_hiring_label.appendChild(worker_hiring_title);
|
worker_hiring_label.appendChild(worker_hiring_title);
|
||||||
worker_hiring_label.appendChild(worker_hiring_input);
|
worker_hiring_label.appendChild(worker_hiring_input);
|
||||||
worker_hiring.appendChild(worker_hiring_label);
|
worker_hiring.appendChild(worker_hiring_label);
|
||||||
worker.appendChild(worker_hiring);
|
worker.appendChild(worker_hiring);
|
||||||
|
|
||||||
|
worker_registration_label.appendChild(worker_registration_title);
|
||||||
|
worker_registration_select.appendChild(
|
||||||
|
worker_registration_option_1,
|
||||||
|
);
|
||||||
|
worker_registration_select.appendChild(
|
||||||
|
worker_registration_option_2,
|
||||||
|
);
|
||||||
|
worker_registration_label.appendChild(worker_registration_select);
|
||||||
|
worker_registration.appendChild(worker_registration_label);
|
||||||
|
worker.appendChild(worker_registration);
|
||||||
|
|
||||||
worker_buttons.appendChild(worker_update_button);
|
worker_buttons.appendChild(worker_update_button);
|
||||||
worker_buttons.appendChild(worker_fire_button);
|
worker_buttons.appendChild(worker_fire_button);
|
||||||
worker.appendChild(worker_buttons);
|
worker.appendChild(worker_buttons);
|
||||||
|
@ -2979,6 +3088,12 @@ if (typeof window.workers !== "function") {
|
||||||
|
|
||||||
document.body.appendChild(this.body.wrap);
|
document.body.appendChild(this.body.wrap);
|
||||||
|
|
||||||
|
// Инициализация значения города
|
||||||
|
worker_city_select.value = data.city ?? "";
|
||||||
|
|
||||||
|
// Инициализация значения типа регистрации
|
||||||
|
worker_registration_select.value = data.registration ?? "";
|
||||||
|
|
||||||
// Инициализация ширины окна с ошибками
|
// Инициализация ширины окна с ошибками
|
||||||
this.body.errors.style.setProperty(
|
this.body.errors.style.setProperty(
|
||||||
"--calculated-width",
|
"--calculated-width",
|
||||||
|
@ -3210,7 +3325,7 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
|
@ -3234,7 +3349,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
) {
|
) {
|
||||||
// Блокировка полей ввода
|
// Блокировка полей ввода
|
||||||
|
@ -3254,7 +3369,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.setAttribute("readonly", true);
|
worker_city.setAttribute("readonly", true);
|
||||||
worker_district.setAttribute("readonly", true);
|
worker_district.setAttribute("readonly", true);
|
||||||
worker_address.setAttribute("readonly", true);
|
worker_address.setAttribute("readonly", true);
|
||||||
worker_work.setAttribute("readonly", true);
|
worker_works.setAttribute("readonly", true);
|
||||||
worker_hiring.setAttribute("readonly", true);
|
worker_hiring.setAttribute("readonly", true);
|
||||||
|
|
||||||
// Блокировка кнопки
|
// Блокировка кнопки
|
||||||
|
@ -3280,7 +3395,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3305,7 +3420,7 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
|
@ -3330,7 +3445,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
) => {
|
) => {
|
||||||
// Инициализация функции разблокировки
|
// Инициализация функции разблокировки
|
||||||
|
@ -3352,7 +3467,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.removeAttribute("readonly");
|
worker_city.removeAttribute("readonly");
|
||||||
worker_district.removeAttribute("readonly");
|
worker_district.removeAttribute("readonly");
|
||||||
worker_address.removeAttribute("readonly");
|
worker_address.removeAttribute("readonly");
|
||||||
worker_work.removeAttribute("readonly");
|
worker_works.removeAttribute("readonly");
|
||||||
worker_hiring.removeAttribute("readonly");
|
worker_hiring.removeAttribute("readonly");
|
||||||
|
|
||||||
// Разблокировка кнопки
|
// Разблокировка кнопки
|
||||||
|
@ -3434,7 +3549,7 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
|
@ -3458,7 +3573,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
) {
|
) {
|
||||||
// Блокировка полей ввода
|
// Блокировка полей ввода
|
||||||
|
@ -3478,7 +3593,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.setAttribute("readonly", true);
|
worker_city.setAttribute("readonly", true);
|
||||||
worker_district.setAttribute("readonly", true);
|
worker_district.setAttribute("readonly", true);
|
||||||
worker_address.setAttribute("readonly", true);
|
worker_address.setAttribute("readonly", true);
|
||||||
worker_work.setAttribute("readonly", true);
|
worker_works.setAttribute("readonly", true);
|
||||||
worker_hiring.setAttribute("readonly", true);
|
worker_hiring.setAttribute("readonly", true);
|
||||||
|
|
||||||
// Блокировка кнопки
|
// Блокировка кнопки
|
||||||
|
@ -3504,7 +3619,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -3529,7 +3644,7 @@ if (typeof window.workers !== "function") {
|
||||||
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
* @param {HTMLElement} worker_city Город проживания сотрудника <select>
|
||||||
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
* @param {HTMLElement} worker_district Регион проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
* @param {HTMLElement} worker_address Адрес проживания сотрудника <input>
|
||||||
* @param {HTMLElement} worker_work Тип работы сотрудника <select>
|
* @param {HTMLElement} worker_works Тип работы сотрудника <select>
|
||||||
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
* @param {HTMLElement} worker_hiring Дата найма сотрудника <input>
|
||||||
*
|
*
|
||||||
* @return {void}
|
* @return {void}
|
||||||
|
@ -3554,7 +3669,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city,
|
worker_city,
|
||||||
worker_district,
|
worker_district,
|
||||||
worker_address,
|
worker_address,
|
||||||
worker_work,
|
worker_works,
|
||||||
worker_hiring,
|
worker_hiring,
|
||||||
) => {
|
) => {
|
||||||
// Инициализация функции разблокировки
|
// Инициализация функции разблокировки
|
||||||
|
@ -3576,7 +3691,7 @@ if (typeof window.workers !== "function") {
|
||||||
worker_city.removeAttribute("readonly");
|
worker_city.removeAttribute("readonly");
|
||||||
worker_district.removeAttribute("readonly");
|
worker_district.removeAttribute("readonly");
|
||||||
worker_address.removeAttribute("readonly");
|
worker_address.removeAttribute("readonly");
|
||||||
worker_work.removeAttribute("readonly");
|
worker_works.removeAttribute("readonly");
|
||||||
worker_hiring.removeAttribute("readonly");
|
worker_hiring.removeAttribute("readonly");
|
||||||
|
|
||||||
// Разблокировка кнопки
|
// Разблокировка кнопки
|
||||||
|
@ -3637,7 +3752,6 @@ if (typeof window.workers !== "function") {
|
||||||
300,
|
300,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
static account = class {
|
static account = class {
|
||||||
/**
|
/**
|
||||||
* Ядро (родительский класс)
|
* Ядро (родительский класс)
|
||||||
|
@ -4943,13 +5057,14 @@ if (typeof window.workers !== "function") {
|
||||||
*
|
*
|
||||||
* @return {array|null} Массив HTML-элементов <option>
|
* @return {array|null} Массив HTML-элементов <option>
|
||||||
*/
|
*/
|
||||||
static async works(id) {
|
static async works(id = '') {
|
||||||
// Запрос к серверу
|
// Запрос к серверу
|
||||||
return await fetch(`/tasks/works`, {
|
return await fetch(`/tasks/works`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
},
|
},
|
||||||
|
body: `worker=${id}`
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
|
@ -12,7 +12,12 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if account.type == 'administrator' or account.type == 'operator' %}
|
{% if account.type == 'administrator' or account.type == 'operator' %}
|
||||||
|
<h4 class="separator unselectable">Последние изменения</h4>
|
||||||
{% for key, data in task.updates %}
|
{% for key, data in task.updates %}
|
||||||
<span id="{{ task.id.value }}_{{ key }}"><b>{{ data.label }}:</b>{% if data.value is empty %}{% else %}{{ data.value }}{% endif %}</span>
|
<span id="{{ task._key }}_{{ key }}"><b>{{ data.label }}:</b>{% if data.value.id is empty %}{% else %}{%
|
||||||
|
if data.value.first is not empty %}{{
|
||||||
|
data.value.first|slice(0, 1)|upper }}.{% endif %}{% if data.value.last is not empty %} {{
|
||||||
|
data.value.last|slice(0, 1)|upper }}.{% endif %}{% if data.value.second is not empty %} {{
|
||||||
|
data.value.second }} ({{ data.value.id }}){% else %}{{ data.value.id }}{% endif %}{% endif %}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
{% if account.type == 'administrator' or account.type == 'operator' %}
|
{% if account.type == 'administrator' or account.type == 'operator' %}
|
||||||
<h4 class="separator unselectable">Последние изменения</h4>
|
<h4 class="separator unselectable">Последние изменения</h4>
|
||||||
{% for key, data in task.updates %}
|
{% for key, data in task.updates %}
|
||||||
<span id="{{ task.id.value }}_{{ key }}"><b>{{ data.label }}:</b>{% if data.value is empty %}{% else %}{{ data.value }}{% endif %}</span>
|
<span id="{{ task._key }}_{{ key }}"><b>{{ data.label }}:</b>{% if data.value.id is empty %}{% else %}{%
|
||||||
|
if data.value.first is not empty %}{{
|
||||||
|
data.value.first|slice(0, 1)|upper }}.{% endif %}{% if data.value.last is not empty %} {{
|
||||||
|
data.value.last|slice(0, 1)|upper }}.{% endif %}{% if data.value.second is not empty %} {{
|
||||||
|
data.value.second }} ({{ data.value.id }}){% else %}{{ data.value.id }}{% endif %}{% endif %}</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% if page != null %}<!-- PAGE #{{ page }} -->{% endif %}
|
{% if page != null %}<!-- PAGE #{{ page }} -->{% endif %}
|
||||||
{% for row in rows %}
|
{% for row in rows %}
|
||||||
<div id="{{ row.account._key }}"
|
<div id="{{ row.account._key }}"
|
||||||
class="row{% if row.account.active is same as(true) %} active{% else %} hided{% endif %}" data-row="operator">
|
class="row{% if row.account.active is same as(true) %} active{% else %} hided{% endif %}{% if row.account.transactions is same as(true) %} transactions{% endif %}" data-row="operator">
|
||||||
<span class="unselectable interactive" data-column="account" title="{{ row.account._key }}"
|
<span class="unselectable interactive" data-column="account" title="{{ row.account._key }}"
|
||||||
onclick="operators.update(this.parentElement)">{{
|
onclick="operators.update(this.parentElement)">{{
|
||||||
row.account._key }}</span>
|
row.account._key }}</span>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
row.worker.name.second }}{% endif %}</span>
|
row.worker.name.second }}{% endif %}</span>
|
||||||
<span class="unselectable interactive" data-column="number"><a href="tel:{{ row.worker.number }}" title="Позвонить">{{
|
<span class="unselectable interactive" data-column="number"><a href="tel:{{ row.worker.number }}" title="Позвонить">{{
|
||||||
row.worker.number|storaged_number_to_readable }}</a></span>
|
row.worker.number|storaged_number_to_readable }}</a></span>
|
||||||
<span class="unselectable interactive" data-column="work">{{ row.worker.work }}</span>
|
<span class="unselectable interactive" data-column="work" title="{% for work in row.worker.works %}{{ work }}{% if not loop.last %}, {% endif %}{% endfor %}">{% for work in row.worker.works %}{{ work|work }}{% if not loop.last %}, {% endif %}{% endfor %}</span>
|
||||||
<span class="unselectable interactive" data-column="address"
|
<span class="unselectable interactive" data-column="address"
|
||||||
title="{{ (row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address)|trim }}"
|
title="{{ (row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address)|trim }}"
|
||||||
onclick="navigator.clipboard.writeText('{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}')">{%
|
onclick="navigator.clipboard.writeText('{{ row.worker.city ~ ' ' ~ row.worker.district ~ ' ' ~ row.worker.address }}')">{%
|
||||||
|
|
|
@ -1,39 +1,36 @@
|
||||||
{% if task %}
|
{% if task %}
|
||||||
|
|
||||||
{% if exist is same as(true) %}
|
{% if exist is same as(true) %}
|
||||||
|
|
||||||
{% for work in works %}
|
{% for work in works %}
|
||||||
<option value="{{ work }}" {% if task.work==work %} selected{% endif %}>{{ work }}</option>
|
<option value="{{ work }}" {% if work in worker.works %} selected{% endif %}>b{{ work }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
||||||
{% if task is not null %}
|
{% if task is not null %}
|
||||||
<optgroup label="Текущее">
|
<optgroup label="Текущее">
|
||||||
<option value="{{ task.work }}" selected>{{ task.work }}</option>
|
<option value="{{ task.work }}" selected>{{ task.work }}</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<optgroup label="Доступное">
|
<optgroup label="Доступное">
|
||||||
{% for work in works %}
|
{% for work in works %}
|
||||||
<option value="{{ work }}">{{ work }}</option>
|
<option value="{{ work }}">{{ work }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</optgroup>
|
</optgroup>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% elseif worker %}
|
{% elseif worker %}
|
||||||
{% if exist is same as(true) %}
|
|
||||||
{% for work in works %}
|
{% for work in works %}
|
||||||
<option value="{{ work }}" {% if worker.work==work %} selected{% endif %}>{{ work }}</option>
|
<option value="{{ work }}" {% if work in worker.works %} selected{% endif %}>{{ work }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if worker is not null %}
|
|
||||||
<optgroup label="Текущее">
|
|
||||||
<option value="{{ worker.work }}" selected>{{ worker.work }}</option>
|
|
||||||
</optgroup>
|
|
||||||
{% endif %}
|
|
||||||
<optgroup label="Доступное">
|
|
||||||
{% for work in works %}
|
|
||||||
<option value="{{ work }}">{{ work }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</optgroup>
|
|
||||||
{% endif %}
|
|
||||||
{% else %}
|
|
||||||
{% for work in works %}
|
{% for work in works %}
|
||||||
<option value="{{ work }}">{{ work }}</option>
|
<option value="{{ work }}">{{ work }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -26,9 +26,9 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if account.type == 'administrator' %}
|
{% if account.type == 'administrator' %}
|
||||||
<!-- <li class="divided">
|
<li class="divided">
|
||||||
<button class="transparent" onclick="loader.settings()" title="Глобальные настройки сайта">Настройки</button>
|
<button class="transparent" onclick="loader.settings()" title="Глобальные настройки сайта">Настройки</button>
|
||||||
</li> -->
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li id="account">
|
<li id="account">
|
||||||
<button class="transparent" onclick="loader.account({{ account.getKey() }})">{%
|
<button class="transparent" onclick="loader.account({{ account.getKey() }})">{%
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
{% block css %}
|
{% block css %}
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/list.css">
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/list.css">
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/pages/markets.css">
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/pages/markets.css">
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/cart.css">
|
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/nametag.css">
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/nametag.css">
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/user_add.css">
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/user_add.css">
|
||||||
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/work_alt.css">
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/work_alt.css">
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
{% extends('index.html') %}
|
||||||
|
|
||||||
|
{% block css %}
|
||||||
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/list.css">
|
||||||
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/user.css">
|
||||||
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/icons/shopping_cart.css">
|
||||||
|
<link type="text/css" rel="stylesheet" data-reinitializer-once="true" href="/css/pages/settings.css">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<section id="settings" class="panel">
|
||||||
|
<section id="market_hour" class="category">
|
||||||
|
<div class="unselectable">
|
||||||
|
<div>
|
||||||
|
<h2>Счёт магазину</h2><i class="icon bold shopping cart"></i>
|
||||||
|
</div>
|
||||||
|
<small>Цена выставляемая магазину за 1 час работы сотрудника</small>
|
||||||
|
</div>
|
||||||
|
{% for city, _settings in settings.market_hour|settings_by_city %}
|
||||||
|
<section class="subcategory">
|
||||||
|
<h3 class="unselectable">{{ city }}</h3>
|
||||||
|
<div class="divider separator"></div>
|
||||||
|
{% for hour in _settings %}
|
||||||
|
<label>
|
||||||
|
<span class="unselectable separated right">{{ hour.work }}</span>
|
||||||
|
<input id="{{ hour._key }}" type="number" placeholder="0" value="{{ hour.value ?? 0 }}" min="0" max="9999"
|
||||||
|
step="0.1" onkeypress="return core.numbers(event)"
|
||||||
|
onkeyup="settings.write(this.getAttribute('id'), this.value)"
|
||||||
|
oninput="settings.write(this.getAttribute('id'), this.value)">
|
||||||
|
</label>
|
||||||
|
{% else %}
|
||||||
|
<p class="empty">Не найдено</p>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="worker_hour" class="category">
|
||||||
|
<div class="unselectable">
|
||||||
|
<div>
|
||||||
|
<h2>Выплата сотруднику</h2><i class="icon bold user"></i>
|
||||||
|
</div>
|
||||||
|
<small>Количество заработной платы выплачиваемой сотруднику за 1 час его работы</small>
|
||||||
|
</div>
|
||||||
|
{% for city, _settings in settings.worker_hour|settings_by_city %}
|
||||||
|
<section class="subcategory">
|
||||||
|
<h3 class="unselectable">{{ city }}</h3>
|
||||||
|
{% for hour in _settings %}
|
||||||
|
<label>
|
||||||
|
<span class="unselectable separated right">{{ hour.work }}</span>
|
||||||
|
<input id="{{ hour._key }}" type="number" placeholder="0" value="{{ hour.value ?? 0 }}" min="0" max="9999"
|
||||||
|
step="0.1" onkeypress="return core.numbers(event)"
|
||||||
|
onkeyup="settings.write(this.getAttribute('id'), this.value)"
|
||||||
|
oninput="settings.write(this.getAttribute('id'), this.value)">
|
||||||
|
</label>
|
||||||
|
{% else %}
|
||||||
|
<p class="empty">Не найдено</p>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="worker_bonus" class="category">
|
||||||
|
<div class="unselectable">
|
||||||
|
<div>
|
||||||
|
<h2>Премия сотруднику</h2><i class="icon bold user"></i>
|
||||||
|
</div>
|
||||||
|
<small>Количество добавления к заработной плате выплачиваемой сотруднику относительно оценки проделанной им работы
|
||||||
|
на
|
||||||
|
заявке магазином</small>
|
||||||
|
</div>
|
||||||
|
<section class="subcategory">
|
||||||
|
{% for bonus in settings.worker_bonus %}
|
||||||
|
<label>
|
||||||
|
<span class="unselectable separated right">{{ bonus.rating }}</span>
|
||||||
|
<input id="{{ bonus._key }}" type="number" placeholder="0" value="{{ bonus.value ?? 0 }}" min="0" max="9999"
|
||||||
|
step="0.1" onkeypress="return core.numbers(event)"
|
||||||
|
onkeyup="settings.write(this.getAttribute('id'), this.value)"
|
||||||
|
oninput="settings.write(this.getAttribute('id'), this.value)">
|
||||||
|
</label>
|
||||||
|
{% else %}
|
||||||
|
<p class="empty">Не найдено</p>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="worker_penalty" class="category">
|
||||||
|
<div class="unselectable">
|
||||||
|
<div>
|
||||||
|
<h2>Штраф сотруднику</h2><i class="icon bold user"></i>
|
||||||
|
</div>
|
||||||
|
<small>Количество убавления от заработной платы выплачиваемой сотруднику относительно оценки проделанной им работы
|
||||||
|
на заявке магазином</small>
|
||||||
|
</div>
|
||||||
|
<section class="subcategory">
|
||||||
|
{% for penalty in settings.worker_penalty %}
|
||||||
|
<label>
|
||||||
|
<span class="unselectable separated right">{{ penalty.rating }}</span>
|
||||||
|
<input id="{{ penalty._key }}" type="number" placeholder="0" value="{{ penalty.value ?? 0 }}" min="-9999" max="1"
|
||||||
|
step="0.1" onkeypress="return core.numbers(event)"
|
||||||
|
onkeyup="settings.write(this.getAttribute('id'), this.value)"
|
||||||
|
oninput="settings.write(this.getAttribute('id'), this.value)">
|
||||||
|
</label>
|
||||||
|
{% else %}
|
||||||
|
<p class="empty">Не найдено</p>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="worker_tax" class="category">
|
||||||
|
<div class="unselectable">
|
||||||
|
<div>
|
||||||
|
<h2>Налоги за работу сотрудника</h2><i class="icon bold user"></i>
|
||||||
|
</div>
|
||||||
|
<small>Количество вычитаемое из заработной платы выплачиваемой сотруднику на уплату налогов</small>
|
||||||
|
</div>
|
||||||
|
<section class="subcategory">
|
||||||
|
{% for tax in settings.worker_tax %}
|
||||||
|
<label>
|
||||||
|
<span class="unselectable separated right">{{ tax.registration }}</span>
|
||||||
|
<input id="{{ tax._key }}" type="number" placeholder="0" value="{{ tax.value ?? 0 }}" min="0" max="9999"
|
||||||
|
step="0.1" onkeypress="return core.numbers(event)"
|
||||||
|
onkeyup="settings.write(this.getAttribute('id'), this.value)"
|
||||||
|
oninput="settings.write(this.getAttribute('id'), this.value)">
|
||||||
|
</label>
|
||||||
|
{% else %}
|
||||||
|
<p class="empty">Не найдено</p>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js %}
|
||||||
|
<script type="text/javascript" data-reinitializer-once="true" src="/js/imask-7.1.0-alpha.js" defer></script>
|
||||||
|
<script type="text/javascript" src="/js/settings.js" defer></script>
|
||||||
|
{% endblock %}
|
|
@ -20,7 +20,7 @@
|
||||||
{% if account.type == 'administrator' or account.type == 'operator' or account.type == 'market' %}
|
{% if account.type == 'administrator' or account.type == 'operator' or account.type == 'market' %}
|
||||||
<button class="grass dense" onclick="tasks.create()">Создать</button>
|
<button class="grass dense" onclick="tasks.create()">Создать</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if account.type == 'administrator' or account.type == 'operator' %}
|
{% if account.type == 'administrator' or (account.type == 'operator' and account.transactions) %}
|
||||||
<div>
|
<div>
|
||||||
<button class="sea merged right" onclick="payments.workers()">Сотрудники</button>
|
<button class="sea merged right" onclick="payments.workers()">Сотрудники</button>
|
||||||
<button class="river merged left" onclick="payments.confirm('workers')">Подтвердить</button>
|
<button class="river merged left" onclick="payments.confirm('workers')">Подтвердить</button>
|
||||||
|
|
|
@ -116,6 +116,18 @@ final class templater extends controller implements ArrayAccess
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Инициализация фильтра
|
||||||
|
$this->twig->addFilter(
|
||||||
|
new TwigFilter(
|
||||||
|
'settings_by_city',
|
||||||
|
function (array|null $settings = []) {
|
||||||
|
$result = [];
|
||||||
|
foreach($settings ?? [] as $setting) $result[$setting['city']][] = $setting;
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Инициализация расширений
|
// Инициализация расширений
|
||||||
$this->twig->addExtension(new intl());
|
$this->twig->addExtension(new intl());
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue