hl-core 0.0.8-beta.39 → 0.0.8-beta.40

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.
package/api/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { MemberCodes } from '../types/enum';
1
2
  import { useAxios } from '../composables/axios';
2
3
  import { Value, IDocument } from '../composables/classes';
3
4
  import { AxiosRequestConfig } from 'axios';
@@ -147,7 +148,7 @@ export class ApiClass {
147
148
  });
148
149
  }
149
150
 
150
- async getContragent(queryData: any) {
151
+ async getContragent(queryData: GetContragentRequest): Promise<GetContragentResponse> {
151
152
  return this.axiosCall({
152
153
  method: Methods.GET,
153
154
  url: `/Ekk/api/Contragentinsis/Contragent?Iin=${queryData.iin}&FirstName=${queryData.firstName}&LastName=${queryData.lastName}&MiddleName=${queryData.middleName}`,
@@ -161,28 +162,28 @@ export class ApiClass {
161
162
  });
162
163
  }
163
164
 
164
- async getQuestionList(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaFirst> {
165
+ async getQuestionList(surveyType: string, processInstanceId: string | number, insuredId: number | string): Promise<AnketaFirst> {
165
166
  return this.axiosCall({
166
167
  method: Methods.GET,
167
168
  url: `/${this.productUrl}/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
168
169
  });
169
170
  }
170
171
 
171
- async getClientQuestionList(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaFirst> {
172
+ async getClientQuestionList(surveyType: string, processInstanceId: string | number, insuredId: number | string): Promise<AnketaFirst> {
172
173
  return this.axiosCall({
173
174
  method: Methods.GET,
174
175
  url: `/${this.productUrl}/api/Application/AnketaClient/${surveyType}/${processInstanceId}/${insuredId}`,
175
176
  });
176
177
  }
177
178
 
178
- async getQuestionListSecond(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaSecond[]> {
179
+ async getQuestionListSecond(surveyType: string, processInstanceId: string | number, insuredId: number | string): Promise<AnketaSecond[]> {
179
180
  return this.axiosCall({
180
181
  method: Methods.GET,
181
182
  url: `/${this.productUrl}/api/Application/Anketa/${surveyType}/${processInstanceId}/${insuredId}`,
182
183
  });
183
184
  }
184
185
 
185
- async getClientQuestionListSecond(surveyType: string, processInstanceId: string, insuredId: number | string): Promise<AnketaSecond[]> {
186
+ async getClientQuestionListSecond(surveyType: string, processInstanceId: string | number, insuredId: number | string): Promise<AnketaSecond[]> {
186
187
  return this.axiosCall({
187
188
  method: Methods.GET,
188
189
  url: `/${this.productUrl}/api/Application/AnketaClient/${surveyType}/${processInstanceId}/${insuredId}`,
@@ -218,7 +219,7 @@ export class ApiClass {
218
219
  });
219
220
  }
220
221
 
221
- async getAdditionalInsuranceTermsAnswers(processCode: string | number, questionId: string) {
222
+ async getAdditionalInsuranceTermsAnswers(processCode: string | number, questionId: string): Promise<AddCoverAnswer[]> {
222
223
  return this.axiosCall({
223
224
  method: Methods.GET,
224
225
  url: `/Arm/api/Dictionary/ProcessCoverTypeSum/${processCode}/${questionId}`,
@@ -239,14 +240,20 @@ export class ApiClass {
239
240
  });
240
241
  }
241
242
 
242
- async getContragentById(id: any) {
243
+ async getContragentById(id: number): Promise<GetContragentResponse> {
243
244
  return this.axiosCall({
244
245
  method: Methods.GET,
245
246
  url: `/Ekk/api/Contragentinsis/Contragent?PersonId=${id}`,
246
247
  });
247
248
  }
248
249
 
249
- async saveContragent(data: any) {
250
+ async saveContragent(data: {
251
+ contragent: ContragentType;
252
+ questionaries: ContragentQuestionaries[];
253
+ contacts: ContragentContacts[];
254
+ documents: ContragentDocuments[];
255
+ addresses: ContragentAddress[];
256
+ }): Promise<number> {
250
257
  return this.axiosCall({
251
258
  method: Methods.POST,
252
259
  url: `/Ekk/api/Contragentinsis/SaveContragent`,
@@ -272,28 +279,28 @@ export class ApiClass {
272
279
  });
273
280
  }
274
281
 
275
- async getContrAgentData(personId: string | number) {
282
+ async getContrAgentData(personId: string | number): Promise<ContragentQuestionaries[]> {
276
283
  return this.axiosCall({
277
284
  method: Methods.GET,
278
285
  url: `/Ekk/api/Contragentinsis/Questionaries?PersonId=${personId}`,
279
286
  });
280
287
  }
281
288
 
282
- async getContrAgentContacts(personId: string | number) {
289
+ async getContrAgentContacts(personId: string | number): Promise<ContragentContacts[]> {
283
290
  return this.axiosCall({
284
291
  method: Methods.GET,
285
292
  url: `/Ekk/api/Contragentinsis/Contacts?PersonId=${personId}`,
286
293
  });
287
294
  }
288
295
 
289
- async getContrAgentDocuments(personId: string | number) {
296
+ async getContrAgentDocuments(personId: string | number): Promise<ContragentDocuments[]> {
290
297
  return this.axiosCall({
291
298
  method: Methods.GET,
292
299
  url: `/Ekk/api/Contragentinsis/Documents?PersonId=${personId}`,
293
300
  });
294
301
  }
295
302
 
296
- async getContrAgentAddress(personId: string | number) {
303
+ async getContrAgentAddress(personId: string | number): Promise<ContragentAddress[]> {
297
304
  return this.axiosCall({
298
305
  method: Methods.GET,
299
306
  url: `/Ekk/api/Contragentinsis/Address?PersonId=${personId}`,
@@ -378,20 +385,20 @@ export class ApiClass {
378
385
  });
379
386
  }
380
387
 
381
- async getApplicationData(id: string) {
388
+ async getApplicationData(id: string): Promise<any> {
382
389
  return this.axiosCall({
383
390
  url: `/${this.productUrl}/api/Application/applicationData?Id=${id} `,
384
391
  });
385
392
  }
386
393
 
387
- async getCalculation(id: string) {
394
+ async getCalculation(id: string): Promise<Number> {
388
395
  return this.axiosCall({
389
396
  method: Methods.POST,
390
397
  url: `/${this.productUrl}/api/Application/Calculator?processInstanceId=${id}`,
391
398
  });
392
399
  }
393
400
 
394
- async setApplication(data: any) {
401
+ async setApplication(data: { policyAppDto: PolicyAppDto; addCoversDto: AddCover[] }): Promise<void> {
395
402
  return this.axiosCall({
396
403
  method: Methods.POST,
397
404
  url: `/${this.productUrl}/api/Application/SetApplicationData`,
@@ -427,7 +434,7 @@ export class ApiClass {
427
434
  });
428
435
  }
429
436
 
430
- async setMember(whichMember: string, data: any) {
437
+ async setMember(whichMember: keyof typeof MemberCodes, data: any) {
431
438
  return this.axiosCall({
432
439
  method: Methods.POST,
433
440
  url: `/Arm/api/BpmMembers/Set${whichMember}`,
@@ -435,14 +442,14 @@ export class ApiClass {
435
442
  });
436
443
  }
437
444
 
438
- async deleteMember(whichMember: string, id: number | string) {
445
+ async deleteMember(whichMember: keyof typeof MemberCodes, id: number | string) {
439
446
  return this.axiosCall({
440
447
  method: Methods.POST,
441
448
  url: `/Arm/api/BpmMembers/Delete${whichMember}/${id}`,
442
449
  });
443
450
  }
444
451
 
445
- async getInvoiceData(processInstanceId: string): Promise<EpayResponse> {
452
+ async getInvoiceData(processInstanceId: string | number): Promise<EpayResponse> {
446
453
  return this.axiosCall({
447
454
  method: Methods.GET,
448
455
  url: `/Arm/api/Invoice/InvoiceData?processInstanceId=${processInstanceId}`,
@@ -456,14 +463,14 @@ export class ApiClass {
456
463
  });
457
464
  }
458
465
 
459
- async createInvoice(processInstanceId: string, amount: number | string): Promise<string> {
466
+ async createInvoice(processInstanceId: string | number, amount: number | string): Promise<string> {
460
467
  return this.axiosCall({
461
468
  method: Methods.POST,
462
469
  url: `/Arm/api/Invoice/CreateInvoice/${processInstanceId}/${amount}`,
463
470
  });
464
471
  }
465
472
 
466
- async sendToEpay(processInstanceId: string): Promise<EpayShortResponse> {
473
+ async sendToEpay(processInstanceId: string | number): Promise<EpayShortResponse> {
467
474
  return this.axiosCall({
468
475
  method: Methods.POST,
469
476
  url: `/Arm/api/Invoice/SendToEpay/${processInstanceId}`,
@@ -478,7 +485,7 @@ export class ApiClass {
478
485
  });
479
486
  }
480
487
 
481
- async getSignedDocList(data: { processInstanceId: string }): Promise<IDocument[]> {
488
+ async getSignedDocList(data: { processInstanceId: string | number }): Promise<IDocument[]> {
482
489
  return this.axiosCall({
483
490
  method: Methods.POST,
484
491
  url: '/File/api/Data/List',
@@ -486,7 +493,7 @@ export class ApiClass {
486
493
  });
487
494
  }
488
495
 
489
- async calculateWithoutApplication(data: RecalculationDataType, product = this.productUrl): Promise<RecalculationResponseType> {
496
+ async calculateWithoutApplication(data: RecalculationDataType, product: string | undefined | null = this.productUrl): Promise<RecalculationResponseType> {
490
497
  return this.axiosCall({
491
498
  method: Methods.POST,
492
499
  url: `/${product}/api/Application/Calculate`,
@@ -494,7 +501,7 @@ export class ApiClass {
494
501
  });
495
502
  }
496
503
 
497
- async getDefaultCalculationData(product = this.productUrl): Promise<RecalculationDataType> {
504
+ async getDefaultCalculationData(product: string | undefined | null = this.productUrl): Promise<RecalculationDataType> {
498
505
  return this.axiosCall({
499
506
  method: Methods.GET,
500
507
  url: `/${product}/api/Application/DefaultCalculatorValues`,
@@ -583,14 +590,14 @@ export class ApiClass {
583
590
  });
584
591
  }
585
592
 
586
- async filterManagerByRegion(dictName: string, filterName: string) {
593
+ async filterManagerByRegion(dictName: string, filterName: string): Promise<Value[]> {
587
594
  return this.axiosCall({
588
595
  method: Methods.GET,
589
596
  url: `/Ekk/api/ContragentInsis/DictionaryItems/${dictName}?filter=${filterName}`,
590
597
  });
591
598
  }
592
599
 
593
- async setINSISWorkData(data: any) {
600
+ async setINSISWorkData(data: InsisWorkDataApp) {
594
601
  return this.axiosCall({
595
602
  method: Methods.POST,
596
603
  url: `/Arm/api/Bpm/SetInsisWorkData`,
@@ -6,7 +6,7 @@
6
6
  <div
7
7
  v-if="isMultiple && more && !isShort && isActionsAvailable"
8
8
  :class="[$libStyles.blueBg, $libStyles.whiteText, $libStyles.textSimple, disabled ? $libStyles.disabled : 'cursor-pointer']"
9
- class="hidden lg:flex transition-all rounded-lg h-[36px] flex items-center font-medium justify-center opacity-50 hover:opacity-90 w-[120px]"
9
+ class="lg:flex transition-all rounded-lg h-[36px] flex items-center font-medium justify-center opacity-50 hover:opacity-90 w-[120px]"
10
10
  @click="!disabled && memberStore.addMember(whichForm)"
11
11
  >
12
12
  {{ $dataStore.t('buttons.add') }}
@@ -25,9 +25,9 @@
25
25
  <span v-if="!isShort" :class="[$libStyles.textSimple]" class="font-medium hidden lg:block">{{ $dataStore.t('form.Country') }} </span>
26
26
  <span v-if="!isShort" :class="[$libStyles.textSimple]" class="font-medium hidden lg:block"> {{ $dataStore.t('code') }}</span>
27
27
  </div>
28
- <div v-if="isMultiple" class="ml-5 flex flex-col" :class="[isShort ? 'mb-6' : '']">
28
+ <div v-if="isMultiple && multipleMember !== null" class="ml-5 flex flex-col" :class="[isShort ? 'mb-6' : '']">
29
29
  <div
30
- v-for="(each, index) of member"
30
+ v-for="(each, index) of multipleMember"
31
31
  :key="index"
32
32
  class="grid auto-rows-fr items-center relative"
33
33
  :class="[isShort ? 'grid-cols-2 md:gap-5 md:grid-cols-2 lg:grid-cols-2' : 'grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7']"
@@ -49,16 +49,22 @@
49
49
  </div>
50
50
  </div>
51
51
  <div
52
- v-else
52
+ v-if="singleMember !== null"
53
53
  class="ml-5 grid auto-rows-fr items-center relative"
54
54
  :class="[isShort ? 'grid-cols-2 md:gap-5 md:grid-cols-2 lg:grid-cols-2' : 'grid-cols-4 md:gap-5 md:grid-cols-4 lg:grid-cols-7']"
55
55
  >
56
- <span :class="[getMemberInfo(member).fullName === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(member).fullName }}</span>
57
- <span :class="[getMemberInfo(member).iin === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(member).iin }}</span>
58
- <span v-if="!isShort" :class="[getMemberInfo(member).gender === null && $libStyles.emptyBlockCol]" class="hidden lg:block">{{ getMemberInfo(member).gender }} </span>
59
- <span v-if="!isShort" :class="[getMemberInfo(member).birthDate === null && $libStyles.emptyBlockCol]"> {{ getMemberInfo(member).birthDate }} </span>
60
- <span v-if="!isShort" :class="[getMemberInfo(member).birthPlace === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(member).birthPlace }} </span>
61
- <span v-if="!isShort" :class="[getMemberInfo(member).sectorCode === null && $libStyles.emptyBlockCol]" class="hidden lg:block"> {{ getMemberInfo(member).sectorCode }} </span>
56
+ <span :class="[getMemberInfo(singleMember).fullName === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(singleMember).fullName }}</span>
57
+ <span :class="[getMemberInfo(singleMember).iin === null && $libStyles.emptyBlockCol]">{{ getMemberInfo(singleMember).iin }}</span>
58
+ <span v-if="!isShort" :class="[getMemberInfo(singleMember).gender === null && $libStyles.emptyBlockCol]" class="hidden lg:block"
59
+ >{{ getMemberInfo(singleMember).gender }}
60
+ </span>
61
+ <span v-if="!isShort" :class="[getMemberInfo(singleMember).birthDate === null && $libStyles.emptyBlockCol]"> {{ getMemberInfo(singleMember).birthDate }} </span>
62
+ <span v-if="!isShort" :class="[getMemberInfo(singleMember).birthPlace === null && $libStyles.emptyBlockCol]" class="hidden lg:block">
63
+ {{ getMemberInfo(singleMember).birthPlace }}
64
+ </span>
65
+ <span v-if="!isShort" :class="[getMemberInfo(singleMember).sectorCode === null && $libStyles.emptyBlockCol]" class="hidden lg:block">
66
+ {{ getMemberInfo(singleMember).sectorCode }}
67
+ </span>
62
68
  <div
63
69
  v-if="!isShort"
64
70
  class="rounded-br-lg transition-all h-[70px] w-[60px] place-self-end"
@@ -71,7 +77,7 @@
71
77
  <div
72
78
  v-if="isMultiple && more && !isShort && isActionsAvailable"
73
79
  :class="[$libStyles.blueBg, $libStyles.whiteText, $libStyles.textSimple, disabled ? $libStyles.disabled : 'cursor-pointer']"
74
- class="block lg:hidden transition-all rounded-b-lg h-[36px] flex items-center font-medium justify-center opacity-50 hover:opacity-90"
80
+ class="lg:hidden transition-all rounded-b-lg h-[36px] flex items-center font-medium justify-center opacity-50 hover:opacity-90"
75
81
  @click="!disabled && memberStore.addMember(whichForm)"
76
82
  >
77
83
  {{ $dataStore.t('buttons.add') }}
@@ -80,6 +86,7 @@
80
86
  </template>
81
87
 
82
88
  <script lang="ts">
89
+ import { StoreMembers } from '../../types/enum';
83
90
  import { Member } from '../../composables/classes';
84
91
 
85
92
  export default defineComponent({
@@ -93,7 +100,7 @@ export default defineComponent({
93
100
  default: '',
94
101
  },
95
102
  whichForm: {
96
- type: String as PropType<MemberFormTypes>,
103
+ type: String as PropType<keyof typeof StoreMembers>,
97
104
  default: '',
98
105
  },
99
106
  more: {
@@ -111,12 +118,15 @@ export default defineComponent({
111
118
  },
112
119
  emits: ['onMore', 'addMember'],
113
120
  setup(props) {
114
- const dataStore = useDataStore();
115
121
  const formStore = useFormStore();
116
122
  const memberStore = useMemberStore();
117
- const multipleMembers = ['insuredForm', 'beneficiaryForm', 'beneficialOwnerForm'];
118
- const isMultiple = ref(multipleMembers.includes(props.whichForm));
119
- const member: Member = formStore[props.whichForm as MemberKeys];
123
+ const isMultiple = computed(() => [StoreMembers.insuredForm, StoreMembers.beneficiaryForm, StoreMembers.beneficialOwnerForm].includes(props.whichForm as StoreMembers));
124
+ const singleMember: Member | null =
125
+ props.whichForm === StoreMembers.policyholderForm || props.whichForm === StoreMembers.policyholdersRepresentativeForm ? formStore[props.whichForm] : null;
126
+ const multipleMember: Member[] | null =
127
+ props.whichForm === StoreMembers.insuredForm || props.whichForm === StoreMembers.beneficiaryForm || props.whichForm === StoreMembers.beneficialOwnerForm
128
+ ? formStore[props.whichForm]
129
+ : null;
120
130
 
121
131
  const isShort = computed(() => props.type === 'short');
122
132
  const isActionsAvailable = computed(() => memberStore.isStatementEditible(props.whichForm));
@@ -136,7 +146,8 @@ export default defineComponent({
136
146
  // State
137
147
  formStore,
138
148
  memberStore,
139
- member,
149
+ singleMember,
150
+ multipleMember,
140
151
  isMultiple,
141
152
 
142
153
  // Computed
@@ -131,7 +131,7 @@ export default defineComponent({
131
131
 
132
132
  if (currentDict === 'ManagerPolicy') {
133
133
  isPanelLoading.value = true;
134
- await dataStore.filterManagerByRegion(formStore.RegionPolicy?.ids);
134
+ await dataStore.filterManagerByRegion(String(formStore.RegionPolicy.ids ?? ''));
135
135
  }
136
136
 
137
137
  isPanelOpen.value = true;
@@ -58,7 +58,9 @@ export default defineComponent({
58
58
  );
59
59
  const policyNumber = computed(() => (formStore.applicationData && formStore.applicationData.policyAppDto ? formStore.applicationData.policyAppDto.policyNumber : null));
60
60
  const contractDate = computed(() =>
61
- formStore.applicationData && formStore.applicationData.policyAppDto ? reformatDate(formStore.applicationData.policyAppDto.contractDate) : null,
61
+ formStore.applicationData && formStore.applicationData.policyAppDto && formStore.applicationData.policyAppDto.contractDate
62
+ ? reformatDate(formStore.applicationData.policyAppDto.contractDate)
63
+ : null,
62
64
  );
63
65
  const coverPeriod = computed(() => (formStore.productConditionsForm && formStore.productConditionsForm.coverPeriod ? formStore.productConditionsForm.coverPeriod : null));
64
66
  const paymentPeriod = computed(() =>
@@ -94,7 +94,13 @@
94
94
  >
95
95
  <section v-if="currentQuestion" :class="[$libStyles.blueBgLight, $libStyles.rounded]" class="mx-[10px] mt-[14px] p-4 flex flex-col gap-4">
96
96
  <base-form-text-section v-for="question in currentQuestion.second" :title="question.name" :key="question.name">
97
- <base-form-input v-if="question.definedAnswers === 'N'" v-model="question.answerText" class="border-t-[1px] border-t-[#F3F6FC]" placeholder="Введите текст" />
97
+ <base-form-input
98
+ v-if="question.definedAnswers === 'N'"
99
+ v-model="question.answerText"
100
+ class="border-t-[1px] border-t-[#F3F6FC]"
101
+ placeholder="Введите текст"
102
+ :readonly="formStore.isDisabled[whichSurvey] || !$dataStore.isTask()"
103
+ />
98
104
  <span v-else class="flex items-center justify-between p-4 cursor-pointer" :class="[$libStyles.textTitle, $libStyles.greenText]" @click="openSecondPanel(question)">
99
105
  {{ question.answerName ? question.answerName : 'Выбрать вариант ответа' }}
100
106
  <i class="mdi mdi-chevron-right text-[28px]"></i>
@@ -153,7 +159,7 @@ export default defineComponent({
153
159
  const isPanelLoading = ref<boolean>(false);
154
160
  const searchQuery = ref<string>('');
155
161
 
156
- const whichMember = computed(() => ('member' in route.query && !!route.query.member ? (route.query.member as string) : 'insured'));
162
+ const whichMember = computed(() => ('member' in route.query && !!route.query.member ? (route.query.member as 'insured' | 'policyholder') : 'insured'));
157
163
  const scrollForm = (direction: 'up' | 'down') => {
158
164
  const scrollObject = { top: direction === 'up' ? 0 : screen.height * 10, behavior: 'smooth' };
159
165
  if (firstPanel.value) {
@@ -173,7 +179,7 @@ export default defineComponent({
173
179
  }
174
180
  });
175
181
  formStore[whichSurvey.value]!.type = surveyType.value;
176
- const anketaToken = await dataStore.setSurvey(formStore[whichSurvey.value]);
182
+ const anketaToken = await dataStore.setSurvey(formStore[whichSurvey.value]!);
177
183
  if (typeof anketaToken === 'string') {
178
184
  formStore[whichSurvey.value]!.id = anketaToken;
179
185
  }
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <section class="flex flex-col gap-4 px-[10px]">
3
3
  <v-form v-if="member" ref="vForm" @submit="submitForm" class="max-h-[82svh] overflow-y-scroll">
4
- <div v-if="memberSetting.has === true && memberSetting.isMultiple === true" class="flex items-center mt-[14px] min-h-[54px]">
4
+ <div v-if="memberSetting && memberSetting.has === true && memberSetting.isMultiple === true" class="flex items-center mt-[14px] min-h-[54px]">
5
5
  <div :class="[$libStyles.blueBgLight]" class="flex flex-wrap items-center gap-2 p-1 rounded-t-[8px] h-full">
6
6
  <div
7
- v-for="(each, index) of formStore[whichForm as MemberKeys]"
7
+ v-for="(each, index) of formStore[whichForm]"
8
8
  :key="index"
9
9
  class="pl-3 pr-1 py-1 rounded-[8px] cursor-pointer flex items-center"
10
10
  :class="[Number(whichIndex) === index ? `${$libStyles.blueBg} ${$libStyles.whiteText}` : '', $libStyles.textSimple]"
@@ -14,20 +14,18 @@
14
14
  <v-btn
15
15
  icon="mdi-close !text-[20px]"
16
16
  size="x-small"
17
- :disabled="!memberStore.canMemberDeleted((whichForm as MemberKeys), index) && !memberStore.canMemberCleared((whichForm as MemberKeys), index)"
17
+ :disabled="!memberStore.canMemberDeleted(whichForm, index) && !memberStore.canMemberCleared(whichForm, index)"
18
18
  variant="plain"
19
19
  :color="Number(whichIndex) === index ? '#FFF' : '#A0B3D8'"
20
- @click.prevent="
21
- memberStore.canMemberDeleted(whichForm as MemberKeys, index) || memberStore.canMemberCleared(whichForm as MemberKeys, index) ? deleteMember(index) : null
22
- "
20
+ @click.prevent="memberStore.canMemberDeleted(whichForm, index) || memberStore.canMemberCleared(whichForm, index) ? deleteMember(index) : null"
23
21
  />
24
22
  </div>
25
23
  </div>
26
- <v-btn class="ml-2" icon="mdi-plus !text-[24px]" @click="memberStore.addMember(whichForm as MemberKeys)" size="small" color="#A0B3D8" variant="tonal" />
24
+ <v-btn class="ml-2" icon="mdi-plus !text-[24px]" @click="memberStore.addMember(whichForm)" size="small" color="#A0B3D8" variant="tonal" />
27
25
  </div>
28
26
  <base-form-section
29
27
  :title="$dataStore.t('form.personalData')"
30
- :class="[memberSetting.has === true && memberSetting.isMultiple === true ? 'rounded-t-0 !mt-[-5px]' : 'mt-[14px]']"
28
+ :class="[memberSetting && memberSetting.has === true && memberSetting.isMultiple === true ? 'rounded-t-0 !mt-[-5px]' : 'mt-[14px]']"
31
29
  >
32
30
  <base-form-input
33
31
  v-model="member.phoneNumber"
@@ -539,9 +537,9 @@
539
537
  </template>
540
538
 
541
539
  <script lang="ts">
542
- import { LocationQueryValue } from 'vue-router';
543
540
  import { Value, DocumentItem, Member } from '../../composables/classes';
544
541
  import { uuid } from 'vue-uuid';
542
+ import { StoreMembers } from '../../types/enum';
545
543
 
546
544
  export default {
547
545
  setup() {
@@ -551,9 +549,10 @@ export default {
551
549
  const dataStore = useDataStore();
552
550
  const formStore = useFormStore();
553
551
  const memberStore = useMemberStore();
554
- const getMember = (whichForm: LocationQueryValue | LocationQueryValue[], whichIndex?: LocationQueryValue | LocationQueryValue[]) =>
555
- memberStore.getMemberFromStore(whichForm as MemberKeys, Number((whichIndex ? whichIndex : '0') as string))!;
556
- const member = ref(getMember(route.query.tab, route.query.i));
552
+ const whichForm = computed(() => route.query.tab as keyof typeof StoreMembers);
553
+ const whichIndex = computed(() => route.query.i as string);
554
+ const getMember = (whichForm: keyof typeof StoreMembers, whichIndex?: string) => memberStore.getMemberFromStore(whichForm, Number((whichIndex ? whichIndex : '0') as string))!;
555
+ const member = ref(getMember(whichForm.value, whichIndex.value));
557
556
  const selectedFamilyMember = ref<BirthInfoGKB>({});
558
557
  const isPanelOpen = ref<boolean>(false);
559
558
  const memberDocument = ref<DocumentItem>();
@@ -574,11 +573,9 @@ export default {
574
573
  const searchQuery = ref<string>('');
575
574
  const fileData = ref<{ file: any }>();
576
575
 
577
- const whichForm = computed(() => route.query.tab);
578
- const whichIndex = computed(() => route.query.i);
579
- const memberSetting = computed(() => dataStore.members[memberStore.getMemberApplicationCode(whichForm.value as MemberKeys) as keyof typeof dataStore.members]);
576
+ const memberSetting = computed(() => dataStore.members[memberStore.getMemberApplicationCode(whichForm.value)!]);
580
577
  const hasOtp = computed(() => member.value.otpCode && member.value.otpCode.length === useMask().otp.length);
581
- const isDisabled = computed(() => !memberStore.isStatementEditible(whichForm.value as string));
578
+ const isDisabled = computed(() => !memberStore.isStatementEditible(whichForm.value));
582
579
  const isTask = computed(() => route.params.taskId === '0' || dataStore.isTask());
583
580
  const isIinPhoneDisabled = computed(() => member.value.hasAgreement);
584
581
  const isFromGBD = computed(() => !!member.value.gosPersonData);
@@ -885,6 +882,7 @@ export default {
885
882
  };
886
883
 
887
884
  const getFamilyInfo = async () => {
885
+ if (!formStore.policyholderForm.iin || !formStore.policyholderForm.phoneNumber) return;
888
886
  if (formStore.birthInfos.length === 0) {
889
887
  isButtonLoading.value = true;
890
888
  await dataStore.getFamilyInfo(formStore.policyholderForm.iin, formStore.policyholderForm.phoneNumber);
@@ -971,18 +969,18 @@ export default {
971
969
  };
972
970
 
973
971
  const validateESBD = async (docTypeNumber: number) => {
974
- const data = {
972
+ const data: ESBDValidationType = {
975
973
  personType: 1,
976
974
  iin: member.value.iin!.replaceAll('-', ''),
977
- lastName: member.value.lastName,
978
- firstName: member.value.firstName,
979
- middleName: member.value.middleName,
980
- birthDate: member.value.getDateByKey('birthDate'),
981
- sex: member.value.gender.id,
975
+ lastName: member.value.lastName ?? '',
976
+ firstName: member.value.firstName ?? '',
977
+ middleName: member.value.middleName ?? '',
978
+ birthDate: member.value.getDateByKey('birthDate') ?? '',
979
+ sex: Number(member.value.gender.id),
982
980
  docType: docTypeNumber,
983
- docNumber: member.value.documentNumber,
984
- docIssuedDate: member.value.getDateByKey('documentDate'),
985
- docIssuedBy: member.value.documentIssuers.nameRu,
981
+ docNumber: member.value.documentNumber ?? '',
982
+ docIssuedDate: member.value.getDateByKey('documentDate') ?? '',
983
+ docIssuedBy: member.value.documentIssuers.nameRu ?? '',
986
984
  activityKindId: 0,
987
985
  economicsSectorId: Number((member.value.economySectorCode.ids! as string).at(-1)),
988
986
  resident: member.value.signOfResidency.ids === '500011.2' || member.value.signOfResidency.ids === null ? 0 : 1,
@@ -992,7 +990,7 @@ export default {
992
990
  };
993
991
 
994
992
  const saveMember = async () => {
995
- const hasSaved = await dataStore.saveContragent(member.value, whichForm.value, whichIndex.value, true);
993
+ const hasSaved = await dataStore.saveContragent(member.value, whichForm.value, whichIndex.value ? Number(whichIndex.value) : null, true);
996
994
  if (hasSaved === false) {
997
995
  dataStore.isLoading = false;
998
996
  return false;
@@ -1003,7 +1001,7 @@ export default {
1003
1001
  if (route.params.taskId === '0') {
1004
1002
  try {
1005
1003
  const taskId = await dataStore.startApplication(member.value);
1006
- if (taskId) {
1004
+ if (typeof taskId === 'string') {
1007
1005
  await dataStore.getApplicationData(taskId, false, false, false, false);
1008
1006
  remoteIsInsured.value = formStore.applicationData.clientApp.isInsured;
1009
1007
  await router.replace({
@@ -1027,20 +1025,20 @@ export default {
1027
1025
  await uploadFile(formStore.applicationData.processInstanceId);
1028
1026
  }
1029
1027
  }
1030
- const memberFromApplicaiton = memberStore.getMemberFromApplication(whichForm.value as MemberKeys, whichIndex.value ? Number(whichIndex.value) : undefined);
1028
+ const memberFromApplicaiton = memberStore.getMemberFromApplication(whichForm.value, whichIndex.value ? Number(whichIndex.value) : undefined);
1031
1029
  if (typeof member.value.id !== 'number' || (typeof member.value.id === 'number' && member.value.id > 0 === false)) {
1032
1030
  return false;
1033
1031
  }
1034
1032
  const wasInsuredAction = ref<boolean>(false);
1035
- const isSaved = await dataStore.saveMember(member.value, memberStore.getMemberCode(whichForm.value as MemberKeys), memberFromApplicaiton);
1033
+ const isSaved = await dataStore.saveMember(member.value, memberStore.getMemberCode(whichForm.value)!, memberFromApplicaiton);
1036
1034
  if (!isSaved) return false;
1037
1035
  if (whichForm.value === formStore.policyholderFormKey) {
1038
1036
  if (isInsured === true || remoteIsInsured.value === true) {
1039
1037
  formStore.insuredForm[0] = formStore.policyholderForm;
1040
1038
  const isInsuredSaved = await dataStore.saveMember(
1041
1039
  member.value,
1042
- memberStore.getMemberCode(formStore.insuredFormKey as MemberKeys),
1043
- memberStore.getMemberFromApplication(formStore.insuredFormKey as MemberKeys, formStore.insuredFormIndex),
1040
+ memberStore.getMemberCode(formStore.insuredFormKey)!,
1041
+ memberStore.getMemberFromApplication(formStore.insuredFormKey, formStore.insuredFormIndex),
1044
1042
  );
1045
1043
  if (!isInsuredSaved) return false;
1046
1044
  wasInsuredAction.value = true;
@@ -1053,7 +1051,7 @@ export default {
1053
1051
  name: route.name!,
1054
1052
  query: { ...route.query, id: member.value.id },
1055
1053
  });
1056
- await dataStore.getApplicationData(route.params.taskId, false, false, true, wasInsuredAction.value);
1054
+ await dataStore.getApplicationData(route.params.taskId as string, false, false, true, wasInsuredAction.value);
1057
1055
  if (dataStore.controls.hasCalculator) {
1058
1056
  if (formStore.additionalInsuranceTermsWithout && formStore.additionalInsuranceTermsWithout.length !== 0) {
1059
1057
  formStore.additionalInsuranceTerms.forEach((term: any) => {
@@ -1208,7 +1206,7 @@ export default {
1208
1206
  };
1209
1207
 
1210
1208
  const deleteMember = async (index: number) => {
1211
- await memberStore.deleteMember(route.params.taskId as string, whichForm.value as MemberKeys, index);
1209
+ await memberStore.deleteMember(route.params.taskId as string, whichForm.value, index);
1212
1210
  const currentIndex = Number(whichIndex.value);
1213
1211
  if (index <= currentIndex) {
1214
1212
  const newIndex = ref<number>(currentIndex - 1 > 0 ? currentIndex - 1 : 0);
@@ -1282,7 +1280,7 @@ export default {
1282
1280
 
1283
1281
  const onIinInput = () => {
1284
1282
  if (!!member.value.iin && member.value.iin.length === useMask().iin.length && memberSetting.value.isMultiple === true) {
1285
- const alreadyInStatement = formStore[whichForm.value as MemberKeys].findIndex((i: Member) => i.iin === member.value.iin);
1283
+ const alreadyInStatement = formStore[whichForm.value as MultipleMember].findIndex((i: Member) => i.iin === member.value.iin);
1286
1284
  if (alreadyInStatement !== -1 && alreadyInStatement !== Number(whichIndex.value)) {
1287
1285
  dataStore.showToaster('error', dataStore.t('toaster.hasAlreadyMember'), 3000);
1288
1286
  member.value.iin = null;
@@ -391,7 +391,7 @@ export default defineComponent({
391
391
  return formStore.applicationData.statusCode === 'UnderwriterForm';
392
392
  }
393
393
  });
394
- const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible(formStore.productConditionsFormKey)));
394
+ const isDisabled = computed(() => (dataStore.isCalculator ? false : !memberStore.isStatementEditible('productConditionsForm')));
395
395
  const isTermsDisabled = computed(() => {
396
396
  if (dataStore.isGons) {
397
397
  return true;
@@ -727,17 +727,17 @@ export default defineComponent({
727
727
 
728
728
  if (isUnderwriterForm.value) {
729
729
  type recalculationInfo = {
730
- lifeMultiply: string | null;
731
- lifeAdditive: string | null;
732
- lifeMultiplyClient?: number | null;
733
- lifeAdditiveClient?: number | null;
734
- adbMultiply: string | null;
735
- adbAdditive: string | null;
736
- disabilityMultiply: string | null;
737
- disabilityAdditive: string | null;
738
- amount?: number | null;
739
- premium?: number | null;
740
- riskGroup?: string | number | null;
730
+ lifeMultiply: string | null | number;
731
+ lifeAdditive: string | null | number;
732
+ lifeMultiplyClient?: string | number | null;
733
+ lifeAdditiveClient?: string | number | null;
734
+ adbMultiply: string | null | number;
735
+ adbAdditive: string | null | number;
736
+ disabilityMultiply: string | null | number;
737
+ disabilityAdditive: string | null | number;
738
+ amount?: string | number | null;
739
+ premium?: string | number | null;
740
+ riskGroup?: string | string | number | null;
741
741
  };
742
742
  const recalculationData: recalculationInfo = (({ lifeMultiply, lifeAdditive, adbMultiply, adbAdditive, disabilityMultiply, disabilityAdditive }) => ({
743
743
  lifeMultiply,
@@ -765,7 +765,7 @@ export default defineComponent({
765
765
  recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
766
766
  recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
767
767
  isCalculating.value = true;
768
- await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId, whichSum.value);
768
+ await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId as string, whichSum.value);
769
769
  }
770
770
  isCalculating.value = true;
771
771
  if (props.isRecalculation) {
@@ -774,7 +774,7 @@ export default defineComponent({
774
774
  additionalTerms.value = formStore.additionalInsuranceTermsWithout;
775
775
  } else {
776
776
  if (dataStore.isProcessEditable(formStore.applicationData.statusCode)) {
777
- await dataStore.calculate(route.params.taskId);
777
+ await dataStore.calculate(route.params.taskId as string);
778
778
  additionalTerms.value = formStore.additionalInsuranceTerms;
779
779
  }
780
780
  }
@@ -172,10 +172,10 @@ export default defineComponent({
172
172
  loading.value = true;
173
173
  switch (dataStore.panelAction) {
174
174
  case constants.actions.pay:
175
- await dataStore.sendSMS('PayUrl', phoneNumber.value, formStore.epayLink);
175
+ await dataStore.sendSMS('PayUrl', phoneNumber.value!, formStore.epayLink!);
176
176
  break;
177
177
  case constants.actions.sign:
178
- await dataStore.sendSMS('SignUrl', phoneNumber.value, selectedClient.value?.uri);
178
+ await dataStore.sendSMS('SignUrl', phoneNumber.value!, selectedClient.value?.uri!);
179
179
  break;
180
180
  case constants.actions.affiliate:
181
181
  formStore.affilationResolution.processInstanceId = formStore.applicationData.processInstanceId;
@@ -198,7 +198,7 @@ export default defineComponent({
198
198
 
199
199
  const handleTask = async () => {
200
200
  loading.value = true;
201
- await dataStore.handleTask(dataStore.panelAction, route.params.taskId, actionCause.value);
201
+ await dataStore.handleTask(dataStore.panelAction, route.params.taskId as string, actionCause.value);
202
202
  loading.value = false;
203
203
  };
204
204