4 Commits

Author SHA1 Message Date
4fdcae74be cost filters and deleting 2026-03-04 22:46:47 +05:00
4839f950e5 cost changing 2026-03-04 00:05:04 +05:00
3fa8e067a1 cost per hour, worker, CRM deleted 2026-03-01 23:07:55 +05:00
74d2eaa62b several selections system + integrations 2026-02-27 23:42:35 +05:00
13 changed files with 1311 additions and 186 deletions

View File

@@ -0,0 +1,75 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor;
// Files of the project
use kodorvan\constructor\models\account,
kodorvan\constructor\models\authorizations,
kodorvan\constructor\models\worker,
kodorvan\constructor\models\tariff;
// The library for currencies support
use mirzaev\currencies\currency;
// Svoboda time
use svoboda\time\statement as svoboda;
// Baza database
use mirzaev\baza\record;
// Enabling debugging
/* ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); */
// Initializing path to the public directory
define('INDEX', __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'public');
// Initializing path to the root directory
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
// Initializing path to the settings directory
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
// Initializing path to the storage directory
define('STORAGE', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'storage');
// Initializing path to the databases directory
define('DATABASES', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'databases');
// Initializing path to the localizations directory
define('LOCALIZATIONS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'localizations');
// Initiailizing telegram data
require(SETTINGS . DIRECTORY_SEPARATOR . 'telegram.php');
// Initializing dependencies
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
// Initializing the account model
$account_model = new account();
// Searching for the account
$account = $account_model->read(
filter: fn(record $record) => $record->domain === 'buddy_volkodav',
);
var_dump($account);
// Searching for the account authorizations
$authorizations = $account->authorizations();
var_dump($authorizations);
// Creating the worker
$worker = new worker()->write(
account: $account->identifier,
hour: 2000,
currency: currency::rub,
active: true
);
var_dump($worker);

View File

@@ -25,10 +25,21 @@ return [
// Проект: создание
'project_create_title' => 'Создание проекта',
/* 'project_create_description' => "Расчитайте ориентировочное время разработки, затем выберите разработчиков и получите стоимость\n\nПосле расчётов можно будет отправить проект в заказ разработчикам и приложить ТЗ, либо краткое описание задачи\n\nМы погружаемся в проекты полностью, поэтому стараемся не распыляться - от степени нагрузки меняется коэффициент стоимости!", */
'project_create_description' => "Задайте параметры и получите ориентировочное время разработки, затем выберите разработчиков и получите стоимость их работы\n\nосле расчётов можно отправить проект в заказ и приложить ТЗ, либо описание задачи_",
'project_create_description' => "Установите параметры и получите ориентировочное время разработки\n\nосле расчётов можно отправить проект в заказ приложив ТЗ, либо описание задачи_",
'project_create_cost_description' => "Стоимость и сроки выполнения предоставлены для планирования и *не являются публичной офертой*",
'project_create_time' => 'Время разработки',
'project_create_time_hours' => 'ч',
'project_create_time_hours_from' => 'от',
'project_create_time_days' => 'дн',
'project_create_cost' => 'Стоимость',
'project_create_request_cost_title' => 'Стоимость разработки',
'project_create_request_cost_description' => 'Введите предложение по *оплате за 1 час* разработки',
'project_create_request_cost_default' => '*`%d%s`* \- средняя стоимость с учётом *компетенции*, совокупного опыта, *уникальных* разработок\. Цена уже включает\: *наши сервера*, документирование кода, *передачу кода*, ведение репозитория, *техподдержку* и репутационные гарантии',
'project_create_request_cost_warning' => '_Если цена окажется *недостаточной*, мы выставим *справедливое* и *конкурентное* встречное предложение_',
'project_create_request_cost_error_distance' => 'Длина сообщения должна быть от %d и до %d символов',
'project_create_request_cost_error_not_a_number' => 'Значение должно быть числом',
'project_create_button_back' => 'Назад',
'project_create_button_cost_per_hour' => 'Час',
'project_create_button_request' => 'Заказать',
'project_create_architectures_title' => 'Выбор архитектуры проекта',
@@ -42,7 +53,7 @@ return [
'project_create_button_purpose_selected' => 'Назнач.',
'project_create_integrations_title' => 'Выбор интеграций',
'project_create_integrations_description' => 'Синхронизация, скачивание, загрузка, запись...',
'project_create_integrations_description' => "Синхронизация заказов, товаров, публикаций и прочего в реальном времени, скачивание, загрузка, админ\-панель, рассылка сообщений, подключение аккаунтов\.\.\.\n\n_Отправка запросов в *API*, генерация и перехват *HTTP\-сообщений*, *эмуляция действий пользователя*_",
'project_create_button_integrations' => 'Интеграции',
'project_create_button_integrations_selected' => 'Интеграции',
@@ -87,6 +98,15 @@ return [
'project_purpose_events' => 'События',
'project_purpose_special' => 'Особенный',
// Проект: интеграции
'project_integration_one_c' => '1C',
'project_integration_bitrix24' => 'Битрикс 24',
'project_integration_moy_sklad' => 'Мой Склад',
'project_integration_telegram' => 'Телеграм',
'project_integration_mail' => 'Почта',
'project_integration_excel' => 'Excel',
/* 'project_integration_' => '', */
// Настройки: язык
'settings_language_title' => 'Выбери язык',
'settings_language_description' => 'Выбранный язык будет использоваться для генерации системного отображения',

View File

@@ -8,6 +8,7 @@ namespace kodorvan\constructor\models;
use kodorvan\constructor\models\core,
kodorvan\constructor\models\authorizations,
kodorvan\constructor\models\settings,
kodorvan\constructor\models\worker,
kodorvan\constructor\models\project,
kodorvan\constructor\models\project\enumerations\type as project_type,
kodorvan\constructor\models\project\enumerations\status as project_status;
@@ -65,6 +66,13 @@ final class account extends core implements record_interface
*/
public protected(set) database $database;
/**
* Serialized
*
* @var bool $serialized Is the implementator object serialized?
*/
private bool $serialized = true;
/**
* Constructor
*
@@ -84,6 +92,7 @@ final class account extends core implements record_interface
new column('name_first', type::string, ['length' => 64]),
new column('name_second', type::string, ['length' => 64]),
new column('language', type::string, ['length' => 2]),
new column('currency', type::string, ['length' => 3]),
new column('robot', type::char),
/* new column('', type::), */
new column('active', type::char),
@@ -215,6 +224,7 @@ final class account extends core implements record_interface
name_second: (string) $telegram->last_name,
domain: (string) $telegram->username,
language: (string) $telegram->language_code,
currency: CURRENCY_DEFAULT,
robot: (bool) $telegram->is_bot
);
@@ -256,6 +266,7 @@ final class account extends core implements record_interface
* @param string $name_second
* @param string $domain
* @param language|string $language
* @param currency|string $currency
* @param bool $robot Is a robot?
* @param bool $active Is the record active?
*
@@ -267,6 +278,7 @@ final class account extends core implements record_interface
string $name_first = '',
string $name_second = '',
language|string $language = LANGUAGE_DEFAULT ?? language::en,
currency|string $currency = CURRENCY_DEFAULT ?? currency::usd,
bool $robot = false,
bool $active = true,
): record|false {
@@ -278,6 +290,7 @@ final class account extends core implements record_interface
$name_first,
$name_second,
$language instanceof language ? $language->name : (string) $language,
$currency instanceof currency ? $currency->name : (string) $currency,
(int) $robot,
/* */
(int) $active,
@@ -299,11 +312,22 @@ final class account extends core implements record_interface
*/
public function serialize(): self
{
if ($this->serialized) {
// The record implementor is serialized
// Exit (fail)
throw new exception_runtime('The record implementor is already serialized');
}
// Serializing the record parameters
$this->record->language = $this->record->language->name;
$this->record->currency = $this->record->currency->name;
$this->record->robot = (int) $this->record->robot;
$this->record->active = (int) $this->record->active;
// Writing the status of serializing
$this->serialized = true;
// Exit (success)
return $this;
}
@@ -315,11 +339,22 @@ final class account extends core implements record_interface
*/
public function deserialize(): self
{
if (!$this->serialized) {
// The record implementor is deserialized
// Exit (fail)
throw new exception_runtime('The record implementor is already deserialized');
}
// Deserializing the record parameters
$this->record->language = language::{$this->record->language} ?? LANGUAGE_DEFAULT ?? language::en;
$this->record->currency = currency::{$this->record->currency} ?? CURRENCY_DEFAULT ?? currency::usd;
$this->record->robot = (bool) $this->record->robot;
$this->record->active = (bool) $this->record->active;
// Writing the status of serializing
$this->serialized = false;
// Exit (success)
return $this;
}
@@ -347,6 +382,29 @@ final class account extends core implements record_interface
return null;
}
/**
* Worker
*
* Search for the account worker
*
* @return worker|null The account worker
*/
public function worker(): ?worker
{
// Search for the account worker
$worker = new worker()->read(filter: fn(record $record) => $record->active === 1 && $record->account === $this->identifier);
if ($worker instanceof worker) {
// Found the account worker
// Exit (success)
return $worker;
}
// Exit (fail)
return null;
}
/**
* Settings
*

View File

@@ -51,6 +51,13 @@ final class authorizations extends core implements record_interface
*/
public protected(set) database $database;
/**
* Serialized
*
* @var bool $serialized Is the implementator object serialized?
*/
private bool $serialized = true;
/**
* Constructor
*
@@ -124,12 +131,22 @@ final class authorizations extends core implements record_interface
*/
public function serialize(): self
{
if ($this->serialized) {
// The record implementor is serialized
// Exit (fail)
throw new exception_runtime('The record implementor is already serialized');
}
// Serializing the record parameters
$this->record->system = (int) $this->record->system;
$this->record->settings = (int) $this->record->settings;
$this->record->system_settings = (int) $this->record->system_settings;
$this->record->active = (int) $this->record->active;
// Writing the status of serializing
$this->serialized = true;
// Exit (success)
return $this;
}
@@ -141,12 +158,22 @@ final class authorizations extends core implements record_interface
*/
public function deserialize(): self
{
if (!$this->serialized) {
// The record implementor is deserialized
// Exit (fail)
throw new exception_runtime('The record implementor is already deserialized');
}
// Deserializing the record parameters
$this->record->system = (bool) $this->record->system;
$this->record->settings = (bool) $this->record->settings;
$this->record->system_settings = (bool) $this->record->system_settings;
$this->record->active = (bool) $this->record->active;
// Writing the status of serializing
$this->serialized = false;
// Exit (success)
return $this;
}

View File

@@ -53,6 +53,13 @@ final class project extends core implements record_interface
*/
public protected(set) database $database;
/**
* Serialized
*
* @var bool $serialized Is the implementator object serialized?
*/
private bool $serialized = true;
/**
* Constructor
*

View File

@@ -5,7 +5,8 @@ declare(strict_types=1);
namespace kodorvan\constructor\models\project\enumerations;
// Files of the project
use kodorvan\constructor\models\project\enumerations\purpose;
use kodorvan\constructor\models\project\enumerations\purpose,
kodorvan\constructor\models\project\enumerations\integration;
// The library for languages support
use mirzaev\languages\language;
@@ -30,10 +31,8 @@ enum architecture
case chat_robot;
case parser;
case script;
case crm;
case site;
case program;
/* case calculator; */
case complex;
@@ -60,9 +59,6 @@ enum architecture
language::en => 'Script',
language::ru => 'Скрипт'
},
static::crm => match ($language) {
default => 'CRM'
},
static::site => match ($language) {
language::en => 'Site',
language::ru => 'Сайт'
@@ -87,13 +83,12 @@ enum architecture
{
// Exit (success)
return match ($this) {
static::chat_robot => 2,
static::chat_robot => 1,
static::parser => 1,
static::script => 1,
static::crm => 1,
static::site => 1,
static::program => 1,
static::complex => 2,
static::complex => 4,
default => 1
};
}
@@ -124,8 +119,6 @@ enum architecture
purpose::calculate,
purpose::landing,
purpose::marketplace,
purpose::events,
purpose::charity
],
static::parser => [
purpose::search
@@ -133,12 +126,6 @@ enum architecture
static::script => [
purpose::logic
],
static::crm => [
purpose::workers,
purpose::tools,
purpose::objects,
purpose::events
],
static::site => [
purpose::funnel,
purpose::contact,
@@ -148,27 +135,55 @@ enum architecture
purpose::calculate,
purpose::landing,
purpose::marketplace,
purpose::workers,
purpose::tools,
purpose::objects,
purpose::events,
purpose::charity
],
static::program => [
purpose::neural_network,
purpose::crm,
purpose::calculate,
purpose::marketplace,
purpose::workers,
purpose::tools,
purpose::objects,
purpose::events,
purpose::charity
],
default => []
};
}
/**
* Integrations
*
* @return array Integrations
*/
/* public function integrations(): array
{
// Exit (success)
return match ($this) {
static::chat_robot => [
integration::one_c,
integration::moy_sklad
],
static::parser => [
integration::one_c,
integration::moy_sklad
],
static::script => [],
static::crm => [
integration::one_c,
integration::moy_sklad
],
static::site => [
integration::one_c,
integration::moy_sklad
],
static::program => [
integration::one_c,
integration::moy_sklad
],
static::complex => [
integration::one_c,
integration::moy_sklad
],
default => []
};
} */
/**
* Cost
*
@@ -192,10 +207,6 @@ enum architecture
currency::usd => 10,
currency::rub => 1000
},
static::crm => match ($currency) {
currency::usd => 100,
currency::rub => 8000
},
static::site => match ($currency) {
currency::usd => 50,
currency::rub => 5000
@@ -223,7 +234,6 @@ enum architecture
static::chat_robot => 3,
static::parser => 2,
static::script => 1,
static::crm => 6,
static::site => 3,
static::program => 4,
static::complex => 5,

View File

@@ -0,0 +1,99 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor\models\project\enumerations;
// The library for languages support
use mirzaev\languages\language;
// Built-in libraries
use InvalidArgumentException as exception_argument,
DomainException as exception_domain;
/**
* Integration
*
* @package kodorvan\neurobot\models\project\enumerations
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
enum integration
{
case one_c;
case bitrix24;
case moy_sklad;
case telegram;
case mail;
case excel;
/**
* Label
*
* @param language $language The language
*
* @return string The project form label
*/
public function label(language $language = LANGUAGE_DEFAULT): string
{
// Exit (success)
return match ($this) {
static::one_c => '1C',
static::bitrix24 => match ($language) {
language::en => 'Bitrix 24',
language::ru => 'Битрикс 24'
},
static::moy_sklad => match ($language) {
language::en => 'Moy Sklad',
language::ru => 'Мой Склад'
},
static::telegram => match ($language) {
language::en => 'Telegram',
language::ru => 'Телеграм'
},
static::mail => match ($language) {
language::en => 'Mail',
language::ru => 'Почта'
},
static::excel => 'Excel'
};
}
/**
* Length
*
* @return int Amount of buttons cells length
*/
public function length(): int
{
// Exit (success)
return match ($this) {
static::one_c => 1,
static::bitrix24 => 2,
static::moy_sklad => 2,
static::telegram => 2,
static::mail => 1,
static::excel => 1,
};
}
/**
* Coefficient
*
* @return int|float Coefficient to the project development hours
*/
public function coefficient(): int|float
{
// Exit (success)
return match ($this) {
static::one_c => 3,
static::bitrix24 => 3.5,
static::moy_sklad => 3,
static::telegram => 2,
static::mail => 1.2,
static::excel => 1.5,
default => 2
};
}
}

