hl-core 0.0.7 → 0.0.8-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/.prettierrc +2 -1
  2. package/api/index.ts +548 -0
  3. package/api/interceptors.ts +38 -0
  4. package/components/Button/Btn.vue +57 -0
  5. package/components/Button/BtnIcon.vue +47 -0
  6. package/components/Button/ScrollButtons.vue +6 -0
  7. package/components/Button/SortArrow.vue +21 -0
  8. package/components/Complex/Content.vue +5 -0
  9. package/components/Complex/ContentBlock.vue +5 -0
  10. package/components/Complex/Page.vue +43 -0
  11. package/components/Dialog/Dialog.vue +76 -0
  12. package/components/Dialog/FamilyDialog.vue +39 -0
  13. package/components/Form/FormBlock.vue +114 -0
  14. package/components/Form/FormSection.vue +18 -0
  15. package/components/Form/FormTextSection.vue +20 -0
  16. package/components/Form/FormToggle.vue +52 -0
  17. package/components/Form/ProductConditionsBlock.vue +68 -0
  18. package/components/Input/EmptyFormField.vue +5 -0
  19. package/components/Input/FileInput.vue +71 -0
  20. package/components/Input/FormInput.vue +171 -0
  21. package/components/Input/PanelInput.vue +133 -0
  22. package/components/Input/RoundedInput.vue +143 -0
  23. package/components/Layout/Drawer.vue +45 -0
  24. package/components/Layout/Header.vue +48 -0
  25. package/components/Layout/Loader.vue +35 -0
  26. package/components/Layout/SettingsPanel.vue +48 -0
  27. package/components/List/ListEmpty.vue +22 -0
  28. package/components/Menu/MenuNav.vue +108 -0
  29. package/components/Menu/MenuNavItem.vue +37 -0
  30. package/components/Pages/Anketa.vue +333 -0
  31. package/components/Pages/Auth.vue +91 -0
  32. package/components/Pages/Documents.vue +108 -0
  33. package/components/Pages/MemberForm.vue +1134 -0
  34. package/components/Pages/ProductAgreement.vue +18 -0
  35. package/components/Pages/ProductConditions.vue +360 -0
  36. package/components/Panel/PanelHandler.vue +231 -0
  37. package/components/Panel/PanelItem.vue +5 -0
  38. package/components/Panel/PanelSelectItem.vue +20 -0
  39. package/components/Transitions/FadeTransition.vue +5 -0
  40. package/components/Transitions/SlideTransition.vue +5 -0
  41. package/composables/axios.ts +11 -0
  42. package/composables/classes.ts +1129 -0
  43. package/composables/constants.ts +65 -0
  44. package/composables/index.ts +168 -2
  45. package/composables/styles.ts +43 -8
  46. package/layouts/clear.vue +3 -0
  47. package/layouts/default.vue +75 -0
  48. package/layouts/full.vue +6 -0
  49. package/nuxt.config.ts +27 -5
  50. package/package.json +23 -11
  51. package/pages/500.vue +85 -0
  52. package/plugins/helperFunctionsPlugins.ts +14 -2
  53. package/plugins/storePlugin.ts +6 -7
  54. package/plugins/vuetifyPlugin.ts +10 -0
  55. package/store/data.store.js +2482 -6
  56. package/store/form.store.ts +8 -0
  57. package/store/member.store.ts +291 -0
  58. package/store/messages.ts +160 -37
  59. package/store/rules.js +26 -28
  60. package/tailwind.config.js +10 -0
  61. package/types/index.ts +303 -0
  62. package/app.vue +0 -3
  63. package/components/Button/GreenBtn.vue +0 -33
  64. package/store/app.store.js +0 -12
