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

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>
@@ -27,7 +27,7 @@ export default defineComponent({
27
27
  },
28
28
  title: {
29
29
  type: String,
30
- default: '',
30
+ default: useDataStore().t('dialog.title'),
31
31
  },
32
32
  subtitle: {
33
33
  type: String,
@@ -13,6 +13,7 @@
13
13
  <slot></slot>
14
14
  </div>
15
15
  <base-panel-handler v-else></base-panel-handler>
16
+ <slot></slot>
16
17
  </v-navigation-drawer>
17
18
  </template>
18
19
 
@@ -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"
@@ -139,6 +139,7 @@
139
139
  :clearable="!isDisabled"
140
140
  :rules="requestedSumInsured"
141
141
  :label="$t('productConditionsForm.requestedSumInsured')"
142
+ :suffix="$constants.currencySymbols.kzt"
142
143
  @input="onInputSum"
143
144
  ></base-form-input>
144
145
  <base-form-input
@@ -192,6 +193,7 @@
192
193
  </div>
193
194
  </base-form-section>
194
195
  </v-form>
196
+ <base-btn v-if="isRecalculation && hasCalculated" :btn="$libStyles.greenLightBtn" :text="$t('buttons.toStatement')" @click="toStatement"></base-btn>
195
197
  <base-btn
196
198
  v-if="!isDisabled && isTask && ($dataStore.isInitiator() || $dataStore.isUnderwriter())"
197
199
  :loading="isCalculating"
@@ -281,6 +283,7 @@ export default defineComponent({
281
283
  const isUnderwriterRole = computed(() => dataStore.isUnderwriter() || dataStore.isAdmin() || dataStore.isSupport());
282
284
  const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
283
285
  const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
286
+ const hasCalculated = computed(() => !!productConditionsForm.requestedSumInsured && !!productConditionsForm.insurancePremiumPerMonth);
284
287
  const hasProcessIndexRate = computed(() => {
285
288
  if (dataStore.isGons || dataStore.isKazyna) {
286
289
  return false;
@@ -322,6 +325,20 @@ export default defineComponent({
322
325
  return baseCondition;
323
326
  });
324
327
 
328
+ const toStatement = async () => {
329
+ const statementItem = dataStore.menuItems.find(i => i.id === 'statement');
330
+ if (statementItem) {
331
+ dataStore.menu.selectedItem = statementItem;
332
+ await router.replace({
333
+ name: 'taskId',
334
+ query: {
335
+ ...route.query,
336
+ tab: 'statement',
337
+ },
338
+ });
339
+ }
340
+ };
341
+
325
342
  const pickPanelValue = (item: Value) => {
326
343
  dataStore.panel.open = false;
327
344
  isPanelOpen.value = false;
@@ -637,6 +654,7 @@ export default defineComponent({
637
654
  hasRequestedSumInsuredInDollar,
638
655
  hasInsurancePremiumPerMonthInDollar,
639
656
  hasCurrency,
657
+ hasCalculated,
640
658
 
641
659
  // Rules
642
660
  coverPeriodRule,
@@ -653,6 +671,7 @@ export default defineComponent({
653
671
  onInputInsurancePremiumPerMonthInDollar,
654
672
  onInputSum,
655
673
  onInputSumDollar,
674
+ toStatement,
656
675
  };
657
676
  },
658
677
  });
@@ -159,6 +159,8 @@ export default defineComponent({
159
159
  return dataStore.t('buttons.sign');
160
160
  case constants.actions.pay:
161
161
  return dataStore.t('buttons.pay');
162
+ case constants.actions.register:
163
+ return dataStore.t('buttons.register');
162
164
  }
163
165
  });
164
166
 
@@ -266,7 +266,7 @@ class Person {
266
266
  const date = this.formatDate(this.birthDate);
267
267
  if (date) {
268
268
  const age = Math.abs(new Date(Date.now() - new Date(date).getTime()).getUTCFullYear() - 1970);
269
- if (new Date(date) < new Date(Date.now()) && age > 0) {
269
+ if (new Date(date) < new Date(Date.now()) && age >= 0) {
270
270
  return age.toString();
271
271
  }
272
272
  } else {
@@ -428,6 +428,7 @@ export class Member extends Person {
428
428
  hasAgreement: boolean | null;
429
429
  otpTokenId: string | null;
430
430
  otpCode: string | null;
431
+ documentsList: UserDocument[];
431
432
  constructor(
432
433
  id = 0,
433
434
  type = 1,
@@ -495,6 +496,7 @@ export class Member extends Person {
495
496
  isNotary = false,
496
497
  ) {
497
498
  super(id, type, iin, longName, lastName, firstName, middleName, birthDate, gender, genderName, birthPlace, age);
499
+ this.documentsList = [];
498
500
  this.postIndex = null;
499
501
  this.isPdl = false;
500
502
  this.migrationCard = migrationCard;
@@ -891,7 +893,25 @@ export class DataStoreClass {
891
893
  eur: number | null;
892
894
  usd: number | null;
893
895
  };
896
+ filters: {
897
+ show: (item: MenuItem) => boolean;
898
+ disabled: (item: MenuItem) => boolean;
899
+ };
894
900
  constructor() {
901
+ this.filters = {
902
+ show: (item: MenuItem) => {
903
+ if (typeof item.show === 'boolean') {
904
+ return item.show;
905
+ }
906
+ return true;
907
+ },
908
+ disabled: (item: MenuItem) => {
909
+ if (typeof item.disabled === 'boolean') {
910
+ return item.disabled;
911
+ }
912
+ return false;
913
+ },
914
+ };
895
915
  this.currencies = {
896
916
  eur: null,
897
917
  usd: null,
@@ -12,6 +12,8 @@ export const constants = Object.freeze({
12
12
 
13
13
  editableStatuses: ['StartForm', 'EditBeneficiaryForm', 'EditForm'],
14
14
  documentsLinkVisibleStatuses: ['DocumentsSignedFrom', 'UnderwriterForm', 'AffilationResolutionForm', 'Completed', 'InsurancePremiumOnlinePaid'],
15
+ returnStatementStatuses: ['DocumentsSignedFrom', 'WaitingInsurancePremiumForm', 'UnderwriterForm'],
16
+ cancelApplicationStatuses: ['StartForm', 'EditForm', 'WaitingInsurancePremiumForm', 'DocumentsSignedFrom'],
15
17
  gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
16
18
  types: {
17
19
  string: 'string',
@@ -42,6 +44,8 @@ export const constants = Object.freeze({
42
44
  claim: 'claim',
43
45
  sign: 'sign',
44
46
  pay: 'pay',
47
+ register: 'register',
48
+ send: 'send',
45
49
  },
46
50
  yearCases: [2, 0, 1, 1, 1, 2],
47
51
  yearTitles: ['год', 'года', 'лет'],
@@ -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
@@ -88,7 +88,8 @@
88
88
  "requiredInsured": "You need to specify insured person's data",
89
89
  "needToRecalculate": "You need to recalculate the product conditions",
90
90
  "noUrl": "No link available",
91
- "pickFamilyMember": "Pick a family member"
91
+ "pickFamilyMember": "Pick a family member",
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
93
  },
93
94
  "buttons": {
94
95
  "createStatement": "Create Statement",
@@ -136,7 +137,10 @@
136
137
  "calcPremium": "Calculate Premium",
137
138
  "accept": "Approve",
138
139
  "reject": "Reject",
139
- "pay": "Pay"
140
+ "pay": "Pay",
141
+ "register": "Registration reestr number",
142
+ "send": "Send",
143
+ "toStatement": "Continue checkout"
140
144
  },
141
145
  "dialog": {
142
146
  "title": "Confirmation",
@@ -153,9 +157,11 @@
153
157
  "deleteFile": "Are you sure you want to delete the file?",
154
158
  "continue": "Continue",
155
159
  "correctSum": "Is the insurance premium amount correct?",
156
- "sign": "Confirmation of signature",
157
- "pay": "Payment confirmation",
158
- "familyMember": "Choose a family member"
160
+ "sign": "Are you sure you want to sign?",
161
+ "pay": "Are you sure you want to pay?",
162
+ "familyMember": "Pick family member",
163
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
164
+ "toApprove": "Are you sure you want to send to approve?"
159
165
  },
160
166
  "sign": {
161
167
  "chooseDoc": "Choose documents to sign",
@@ -277,7 +283,11 @@
277
283
  "information": "Additional Data",
278
284
  "policyNumber": "Policy Number",
279
285
  "statusCode": "Application Status",
280
- "initiator": "Initiator"
286
+ "initiator": "Initiator",
287
+ "iin&bin": "IIN/BIN",
288
+ "insurerIin": "Insured IIN",
289
+ "insurerLongName": "Insured Full Name",
290
+ "jsonObject": "JSON value"
281
291
  },
282
292
  "placeholders": {
283
293
  "login": "Login",
package/locales/kz.json CHANGED
@@ -88,7 +88,8 @@
88
88
  "requiredInsured": "Необходимо указать данные застрахованного",
89
89
  "needToRecalculate": "Необходимо пересчитать условия продукта",
90
90
  "noUrl": "Отсутствует ссылка",
91
- "pickFamilyMember": "Выберите члена семьи"
91
+ "pickFamilyMember": "Выберите члена семьи",
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
93
  },
93
94
  "buttons": {
94
95
  "createStatement": "Создать заявку",
@@ -136,7 +137,10 @@
136
137
  "calcPremium": "Рассчитать премию",
137
138
  "accept": "Одобрить",
138
139
  "reject": "Отказать",
139
- "pay": "Оплатить"
140
+ "pay": "Оплатить",
141
+ "register": "Укажите номер регистрации реестра",
142
+ "send": "Отправить",
143
+ "toStatement": "Продолжить оформление"
140
144
  },
141
145
  "dialog": {
142
146
  "title": "Подтверждение",
@@ -153,9 +157,11 @@
153
157
  "deleteFile": "Вы уверены что хотите удалить файл",
154
158
  "continue": "Продолжить",
155
159
  "correctSum": "Корректна ли сумма страховой премии?",
156
- "sign": "Подтверждение подписания",
157
- "pay": "Подтверждение оплаты",
158
- "familyMember": "Выберите члена семьи"
160
+ "sign": "Вы действительно хотите подписать?",
161
+ "pay": "Вы действительно хотите оплатить?",
162
+ "familyMember": "Выберите члена семьи",
163
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
164
+ "toApprove": "Вы действительно хотите отправить на согласование?"
159
165
  },
160
166
  "sign": {
161
167
  "chooseDoc": "Выберите документы для подписание",
@@ -277,7 +283,11 @@
277
283
  "information": "Дополнительные данные",
278
284
  "policyNumber": "Номер полиса",
279
285
  "statusCode": "Статус заявки",
280
- "initiator": "Инициатор"
286
+ "initiator": "Инициатор",
287
+ "iin&bin": "ИИН/БИН",
288
+ "insurerIin": "ИИН застрахованного",
289
+ "insurerLongName": "ФИО застрахованного",
290
+ "jsonObject": "JSON значение"
281
291
  },
282
292
  "placeholders": {
283
293
  "login": "Логин",
package/locales/ru.json CHANGED
@@ -88,7 +88,8 @@
88
88
  "requiredInsured": "Необходимо указать данные застрахованного",
89
89
  "needToRecalculate": "Необходимо пересчитать условия продукта",
90
90
  "noUrl": "Отсутствует ссылка",
91
- "pickFamilyMember": "Выберите члена семьи"
91
+ "pickFamilyMember": "Выберите члена семьи",
92
+ "numberRegistered": "Регистрационный номер успешно записан в реестр"
92
93
  },
93
94
  "buttons": {
94
95
  "createStatement": "Создать заявку",
@@ -136,7 +137,10 @@
136
137
  "calcPremium": "Рассчитать премию",
137
138
  "accept": "Одобрить",
138
139
  "reject": "Отказать",
139
- "pay": "Оплатить"
140
+ "pay": "Оплатить",
141
+ "register": "Укажите номер регистрации реестра",
142
+ "send": "Отправить",
143
+ "toStatement": "Продолжить оформление"
140
144
  },
141
145
  "dialog": {
142
146
  "title": "Подтверждение",
@@ -153,9 +157,11 @@
153
157
  "deleteFile": "Вы уверены что хотите удалить файл",
154
158
  "continue": "Продолжить",
155
159
  "correctSum": "Корректна ли сумма страховой премии?",
156
- "sign": "Подтверждение подписания",
157
- "pay": "Подтверждение оплаты",
158
- "familyMember": "Выберите члена семьи"
160
+ "sign": "Вы действительно хотите подписать?",
161
+ "pay": "Вы действительно хотите оплатить?",
162
+ "familyMember": "Выберите члена семьи",
163
+ "register": "Вы действительно хотите добавить в реестр данного ребенка?",
164
+ "toApprove": "Вы действительно хотите отправить на согласование?"
159
165
  },
160
166
  "sign": {
161
167
  "chooseDoc": "Выберите документы для подписание",
@@ -277,7 +283,11 @@
277
283
  "information": "Дополнительные данные",
278
284
  "policyNumber": "Номер полиса",
279
285
  "statusCode": "Статус заявки",
280
- "initiator": "Инициатор"
286
+ "initiator": "Инициатор",
287
+ "iin&bin": "ИИН/БИН",
288
+ "insurerIin": "ИИН застрахованного",
289
+ "insurerLongName": "ФИО застрахованного",
290
+ "jsonObject": "JSON значение"
281
291
  },
282
292
  "placeholders": {
283
293
  "login": "Логин",
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.12",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -208,6 +208,20 @@ export const useDataStore = defineStore('data', {
208
208
  isProcessEditable(statusCode) {
209
209
  return !!constants.editableStatuses.find(status => status === statusCode);
210
210
  },
211
+ isProcessReturnable(statusCode) {
212
+ const getReturnableStatuses = () => {
213
+ const defaultStatuses = constants.returnStatementStatuses;
214
+ return defaultStatuses;
215
+ };
216
+ return !!getReturnableStatuses().find(status => status === statusCode);
217
+ },
218
+ isProcessCancel(statusCode) {
219
+ const getCanceleStatuses = () => {
220
+ const defaultStatuses = constants.cancelApplicationStatuses;
221
+ return defaultStatuses;
222
+ };
223
+ return !!getCanceleStatuses().find(status => status === statusCode);
224
+ },
211
225
  isTask() {
212
226
  return this.formStore.applicationData.processInstanceId !== 0 && this.formStore.applicationData.isTask;
213
227
  },
@@ -434,13 +448,21 @@ export const useDataStore = defineStore('data', {
434
448
  member.registrationDate = user.personalData.registrationDate;
435
449
  // Save User Documents Data
436
450
  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);
451
+ member.documentsList = user.documents;
452
+ const documentByPriority = (() => {
453
+ if (this.isLifetrip) {
454
+ return user.documents.find(i => i.type === 'PS');
455
+ }
456
+ return user.documents.find(i => i.type === '1UDL');
457
+ })();
458
+ const userDocument = documentByPriority ? documentByPriority : user.documents[0];
459
+ const documentType = this.documentTypes.find(i => i.ids === userDocument.type);
460
+ const documentIssuer = this.documentIssuers.find(i => i.nameRu === userDocument.issuerNameRu);
439
461
  member.documentType = documentType ? documentType : new Value();
440
- member.documentNumber = user.documents[0].number;
462
+ member.documentNumber = userDocument.number;
441
463
  member.documentIssuers = documentIssuer ? documentIssuer : new Value();
442
- member.documentDate = reformatDate(user.documents[0].issueDate);
443
- member.documentExpire = reformatDate(user.documents[0].expireDate);
464
+ member.documentDate = reformatDate(userDocument.issueDate);
465
+ member.documentExpire = reformatDate(userDocument.expireDate);
444
466
  }
445
467
  // Document detail (residency, economy code, etc..)
446
468
  if ('data' in user && user.data.length) {
@@ -544,7 +566,7 @@ export const useDataStore = defineStore('data', {
544
566
  gender: user.gender.id,
545
567
  genderName: user.genderName ? user.genderName : user.gender.nameRu,
546
568
  birthPlace: user.birthPlace.nameRu,
547
- age: user.age,
569
+ age: Number(user.age),
548
570
  registrationDate: user.registrationDate,
549
571
  verifyType: user.verifyType,
550
572
  verifyDate: user.verifyDate,
@@ -569,7 +591,7 @@ export const useDataStore = defineStore('data', {
569
591
  questName = 'Страна налогового резиденства';
570
592
  }
571
593
  return {
572
- id: 'response' in user && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
594
+ id: 'response' in user && user.response && 'questionnaires' in user.response ? user.response.questionnaires?.find(i => i.questId == questionId).id : question.id,
573
595
  contragentId: user.id,
574
596
  questAnswer: question.ids,
575
597
  questId: questionId,
@@ -580,7 +602,7 @@ export const useDataStore = defineStore('data', {
580
602
  if (user.countryOfTaxResidency.ids !== '500014.3') {
581
603
  user.addTaxResidency = new Value();
582
604
  }
583
- const addTaxResidency = 'response' in user && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
605
+ const addTaxResidency = 'response' in user && user.response && 'questionnaires' in user.response && user.response.questionnaires.find(i => i.questId === '507777');
584
606
  if (user.addTaxResidency.nameRu !== null) {
585
607
  questionariesData.push({
586
608
  id: addTaxResidency ? addTaxResidency.id : 0,
@@ -608,17 +630,21 @@ export const useDataStore = defineStore('data', {
608
630
  if (user.phoneNumber !== '' && user.phoneNumber !== null) {
609
631
  contactsData.push({
610
632
  contragentId: user.id,
611
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
633
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'MOBILE').id : 0,
612
634
  newValue: '',
613
635
  note: '',
614
636
  primaryFlag: 'Y',
615
637
  type: 'MOBILE',
616
638
  typeName: 'Сотовый телефон',
617
639
  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,
640
+ verifyType: user.otpTokenId
641
+ ? 'BMG'
642
+ : 'response' in user && user.response && 'contacts' in user.response
643
+ ? user.response.contacts.find(i => i.type === 'MOBILE').verifyType
644
+ : null,
619
645
  verifyDate: user.otpTokenId
620
646
  ? this.currentDate()
621
- : 'response' in user && 'contacts' in user.response
647
+ : 'response' in user && user.response && 'contacts' in user.response
622
648
  ? user.response.contacts.find(i => i.type === 'MOBILE').verifyDate
623
649
  : null,
624
650
  });
@@ -626,19 +652,19 @@ export const useDataStore = defineStore('data', {
626
652
  if (user.email !== '' && user.email !== null) {
627
653
  contactsData.push({
628
654
  contragentId: user.id,
629
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
655
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').id : 0,
630
656
  newValue: '',
631
657
  note: '',
632
658
  primaryFlag: 'N',
633
659
  type: 'EMAIL',
634
660
  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 : '',
661
+ value: user.email ? user.email : 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'EMAIL').value : '',
636
662
  });
637
663
  }
638
664
  if (user.homePhone !== '' && user.homePhone !== null) {
639
665
  contactsData.push({
640
666
  contragentId: user.id,
641
- id: 'response' in user && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
667
+ id: 'response' in user && user.response && 'contacts' in user.response ? user.response.contacts.find(i => i.type === 'HOME').id : 0,
642
668
  newValue: '',
643
669
  note: '',
644
670
  primaryFlag: 'N',
@@ -646,17 +672,18 @@ export const useDataStore = defineStore('data', {
646
672
  typeName: 'Домашний телефон',
647
673
  value: user.homePhone
648
674
  ? formatPhone(user.homePhone)
649
- : 'response' in user && 'contacts' in user.response
675
+ : 'response' in user && user.response && 'contacts' in user.response
650
676
  ? user.response.contacts.find(i => i.type === 'HOME').value
651
677
  : '',
652
678
  });
653
679
  }
654
680
 
655
681
  // ! SaveContragent -> Documents
656
- let documentsData = [];
657
- documentsData.push({
682
+ let documentsData = user.documentsList;
683
+ const hasAlreadyDocument = documentsData.findIndex(i => i.type === user.documentType.ids && i.number === user.documentNumber);
684
+ const userDocument = {
658
685
  contragentId: user.id,
659
- id: 'response' in user && 'documents' in user.response ? user.response.documents[0].id : 0,
686
+ id: hasAlreadyDocument !== -1 ? documentsData[hasAlreadyDocument].id : 0,
660
687
  description: null,
661
688
  expireDate: user.getDateByKey('documentExpire'),
662
689
  issueDate: user.getDateByKey('documentDate'),
@@ -670,14 +697,18 @@ export const useDataStore = defineStore('data', {
670
697
  serial: null,
671
698
  verifyType: user.verifyType,
672
699
  verifyDate: user.verifyDate,
673
- });
674
-
675
- const checkForNull = value => (value ? value : '');
700
+ };
701
+ if (hasAlreadyDocument !== -1) {
702
+ documentsData[hasAlreadyDocument] = userDocument;
703
+ } else {
704
+ documentsData.push(userDocument);
705
+ }
676
706
 
677
707
  // ! SaveContragent -> Addresses
708
+ const checkForNull = value => (value ? value : '');
678
709
  let addressData = [];
679
710
  addressData.push({
680
- id: 'response' in user && 'addresses' in user.response ? user.response.addresses[0].id : 0,
711
+ id: 'response' in user && user.response && 'addresses' in user.response ? user.response.addresses[0].id : 0,
681
712
  contragentId: user.id,
682
713
  countryCode: user.birthPlace.ids,
683
714
  countryName: user.birthPlace.nameRu,
@@ -697,7 +728,6 @@ export const useDataStore = defineStore('data', {
697
728
  address: `${checkForNull(user.birthPlace.nameRu)}, ${checkForNull(user.registrationRegionType.nameRu)} ${checkForNull(user.registrationCity.nameRu)}, ул. ${checkForNull(
698
729
  user.registrationStreet,
699
730
  )}, д. ${checkForNull(user.registrationNumberHouse)} кв. ${checkForNull(user.registrationNumberApartment)}`,
700
-
701
731
  type: 'H',
702
732
  });
703
733
 
@@ -1339,7 +1369,6 @@ export const useDataStore = defineStore('data', {
1339
1369
  this.isLoading = true;
1340
1370
  try {
1341
1371
  let form1 = {
1342
- baiterekApp: null,
1343
1372
  policyAppDto: {
1344
1373
  id: this.formStore.applicationData.policyAppDto.id,
1345
1374
  processInstanceId: this.formStore.applicationData.policyAppDto.processInstanceId,
@@ -1764,10 +1793,18 @@ export const useDataStore = defineStore('data', {
1764
1793
  if (this.formStore.signUrls.length) {
1765
1794
  return this.formStore.signUrls;
1766
1795
  }
1767
- const data = [
1768
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1769
- { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1770
- ];
1796
+ const prepareSignDocuments = () => {
1797
+ switch (this.formStore.applicationData.statusCode) {
1798
+ case 'ContractSignedFrom':
1799
+ return [{ processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Contract', format: 'pdf' }];
1800
+ default:
1801
+ return [
1802
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Agreement', format: 'pdf' },
1803
+ { processInstanceId: this.formStore.applicationData.processInstanceId, name: 'Statement', format: 'pdf' },
1804
+ ];
1805
+ }
1806
+ };
1807
+ const data = prepareSignDocuments();
1771
1808
  const result = await this.api.signDocument(data);
1772
1809
  this.formStore.signUrls = result;
1773
1810
  return this.formStore.signUrls;
@@ -1862,7 +1899,7 @@ export const useDataStore = defineStore('data', {
1862
1899
  const sumOfPercentage = localMembers.reduce((sum, member) => {
1863
1900
  return sum + Number(member.percentageOfPayoutAmount);
1864
1901
  }, 0);
1865
- if (sumOfPercentage !== 100) {
1902
+ if (sumOfPercentage !== 100 && this.hasPercentageOfPayoutAmount()) {
1866
1903
  this.showToaster('error', this.t('toaster.errorSumOrPercentage'), 3000);
1867
1904
  return false;
1868
1905
  }
@@ -2295,6 +2332,12 @@ export const useDataStore = defineStore('data', {
2295
2332
  return true;
2296
2333
  }
2297
2334
  },
2335
+ hasPercentageOfPayoutAmount() {
2336
+ if (this.isKazyna) {
2337
+ return false;
2338
+ }
2339
+ return true;
2340
+ },
2298
2341
  },
2299
2342
  });
2300
2343
 
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
  }