generated from mirzaev/pot-php-telegram
cost changing
This commit is contained in:
@@ -25,13 +25,17 @@ 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_button_back' => 'Назад',
|
||||
'project_create_button_cost_per_hour' => 'Час',
|
||||
'project_create_button_request' => 'Заказать',
|
||||
@@ -47,7 +51,7 @@ return [
|
||||
'project_create_button_purpose_selected' => 'Назнач.',
|
||||
|
||||
'project_create_integrations_title' => 'Выбор интеграций',
|
||||
'project_create_integrations_description' => "Синхронизация данных в реальном времени, скачивание, загрузка, перенос информации, админ\-панель, рассылка сообщений, подключение аккаунтов\.\.\.\n\n_Отправка запросов в *API*, генерация и перехват *HTTP\-сообщений*, *эмуляция* действий пользователя через *виртуальный браузер* с курсором мыши и клавиатурой, либо *нестандартные протоколы связи*_",
|
||||
'project_create_integrations_description' => "Синхронизация заказов, товаров, публикаций и прочего в реальном времени, скачивание, загрузка, админ\-панель, рассылка сообщений, подключение аккаунтов\.\.\.\n\n_Отправка запросов в *API*, генерация и перехват *HTTP\-сообщений*, *эмуляция действий пользователя*_",
|
||||
'project_create_button_integrations' => 'Интеграции',
|
||||
'project_create_button_integrations_selected' => 'Интеграции',
|
||||
|
||||
|
||||
@@ -78,6 +78,15 @@ final class create extends menu
|
||||
*/
|
||||
public int|float $cost = PROJECT_CREATE_COST_HOUR_DEFAULT ?? 0;
|
||||
|
||||
/**
|
||||
* Messages
|
||||
*
|
||||
* Registry of messages for cleaning
|
||||
*
|
||||
* @var array $messages
|
||||
*/
|
||||
public array $messages = [];
|
||||
|
||||
/**
|
||||
* Start
|
||||
*
|
||||
@@ -515,8 +524,8 @@ final class create extends menu
|
||||
// Writing the project buttons
|
||||
$this->addButtonRow(
|
||||
button::make(
|
||||
text: '⚖️ ' . "$localization->project_create_button_cost_per_hour: $this->cost" . $account->currency->symbol(),
|
||||
callback_data: '@cost'
|
||||
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",
|
||||
@@ -529,8 +538,8 @@ final class create extends menu
|
||||
// Writing the project cost per hour button
|
||||
$this->addButtonRow(
|
||||
button::make(
|
||||
text: '⚖️ ' . $localization->project_create_button_cost_per_hour,
|
||||
callback_data: '@cost'
|
||||
text: '🛠 ' . $localization->project_create_button_cost_per_hour,
|
||||
callback_data: 'set@cost'
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -551,7 +560,7 @@ final class create extends menu
|
||||
*/
|
||||
public function continue(telegram $robot): void
|
||||
{
|
||||
// Continuing the process
|
||||
// Sending the process main menu
|
||||
$this->start(robot: $robot, new: false);
|
||||
}
|
||||
|
||||
@@ -580,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
|
||||
@@ -732,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);
|
||||
}
|
||||
|
||||
@@ -760,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
|
||||
@@ -922,7 +933,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);
|
||||
}
|
||||
|
||||
@@ -950,10 +961,10 @@ final class create extends menu
|
||||
$this->menuText(
|
||||
text: implode(
|
||||
"\n\n",
|
||||
[
|
||||
array_filter([
|
||||
"📡 *$localization->project_create_integrations_title*",
|
||||
$localization->project_create_integrations_description,
|
||||
]
|
||||
])
|
||||
),
|
||||
opt: [
|
||||
'parse_mode' => mode::MARKDOWN
|
||||
@@ -1120,29 +1131,80 @@ final class create extends menu
|
||||
// Initializing the account localization
|
||||
$localization = $robot->get('localization') ?? new localization($language);
|
||||
|
||||
// Initializing the integration
|
||||
$integration = project_integration::{$robot->callbackQuery()->data};
|
||||
// Initializing the user input message
|
||||
$message = $robot->message();
|
||||
|
||||
if (isset($this->integrations[$integration->name])) {
|
||||
// Enabled
|
||||
// Initializing the user input message text
|
||||
$text = $message?->text;
|
||||
|
||||
// Disabling
|
||||
unset($this->integrations[$integration->name]);
|
||||
// Initializing the message data
|
||||
$data = $robot->callbackQuery()?->data;
|
||||
|
||||
if (!empty($text) && $data !== 'set') {
|
||||
// Not empty text
|
||||
|
||||
// Writing the user input message into the messages registry
|
||||
$this->messages[] = $message;
|
||||
|
||||
// Initializing the text length
|
||||
$length = mb_strlen($text);
|
||||
|
||||
if ($length > 0) {
|
||||
// More than 2 symbols text
|
||||
|
||||
// Sanitizing
|
||||
$float = filter_var($text, FILTER_SANITIZE_NUMBER_FLOAT);
|
||||
|
||||
if (filter_var($float, FILTER_VALIDATE_FLOAT)) {
|
||||
// Number
|
||||
|
||||
// Writing the cost
|
||||
$this->cost = (float)$float;
|
||||
|
||||
foreach ($this->messages as $message) {
|
||||
// Iterating over messages registry
|
||||
|
||||
// Deleting the message
|
||||
$message->delete();
|
||||
}
|
||||
|
||||
// Deinitializing the messages registry
|
||||
$this->messages = [];
|
||||
|
||||
// Sending the process main menu
|
||||
$this->start(robot: $robot, new: false);
|
||||
}
|
||||
} else {
|
||||
// Less or equal than 2 symbols text
|
||||
|
||||
}
|
||||
} else {
|
||||
// Disabled
|
||||
// Empty text
|
||||
|
||||
// Enabling
|
||||
$this->integrations[$integration->name] = $integration;
|
||||
};
|
||||
// Sending the message
|
||||
$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,
|
||||
);
|
||||
|
||||
// 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);
|
||||
// Waiting for the user input
|
||||
$this->next('cost');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1303,16 +1365,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
|
||||
|
||||
Reference in New Issue
Block a user