View File

@@ -28,16 +28,16 @@ enum purpose
case crm;
case landing;
case marketplace;
case charity;
/* case charity; */
case search;
case calculate;
case logic;
/* case logic; */
case game;
case workers;
/* case workers;
case tools;
case objects;
case events;
case events; */
case special;
@@ -83,10 +83,10 @@ enum purpose
language::en => 'Marketplace',
language::ru => 'Маркетплейс'
},
static::charity => match ($language) {
/* static::charity => match ($language) {
language::en => 'Charity',
language::ru => 'Благотворительность'
},
}, */
static::search => match ($language) {
language::en => 'Search',
language::ru => 'Поиск'
@@ -95,15 +95,15 @@ enum purpose
language::en => 'Calculate',
language::ru => 'Расчёты'
},
static::logic => match ($language) {
/* static::logic => match ($language) {
language::en => 'Logic',
language::ru => 'Логика'
},
}, */
static::game => match ($language) {
language::en => 'Game',
language::ru => 'Игра'
},
static::workers => match ($language) {
/* static::workers => match ($language) {
language::en => 'Workes',
language::ru => 'Рабочие'
},
@@ -118,7 +118,7 @@ enum purpose
static::events => match ($language) {
language::en => 'Events',
language::ru => 'События'
},
}, */
static::special => match ($language) {
language::en => 'Special',
language::ru => 'Особенный'
@@ -126,6 +126,85 @@ enum purpose
};
}
/**
* Integrations
*
* @return array Integrations
*/
public function integrations(): array
{
// Exit (success)
return match ($this) {
static::funnel => [
integration::telegram,
integration::mail,
integration::bitrix24
],
static::contact => [
integration::mail,
integration::bitrix24
],
static::neural_network => [
integration::telegram
],
static::game => [
integration::telegram
],
static::gallery => [],
static::crm => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::landing => [
integration::telegram
],
static::marketplace => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
/* static::charity => [
integration::one_c,
integration::moy_sklad,
integration::excel
], */
static::search => [],
static::calculate => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
/* static::logic => [],
static::tools => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::workers => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::objects => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::events => [
integration::one_c,
integration::moy_sklad,
integration::excel
],
static::special => [
integration::one_c,
integration::moy_sklad,
integration::excel
], */
default => []
};
}
/**
* Length
*
@@ -143,14 +222,14 @@ enum purpose
static::crm => 1,
static::landing => 1,
static::marketplace => 2,
static::charity => 2,
/* static::charity => 2, */
static::search => 2,
static::calculate => 2,
static::logic => 1,
/* static::logic => 1,
static::tools => 1,
static::workers => 1,
static::objects => 1,
static::events => 1,
static::events => 1, */
static::special => 4,
default => 1
};
@@ -165,22 +244,22 @@ enum purpose
{
// Exit (success)
return match ($this) {
static::funnel => 1.4,
static::funnel => 2,
static::contact => 1.1,
static::neural_network => 2,
static::neural_network => 4,
static::game => 3,
static::gallery => 1,
static::crm => 3,
static::landing => 1.2,
static::marketplace => 2,
static::charity => 0.8,
static::crm => 6,
static::landing => 1.5,
static::marketplace => 8,
/* static::charity => 0.8, */
static::search => 1,
static::calculate => 1.1,
static::logic => 1,
static::calculate => 2,
/* static::logic => 1,
static::tools => 1,
static::workers => 1.2,
static::objects => 1,
static::events => 1.5,
static::events => 1.5, */
static::special => 2,
default => 1
};

View File

@@ -51,6 +51,13 @@ final class settings extends core implements record_interface
*/
public protected(set) database $database;
/**
* Serialized
*
* @var bool $serialized Is the implementator object serialized?
*/
private bool $serialized = true;
/**
* Constructor
*
@@ -111,9 +118,19 @@ final class settings extends core implements record_interface
*/
public function serialize(): self
{
if ($this->serialized) {
// The record implementor is serialized
// Exit (fail)
throw new exception_runtime('The record implementor is already serialized');
}
// Serializing the record parameters
$this->record->active = (int) $this->record->active;
// Writing the status of serializing
$this->serialized = true;
// Exit (success)
return $this;
}
@@ -125,9 +142,19 @@ final class settings extends core implements record_interface
*/
public function deserialize(): self
{
if (!$this->serialized) {
// The record implementor is deserialized
// Exit (fail)
throw new exception_runtime('The record implementor is already deserialized');
}
// Deserializing the record parameters
$this->record->active = (bool) $this->record->active;
// Writing the status of serializing
$this->serialized = false;
// Exit (success)
return $this;
}

View File

@@ -11,6 +11,7 @@ use kodorvan\constructor\models\core,
kodorvan\constructor\models\settings,
kodorvan\constructor\models\project\enumerations\architecture as project_architecture,
kodorvan\constructor\models\project\enumerations\purpose as project_purpose,
kodorvan\constructor\models\project\enumerations\integration as project_integration,
kodorvan\constructor\models\telegram\processes\language\select as process_language_select;
// Library for languages support
@@ -63,6 +64,29 @@ final class create extends menu
*/
public project_purpose $purpose;
/**
* Integrations
*
* @var array $integrations The project integrations
*/
public array $integrations = [];
/**
* Cost
*
* @var int|float $cost Cost per hour
*/
public int|float $cost = PROJECT_CREATE_COST_HOUR_DEFAULT ?? 0;
/**
* Messages
*
* Registry of messages for cleaning
*
* @var array $messages
*/
public array $messages = [];
/**
* Start
*
@@ -82,6 +106,9 @@ final class create extends menu
$robot->endConversation();
}
// Deleting the message buttons
$this->clearButtons();
// Initializing the account language
$language = $robot->get('language') ?? LANGUAGE_DEFAULT;
@@ -94,16 +121,23 @@ final class create extends menu
// Initializing the project development hours
$hours = $this->hours();
// Initializing the calculated offer
$offer = "*$localization->project_create_time:* $hours$localization->project_create_time_hours _\(" . ceil(($hours / PROJECT_CREATE_DAY_HOURS) + PROJECT_CREATE_DAY_ADDITIONAL) . "$localization->project_create_time_days\)_\n" . "*$localization->project_create_cost:* " . unmarkdown((string) ceil($hours * $this->cost)) . $account->currency->symbol();
// Generating the message text
$text = implode(
"\n\n",
[
"🏛 *$localization->project_create_title*",
/* $hours > 0 ? "*$localization->project_create_time* " . unmarkdown((string) $hours) . " $localization->hours" : $localization->project_create_description */
$new
? $localization->project_create_description
: "*$localization->project_create_time:* $hours$localization->project_create_time_hours"
]
array_filter(
[
"🏛 *$localization->project_create_title*",
$new
? $localization->project_create_description
: $offer,
!$new || isset($this->cost)
? '⚠️ ' . $localization->project_create_cost_description
: null,
]
)
);
if ($this->text !== $text) {
@@ -115,6 +149,12 @@ final class create extends menu
);
}
// Initializing the row
$row = [];
// Initializing the maximum amount of buttons in a row
$break = 3;
if (isset($this->architecture)) {
// Initialized the project architecture
@@ -139,36 +179,47 @@ final class create extends menu
// Writing the project buttons first row
$this->addButtonRow(...$first);
// Initializing the row
$row = [];
// Initializing the project integrations
$integrations = $this->purpose->integrations();
// Initializing the maximum amount of buttons in a row
$break = 2;
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
default => false
}) {
if (!empty($integrations)) {
// Integrations
if (isset($this->integrations)) {
// Initialized the project integrations
// Initializing the button text
$text = unmarkdown(
trim(
implode(
', ',
array_map(
fn(project_integration $integration) => $localization['project_integration_' . $integration?->name] ?? $integration?->label($language) ?? '',
$this->integrations,
)
),
' '
)
);
} else {
// Not initialized the project integrations
// Writing the project integrations button into the buffer of the first row
$row[] = button::make(
text: empty($text) ? $localization->project_create_button_integrations : $text,
callback_data: '@integrations'
);
if (count($row) >= $break) {
// The buttons row reach the limit
// Writing the buttons row
$this->addButtonRow(...$row);
// Deinitializing the buttons row
$row = [];
}
}
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -186,7 +237,6 @@ final class create extends menu
}
if (match ($this->architecture) {
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -197,11 +247,7 @@ final class create extends menu
if (isset($this->interface)) {
// Initialized the project interface
if ($this->architecture === project_architecture::crm) {
// CRM
// site, mobile or desktop program
} else if ($this->architecture === project_architecture::program) {
if ($this->architecture === project_architecture::program) {
// Program
// mobile or desktop
@@ -209,11 +255,7 @@ final class create extends menu
} else {
// Not initialized the project interface
if ($this->architecture === project_architecture::crm) {
// CRM
// site, mobile or desktop program
} else if ($this->architecture === project_architecture::program) {
if ($this->architecture === project_architecture::program) {
// Program
// mobile or desktop
@@ -224,7 +266,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -244,7 +285,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -262,7 +302,6 @@ final class create extends menu
}
if (match ($this->architecture) {
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -280,7 +319,6 @@ final class create extends menu
}
if (match ($this->architecture) {
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -300,7 +338,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -319,7 +356,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -339,7 +375,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::complex => true,
default => false
@@ -357,7 +392,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -376,7 +410,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::crm,
project_architecture::site,
project_architecture::complex => true,
default => false
@@ -395,7 +428,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -414,7 +446,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -434,7 +465,6 @@ final class create extends menu
if (match ($this->architecture) {
project_architecture::chat_robot,
project_architecture::parser,
project_architecture::crm,
project_architecture::site,
project_architecture::program,
project_architecture::complex => true,
@@ -474,22 +504,67 @@ final class create extends menu
);
}
if (!empty($row)) {
// The buttons row has buttons
// Writing the buttons row
$this->addButtonRow(...$row);
// Deinitializing the buttons row
$row = [];
}
if (!$new) {
// The project development hours was calculated
// Writing the project architecture button
$this->addButtonRow(
button::make(
text: "☑️ $localization->project_create_button_request",
callback_data: '@request'
)
);
if (isset($this->cost)) {
// Initialized the project cost per hour
// Writing the project buttons
$this->addButtonRow(
button::make(
text: '🛠 ' . "$localization->project_create_button_cost_per_hour: $this->cost" . $account->currency->symbol(),
callback_data: 'set@cost'
),
button::make(
text: "📦 $localization->project_create_button_request",
callback_data: '@request'
)
);
} else {
// Not initialized the project cost per hour
// Writing the project cost per hour button
$this->addButtonRow(
button::make(
text: '🛠 ' . $localization->project_create_button_cost_per_hour,
callback_data: 'set@cost'
)
);
}
}
// Updating the message and saving its text
$this->text = $this->orNext('stop')->showMenu()->text;
}
/**
* Continue
*
* Generate the project create menu and continue the process
*
* @param telegram $robot The robot
*
* @return void
*/
public function continue(telegram $robot): void
{
// Sending the process main menu
$this->start(robot: $robot, new: false);
}
/**
* Architectures
*
@@ -514,10 +589,12 @@ final class create extends menu
$this->menuText(
text: implode(
"\n\n",
[
"⚙️ *$localization->project_create_architectures_title*",
$localization->project_create_architectures_description,
]
array_filter(
[
"⚙️ *$localization->project_create_architectures_title*",
$localization->project_create_architectures_description,
]
)
),
opt: [
'parse_mode' => mode::MARKDOWN
@@ -576,7 +653,6 @@ final class create extends menu
$generated += $row;
// Reinitializing the row buttons length
/* $length -= $break; */
$length = 0;
// Reinitializing the row
@@ -621,7 +697,7 @@ final class create extends menu
}
}
if (!empty($row) > 0) {
if (!empty($row)) {
// The row was not writed
// Writing the row into the menu
@@ -636,7 +712,7 @@ final class create extends menu
}
/**
* architecture
* Architecture
*
* Write the project architecture
*
@@ -655,29 +731,8 @@ final class create extends menu
// Initializing the project architecture
$this->architecture = project_architecture::{$robot->callbackQuery()->data};
// Initializing the project architecture purposes
$purposes = $this->architecture->purposes();
if (empty($purposes)) {
// The project architecture has no purposes
// Initializing the project purpose
$this->purpose = project_purpose::special;
} else if (count($purposes) === 1) {
// The project architecture has only 1 purpose
// Initializing the project purpose
$this->purpose = $purposes[0];
} else if (isset($this->purpose) && array_search($this->purpose, $purposes) !== false) {
// The project architrcture purpose is the same from deprecated purpose
// keep it
} else {
//
// Deinitializing the project purpose
unset($this->purpose);
}
// Clearing from deprecated parameters
$this->clear();
// Sending the popup notification
$robot->answerCallbackQuery(
@@ -688,7 +743,7 @@ final class create extends menu
// Deleting the message buttons
$this->clearButtons();
// Deleting the message buttons
// Sending the process main menu
$this->start(robot: $robot, new: false);
}
@@ -716,10 +771,10 @@ final class create extends menu
$this->menuText(
text: implode(
"\n\n",
[
array_filter([
"🛠 *$localization->project_create_purposes_title*",
$localization->project_create_purposes_description,
]
])
),
opt: [
'parse_mode' => mode::MARKDOWN
@@ -788,12 +843,9 @@ final class create extends menu
// Addition to row buttons length
$length += $purpose->length();
// Initializing the coefficient
$coefficient = $purpose->coefficient();
// Writing the purpose button into the row
$row[] = button::make(
/* text: ($localization['project_purpose_' . $purpose->name] ?? $purpose->label(language: $language)) . (!empty($coefficient) ? ' x' . $coefficient : ''), */
/* text: ($localization['project_purpose_' . $purpose->name] ?? $purpose->label(language: $language)) . (!empty($coefficient) ? ' x' . $coeffici🔹ent : ''), */
text: $localization['project_purpose_' . $purpose->name] ?? $purpose->label(language: $language),
callback_data: "$purpose->name@purpose"
);
@@ -816,9 +868,6 @@ final class create extends menu
// Reinitializing the row buttons length
$length = 0;
// Initializing the coefficient
$coefficient = $next->coefficient();
// Writing the button into the menu
$this->addButtonRow(button::make(
/* text: ($localization['project_purpose_' . $next->name] ?? $next->label(language: $language)) . (!empty($coefficient) ? ' x' . $coefficient : ''), */
@@ -831,7 +880,7 @@ final class create extends menu
}
}
if (!empty($row) > 0) {
if (!empty($row)) {
// The row was not writed
// Writing the row into the menu
@@ -872,6 +921,9 @@ final class create extends menu
// Initializing the project purpose
$this->purpose = project_purpose::{$robot->callbackQuery()->data};
// Clearing from deprecated parameters
$this->clear();
// Sending the popup notification
$robot->answerCallbackQuery(
text: $localization['project_purpose_' . $this->purpose?->name] ?? $this->purpose?->label(language: $language),
@@ -881,35 +933,381 @@ final class create extends menu
// Deleting the message buttons
$this->clearButtons();
// Deleting the message buttons
// Sending the process main menu
$this->start(robot: $robot, new: false);
}
/**
* Integrations
*
* Generate the project integrations select menu
*
* @param telegram $robot The robot
*
* @return void
*/
public function integrations(telegram $robot): void
{
// Initializing the account language
$language = $robot->get('language') ?? LANGUAGE_DEFAULT;
// Initializing the account localization
$localization = $robot->get('localization') ?? new localization($language);
// Initializing the account
$account = $robot->get('account');
// Updating the message text
$this->menuText(
text: implode(
"\n\n",
array_filter([
"📡 *$localization->project_create_integrations_title*",
$localization->project_create_integrations_description,
])
),
opt: [
'parse_mode' => mode::MARKDOWN
]
);
// Deleting the message buttons
$this->clearButtons();
// Initializing the row
$row = [];
// Declaring the buffer of the row buttons length
$length = 0;
// Initializing the maximum amount of buttons in a row
$break = 4;
// Initializing buffer of integrations
$integrations = $this->purpose->integrations();
// Declaring the generated buttons registry
$generated = [];
foreach ($integrations as $index => $integration) {
// Iterating over integrations
if ($length + $integration->length() > $break && !empty($row)) {
// Reached the limit of buttons in a row
// Writing the row into the menu
$this->addButtonRow(...$row);
// Writing buttons into the generated buttons registry
$generated += $row;
// Reinitializing the row buttons length
$length = 0;
// Reinitializing the row
$row = [];
}
// Addition to row buttons length
$length += $integration->length();
// Initializing the target
$target = $this->integrations[$integration->name] ?? null;
// Writing the integration button into the row
$row[] = button::make(
text: (isset($target) && $target ? '🔘 ' : '') . ($localization['project_integration_' . $integration->name] ?? $integration->label(language: $language)),
callback_data: "$integration->name@integration"
);
// Initializing the next integration
$next = $integrations[$index + 1] ?? null;
if ($next?->length() >= $break) {
// The next integration is the full-length button
// Writing the row into the menu
$this->addButtonRow(...$row);
// Writing buttons into the generated buttons registry
$generated += $row;
// Reinitializing the row
$row = [];
// Reinitializing the row buttons length
$length = 0;
// Initializing the target
$target = $this->integrations[$integration->name] ?? null;
// Writing the button into the menu
$this->addButtonRow(button::make(
text: (isset($target) && $target ? '🔹' : '') . ($localization['project_integration_' . $integration->name] ?? $integration->label(language: $language)),
callback_data: "$integration->name@integration"
));
// Writing the button into the generated buttons registry
$generated[] = $next;
}
}
if (!empty($row) > 0) {
// The row was not writed
// Writing the row into the menu
$this->addButtonRow(...$row);
}
// Writing the "back" button into the menu
$this->addButtonRow(button::make(
text: "🔏 $localization->project_create_button_back",
callback_data: '@continue'
));
// Deinitializing deprecated variables
unset($row, $limit, $length, $generated, $integrations, $integration);
// Updating the message and saving its text
$this->text = $this->showMenu()->text;
}
/**
* Integration
*
* Write the project integration
*
* @param telegram $robot The robot
*
* @return void
*/
public function integration(telegram $robot): void
{
// Initializing the account language
$language = $robot->get('language') ?? LANGUAGE_DEFAULT;
// Initializing the account localization
$localization = $robot->get('localization') ?? new localization($language);
// Initializing the integration
$integration = project_integration::{$robot->callbackQuery()->data};
if (isset($this->integrations[$integration->name])) {
// Enabled
// Disabling
unset($this->integrations[$integration->name]);
} else {
// Disabled
// Enabling
$this->integrations[$integration->name] = $integration;
};
// Sending the popup notification
$robot->answerCallbackQuery(
text: $localization['project_integrations_' . (isset($this->integrations[$integration->name]) ? 'enabled' : 'disabled')],
show_alert: false
);
// Deleting the message buttons
$this->integrations(robot: $robot);
}
/**
* Cost
*
* Write the project cost per hour
*
* @param telegram $robot The robot
*
* @return void
*/
public function cost(telegram $robot): void
{
// Initializing the account language
$language = $robot->get('language') ?? LANGUAGE_DEFAULT;
// Initializing the account localization
$localization = $robot->get('localization') ?? new localization($language);
// Initializing the user input message
$message = $robot->message();
// Initializing the user input message text
$text = $message?->text;
// Initializing the message data
$data = $robot->callbackQuery()?->data;
if (!empty($text) && $data !== 'set') {
// Not empty text
// Initializing the message filters
$minimum = 2;
$maximum = 5;
// Writing the user input message into the messages registry
$this->messages[] = $message;
// Initializing the text length
$length = mb_strlen($text);
if ($length >= $minimum) {
// More than minimum amount of symbols
// Sanitizing
$float = filter_var($text, FILTER_SANITIZE_NUMBER_FLOAT);
if (filter_var($float, FILTER_VALIDATE_FLOAT)) {
// Number
// Writing the cost
$this->cost = (float) $float;
try {
foreach ($this->messages as $message) {
// Iterating over messages registry
// Deleting the message
$message->delete();
// Waiting just for rofls
usleep(200);
}
} catch (exception $exception) {
// Sending into the errors output buffer
error_log($exception->getMessage());
} finally {
// Deinitializing the messages registry
$this->messages = [];
}
// Sending the process main menu
$this->start(robot: $robot, new: false);
} else {
// Not a number
// Sending the message
$this->messages[] = $robot->sendMessage(
text: implode(
"\n\n",
array_filter(
[
"⚠️ $localization->project_create_request_cost_error_not_a_number",
]
)
),
parse_mode: mode::MARKDOWN,
disable_notification: true,
);
// Waiting for the user input
$this->next('cost');
}
} else {
// Less or equal than minimum amount of symbols
// Sending the message
$this->messages[] = $robot->sendMessage(
text: implode(
"\n\n",
array_filter(
[
sprintf(
"⚠️ $localization->project_create_request_cost_error_distance",
$minimum,
$maximum
)
]
)
),
parse_mode: mode::MARKDOWN,
disable_notification: true,
);
// Waiting for the user input
$this->next('cost');
}
} else {
// Empty text
// Sending the message and reinitializing the messages registry
$this->messages = [
$robot->sendMessage(
text: implode(
"\n\n",
array_filter(
[
"✏️ *$localization->project_create_request_cost_title*",
$localization->project_create_request_cost_description,
sprintf(
$localization->project_create_request_cost_default,
PROJECT_CREATE_COST_HOUR_DEFAULT,
CURRENCY_DEFAULT->symbol() ?? ''
),
"⚠️ $localization->project_create_request_cost_warning"
]
)
),
parse_mode: mode::MARKDOWN,
disable_notification: true,
)
];
// Waiting for the user input
$this->next('cost');
}
}
/**
* Clear
*
* Deinitialize all deprecated parameters
*
* @return void
*/
public function clear(): void
{
// Initializing the project architecture purposes
$purposes = $this->architecture->purposes();
if (empty($purposes)) {
// The project architecture has no purposes
// Initializing the project purpose
$this->purpose = project_purpose::special;
} else if (count($purposes) === 1) {
// The project architecture has only 1 purpose
// Initializing the project purpose
$this->purpose = $purposes[0];
} else if (isset($this->purpose) && array_search($this->purpose, $purposes) !== false) {
// The project architrcture purpose is the same from deprecated purpose
// keep it
} else {
// The project can have other purposes
// Deinitializing the deprecated project purpose
unset($this->purpose);
}
// Deinitializing integrations
$this->integrations = [];
}
/**
* Hours
*
* Calculate the project development hours
*
* @param bool $absolute Summary all coefficients and then multiply?
*
* @return int|float The project development hours
*/
public function hours(): int|float
{ // Declaring coefficient
$coefficient = PROJECT_CREATE_START_COEFFICIENT ?? 0;
if (isset($this->architecture)) {
// Initialized the project architecture
// Adding into the coefficient
$coefficient += $this->architecture->coefficient();
}
if (isset($this->purpose)) {
// Initialized the project purpose
// Adding into the coefficient
$coefficient += $this->purpose->coefficient();
}
public function hours(bool $absolute = false): int|float
{
// Initializing start hours
$start = PROJECT_CREATE_START_HOURS ?? 1;
$start < 1 and $start = 1;
@@ -917,11 +1315,79 @@ final class create extends menu
// Initializing additional hours
$additional = PROJECT_CREATE_HOURS_ADDITIONAL ?? 0;
// Calculating the development hours
$hours = $start * $coefficient + $additional;
if ($absolute) {
// The absolute coefficient
// Calculating and exit (success)
return ceil(max($hours, PROJECT_CREATE_HOURS_MINIMAL));
// Declaring coefficient
$coefficient = PROJECT_CREATE_START_COEFFICIENT ?? 0;
if (isset($this->architecture)) {
// Initialized the project architecture
// Adding into the coefficient
$coefficient += $this->architecture->coefficient() ?? 0;
}
if (isset($this->purpose)) {
// Initialized the project purpose
// Adding into the coefficient
$coefficient += $this->purpose->coefficient() ?? 0;
}
if (!empty($this->integrations)) {
// Initialized the project integrations
foreach ($this->integrations as $integration) {
// Iterating over the project integrations
// Adding into the coefficient
$coefficient += $integration->coefficient() ?? 0;
}
}
// Calculating the development hours
$hours = $start * $coefficient + $additional;
// Calculating and exit (success)
return ceil(max($hours, PROJECT_CREATE_HOURS_MINIMAL));
} else {
// The relative coefficient
// Initializing the development hours
$hours = $start;
if (isset($this->architecture)) {
// Initialized the project architecture
// Adding into the coefficient
$hours *= $this->architecture->coefficient() ?? 1;
}
if (isset($this->purpose)) {
// Initialized the project purpose
// Adding into the coefficient
$hours *= $this->purpose->coefficient() ?? 1;
}
if (!empty($this->integrations)) {
// Initialized the project integrations
foreach ($this->integrations as $integration) {
// Iterating over the project integrations
// Adding into the coefficient
$hours *= $integration->coefficient() ?? 1;
}
}
//
$hours += $additional;
// Calculating and exit (success)
return ceil(max($hours, PROJECT_CREATE_HOURS_MINIMAL));
}
}
/**
@@ -952,16 +1418,18 @@ final class create extends menu
// Generating the message text
$text = implode(
"\n\n",
[
'*' . unmarkdown(sprintf("💸 $localization->project_request_title", $sex ?? 0)) . '*',
<<<TXT
array_filter(
[
'*' . unmarkdown(sprintf("💸 $localization->project_request_title", $sex ?? 0)) . '*',
<<<TXT
*$localization->project_request_architecture:* $architecture
*$localization->project_request_purpose:* $purpose
TXT,
<<<TXT
<<<TXT
*$localization->project_request_hours:* $hours
TXT
]
]
)
);
// Initializing the keyboard

View File

@@ -0,0 +1,227 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor\models;
// Files of the project
use kodorvan\constructor\models\core,
kodorvan\constructor\models\authorizations,
kodorvan\constructor\models\settings,
kodorvan\constructor\models\project,
kodorvan\constructor\models\account,
kodorvan\constructor\models\project\enumerations\type as project_type,
kodorvan\constructor\models\project\enumerations\status as project_status;
// The library for languages support
use mirzaev\languages\language;
// The library for currencies support
use mirzaev\currencies\currency;
// Baza database
use mirzaev\baza\database,
mirzaev\baza\column,
mirzaev\baza\record,
mirzaev\baza\enumerations\encoding,
mirzaev\baza\enumerations\type;
// Active Record pattern
use mirzaev\record\interfaces\record as record_interface,
mirzaev\record\traits\record as record_trait;
// Svoboda time
use svoboda\time\statement as svoboda;
// Framework for Telegram
use SergiX44\Nutgram\Telegram\Types\User\User as telegram_user;
// Built-in libraries
use Exception as exception,
RuntimeException as exception_runtime;
/**
* Worker
*
* @package kodorvan\constructor\models
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*/
final class worker extends core implements record_interface
{
use record_trait;
/**
* File
*
* @var string $file Path to the database file
*/
protected string $file = DATABASES . DIRECTORY_SEPARATOR . 'workers.baza';
/**
* Database
*
* @var database $database The database
*/
public protected(set) database $database;
/**
* Serialized
*
* @var bool $serialized Is the implementator object serialized?
*/
private bool $serialized = true;
/**
* Constructor
*
* @method record|null $record The record
*
* @return void
*/
public function __construct(?record $record = null)
{
// Initializing the database
$this->database = new database()
->encoding(encoding::utf8)
->columns(
new column('identifier', type::long_long_unsigned),
new column('account', type::long_long_unsigned),
new column('hour', type::integer_unsigned),
new column('currency', type::string, ['length' => 3]),
new column('active', type::char),
new column('updated', type::integer_unsigned),
new column('created', type::integer_unsigned)
)
->connect($this->file);
// Initializing the record
$record instanceof record and $this->record = $record;
}
/**
* Write
*
* @param int $account The account identifier
* @param int|float $hour Cost per hour
* @param currency|string $currency Currency of cost per hour
* @param bool $active Is the record active?
*
* @return record|false The record, if created
*/
public function write(
int $account,
int|float $hour,
currency|string $currency = CURRENCY_DEFAULT ?? currency::usd,
bool $active = true,
): record|false {
// Initializing the record
$record = $this->database->record(
$this->database->count() + 1,
(int) $account,
$hour,
$currency instanceof currency ? $currency->name : (string) $currency,
(int) $active,
svoboda::timestamp(),
svoboda::timestamp()
);
// Writing the record into the database
$created = $this->database->write($record);
// Exit (success)
return $created ? $record : false;
}
/**
* Account
*
* Search for the worker account
*
* @return account|null The account worker
*/
public function account(): ?account
{
// Search for the worker account
$account = new account()->read(filter: fn(record $record) => $record->active === 1 && $record->identifier === $this->account);
if ($account instanceof account) {
// Found the worker account
// Exit (success)
return $account;
}
// Exit (fail)
return null;
}
/**
* Workers
*
* Search for workers
*
* @param int $amount Amount
*
* @return array Workers
*/
public static function workers(int $amount = 100): array
{
// Search for workers and exit (success/fail)
return new static()->database->read(
filter: fn(record $record) => $record->active === 1,
amount: $amount
);
}
/**
* Serialize
*
* @return self The instance from which the method was called (fluent interface)
*/
public function serialize(): self
{
if ($this->serialized) {
// The record implementor is serialized
// Exit (fail)
throw new exception_runtime('The record implementor is already serialized');
}
// Serializing the record parameters
$this->record->currency = $this->record->currency->name;
$this->record->active = (int) $this->record->active;
// Writing the status of serializing
$this->serialized = true;
// Exit (success)
return $this;
}
/**
* Deserialize
*
* @return self The instance from which the method was called (fluent interface)
*/
public function deserialize(): self
{
if (!$this->serialized) {
// The record implementor is deserialized
// Exit (fail)
throw new exception_runtime('The record implementor is already deserialized');
}
// Deserializing the record parameters
$this->record->currency = currency::{$this->record->currency} ?? CURRENCY_DEFAULT ?? currency::usd;
$this->record->active = (bool) $this->record->active;
// Writing the status of serializing
$this->serialized = false;
// Exit (success)
return $this;
}
}

View File

@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace kodorvan\constructor\models\worker\enumerations;
// Built-in libraries
use InvalidArgumentException as exception_argument,
DomainException as exception_domain;
/**
* Type
*
* @package kodorvan\neurobot\models\worker\enumerations
*
* @license http://www.wtfpl.net/ Do What The Fuck You Want To Public License
* @author Arsen Mirzaev Tatyano-Muradovich <arsen@mirzaev.sexy>
*
* @deprecated
*/
enum type
{
case programmer;
case designer;
}

View File

@@ -22,18 +22,21 @@ define('PROJECT_OPERATOR_URL', 'https://t.me/kodorvan?direct');
define('PROJECT_REPOSITORY', REPOSITORY . '/' . PROJECT_CREATOR . '/' . PROJECT_NAME);
define('PROJECT_REPOSITORY_LANGUAGE_ADD', PROJECT_REPOSITORY . '/src/branch/stable/' . PROJECT_CREATOR . '/' . PROJECT_NAME . '/system/localizations');
define('CURRENCY_DEFAULT', currency::usd);
define('LANGUAGE_DEFAULT', language::en);
define('PROJECT_CREATE_START_HOURS', 1);
define('PROJECT_CREATE_START_COEFFICIENT', 0);
define('PROJECT_CREATE_HOURS_ADDITIONAL', 0);
define('PROJECT_CREATE_HOURS_MINIMAL', 4);
define('PROJECT_CREATE_COST_HOUR_DEFAULT', 1200);
define('PROJECT_CREATE_DAY_HOURS', 4);
define('PROJECT_CREATE_DAY_ADDITIONAL', 1);
define('PROJECT_CREATE_COST_HOUR_DEFAULT', 20);
define('PROJECT_CREATE_COST_CURRENCY', CURRENCY_DEFAULT);
define('PROJECT_CREATE_REQUEST_RECEIVERS', [
'-0000000000000'
]);
define('CURRENCY_DEFAULT', currency::rub);
define('LANGUAGE_DEFAULT', language::en);
// Initializing default theme for the views templater
define('THEME', 'default');