From d553a261d80c12e5e854ff6fb29f04b243c65110 Mon Sep 17 00:00:00 2001
From: Vyacheslav Tumanov <me@slavatumanov.me>
Date: Thu, 8 Jun 2023 20:58:48 +0500
Subject: [PATCH] UBER-158: new popup dialog (#3409)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
---
 packages/presentation/src/components/MessageBox.svelte       | 3 ++-
 plugins/recruit-assets/lang/en.json                          | 5 +++--
 plugins/recruit-assets/lang/ru.json                          | 5 +++--
 .../recruit-resources/src/components/CreateVacancy.svelte    | 3 ++-
 plugins/recruit-resources/src/plugin.ts                      | 1 +
 plugins/tracker-assets/lang/en.json                          | 5 +++--
 plugins/tracker-assets/lang/ru.json                          | 5 +++--
 plugins/tracker-resources/src/components/CreateIssue.svelte  | 3 ++-
 plugins/tracker-resources/src/plugin.ts                      | 1 +
 9 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/packages/presentation/src/components/MessageBox.svelte b/packages/presentation/src/components/MessageBox.svelte
index dc4041bb64..78cc159490 100644
--- a/packages/presentation/src/components/MessageBox.svelte
+++ b/packages/presentation/src/components/MessageBox.svelte
@@ -22,6 +22,7 @@
   export let labelProps: IntlString
   export let message: IntlString
   export let params: Record<string, any> = {}
+  export let okLabel: IntlString | undefined = undefined
   export let canSubmit = true
   export let action: (() => Promise<void>) | undefined = undefined
 
@@ -40,7 +41,7 @@
     <Button
       focus
       focusIndex={1}
-      label={presentation.string.Ok}
+      label={okLabel ?? presentation.string.Ok}
       size={'large'}
       kind={'primary'}
       loading={processing}
diff --git a/plugins/recruit-assets/lang/en.json b/plugins/recruit-assets/lang/en.json
index 89f1a008d7..ea5583ddca 100644
--- a/plugins/recruit-assets/lang/en.json
+++ b/plugins/recruit-assets/lang/en.json
@@ -106,8 +106,9 @@
     "SearchVacancy": "Search vacancy...",
     "Organizations": "Companies",
 
-    "TemplateReplace": "You you replace selected template?",
-    "TemplateReplaceConfirm": "All field changes will be override by template values",
+    "TemplateReplace": "Do you want to apply the new template?",
+    "TemplateReplaceConfirm": "All fields will be overwritten by the new template values",
+    "Apply": "Apply",
 
     "OpenVacancyList": "Open list",
     "Export": "Export",
diff --git a/plugins/recruit-assets/lang/ru.json b/plugins/recruit-assets/lang/ru.json
index 83f3305288..c4ec0da490 100644
--- a/plugins/recruit-assets/lang/ru.json
+++ b/plugins/recruit-assets/lang/ru.json
@@ -107,8 +107,9 @@
     "MoveApplication": "Поменять Вакансию",
     "SearchVacancy": "Найти вакансию...",
     "Organizations": "Компании",
-    "TemplateReplace": "Вы хотите заменить выбранный шаблон?",
-    "TemplateReplaceConfirm": "Все внесенные изменения в будут заменены значениями из шаблоном",
+    "TemplateReplace": "Вы хотите применить выбранный шаблон?",
+    "TemplateReplaceConfirm": "Все внесенные изменения в будут заменены значениями из нового шаблона",
+    "Apply": "Применить",
     "OpenVacancyList": "Открыть список",
     "Export": "Экспорт",
     "ConfigLabel": "Рекрутинг",
diff --git a/plugins/recruit-resources/src/components/CreateVacancy.svelte b/plugins/recruit-resources/src/components/CreateVacancy.svelte
index c0a22c13a5..18701aef15 100644
--- a/plugins/recruit-resources/src/components/CreateVacancy.svelte
+++ b/plugins/recruit-resources/src/components/CreateVacancy.svelte
@@ -219,7 +219,8 @@
       MessageBox,
       {
         label: recruit.string.TemplateReplace,
-        message: recruit.string.TemplateReplaceConfirm
+        message: recruit.string.TemplateReplaceConfirm,
+        okLabel: recruit.string.Apply
       },
       'top',
       (result?: boolean) => {
diff --git a/plugins/recruit-resources/src/plugin.ts b/plugins/recruit-resources/src/plugin.ts
index 870cde34b2..ac96ab63e8 100644
--- a/plugins/recruit-resources/src/plugin.ts
+++ b/plugins/recruit-resources/src/plugin.ts
@@ -128,6 +128,7 @@ export default mergeIds(recruitId, recruit, {
 
     TemplateReplace: '' as IntlString,
     TemplateReplaceConfirm: '' as IntlString,
+    Apply: '' as IntlString,
     OpenVacancyList: '' as IntlString,
     Export: '' as IntlString
   },
diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json
index 285bc9ac4a..33f6a9836e 100644
--- a/plugins/tracker-assets/lang/en.json
+++ b/plugins/tracker-assets/lang/en.json
@@ -262,8 +262,9 @@
     "NewProcess": "New Template",
     "SaveProcess": "Save Template",
     "NoIssueTemplate": "No Template",
-    "TemplateReplace": "You you replace selected template?",
-    "TemplateReplaceConfirm": "All field changes will be override by template values",
+    "TemplateReplace": "Do you want to apply the new template?",
+    "TemplateReplaceConfirm": "All fields will be overwritten by the new template values",
+    "Apply": "Apply",
 
     "CurrentWorkDay": "Current Working Day",
     "PreviousWorkDay": "Previous Working Day",
diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json
index c515607228..5f8a9fbb1b 100644
--- a/plugins/tracker-assets/lang/ru.json
+++ b/plugins/tracker-assets/lang/ru.json
@@ -262,8 +262,9 @@
     "NewProcess": "Новый шаблон",
     "SaveProcess": "Сохранить шаблон",
     "NoIssueTemplate": "Шаблон не задан",
-    "TemplateReplace": "Вы хотите заменить выбранный шаблон?",
-    "TemplateReplaceConfirm": "Все внесенные изменения в будут заменены значениями из шаблоном",
+    "TemplateReplace": "Вы хотите применить выбранный шаблон?",
+    "TemplateReplaceConfirm": "Все внесенные изменения в будут заменены значениями из нового шаблона",
+    "Apply": "Применить",
 
     "CurrentWorkDay": "Текущий Рабочий День",
     "PreviousWorkDay": "Предыдущий Рабочий День",
diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte
index 4c8382bd12..2e0806b04a 100644
--- a/plugins/tracker-resources/src/components/CreateIssue.svelte
+++ b/plugins/tracker-resources/src/components/CreateIssue.svelte
@@ -475,7 +475,8 @@
       MessageBox,
       {
         label: tracker.string.TemplateReplace,
-        message: tracker.string.TemplateReplaceConfirm
+        message: tracker.string.TemplateReplaceConfirm,
+        okLabel: tracker.string.Apply
       },
       'top',
       (result?: boolean) => {
diff --git a/plugins/tracker-resources/src/plugin.ts b/plugins/tracker-resources/src/plugin.ts
index 8ba178564a..fbd865a940 100644
--- a/plugins/tracker-resources/src/plugin.ts
+++ b/plugins/tracker-resources/src/plugin.ts
@@ -293,6 +293,7 @@ export default mergeIds(trackerId, tracker, {
     NoIssueTemplate: '' as IntlString,
     TemplateReplace: '' as IntlString,
     TemplateReplaceConfirm: '' as IntlString,
+    Apply: '' as IntlString,
 
     CurrentWorkDay: '' as IntlString,
     PreviousWorkDay: '' as IntlString,