hl-core 0.0.7-beta.9 → 0.0.8

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 (52) hide show
  1. package/.prettierrc +2 -1
  2. package/api/index.ts +66 -47
  3. package/api/interceptors.ts +4 -4
  4. package/components/Button/Btn.vue +7 -2
  5. package/components/Button/ScrollButtons.vue +6 -0
  6. package/components/Complex/ContentBlock.vue +5 -0
  7. package/components/{Layout → Dialog}/Dialog.vue +3 -27
  8. package/components/Dialog/FamilyDialog.vue +39 -0
  9. package/components/Form/FormBlock.vue +114 -0
  10. package/components/Form/FormSection.vue +18 -0
  11. package/components/Form/FormTextSection.vue +20 -0
  12. package/components/Form/FormToggle.vue +52 -0
  13. package/components/Form/ProductConditionsBlock.vue +68 -0
  14. package/components/Input/EmptyFormField.vue +5 -0
  15. package/components/Input/FileInput.vue +71 -0
  16. package/components/Input/FormInput.vue +171 -0
  17. package/components/Input/PanelInput.vue +133 -0
  18. package/components/Input/RoundedInput.vue +35 -36
  19. package/components/Layout/Drawer.vue +18 -16
  20. package/components/Layout/Header.vue +4 -18
  21. package/components/Layout/Loader.vue +1 -7
  22. package/components/Layout/SettingsPanel.vue +17 -37
  23. package/components/List/ListEmpty.vue +22 -0
  24. package/components/Menu/MenuNav.vue +22 -20
  25. package/components/Menu/MenuNavItem.vue +6 -6
  26. package/components/Pages/Anketa.vue +333 -0
  27. package/components/Pages/Auth.vue +91 -0
  28. package/components/Pages/Documents.vue +108 -0
  29. package/components/Pages/MemberForm.vue +1138 -0
  30. package/components/Pages/ProductAgreement.vue +18 -0
  31. package/components/Pages/ProductConditions.vue +349 -0
  32. package/components/Panel/PanelItem.vue +2 -4
  33. package/components/Panel/PanelSelectItem.vue +20 -0
  34. package/components/Transitions/FadeTransition.vue +5 -0
  35. package/composables/classes.ts +299 -253
  36. package/composables/constants.ts +14 -7
  37. package/composables/index.ts +55 -60
  38. package/composables/styles.ts +31 -7
  39. package/layouts/default.vue +46 -26
  40. package/layouts/full.vue +2 -12
  41. package/nuxt.config.ts +3 -0
  42. package/package.json +13 -10
  43. package/pages/500.vue +40 -12
  44. package/plugins/helperFunctionsPlugins.ts +6 -2
  45. package/plugins/storePlugin.ts +6 -5
  46. package/store/data.store.js +781 -1880
  47. package/store/member.store.ts +291 -0
  48. package/store/messages.ts +66 -51
  49. package/store/rules.js +26 -28
  50. package/types/index.ts +250 -0
  51. package/composables/models.ts +0 -43
  52. /package/store/{form.store.js → form.store.ts} +0 -0
@@ -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,349 @@
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
+ return {
321
+ // State
322
+ formStore,
323
+ vForm,
324
+ productConditionsForm,
325
+ isCalculating,
326
+ isPanelLoading,
327
+ isPanelOpen,
328
+ panelValue,
329
+ panelList,
330
+ searchQuery,
331
+ whichSum,
332
+ Value,
333
+
334
+ // Computed
335
+ isTask,
336
+ isDisabled,
337
+ isUnderwriterForm,
338
+ insurancePremiumPerMonth,
339
+ requestedSumInsured,
340
+
341
+ // Functions
342
+ submitForm,
343
+ pickPanelValue,
344
+ openPanel,
345
+ pickCalculation,
346
+ };
347
+ },
348
+ });
349
+ </script>
@@ -1,7 +1,5 @@
1
1
  <template>
2
- <span
3
- class="transition-all h-[64px] px-4 flex justify-between items-center border-b-[1px] hover:border-b-[#A0B3D8]"
4
- >
2
+ <p class="transition-all h-[64px] px-4 flex justify-between items-center border-b-[1px] hover:border-b-[#A0B3D8] text-[16px]">
5
3
  <slot></slot>
6
- </span>
4
+ </p>
7
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>