hl-core 0.0.8-beta.10 → 0.0.8-beta.11

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
@@ -147,7 +147,7 @@ export class ApiClass {
147
147
  async getContragent(queryData: any) {
148
148
  return this.axiosCall({
149
149
  method: Methods.GET,
150
- url: `/Ekk/api/Contragentinsis/Contragent?Iin=${queryData.iin}&FirstName=${queryData.firstName}&LastName=${queryData.lastName}&MiddleName${queryData.middleName}`,
150
+ url: `/Ekk/api/Contragentinsis/Contragent?Iin=${queryData.iin}&FirstName=${queryData.firstName}&LastName=${queryData.lastName}&MiddleName=${queryData.middleName}`,
151
151
  });
152
152
  }
153
153
 
@@ -9,7 +9,7 @@
9
9
  <slot v-if="!subtitle" name="subtitle"></slot>
10
10
  {{ subtitle }}
11
11
  </v-card-subtitle>
12
- <v-card-actions class="gap-[16px]">
12
+ <v-card-actions class="gap-[16px] m-2">
13
13
  <base-btn v-if="actions === 'default'" class="!w-fit px-6" size="sm" :text="$t('confirm.yes')" :btn="$libStyles.blueBtn" @click="$emit('yes')"></base-btn>
14
14
  <base-btn v-if="actions === 'default'" class="!w-fit px-6" size="sm" :text="$t('confirm.no')" :btn="$libStyles.blueBtn" @click="$emit('no')" />
15
15
  <slot v-if="actions !== 'default'" name="actions"></slot>
@@ -10,7 +10,7 @@
10
10
  <i class="mdi mdi-account-outline text-2xl text-[#A0B3D8]"></i
11
11
  ></base-panel-item>
12
12
  <base-panel-item
13
- v-for="panelItem of dataStore.settings.items.filter(i => (typeof i.show === 'boolean' ? i.show : true))"
13
+ v-for="panelItem of dataStore.settings.items.filter(i => $dataStore.filters.show(i))"
14
14
  :key="panelItem.title!"
15
15
  class="cursor-pointer"
16
16
  @click="panelItem.action ? panelItem.action() : null"
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <v-menu v-if="items.length" :activator="activator" location="bottom center" :offset="top" transition="scale-transition">
3
+ <base-form-text-section class="p-4 border-[1px] flex flex-col gap-3 elevation-3 w-[250px]">
4
+ <div v-for="item of items.filter(i => $dataStore.filters.show(i))" :key="item.id">
5
+ <base-menu-nav-item :class="[$libStyles.textSimple]" :menu-item="item" @click="$emit(item.id)"></base-menu-nav-item>
6
+ </div>
7
+ </base-form-text-section>
8
+ </v-menu>
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import { MenuItem } from '@/composables/classes';
13
+
14
+ export default defineComponent({
15
+ props: {
16
+ items: {
17
+ type: Array as PropType<MenuItem[]>,
18
+ default: [],
19
+ },
20
+ activator: {
21
+ type: String,
22
+ default: 'parent',
23
+ },
24
+ top: {
25
+ type: Number,
26
+ default: 10,
27
+ },
28
+ },
29
+ });
30
+ </script>
@@ -16,11 +16,11 @@
16
16
  <slot name="start"></slot>
17
17
  <base-fade-transition>
18
18
  <div v-if="$dataStore.menuItems && $dataStore.menuItems.length" class="flex flex-col gap-[10px]">
19
- <div v-for="(item, index) of $dataStore.menuItems.filter(i => (typeof i.show === 'boolean' ? i.show : true))" :key="index">
19
+ <div v-for="(item, index) of $dataStore.menuItems.filter(i => $dataStore.filters.show(i))" :key="index">
20
20
  <base-menu-nav-item
21
21
  :menu-item="item"
22
22
  :selected="!!selected.title && !!item.title && selected.title === item.title"
23
- :disabled="typeof item.disabled === 'boolean' ? item.disabled : false"
23
+ :disabled="$dataStore.filters.disabled(item)"
24
24
  @click.left="pickItem(item)"
25
25
  @click.middle="openTab(item)"
26
26
  >
@@ -35,7 +35,15 @@
35
35
  <div v-if="$dataStore.buttons && $dataStore.buttons.length" class="flex flex-col gap-[10px] justify-self-end absolute bottom-5 lg:bottom-[30%] w-full pr-4">
36
36
  <div v-for="(item, index) of $dataStore.buttons" :key="index">
37
37
  <transition enter-active-class="animate__animated animate__fadeIn animate__faster" leave-active-class="animate__animated animate__fadeOut animate__faster">
38
- <base-btn v-if="typeof item.show === 'boolean' ? item.show : true" :text="item.title!" :btn="item.color" :disabled="item.disabled" :loading="$dataStore.isButtonsLoading" @click="item.action"> </base-btn>
38
+ <base-btn
39
+ v-if="$dataStore.filters.show(item)"
40
+ :text="item.title!"
41
+ :btn="item.color"
42
+ :disabled="item.disabled"
43
+ :loading="$dataStore.isButtonsLoading"
44
+ @click="item.action"
45
+ >
46
+ </base-btn>
39
47
  </transition>
40
48
  </div></div
41
49
  ></base-fade-transition>
@@ -84,7 +92,7 @@ export default defineComponent({
84
92
  const router = useRouter();
85
93
 
86
94
  const pickItem = async (item: MenuItem) => {
87
- if (item.title !== dataStore.menu.selectedItem.title && (typeof item.disabled === 'boolean' ? !item.disabled : true)) {
95
+ if (item.title !== dataStore.menu.selectedItem.title && !dataStore.filters.disabled(item)) {
88
96
  if (typeof item.link === 'object') {
89
97
  if (item.link && 'name' in item.link) {
90
98
  await router.push(item.link as RouteLocationNormalized);
@@ -96,7 +96,7 @@
96
96
  @append="openPanel($t('form.relations'), [], 'relationDegree', $dataStore.getRelationTypes)"
97
97
  ></base-panel-input>
98
98
  <base-form-input
99
- v-if="whichForm === formStore.beneficiaryFormKey"
99
+ v-if="whichForm === formStore.beneficiaryFormKey && $dataStore.hasPercentageOfPayoutAmount()"
100
100
  v-model="member.percentageOfPayoutAmount"
101
101
  :readonly="isDisabled"
102
102
  :clearable="!isDisabled"
@@ -192,6 +192,7 @@
192
192
  </div>
193
193
  </base-form-section>
194
194
  </v-form>
195
+ <base-btn v-if="isRecalculation && hasCalculated" :btn="$libStyles.greenLightBtn" :text="$t('buttons.toStatement')" @click="toStatement"></base-btn>
195
196
  <base-btn
196
197
  v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
197
198
  :loading="isCalculating"
@@ -281,6 +282,7 @@ export default defineComponent({
281
282
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
282
283
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
283
284
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
285
+ const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
284
286
  const hasProcessIndexRate = computed(() => {
285
287
  if (dataStore.isGons || dataStore.isKazyna) {
286
288
  return false;
@@ -322,6 +324,20 @@ export default defineComponent({
322
324
  return baseCondition;
323
325
  });
324
326
 
327
+ const toStatement = async () => {
328
+ const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
329
+ if (statementItem) {
330
+ dataStore.menu.selectedItem = statementItem;
331
+ await router.replace({
332
+ name: 'taskId',
333
+ query: {
334
+ ...route.query,
335
+ tab: 'statement',
336
+ },
337
+ });
338
+ }
339
+ };
340
+
325
341
  const pickPanelValue = (item: Value) => {
326
342
  dataStore.panel.open = false;
327
343
  isPanelOpen.value = false;
@@ -637,6 +653,7 @@ export default defineComponent({
637
653
  hasRequestedSumInsuredInDollar,
638
654
  hasInsurancePremiumPerMonthInDollar,
639
655
  hasCurrency,
656
+ hasCalculated,
640
657
 
641
658
  // Rules
642
659
  coverPeriodRule,
@@ -653,6 +670,7 @@ export default defineComponent({
653
670
  onInputInsurancePremiumPerMonthInDollar,
654
671
  onInputSum,
655
672
  onInputSumDollar,
673
+ toStatement,
656
674
  };
657
675
  },
658
676
  });
@@ -89,6 +89,14 @@
89
89
  </base-fade-transition>
90
90
  </div>
91
91
  </section>
92
+ <section v-if="registerActions">
93
+ <div :class="[$libStyles.flexColNav]">
94
+ <v-form ref="vForm">
95
+ <base-rounded-input v-model="actionCause" placeholder="№ ХХХХХХХХХ" :rules="$rules.required"></base-rounded-input>
96
+ </v-form>
97
+ <base-btn :text="$t('buttons.send')" :loading="loading" @click="submitForm"></base-btn>
98
+ </div>
99
+ </section>
92
100
  </template>
93
101
 
94
102
  <script lang="ts">
@@ -159,6 +167,8 @@ export default defineComponent({
159
167
  return dataStore.t('buttons.sign');
160
168
  case constants.actions.pay:
161
169
  return dataStore.t('buttons.pay');
170
+ case constants.actions.register:
171
+ return dataStore.t('buttons.register');
162
172
  }
163
173
  });
164
174
 
@@ -178,6 +188,7 @@ export default defineComponent({
178
188
  const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
179
189
  const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
180
190
  const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
191
+ const registerActions = computed(() => dataStore.panelAction === constants.actions.register);
181
192
  const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
182
193
  const insurancePremiumPerMonth = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.insurancePremiumPerMonth));
183
194
  const requestedSumInsured = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.requestedSumInsured));
@@ -205,6 +216,7 @@ export default defineComponent({
205
216
  signingActions,
206
217
  payingActions,
207
218
  acceptAction,
219
+ registerActions,
208
220
  paymentPeriod,
209
221
  insurancePremiumPerMonth,
210
222
  requestedSumInsured,
@@ -265,7 +265,8 @@ class Person {
265
265
  getAgeByBirthDate() {
266
266
  const date = this.formatDate(this.birthDate);
267
267
  if (date) {
268
- const age = Math.abs(new Date(Date.now() - new Date(date).getTime()).getUTCFullYear() - 1970);
268
+ const calcAge = Math.abs(new Date(Date.now() - new Date(date).getTime()).getUTCFullYear() - 1970);
269
+ const age = calcAge === 0 ? 1 : calcAge;
269
270
  if (new Date(date) < new Date(Date.now()) && age > 0) {
270
271
  return age.toString();
271
272
  }
@@ -428,6 +429,7 @@ export class Member extends Person {
428
429
  hasAgreement: boolean | null;
429
430
  otpTokenId: string | null;
430
431
  otpCode: string | null;
432
+ documentsList: UserDocument[];
431
433
  constructor(
432
434
  id = 0,
433
435
  type = 1,
@@ -495,6 +497,7 @@ export class Member extends Person {
495
497
  isNotary = false,
496
498
  ) {
497
499
  super(id, type, iin, longName, lastName, firstName, middleName, birthDate, gender, genderName, birthPlace, age);
500
+ this.documentsList = [];
498
501
  this.postIndex = null;
499
502
  this.isPdl = false;
500
503
  this.migrationCard = migrationCard;
@@ -891,7 +894,25 @@ export class DataStoreClass {
891
894
  eur: number | null;
892
895
  usd: number | null;
893
896
  };
897
+ filters: {
898
+ show: (item: MenuItem) => boolean;
899
+ disabled: (item: MenuItem) => boolean;
900
+ };
894
901
  constructor() {
902
+ this.filters = {
903
+ show: (item: MenuItem) => {
904
+ if (typeof item.show === 'boolean') {
905
+ return item.show;
906
+ }
907
+ return true;
908
+ },
909
+ disabled: (item: MenuItem) => {
910
+ if (typeof item.disabled === 'boolean') {
911
+ return item.disabled;
912
+ }
913
+ return false;
914
+ },
915
+ };
895
916
  this.currencies = {
896
917
  eur: null,
897
918
  usd: null,
@@ -42,6 +42,8 @@ export const constants = Object.freeze({
42
42
  claim: 'claim',
43
43
  sign: 'sign',
44
44
  pay: 'pay',
45
+ register: 'register',
46
+ send: 'send',
45
47
  },
46
48
  yearCases: [2, 0, 1, 1, 1, 2],
47
49
  yearTitles: ['год', 'года', 'лет'],
@@ -92,8 +92,9 @@ export const getKeyWithPattern = (obj: any, key: string) => {
92
92
  };
93
93
 
94
94
  export const getAgeByBirthDate = (rawDate: string) => {
95
- const age = Math.abs(new Date(Date.now() - new Date(rawDate).getTime()).getUTCFullYear() - 1970);
96
- if (new Date(rawDate) < new Date(Date.now()) && age >= 0) {
95
+ const calcAge = Math.abs(new Date(Date.now() - new Date(rawDate).getTime()).getUTCFullYear() - 1970);
96
+ const age = calcAge === 0 ? 1 : calcAge;
97
+ if (new Date(rawDate) < new Date(Date.now()) && age > 0) {
97
98
  return age;
98
99
  }
99
100
  };
@@ -17,9 +17,10 @@ export class Styles {
17
17
  // Green
18
18
  greenBg: string = 'bg-[#009C73]';
19
19
  greenBgHover: string = 'hover:bg-[#00a277]';
20
- greenBgLight: string = 'bg-[#009C73]';
21
- greenText: string = 'text-[#009C73]';
20
+ greenBgLight: string = 'bg-[#EAF6EF]';
21
+ greenText: string = '!text-[#009C73]';
22
22
  greenTextHover: string = 'hover:text-[#009C73]';
23
+ greenBgLightHover: string = 'hover:bg-[#dbf0e4]';
23
24
 
24
25
  // Yellow
25
26
  yellowText: string = 'text-[#FAB31C]';
@@ -61,6 +62,7 @@ export class Styles {
61
62
  yellowBtn: string;
62
63
  whiteBtn: string;
63
64
  blueLightBtn: string;
65
+ greenLightBtn: string;
64
66
 
65
67
  // Complex
66
68
  flexColNav: string;
@@ -79,6 +81,7 @@ export class Styles {
79
81
  this.blueBtn = `${this.blueBg} ${this.whiteText} ${this.textTitle} ${this.rounded} w-full ${this.blueBgHover}`;
80
82
  this.whiteBtn = ` ${this.blackText} ${this.textTitle} ${this.rounded} w-full ${this.blueLightBgHover}`;
81
83
  this.blueLightBtn = `${this.blueBgLight} ${this.greyTextLight} ${this.textTitle} ${this.rounded} w-full ${this.blueBgLightHover}`;
84
+ this.greenLightBtn = `${this.greenBgLight} ${this.greenText} ${this.textTitle} ${this.rounded} w-full ${this.greenBgLightHover}`;
82
85
 
83
86
  // Complex
84
87
  this.flexColNav = 'flex flex-col gap-[10px] px-2 pt-[14px]';
@@ -38,7 +38,7 @@ const openSettings = async () => {
38
38
 
39
39
  const onLink = async (item: MenuItem) => {
40
40
  if (dataStore.menu.onLink) await dataStore.menu.onLink(item);
41
- if (typeof item.disabled === 'boolean' ? !item.disabled : true) dataStore.menu.selectedItem = item;
41
+ if (!dataStore.filters.disabled(item)) dataStore.menu.selectedItem = item;
42
42
  };
43
43
 
44
44
  const onBack = async (item: MenuItem) => {
package/locales/en.json CHANGED
@@ -136,7 +136,10 @@
136
136
  "calcPremium": "Calculate Premium",
137
137
  "accept": "Approve",
138
138
  "reject": "Reject",
139
- "pay": "Pay"
139
+ "pay": "Pay",
140
+ "register": "Registration reestr number",
141
+ "send": "Send",
142
+ "toStatement": "Continue checkout"
140
143
  },
141
144
  "dialog": {
142
145
  "title": "Confirmation",
@@ -153,9 +156,11 @@
153
156
  "deleteFile": "Are you sure you want to delete the file?",
154
157
  "continue": "Continue",
155
158
  "correctSum": "Is the insurance premium amount correct?",
156
- "sign": "Confirmation of signature",
157
- "pay": "Payment confirmation",
158
- "familyMember": "Choose a family member"
159
+ "sign": "Are you sure you want to sign?",
160
+ "pay": "Are you sure you want to pay?",
161
+ "familyMember": "Pick family member",
162
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
163
+ "toApprove": "Are you sure you want to send to approve?"
159
164
  },
160
165
  "sign": {
161
166
  "chooseDoc": "Choose documents to sign",
package/locales/kz.json CHANGED
@@ -136,7 +136,10 @@
136
136
  "calcPremium": "Рассчитать премию",
137
137
  "accept": "Одобрить",
138
138
  "reject": "Отказать",
139
- "pay": "Оплатить"
139
+ "pay": "Оплатить",
140
+ "register": "Укажите номер регистрации реестра",
141
+ "send": "Отправить",
142
+ "toStatement": "Продолжить оформление"
140
143
  },
141
144
  "dialog": {
142
145
  "title": "Подтверждение",
@@ -153,9 +156,11 @@
153
156
  "deleteFile": "Вы уверены что хотите удалить файл",
154
157
  "continue": "Продолжить",
155
158
  "correctSum": "Корректна ли сумма страховой премии?",
156
- "sign": "Подтверждение подписания",
157
- "pay": "Подтверждение оплаты",
158
- "familyMember": "Выберите члена семьи"
159
+ "sign": "Вы действительно хотите подписать?",
160
+ "pay": "Вы действительно хотите оплатить?",
161
+ "familyMember": "Выберите члена семьи",
162
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
163
+ "toApprove": "Вы действительно хотите отправить на согласование?"
159
164
  },
160
165
  "sign": {
161
166
  "chooseDoc": "Выберите документы для подписание",
package/locales/ru.json CHANGED
@@ -136,7 +136,10 @@
136
136
  "calcPremium": "Рассчитать премию",
137
137
  "accept": "Одобрить",
138
138
  "reject": "Отказать",
139
- "pay": "Оплатить"
139
+ "pay": "Оплатить",
140
+ "register": "Укажите номер регистрации реестра",
141
+ "send": "Отправить",
142
+ "toStatement": "Продолжить оформление"
140
143
  },
141
144
  "dialog": {
142
145
  "title": "Подтверждение",
@@ -153,9 +156,11 @@
153
156
  "deleteFile": "Вы уверены что хотите удалить файл",
154
157
  "continue": "Продолжить",
155
158
  "correctSum": "Корректна ли сумма страховой премии?",
156
- "sign": "Подтверждение подписания",
157
- "pay": "Подтверждение оплаты",
158
- "familyMember": "Выберите члена семьи"
159
+ "sign": "Вы действительно хотите подписать?",
160
+ "pay": "Вы действительно хотите оплатить?",
161
+ "familyMember": "Выберите члена семьи",
162
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
163
+ "toApprove": "Вы действительно хотите отправить на согласование?"
159
164
  },
160
165
  "sign": {
161
166
  "chooseDoc": "Выберите документы для подписание",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.8-beta.10",
3
+ "version": "0.0.8-beta.11",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -434,13 +434,21 @@ export const useDataStore = defineStore('data', {
434
434
  member.registrationDate = user.personalData.registrationDate;
435
435
  // Save User Documents Data
436
436
  if ('documents' in user && user.documents.length) {
437
- const documentType = this.documentTypes.find(i => i.ids === user.documents[0].type);
438
- const documentIssuer = this.documentIssuers.find(i => i.nameRu === user.documents[0].issuerNameRu);
437
+ member.documentsList = user.documents;
438
+ const documentByPriority = (() => {
439
+ if (this.isLifetrip) {
440
+ return user.documents.find(i => i.type === 'PS');
441
+ }
442
+ return user.documents.find(i => i.type === '1UDL');
443
+ })();
444
+ const userDocument = documentByPriority ? documentByPriority : user.documents[0];
445
+ const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
446
+ const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
439
447
  member.documentType = documentType ? documentType : new Value();
440
- member.documentNumber = user.documents[0].number;
448
+ member.documentNumber = userDocument.number;
441
449
  member.documentIssuers = documentIssuer ? documentIssuer : new Value();
442
- member.documentDate = reformatDate(user.documents[0].issueDate);
443
- member.documentExpire = reformatDate(user.documents[0].expireDate);
450
+ member.documentDate = reformatDate(userDocument.issueDate);
451
+ member.documentExpire = reformatDate(userDocument.expireDate);
444
452
  }
445
453
  // Document detail (residency, economy code, etc..)
446
454
  if ('data' in user && user.data.length) {
@@ -544,7 +552,7 @@ export const useDataStore = defineStore('data', {
544
552
  gender: user.gender.id,
545
553
  genderName: user.genderName ? user.genderName : user.gender.nameRu,
546
554
  birthPlace: user.birthPlace.nameRu,
547
- age: user.age,
555
+ age: Number(user.age),
548
556
  registrationDate: user.registrationDate,
549
557
  verifyType: user.verifyType,
550
558
  verifyDate: user.verifyDate,
@@ -569,7 +577,7 @@ export const useDataStore = defineStore('data', {
569
577
  questName = 'Страна налогового резиденства';
570
578
  }
571
579
  return {
572
- id: 'response' in user && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
580
+ id: 'response' in user && user.response && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
573
581
  contragentId: user.id,
574
582
  questAnswer: question.ids,
575
583
  questId: questionId,
@@ -580,7 +588,7 @@ export const useDataStore = defineStore('data', {
580
588
  if (user.countryOfTaxResidency.ids !== '500014.3') {
581
589
  user.addTaxResidency = new Value();
582
590
  }
583
- const addTaxResidency = 'response' in user && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
591
+ const addTaxResidency = 'response' in user && user.response && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
584
592
  if (user.addTaxResidency.nameRu !== null) {
585
593
  questionariesData.push({
586
594
  id: addTaxResidency ? addTaxResidency.id : 0,
@@ -608,17 +616,21 @@ export const useDataStore = defineStore('data', {
608
616
  if (user.phoneNumber !== '' && user.phoneNumber !== null) {
609
617
  contactsData.push({
610
618
  contragentId: user.id,
611
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
619
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
612
620
  newValue: '',
613
621
  note: '',
614
622
  primaryFlag: 'Y',
615
623
  type: 'MOBILE',
616
624
  typeName: 'Сотовый телефон',
617
625
  value: formatPhone(user.phoneNumber),
618
- verifyType: user.otpTokenId ? 'BMG' : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType : null,
626
+ verifyType: user.otpTokenId
627
+ ? 'BMG'
628
+ : 'response' in user && user.response && 'contacts' in user.response
629
+ ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
630
+ : null,
619
631
  verifyDate: user.otpTokenId
620
632
  ? this.currentDate()
621
- : 'response' in user && 'contacts' in user.response
633
+ : 'response' in user && user.response && 'contacts' in user.response
622
634
  ? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
623
635
  : null,
624
636
  });
@@ -626,19 +638,19 @@ export const useDataStore = defineStore('data', {
626
638
  if (user.email !== '' && user.email !== null) {
627
639
  contactsData.push({
628
640
  contragentId: user.id,
629
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
641
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
630
642
  newValue: '',
631
643
  note: '',
632
644
  primaryFlag: 'N',
633
645
  type: 'EMAIL',
634
646
  typeName: 'E-Mail',
635
- value: user.email ? user.email : 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
647
+ value: user.email ? user.email : 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
636
648
  });
637
649
  }
638
650
  if (user.homePhone !== '' && user.homePhone !== null) {
639
651
  contactsData.push({
640
652
  contragentId: user.id,
641
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
653
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
642
654
  newValue: '',
643
655
  note: '',
644
656
  primaryFlag: 'N',
@@ -646,17 +658,18 @@ export const useDataStore = defineStore('data', {
646
658
  typeName: 'Домашний телефон',
647
659
  value: user.homePhone
648
660
  ? formatPhone(user.homePhone)
649
- : 'response' in user && 'contacts' in user.response
661
+ : 'response' in user && user.response && 'contacts' in user.response
650
662
  ? user.response.contacts.find(i => i.type === 'HOME').value
651
663
  : '',
652
664
  });
653
665
  }
654
666
 
655
667
  // ! SaveContragent -> Documents
656
- let documentsData = [];
657
- documentsData.push({
668
+ let documentsData = user.documentsList;
669
+ const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
670
+ const userDocument = {
658
671
  contragentId: user.id,
659
- id: 'response' in user && 'documents' in user.response ? user.response.documents[0].id : 0,
672
+ id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
660
673
  description: null,
661
674
  expireDate: user.getDateByKey('documentExpire'),
662
675
  issueDate: user.getDateByKey('documentDate'),
@@ -670,14 +683,18 @@ export const useDataStore = defineStore('data', {
670
683
  serial: null,
671
684
  verifyType: user.verifyType,
672
685
  verifyDate: user.verifyDate,
673
- });
674
-
675
- const checkForNull = value => (value ? value : '');
686
+ };
687
+ if (hasAlreadyDocument !== -1) {
688
+ documentsData[hasAlreadyDocument] = userDocument;
689
+ } else {
690
+ documentsData.push(userDocument);
691
+ }
676
692
 
677
693
  // ! SaveContragent -> Addresses
694
+ const checkForNull = value => (value ? value : '');
678
695
  let addressData = [];
679
696
  addressData.push({
680
- id: 'response' in user && 'addresses' in user.response ? user.response.addresses[0].id : 0,
697
+ id: 'response' in user && user.response && 'addresses' in user.response ? user.response.addresses[0].id : 0,
681
698
  contragentId: user.id,
682
699
  countryCode: user.birthPlace.ids,
683
700
  countryName: user.birthPlace.nameRu,
@@ -697,7 +714,6 @@ export const useDataStore = defineStore('data', {
697
714
  address: `${checkForNull(user.birthPlace.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(user.registrationCity.nameRu)}, ул. ${checkForNull(
698
715
  user.registrationStreet,
699
716
  )}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
700
-
701
717
  type: 'H',
702
718
  });
703
719
 
@@ -1339,7 +1355,6 @@ export const useDataStore = defineStore('data', {
1339
1355
  this.isLoading = true;
1340
1356
  try {
1341
1357
  let form1 = {
1342
- baiterekApp: null,
1343
1358
  policyAppDto: {
1344
1359
  id: this.formStore.applicationData.policyAppDto.id,
1345
1360
  processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
@@ -1764,10 +1779,18 @@ export const useDataStore = defineStore('data', {
1764
1779
  if (this.formStore.signUrls.length) {
1765
1780
  return this.formStore.signUrls;
1766
1781
  }
1767
- const data = [
1768
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1769
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1770
- ];
1782
+ const prepareSignDocuments = () => {
1783
+ switch (this.formStore.applicationData.statusCode) {
1784
+ case 'ContractSignedFrom':
1785
+ return [{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Contract', format: 'pdf' }];
1786
+ default:
1787
+ return [
1788
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1789
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1790
+ ];
1791
+ }
1792
+ };
1793
+ const data = prepareSignDocuments();
1771
1794
  const result = await this.api.signDocument(data);
1772
1795
  this.formStore.signUrls = result;
1773
1796
  return this.formStore.signUrls;
@@ -1862,7 +1885,7 @@ export const useDataStore = defineStore('data', {
1862
1885
  const sumOfPercentage = localMembers.reduce((sum, member) => {
1863
1886
  return sum + Number(member.percentageOfPayoutAmount);
1864
1887
  }, 0);
1865
- if (sumOfPercentage !== 100) {
1888
+ if (sumOfPercentage !== 100 && this.hasPercentageOfPayoutAmount()) {
1866
1889
  this.showToaster('error', this.t('toaster.errorSumOrPercentage'), 3000);
1867
1890
  return false;
1868
1891
  }
@@ -2295,6 +2318,12 @@ export const useDataStore = defineStore('data', {
2295
2318
  return true;
2296
2319
  }
2297
2320
  },
2321
+ hasPercentageOfPayoutAmount() {
2322
+ if (this.isKazyna) {
2323
+ return false
2324
+ };
2325
+ return true
2326
+ },
2298
2327
  },
2299
2328
  });
2300
2329
 
package/types/index.ts CHANGED
@@ -314,4 +314,22 @@ declare global {
314
314
  agentNo?: string;
315
315
  iin?: string | null;
316
316
  };
317
+
318
+ type UserDocument = {
319
+ id: number | null;
320
+ contragentId: number | null;
321
+ type: string;
322
+ typeName: string;
323
+ serial: string | number | null;
324
+ number: string;
325
+ issueDate: string;
326
+ expireDate: string;
327
+ issuerId: number;
328
+ issuerName: string;
329
+ issuerNameRu: string;
330
+ description: string | null;
331
+ note: string | null;
332
+ verifyType: string;
333
+ verifyDate: string;
334
+ };
317
335
  }