feat: add customizable text for manager contact button
- Add text_manager_button field to TextsDTO with getter method - Update SettingsSerializerService to validate and deserialize new field - Add text_manager_button field to admin settings store - Add input field in admin TextsView for configuring button text - Update SPA SettingsStore with default value including emoji - Replace hardcoded button text in Product.vue with configurable text - Remove SVG icon from manager button to allow emoji usage - Add default value with emoji to app.php configuration - Button text now customizable via admin panel Texts tab
This commit is contained in:
@@ -63,6 +63,7 @@ HTML,
|
||||
'text_no_more_products' => 'Это всё по текущему запросу. Попробуйте уточнить фильтры или поиск.',
|
||||
'text_empty_cart' => 'Ваша корзина пуста.',
|
||||
'text_order_created_success' => 'Ваш заказ успешно оформлен и будет обработан в ближайшее время.',
|
||||
'text_manager_button' => '💬 Связаться с менеджером',
|
||||
'start_message' => <<<HTML
|
||||
👋 <b>Добро пожаловать!</b>
|
||||
|
||||
|
||||
@@ -7,15 +7,18 @@ final class TextsDTO
|
||||
private string $textNoMoreProducts;
|
||||
private string $textEmptyCart;
|
||||
private string $textOrderCreatedSuccess;
|
||||
private string $textManagerButton;
|
||||
|
||||
public function __construct(
|
||||
string $textNoMoreProducts,
|
||||
string $textEmptyCart,
|
||||
string $textOrderCreatedSuccess
|
||||
string $textOrderCreatedSuccess,
|
||||
string $textManagerButton
|
||||
) {
|
||||
$this->textNoMoreProducts = $textNoMoreProducts;
|
||||
$this->textEmptyCart = $textEmptyCart;
|
||||
$this->textOrderCreatedSuccess = $textOrderCreatedSuccess;
|
||||
$this->textManagerButton = $textManagerButton;
|
||||
}
|
||||
|
||||
public function getTextNoMoreProducts(): string
|
||||
@@ -33,12 +36,18 @@ final class TextsDTO
|
||||
return $this->textOrderCreatedSuccess;
|
||||
}
|
||||
|
||||
public function getTextManagerButton(): string
|
||||
{
|
||||
return $this->textManagerButton;
|
||||
}
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'text_no_more_products' => $this->textNoMoreProducts,
|
||||
'text_empty_cart' => $this->textEmptyCart,
|
||||
'text_order_created_success' => $this->textOrderCreatedSuccess,
|
||||
'text_manager_button' => $this->textManagerButton,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,8 @@ class SettingsSerializerService
|
||||
return new TextsDTO(
|
||||
$data['text_no_more_products'],
|
||||
$data['text_empty_cart'],
|
||||
$data['text_order_created_success']
|
||||
$data['text_order_created_success'],
|
||||
$data['text_manager_button'] ?? ''
|
||||
);
|
||||
}
|
||||
|
||||
@@ -377,6 +378,10 @@ class SettingsSerializerService
|
||||
if (isset($data['text_order_created_success']) && ! is_string($data['text_order_created_success'])) {
|
||||
throw new InvalidArgumentException('texts.text_order_created_success must be a string');
|
||||
}
|
||||
|
||||
if (isset($data['text_manager_button']) && ! is_string($data['text_manager_button'])) {
|
||||
throw new InvalidArgumentException('texts.text_manager_button must be a string');
|
||||
}
|
||||
}
|
||||
|
||||
private function deserializeLogs(array $logs): LogsDTO
|
||||
|
||||
Reference in New Issue
Block a user