@@ -0,0 +1,18 @@
1
+ <template>
2
+ <base-content :title="$t('agreementBlock.title')" class="!w-full">
3
+ <p class="h-full p-4 lg:p-8 leading-8 font-medium" :class="[$libStyles.scrollPage, $libStyles.textSimple]">&nbsp;&nbsp;&nbsp;&nbsp; {{ $t('agreementBlock.text') }}</p>
4
+ </base-content>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ export default defineComponent({
9
+ setup() {
10
+ const dataStore = useDataStore();
11
+
12
+ onUnmounted(() => {
13
+ dataStore.panel.open = false;
14
+ dataStore.panelAction = null;
15
+ });
16
+ },
17
+ });
18
+ </script>
@@ -0,0 +1,360 @@
1
+ <template>
2
+ <section class="flex flex-col gap-4 px-[10px]">
3
+ <v-form ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
+ <base-form-section v-if="$dataStore.isGons" :title="$t('productConditionsForm.requestedProductConditions')" :class="[$libStyles.textSimple]">
5
+ <base-form-text-section
6
+ class="mb-4"
7
+ title="Инвалидность I или II группы по причине несчастного случая, начиная с третьего года по любой причине, с освобождением от уплаты страховых взносов"
8
+ subtitle="Равна страховой сумме по основному покрытию"
9
+ ></base-form-text-section>
10
+ <base-form-text-section
11
+ title="Если лицо, назначенное Выгодоприобретателем, на дату осуществления Страховщиком страховой выплаты не достигло совершеннолетия (восемнадцатилетнего возраста), страховая
12
+ выплата подлежит осуществлению:"
13
+ subtitle="Если несовершеннолетний не достиг возраста 14 лет - законному представителю в соответствии с законодательством Республики Казахстан"
14
+ ></base-form-text-section>
15
+ </base-form-section>
16
+ <base-form-section :title="$t('generalConditions')">
17
+ <div v-if="isRecalculation && $route.params.taskId === '0'">
18
+ <base-form-input
19
+ v-model="productConditionsForm.signDate"
20
+ :maska="$maska.date"
21
+ :clearable="false"
22
+ :readonly="true"
23
+ :label="$t('form.signDate')"
24
+ append-inner-icon="mdi mdi-calendar-blank-outline"
25
+ ></base-form-input>
26
+ <base-form-input
27
+ v-model="productConditionsForm.birthDate"
28
+ :maska="$maska.date"
29
+ :readonly="isDisabled"
30
+ :clearable="!isDisabled"
31
+ :label="$t('form.birthDate')"
32
+ :rules="$rules.required.concat($rules.birthDate)"
33
+ append-inner-icon="mdi mdi-calendar-blank-outline"
34
+ ></base-form-input>
35
+ <base-panel-input
36
+ v-model="productConditionsForm.gender"
37
+ :value="productConditionsForm.gender.nameRu"
38
+ :readonly="isDisabled"
39
+ :clearable="!isDisabled"
40
+ :label="$t('form.gender')"
41
+ :rules="$rules.objectRequired"
42
+ append-inner-icon="mdi mdi-chevron-right"
43
+ @append="openPanel($t('form.gender'), $dataStore.gender, 'gender')"
44
+ ></base-panel-input>
45
+ </div>
46
+ <base-form-input
47
+ v-model="productConditionsForm.coverPeriod"
48
+ :maska="$maska.numbers"
49
+ :readonly="isDisabled"
50
+ :clearable="!isDisabled"
51
+ :rules="$rules.required.concat($rules.numbers, $rules.coverPeriodFrom3to20)"
52
+ :label="$t('productConditionsForm.coverPeriodFrom3to20')"
53
+ ></base-form-input>
54
+ <base-panel-input
55
+ v-model="productConditionsForm.paymentPeriod"
56
+ :value="productConditionsForm.paymentPeriod.nameRu"
57
+ :readonly="isDisabled"
58
+ :clearable="!isDisabled"
59
+ :rules="$rules.objectRequired"
60
+ :label="$t('productConditionsForm.processPaymentPeriod')"
61
+ append-inner-icon="mdi mdi-chevron-right"
62
+ @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
63
+ ></base-panel-input>
64
+ <base-form-input
65
+ v-model="productConditionsForm.requestedSumInsured"
66
+ :readonly="isDisabled"
67
+ :clearable="!isDisabled"
68
+ :rules="requestedSumInsured"
69
+ :label="$t('productConditionsForm.requestedSumInsured')"
70
+ ></base-form-input>
71
+ <base-form-input
72
+ v-model="productConditionsForm.insurancePremiumPerMonth"
73
+ :readonly="isDisabled"
74
+ :clearable="!isDisabled"
75
+ :rules="insurancePremiumPerMonth"
76
+ :label="$t('productConditionsForm.insurancePremiumAmount')"
77
+ ></base-form-input>
78
+ </base-form-section>
79
+ </v-form>
80
+ <base-btn
81
+ v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
82
+ :loading="isCalculating"
83
+ :text="$t('buttons.calculate')"
84
+ @click="submitForm"
85
+ ></base-btn>
86
+ <Teleport v-if="isPanelOpen" to="#panel-actions">
87
+ <div :class="[$libStyles.scrollPage]" class="flex flex-col items-center">
88
+ <base-rounded-input v-model="searchQuery" :label="$t('labels.search')" class="w-full p-2" :hide-details="true"></base-rounded-input>
89
+ <div v-if="panelList && isPanelLoading === false" class="w-full flex flex-col gap-2 p-2">
90
+ <base-panel-select-item :text="$t('form.notChosen')" :selected="panelValue.nameRu === null" @click="pickPanelValue(new Value())"></base-panel-select-item>
91
+ <base-panel-select-item
92
+ v-for="(item, index) of panelList.filter(i => i.nameRu && (i.nameRu as string).match(new RegExp(searchQuery, 'i')))"
93
+ :key="index"
94
+ :text="item.nameRu as string"
95
+ :selected="item.nameRu === panelValue.nameRu"
96
+ @click="pickPanelValue(item)"
97
+ ></base-panel-select-item>
98
+ </div>
99
+ <base-loader v-if="isPanelLoading" class="absolute mt-10" :size="50"></base-loader>
100
+ </div>
101
+ </Teleport>
102
+ </section>
103
+ </template>
104
+
105
+ <script lang="ts">
106
+ import { Value } from '@/composables/classes';
107
+
108
+ export default defineComponent({
109
+ props: {
110
+ isRecalculation: {
111
+ type: Boolean,
112
+ default: false,
113
+ },
114
+ },
115
+ setup(props) {
116
+ const vForm = ref<any>();
117
+ const route = useRoute();
118
+ const router = useRouter();
119
+ const formStore = useFormStore();
120
+ const dataStore = useDataStore();
121
+ const memberStore = useMemberStore();
122
+
123
+ const isCalculating = ref<boolean>(false);
124
+ const isPanelLoading = ref<boolean>(false);
125
+ const isPanelOpen = ref<boolean>(false);
126
+ const panelValue = ref<Value>(new Value());
127
+ const panelList = ref<Value[]>([]);
128
+ const productConditionsForm = formStore.productConditionsForm;
129
+ const currentPanel = ref<keyof typeof productConditionsForm>();
130
+ const searchQuery = ref<string>('');
131
+ const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
132
+
133
+ const isUnderwriterForm = computed(() => {
134
+ if (route.params.taskId === '0 ' || props.isRecalculation === true) {
135
+ return false;
136
+ } else {
137
+ return formStore.applicationData.statusCode === 'UnderwriterForm';
138
+ }
139
+ });
140
+ const isDisabled = computed(() => !memberStore.isStatementEditible(formStore.productConditionsFormKey));
141
+ const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
142
+ const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
143
+ const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
144
+
145
+ const pickPanelValue = (item: Value) => {
146
+ if (!isDisabled.value) {
147
+ dataStore.panel.open = false;
148
+ isPanelOpen.value = false;
149
+ // @ts-ignore
150
+ productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
151
+ } else {
152
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
153
+ }
154
+ };
155
+
156
+ const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
157
+ if (!isDisabled.value) {
158
+ searchQuery.value = '';
159
+ currentPanel.value = key as keyof typeof productConditionsForm;
160
+ isPanelOpen.value = true;
161
+ dataStore.panelAction = null;
162
+ dataStore.panel.open = true;
163
+ dataStore.panel.title = title;
164
+
165
+ let newList = list;
166
+ if (asyncFunction) {
167
+ isPanelLoading.value = true;
168
+ newList = await asyncFunction(filterKey, formStore.productConditionsFormKey);
169
+ }
170
+ panelList.value = newList;
171
+ // @ts-ignore
172
+ panelValue.value = productConditionsForm[currentPanel.value];
173
+ isPanelLoading.value = false;
174
+ } else {
175
+ dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
176
+ }
177
+ };
178
+
179
+ const pickCalculation = async (type: 'insurancePremiumPerMonth' | 'requestedSumInsured') => {
180
+ if (!type) return false;
181
+ whichSum.value = type;
182
+ await submitForm();
183
+ };
184
+
185
+ const submitForm = async () => {
186
+ vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
187
+ if (v.valid) {
188
+ if (whichSum.value === 'requestedSumInsured') {
189
+ productConditionsForm.insurancePremiumPerMonth = null;
190
+ }
191
+ if (whichSum.value === 'insurancePremiumPerMonth') {
192
+ productConditionsForm.requestedSumInsured = null;
193
+ }
194
+ if (productConditionsForm.requestedSumInsured !== '' && productConditionsForm.requestedSumInsured != null) {
195
+ productConditionsForm.insurancePremiumPerMonth = null;
196
+ if (props.isRecalculation) whichSum.value = 'requestedSumInsured';
197
+ }
198
+ if (productConditionsForm.insurancePremiumPerMonth !== '' && productConditionsForm.insurancePremiumPerMonth != null) {
199
+ productConditionsForm.requestedSumInsured = null;
200
+ if (props.isRecalculation) whichSum.value = 'insurancePremiumPerMonth';
201
+ }
202
+
203
+ if (!whichSum.value && isUnderwriterForm.value === false) {
204
+ dataStore.showToaster('error', dataStore.t('toaster.emptyProductConditions'));
205
+ return;
206
+ }
207
+
208
+ if (isUnderwriterForm.value) {
209
+ type recalculationInfo = {
210
+ lifeMultiply: string | null;
211
+ lifeAdditive: string | null;
212
+ adbMultiply: string | null;
213
+ adbAdditive: string | null;
214
+ disabilityMultiply: string | null;
215
+ disabilityAdditive: string | null;
216
+ amount?: number | null;
217
+ premium?: number | null;
218
+ riskGroup?: string | number | null;
219
+ };
220
+ const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
221
+ lifeMultiply,
222
+ lifeAdditive,
223
+ adbMultiply,
224
+ adbAdditive,
225
+ disabilityMultiply,
226
+ disabilityAdditive,
227
+ }))(productConditionsForm);
228
+ Object.keys(recalculationData).forEach(key => {
229
+ // @ts-ignore
230
+ recalculationData[key] = formatProcents(recalculationData[key]);
231
+ });
232
+ recalculationData.amount = Number((productConditionsForm.requestedSumInsured as string)?.replace(/\s/g, ''));
233
+ recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
234
+ recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
235
+ isCalculating.value = true;
236
+ await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId, whichSum.value);
237
+ }
238
+ isCalculating.value = true;
239
+ if (props.isRecalculation) {
240
+ await dataStore.calculateWithoutApplication(true);
241
+ } else {
242
+ if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
243
+ await dataStore.calculate(route.params.taskId);
244
+ }
245
+ }
246
+ isCalculating.value = false;
247
+ } else {
248
+ const errors = document.querySelector('.v-input--error');
249
+ if (errors) {
250
+ const errorText = errors.querySelector('.v-label.v-field-label');
251
+ if (errorText) {
252
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorText.innerHTML?.replace(/[-<>!//.]/g, '')));
253
+ } else {
254
+ const errorFieldText = errors.querySelector('.v-input__control');
255
+ if (errorFieldText) {
256
+ dataStore.showToaster('error', dataStore.t('toaster.errorFormField').replace('{text}', errorFieldText.innerHTML?.replace(/[-<>!//.]/g, '')));
257
+ }
258
+ }
259
+ errors.scrollIntoView({
260
+ behavior: 'smooth',
261
+ block: 'center',
262
+ inline: 'nearest',
263
+ });
264
+ }
265
+ }
266
+ });
267
+ };
268
+
269
+ onMounted(async () => {
270
+ if (props.isRecalculation === true) {
271
+ if (route.params.taskId === '0' && productConditionsForm.requestedSumInsured === null && productConditionsForm.insurancePremiumPerMonth === null) {
272
+ const defaultData = await dataStore.getDefaultCalculationData(true);
273
+ if (!defaultData) {
274
+ dataStore.showToaster('error', 'Отсутствуют базовые данные');
275
+ return;
276
+ }
277
+ formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
278
+ productConditionsForm.requestedSumInsured = defaultData.amount;
279
+ productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
280
+ productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
281
+ productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
282
+ productConditionsForm.signDate = reformatDate(defaultData.signDate);
283
+ }
284
+ }
285
+ if (!!productConditionsForm.insurancePremiumPerMonth) {
286
+ whichSum.value = 'insurancePremiumPerMonth';
287
+ }
288
+ if (!!productConditionsForm.requestedSumInsured) {
289
+ whichSum.value = 'requestedSumInsured';
290
+ }
291
+ });
292
+
293
+ watch(
294
+ () => productConditionsForm.requestedSumInsured,
295
+ val => {
296
+ if (!val && whichSum.value == 'requestedSumInsured') whichSum.value = '';
297
+ if (val && whichSum.value != 'insurancePremiumPerMonth') {
298
+ whichSum.value = 'requestedSumInsured';
299
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(val);
300
+ }
301
+ },
302
+ );
303
+ watch(
304
+ () => productConditionsForm.insurancePremiumPerMonth,
305
+ val => {
306
+ if (!val && whichSum.value == 'insurancePremiumPerMonth') whichSum.value = '';
307
+ if (val && whichSum.value != 'requestedSumInsured') {
308
+ whichSum.value = 'insurancePremiumPerMonth';
309
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(val);
310
+ }
311
+ },
312
+ );
313
+ watch(
314
+ () => productConditionsForm.amountOfInsurancePremium,
315
+ val => {
316
+ if (val) productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
317
+ },
318
+ );
319
+
320
+ watch(
321
+ () => dataStore.panel.open,
322
+ () => {
323
+ if (dataStore.panel.open === false) {
324
+ isPanelOpen.value = false;
325
+ dataStore.panelAction = null;
326
+ }
327
+ },
328
+ { immediate: true },
329
+ );
330
+
331
+ return {
332
+ // State
333
+ formStore,
334
+ vForm,
335
+ productConditionsForm,
336
+ isCalculating,
337
+ isPanelLoading,
338
+ isPanelOpen,
339
+ panelValue,
340
+ panelList,
341
+ searchQuery,
342
+ whichSum,
343
+ Value,
344
+
345
+ // Computed
346
+ isTask,
347
+ isDisabled,
348
+ isUnderwriterForm,
349
+ insurancePremiumPerMonth,
350
+ requestedSumInsured,
351
+
352
+ // Functions
353
+ submitForm,
354
+ pickPanelValue,
355
+ openPanel,
356
+ pickCalculation,
357
+ };
358
+ },
359
+ });
360
+ </script>
@@ -0,0 +1,231 @@
1
+ <template>
2
+ <section v-if="sendingActions">
3
+ <div :class="[$libStyles.flexColNav]">
4
+ <v-form ref="vForm">
5
+ <base-rounded-input v-model="actionCause" placeholder="Причина" :rules="$rules.required"></base-rounded-input>
6
+ </v-form>
7
+ <base-btn :text="buttonText" :loading="loading" @click="submitForm"></base-btn>
8
+ </div>
9
+ </section>
10
+ <section v-if="acceptAction">
11
+ <div :class="[$libStyles.flexColNav]">
12
+ <base-content-block class="flex flex-col gap-3">
13
+ <span
14
+ >{{ `Сумма страховой премии ${paymentPeriod}:` }} <b>{{ `${insurancePremiumPerMonth}₸` }}</b></span
15
+ >
16
+ <span
17
+ >{{ `Запрашиваемая страховая сумма: ` }} <b>{{ `${requestedSumInsured}₸` }}</b>
18
+ </span>
19
+ </base-content-block>
20
+ <base-btn :text="$t('confirm.yes')" @click="handleTask"></base-btn>
21
+ <base-btn :btn="$libStyles.blueLightBtn" :text="$t('confirm.no')" @click="closePanel"></base-btn>
22
+ </div>
23
+ </section>
24
+ <section v-if="signingActions" class="relative">
25
+ <div>
26
+ <base-fade-transition>
27
+ <div v-if="!isSendNumberOpen" :class="[$libStyles.flexColNav]">
28
+ <div :class="[$libStyles.blueBgLight]" class="rounded-lg p-4">
29
+ <v-expansion-panels v-if="formStore.signUrls && formStore.signUrls.length" variant="accordion" multiple>
30
+ <v-expansion-panel v-for="signUrl of formStore.signUrls" :key="signUrl.iin!" class="border-[1px]" elevation="0" bg-color="#FFF">
31
+ <v-expansion-panel-title class="h-[80px]" :class="$libStyles.textTitle">{{ `${signUrl.longName} - ${signUrl.iin}` }}</v-expansion-panel-title>
32
+ <v-expansion-panel-text class="border-t-[1px]">
33
+ <section class="flex flex-col gap-4 py-3" :class="$libStyles.textSimple">
34
+ <base-btn :loading="loading" :text="$t('sign.copyCloud')" @click="$dataStore.copyToClipboard(signUrl.uri)"></base-btn>
35
+ <base-btn :loading="loading" :btn="$libStyles.blueLightBtn" :text="$t('sign.recipientNumber')" @click="openSmsPanel(signUrl)"></base-btn>
36
+ </section>
37
+ </v-expansion-panel-text>
38
+ </v-expansion-panel>
39
+ </v-expansion-panels>
40
+ <base-list-empty v-else></base-list-empty>
41
+ </div>
42
+ </div>
43
+ <div v-if="isSendNumberOpen" :class="[$libStyles.flexColNav]">
44
+ <i
45
+ class="mdi mdi-arrow-left cursor-pointer absolute text-xl left-0 top-0 rounded-br-full bg-white border-[1px] pb-3 pt-1 pl-1 pr-3"
46
+ @click="isSendNumberOpen = false"
47
+ ></i>
48
+ <base-form-section :title="selectedClient && selectedClient.longName ? selectedClient.longName : ''">
49
+ <v-form ref="vForm">
50
+ <base-rounded-input
51
+ v-model="phoneNumber"
52
+ :maska="$maska.phone"
53
+ :rules="$rules.required.concat($rules.phoneFormat)"
54
+ :label="$t('form.phoneNumber')"
55
+ placeholder="+7 7"
56
+ ></base-rounded-input>
57
+ </v-form>
58
+ <base-btn :text="$t('buttons.sendSMS')" :loading="loading" @click="submitForm"></base-btn
59
+ ></base-form-section>
60
+ </div>
61
+ </base-fade-transition>
62
+ </div>
63
+ </section>
64
+ <section v-if="payingActions" class="relative">
65
+ <div>
66
+ <base-fade-transition>
67
+ <div v-if="!isSendNumberOpen" :class="[$libStyles.flexColNav]">
68
+ <base-btn :loading="loading" :text="$t('payment.copyUrl')" @click="$dataStore.copyToClipboard(formStore.epayLink)"></base-btn>
69
+ <base-btn :loading="loading" :btn="$libStyles.blueLightBtn" :text="$t('payment.recipientNumber')" @click="openEpayPanel"></base-btn>
70
+ </div>
71
+ <div v-if="isSendNumberOpen" :class="[$libStyles.flexColNav]">
72
+ <i
73
+ class="mdi mdi-arrow-left cursor-pointer absolute text-xl left-0 top-0 rounded-br-full bg-white border-[1px] pb-3 pt-1 pl-1 pr-3"
74
+ @click="isSendNumberOpen = false"
75
+ ></i>
76
+ <base-form-section title="">
77
+ <v-form ref="vForm">
78
+ <base-rounded-input
79
+ v-model="phoneNumber"
80
+ v-maska="'+7 (7##) ### ## ##'"
81
+ :rules="$rules.required.concat($rules.phoneFormat)"
82
+ :label="$t('form.phoneNumber')"
83
+ placeholder="+7 7"
84
+ ></base-rounded-input>
85
+ </v-form>
86
+ <base-btn :text="$t('buttons.sendSMS')" :loading="loading" @click="submitForm"></base-btn>
87
+ </base-form-section>
88
+ </div>
89
+ </base-fade-transition>
90
+ </div>
91
+ </section>
92
+ </template>
93
+
94
+ <script lang="ts">
95
+ export default defineComponent({
96
+ setup() {
97
+ const route = useRoute();
98
+ const dataStore = useDataStore();
99
+ const formStore = useFormStore();
100
+ const actionCause = ref<string>('');
101
+ const loading = ref<boolean>(false);
102
+ const vForm = ref<any>();
103
+ const isSendNumberOpen = ref<boolean>(false);
104
+ const phoneNumber = ref<string | null>(formStore.policyholderForm.phoneNumber ?? '');
105
+ const selectedClient = ref<SignUrlType>();
106
+
107
+ watch(
108
+ () => dataStore.panelAction,
109
+ val => {
110
+ if (!!val) {
111
+ dataStore.panel.title = buttonText.value!;
112
+ dataStore.panel.open = true;
113
+ }
114
+ },
115
+ );
116
+
117
+ const openSmsPanel = (signInfo: SignUrlType) => {
118
+ if (signInfo) {
119
+ isSendNumberOpen.value = true;
120
+ selectedClient.value = signInfo;
121
+ phoneNumber.value = signInfo.phoneNumber;
122
+ }
123
+ };
124
+
125
+ const openEpayPanel = () => {
126
+ isSendNumberOpen.value = true;
127
+ };
128
+
129
+ const closePanel = () => {
130
+ dataStore.panel.open = false;
131
+ dataStore.panelAction = null;
132
+ };
133
+
134
+ const submitForm = async () => {
135
+ await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
136
+ if (v.valid) {
137
+ loading.value = true;
138
+ switch (dataStore.panelAction) {
139
+ case constants.actions.pay:
140
+ await dataStore.sendSMS('PayUrl', phoneNumber.value, formStore.epayLink);
141
+ case constants.actions.sign:
142
+ await dataStore.sendSMS('SignUrl', phoneNumber.value, selectedClient.value?.uri);
143
+ default:
144
+ await handleTask();
145
+ }
146
+ loading.value = false;
147
+ }
148
+ });
149
+ };
150
+
151
+ const handleTask = async () => {
152
+ loading.value = true;
153
+ await dataStore.handleTask(dataStore.panelAction, route.params.taskId, actionCause.value);
154
+ loading.value = false;
155
+ };
156
+
157
+ const buttonText = computed(() => {
158
+ switch (dataStore.panelAction) {
159
+ case constants.actions.reject:
160
+ case constants.actions.rejectclient:
161
+ return dataStore.t('buttons.rejectStatement');
162
+ case constants.actions.return:
163
+ return dataStore.t('buttons.returnStatement');
164
+ case constants.actions.accept:
165
+ return dataStore.t('buttons.approve');
166
+ case constants.actions.sign:
167
+ return dataStore.t('buttons.sign');
168
+ case constants.actions.pay:
169
+ return dataStore.t('buttons.pay');
170
+ }
171
+ });
172
+
173
+ const sendingActions = computed(
174
+ () => dataStore.panelAction === constants.actions.reject || dataStore.panelAction === constants.actions.return || dataStore.panelAction === constants.actions.rejectclient,
175
+ );
176
+ const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
177
+ const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
178
+ const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
179
+ const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
180
+ const insurancePremiumPerMonth = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.insurancePremiumPerMonth));
181
+ const requestedSumInsured = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.requestedSumInsured));
182
+
183
+ return {
184
+ // State
185
+ formStore,
186
+ loading,
187
+ actionCause,
188
+ vForm,
189
+ isSendNumberOpen,
190
+ phoneNumber,
191
+ selectedClient,
192
+
193
+ // Functions
194
+ closePanel,
195
+ submitForm,
196
+ handleTask,
197
+ openSmsPanel,
198
+ openEpayPanel,
199
+
200
+ // Computed
201
+ buttonText,
202
+ sendingActions,
203
+ signingActions,
204
+ payingActions,
205
+ acceptAction,
206
+ paymentPeriod,
207
+ insurancePremiumPerMonth,
208
+ requestedSumInsured,
209
+ };
210
+ },
211
+ });
212
+ </script>
213
+
214
+ <style>
215
+ .v-expansion-panel-title__overlay {
216
+ background: #ffffff;
217
+ }
218
+ .v-expansion-panel-title {
219
+ height: 70px !important;
220
+ padding: 10px 20px !important;
221
+ }
222
+ .v-expansion-panels--variant-accordion > :last-child {
223
+ border-top-left-radius: 0.5rem !important;
224
+ border-top-right-radius: 0.5rem !important;
225
+ border-top-left-radius: 0.5rem !important;
226
+ border-radius: 0.5rem !important;
227
+ }
228
+ .v-expansion-panel-text__wrapper {
229
+ padding: 10px 20px !important;
230
+ }
231
+ </style>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <p class="transition-all h-[64px] px-4 flex justify-between items-center border-b-[1px] hover:border-b-[#A0B3D8] text-[16px]">
3
+ <slot></slot>
4
+ </p>
5
+ </template>
@@ -0,0 +1,20 @@
1
+ <template>
2
+ <div class="flex justify-between px-4 items-center cursor-pointer h-[60px]" :class="[$libStyles.rounded, $libStyles.blueBgLight, $libStyles.blueBgLightHover]">
3
+ <span :class="[$libStyles.textSimple]">{{ text }}</span>
4
+ <i class="mdi text-xl" :class="[selected ? `mdi-radiobox-marked ${$libStyles.greenText}` : 'mdi-radiobox-blank text-[#636363]']"></i>
5
+ </div>
6
+ </template>
7
+
8
+ <script lang="ts">
9
+ export default defineComponent({
10
+ props: {
11
+ text: {
12
+ type: [String, Number],
13
+ },
14
+ selected: {
15
+ type: Boolean,
16
+ default: false,
17
+ },
18
+ },
19
+ });
20
+ </script>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <transition-group enter-active-class="animate__animated animate__fadeIn">
3
+ <slot></slot>
4
+ </transition-group>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <transition-group enter-active-class="animate__animated animate__slideInRight">
3
+ <slot></slot>
4
+ </transition-group>
5
+ </template>
@@ -0,0 +1,11 @@
1
+ import axios from 'axios';
2
+ import interceptors from '@/api/interceptors';
3
+
4
+ export const useAxios = (baseURL: string) => {
5
+ const axiosInstance = axios.create({
6
+ baseURL: baseURL,
7
+ });
8
+ interceptors(axiosInstance);
9
+
10
+ return axiosInstance;
11
+ };