hl-core 0.0.7-beta.20 → 0.0.7-beta.21

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.
@@ -16,7 +16,7 @@
16
16
  <base-form-section :title="$t('generalConditions')">
17
17
  <div v-if="isRecalculation && $route.params.taskId === '0'">
18
18
  <base-form-input
19
- v-model="formStore.productConditionsForm.signDate"
19
+ v-model="productConditionsForm.signDate"
20
20
  :maska="$maska.date"
21
21
  :clearable="false"
22
22
  :readonly="true"
@@ -24,7 +24,7 @@
24
24
  append-inner-icon="mdi mdi-calendar-blank-outline"
25
25
  ></base-form-input>
26
26
  <base-form-input
27
- v-model="formStore.productConditionsForm.birthDate"
27
+ v-model="productConditionsForm.birthDate"
28
28
  :maska="$maska.date"
29
29
  :readonly="isDisabled"
30
30
  :clearable="!isDisabled"
@@ -33,8 +33,8 @@
33
33
  append-inner-icon="mdi mdi-calendar-blank-outline"
34
34
  ></base-form-input>
35
35
  <base-panel-input
36
- v-model="formStore.productConditionsForm.gender"
37
- :value="formStore.productConditionsForm.gender.nameRu"
36
+ v-model="productConditionsForm.gender"
37
+ :value="productConditionsForm.gender.nameRu"
38
38
  :readonly="isDisabled"
39
39
  :clearable="!isDisabled"
40
40
  :label="$t('form.gender')"
@@ -44,7 +44,7 @@
44
44
  ></base-panel-input>
45
45
  </div>
46
46
  <base-form-input
47
- v-model="formStore.productConditionsForm.coverPeriod"
47
+ v-model="productConditionsForm.coverPeriod"
48
48
  :maska="$maska.numbers"
49
49
  :readonly="isDisabled"
50
50
  :clearable="!isDisabled"
@@ -52,8 +52,8 @@
52
52
  :label="$t('productConditionsForm.coverPeriodFrom3to20')"
53
53
  ></base-form-input>
54
54
  <base-panel-input
55
- v-model="formStore.productConditionsForm.paymentPeriod"
56
- :value="formStore.productConditionsForm.paymentPeriod.nameRu"
55
+ v-model="productConditionsForm.paymentPeriod"
56
+ :value="productConditionsForm.paymentPeriod.nameRu"
57
57
  :readonly="isDisabled"
58
58
  :clearable="!isDisabled"
59
59
  :rules="$rules.objectRequired"
@@ -62,14 +62,14 @@
62
62
  @append="openPanel($t('productConditionsForm.processPaymentPeriod'), $dataStore.processPaymentPeriod, 'paymentPeriod', $dataStore.getProcessPaymentPeriod)"
63
63
  ></base-panel-input>
64
64
  <base-form-input
65
- v-model="formStore.productConditionsForm.requestedSumInsured"
65
+ v-model="productConditionsForm.requestedSumInsured"
66
66
  :readonly="isDisabled"
67
67
  :clearable="!isDisabled"
68
68
  :rules="requestedSumInsured"
69
69
  :label="$t('productConditionsForm.requestedSumInsured')"
70
70
  ></base-form-input>
71
71
  <base-form-input
72
- v-model="formStore.productConditionsForm.insurancePremiumPerMonth"
72
+ v-model="productConditionsForm.insurancePremiumPerMonth"
73
73
  :readonly="isDisabled"
74
74
  :clearable="!isDisabled"
75
75
  :rules="insurancePremiumPerMonth"
@@ -125,7 +125,8 @@ export default defineComponent({
125
125
  const isPanelOpen = ref<boolean>(false);
126
126
  const panelValue = ref<Value>(new Value());
127
127
  const panelList = ref<Value[]>([]);
128
- const currentPanel = ref<keyof typeof formStore.productConditionsForm>();
128
+ const productConditionsForm = formStore.productConditionsForm;
129
+ const currentPanel = ref<keyof typeof productConditionsForm>();
129
130
  const searchQuery = ref<string>('');
130
131
  const whichSum = ref<'insurancePremiumPerMonth' | 'requestedSumInsured' | ''>('');
131
132
 
@@ -138,15 +139,15 @@ export default defineComponent({
138
139
  });
139
140
  const isDisabled = computed(() => !memberStore.isStatementEditible(formStore.productConditionsFormKey));
140
141
  const isTask = computed(() => (route.params.taskId === '0' && props.isRecalculation === true) || dataStore.isTask());
141
- const insurancePremiumPerMonth = computed(() => (!!formStore.productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
142
- const requestedSumInsured = computed(() => (!!formStore.productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
142
+ const insurancePremiumPerMonth = computed(() => (!!productConditionsForm.insurancePremiumPerMonth ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
143
+ const requestedSumInsured = computed(() => (!!productConditionsForm.requestedSumInsured ? dataStore.rules.required.concat(dataStore.rules.sums) : []));
143
144
 
144
145
  const pickPanelValue = (item: Value) => {
145
146
  if (!isDisabled.value) {
146
147
  dataStore.panel.open = false;
147
148
  isPanelOpen.value = false;
148
149
  // @ts-ignore
149
- formStore.productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
150
+ productConditionsForm[currentPanel.value] = item.nameRu === null ? new Value() : item;
150
151
  } else {
151
152
  dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
152
153
  }
@@ -155,7 +156,7 @@ export default defineComponent({
155
156
  const openPanel = async (title: string, list: Value[], key: string, asyncFunction?: Function, filterKey?: string) => {
156
157
  if (!isDisabled.value) {
157
158
  searchQuery.value = '';
158
- currentPanel.value = key as keyof typeof formStore.productConditionsForm;
159
+ currentPanel.value = key as keyof typeof productConditionsForm;
159
160
  isPanelOpen.value = true;
160
161
  dataStore.panelAction = null;
161
162
  dataStore.panel.open = true;
@@ -168,7 +169,7 @@ export default defineComponent({
168
169
  }
169
170
  panelList.value = newList;
170
171
  // @ts-ignore
171
- panelValue.value = formStore.productConditionsForm[currentPanel.value];
172
+ panelValue.value = productConditionsForm[currentPanel.value];
172
173
  isPanelLoading.value = false;
173
174
  } else {
174
175
  dataStore.showToaster('error', dataStore.t('toaster.viewErrorText'));
@@ -185,17 +186,17 @@ export default defineComponent({
185
186
  vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
186
187
  if (v.valid) {
187
188
  if (whichSum.value === 'requestedSumInsured') {
188
- formStore.productConditionsForm.insurancePremiumPerMonth = null;
189
+ productConditionsForm.insurancePremiumPerMonth = null;
189
190
  }
190
191
  if (whichSum.value === 'insurancePremiumPerMonth') {
191
- formStore.productConditionsForm.requestedSumInsured = null;
192
+ productConditionsForm.requestedSumInsured = null;
192
193
  }
193
- if (formStore.productConditionsForm.requestedSumInsured !== '' && formStore.productConditionsForm.requestedSumInsured != null) {
194
- formStore.productConditionsForm.insurancePremiumPerMonth = null;
194
+ if (productConditionsForm.requestedSumInsured !== '' && productConditionsForm.requestedSumInsured != null) {
195
+ productConditionsForm.insurancePremiumPerMonth = null;
195
196
  if (props.isRecalculation) whichSum.value = 'requestedSumInsured';
196
197
  }
197
- if (formStore.productConditionsForm.insurancePremiumPerMonth !== '' && formStore.productConditionsForm.insurancePremiumPerMonth != null) {
198
- formStore.productConditionsForm.requestedSumInsured = null;
198
+ if (productConditionsForm.insurancePremiumPerMonth !== '' && productConditionsForm.insurancePremiumPerMonth != null) {
199
+ productConditionsForm.requestedSumInsured = null;
199
200
  if (props.isRecalculation) whichSum.value = 'insurancePremiumPerMonth';
200
201
  }
201
202
 
@@ -223,14 +224,14 @@ export default defineComponent({
223
224
  adbAdditive,
224
225
  disabilityMultiply,
225
226
  disabilityAdditive,
226
- }))(formStore.productConditionsForm);
227
+ }))(productConditionsForm);
227
228
  Object.keys(recalculationData).forEach(key => {
228
229
  // @ts-ignore
229
230
  recalculationData[key] = formatProcents(recalculationData[key]);
230
231
  });
231
- recalculationData.amount = Number(formStore.productConditionsForm.requestedSumInsured?.replace(/\s/g, ''));
232
- recalculationData.premium = Number(formStore.productConditionsForm.insurancePremiumPerMonth?.replace(/\s/g, ''));
233
- recalculationData.riskGroup = formStore.productConditionsForm.riskGroup?.id ? formStore.productConditionsForm.riskGroup.id : 1;
232
+ recalculationData.amount = Number((productConditionsForm.requestedSumInsured as string)?.replace(/\s/g, ''));
233
+ recalculationData.premium = Number((productConditionsForm.insurancePremiumPerMonth as string)?.replace(/\s/g, ''));
234
+ recalculationData.riskGroup = productConditionsForm.riskGroup?.id ? productConditionsForm.riskGroup.id : 1;
234
235
  isCalculating.value = true;
235
236
  await dataStore.reCalculate(formStore.applicationData.processInstanceId, recalculationData, route.params.taskId, whichSum.value);
236
237
  }
@@ -267,48 +268,52 @@ export default defineComponent({
267
268
 
268
269
  onMounted(async () => {
269
270
  if (props.isRecalculation === true) {
270
- if (route.params.taskId === '0') {
271
+ if (route.params.taskId === '0' && productConditionsForm.requestedSumInsured === null && productConditionsForm.insurancePremiumPerMonth === null) {
271
272
  const defaultData = await dataStore.getDefaultCalculationData(true);
272
- dataStore.additionalInsuranceTermsWithout = defaultData.addCovers;
273
- formStore.productConditionsForm.requestedSumInsured = defaultData.amount;
274
- formStore.productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
275
- formStore.productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
276
- formStore.productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
277
- formStore.productConditionsForm.signDate = reformatDate(defaultData.signDate);
273
+ if (!defaultData) {
274
+ dataStore.showToaster('error', 'Отсутствуют базовые данные');
275
+ return;
276
+ }
277
+ formStore.additionalInsuranceTermsWithout = defaultData.addCovers;
278
+ productConditionsForm.requestedSumInsured = defaultData.amount;
279
+ productConditionsForm.insurancePremiumPerMonth = defaultData.premium;
280
+ productConditionsForm.processIndexRate = dataStore.processIndexRate.find(i => i.id === defaultData.indexRateId);
281
+ productConditionsForm.paymentPeriod = dataStore.processPaymentPeriod.find(i => i.id == defaultData.paymentPeriodId);
282
+ productConditionsForm.signDate = reformatDate(defaultData.signDate);
278
283
  }
279
284
  }
280
- if (!!formStore.productConditionsForm.insurancePremiumPerMonth) {
285
+ if (!!productConditionsForm.insurancePremiumPerMonth) {
281
286
  whichSum.value = 'insurancePremiumPerMonth';
282
287
  }
283
- if (!!formStore.productConditionsForm.requestedSumInsured) {
288
+ if (!!productConditionsForm.requestedSumInsured) {
284
289
  whichSum.value = 'requestedSumInsured';
285
290
  }
286
291
  });
287
292
 
288
293
  watch(
289
- () => formStore.productConditionsForm.requestedSumInsured,
294
+ () => productConditionsForm.requestedSumInsured,
290
295
  val => {
291
296
  if (!val && whichSum.value == 'requestedSumInsured') whichSum.value = '';
292
297
  if (val && whichSum.value != 'insurancePremiumPerMonth') {
293
298
  whichSum.value = 'requestedSumInsured';
294
- formStore.productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(val);
299
+ productConditionsForm.requestedSumInsured = dataStore.getNumberWithSpaces(val);
295
300
  }
296
301
  },
297
302
  );
298
303
  watch(
299
- () => formStore.productConditionsForm.insurancePremiumPerMonth,
304
+ () => productConditionsForm.insurancePremiumPerMonth,
300
305
  val => {
301
306
  if (!val && whichSum.value == 'insurancePremiumPerMonth') whichSum.value = '';
302
307
  if (val && whichSum.value != 'requestedSumInsured') {
303
308
  whichSum.value = 'insurancePremiumPerMonth';
304
- formStore.productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(val);
309
+ productConditionsForm.insurancePremiumPerMonth = dataStore.getNumberWithSpaces(val);
305
310
  }
306
311
  },
307
312
  );
308
313
  watch(
309
- () => formStore.productConditionsForm.amountOfInsurancePremium,
314
+ () => productConditionsForm.amountOfInsurancePremium,
310
315
  val => {
311
- if (val) formStore.productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
316
+ if (val) productConditionsForm.amountOfInsurancePremium = dataStore.getNumberWithSpaces(val);
312
317
  },
313
318
  );
314
319
 
@@ -316,6 +321,7 @@ export default defineComponent({
316
321
  // State
317
322
  formStore,
318
323
  vForm,
324
+ productConditionsForm,
319
325
  isCalculating,
320
326
  isPanelLoading,
321
327
  isPanelOpen,
@@ -68,7 +68,7 @@ export class Value {
68
68
  }
69
69
  }
70
70
 
71
- class IDocument {
71
+ export class IDocument {
72
72
  id?: string;
73
73
  processInstanceId?: string;
74
74
  iin?: string;
@@ -678,8 +678,8 @@ export class ProductConditions {
678
678
  termsOfInsurance: string | null;
679
679
  annualIncome: string | null;
680
680
  processIndexRate: Value;
681
- requestedSumInsured: string | null;
682
- insurancePremiumPerMonth: string | null;
681
+ requestedSumInsured: number | string | null;
682
+ insurancePremiumPerMonth: number | string | null;
683
683
  establishingGroupDisabilityFromThirdYear: string | null;
684
684
  possibilityToChange: string | null;
685
685
  deathOfInsuredDueToAccident: Value;
@@ -769,6 +769,10 @@ export class DataStoreClass {
769
769
  controls: {
770
770
  // Проверка на роль при авторизации
771
771
  onAuth: boolean;
772
+ // Согласие на главной странице
773
+ hasAgreement: boolean;
774
+ // Наличие анкеты
775
+ hasAnketa: boolean;
772
776
  // Подтягивание с ГБДФЛ
773
777
  hasGBDFL: boolean;
774
778
  // Подтягивание с ГКБ
@@ -823,7 +827,7 @@ export class DataStoreClass {
823
827
  documentIssuers: Value[];
824
828
  familyStatuses: Value[];
825
829
  relations: Value[];
826
- questionRefs: any[];
830
+ questionRefs: Value[];
827
831
  epayLink: string;
828
832
  residents: Value[];
829
833
  ipdl: Value[];
@@ -839,8 +843,6 @@ export class DataStoreClass {
839
843
  processCoverTypeSum: any[];
840
844
  processIndexRate: any[];
841
845
  processPaymentPeriod: any[];
842
- additionalInsuranceTerms: any[];
843
- additionalInsuranceTermsWithout: any[];
844
846
  taskList: TaskListItem[];
845
847
  processHistory: TaskHistory[];
846
848
  contragentList: any[];
@@ -849,30 +851,16 @@ export class DataStoreClass {
849
851
  groupCode: string;
850
852
  userGroups: Item[];
851
853
  onMainPage: boolean;
852
- signUrl: string | null;
853
854
  SaleChanellPolicyList: any[];
854
855
  RegionPolicyList: any[];
855
856
  ManagerPolicyList: any[];
856
857
  AgentDataList: any[];
857
- affilationResolution: {
858
- id: string | number | null;
859
- processInstanceId: string | number | null;
860
- number: string | number | null;
861
- date: string | number | null;
862
- };
863
- signedDocumentList: any[];
864
- surveyByHealthBase: any[];
865
- surveyByCriticalBase: any[];
866
- surveyByHealthSecond: any[];
867
- surveyByCriticalSecond: any[];
868
- definedAnswersId: {
869
- surveyByHealthBase: any;
870
- surveyByCriticalBase: any;
871
- };
872
858
  riskGroup: any[];
873
859
  constructor() {
874
860
  this.controls = {
875
861
  onAuth: false,
862
+ hasAnketa: true,
863
+ hasAgreement: true,
876
864
  hasGBDFL: true,
877
865
  hasGKB: false,
878
866
  hasInsis: false,
@@ -881,24 +869,11 @@ export class DataStoreClass {
881
869
  this.hasLayoutMargins = true;
882
870
  this.processIndexRate = [];
883
871
  this.processPaymentPeriod = [];
884
- this.additionalInsuranceTerms = [];
885
- this.additionalInsuranceTermsWithout = [];
886
- this.definedAnswersId = {
887
- surveyByHealthBase: {},
888
- surveyByCriticalBase: {},
889
- };
890
- this.signedDocumentList = [];
891
- this.affilationResolution = {
892
- id: null,
893
- processInstanceId: null,
894
- number: null,
895
- date: null,
896
- };
872
+ this.questionRefs = [];
897
873
  this.SaleChanellPolicyList = [];
898
874
  this.RegionPolicyList = [];
899
875
  this.ManagerPolicyList = [];
900
876
  this.AgentDataList = [];
901
- this.signUrl = null;
902
877
  this.product = import.meta.env.VITE_PRODUCT ? (import.meta.env.VITE_PRODUCT as string) : null;
903
878
  this.showNav = true;
904
879
  this.menuItems = [];
@@ -948,11 +923,6 @@ export class DataStoreClass {
948
923
  this.documentIssuers = [];
949
924
  this.familyStatuses = [];
950
925
  this.relations = [];
951
- this.surveyByHealthBase = [];
952
- this.surveyByCriticalBase = [];
953
- this.surveyByHealthSecond = [];
954
- this.surveyByCriticalSecond = [];
955
- this.questionRefs = [];
956
926
  this.epayLink = '';
957
927
  this.residents = [];
958
928
  this.ipdl = [new Value(1, null), new Value(2, 'Да'), new Value(3, 'Нет')];
@@ -1006,6 +976,24 @@ export class DataStoreClass {
1006
976
  }
1007
977
 
1008
978
  export class FormStoreClass {
979
+ additionalInsuranceTerms: AddCover[];
980
+ additionalInsuranceTermsWithout: AddCover[];
981
+ signUrl: string | null;
982
+ affilationResolution: {
983
+ id: string | number | null;
984
+ processInstanceId: string | number | null;
985
+ number: string | number | null;
986
+ date: string | number | null;
987
+ };
988
+ signedDocumentList: IDocument[];
989
+ surveyByHealthBase: AnketaFirst | null;
990
+ surveyByCriticalBase: AnketaFirst | null;
991
+ surveyByHealthSecond: AnketaSecond[] | null;
992
+ surveyByCriticalSecond: AnketaSecond[] | null;
993
+ definedAnswersId: {
994
+ surveyByHealthBase: any;
995
+ surveyByCriticalBase: any;
996
+ };
1009
997
  birthInfos: BirthInfoGKB[];
1010
998
  SaleChanellPolicy: Value;
1011
999
  AgentData: {
@@ -1068,6 +1056,24 @@ export class FormStoreClass {
1068
1056
  canBeClaimed: boolean | null;
1069
1057
  applicationTaskId: string | null;
1070
1058
  constructor(procuctConditionsTitle?: string) {
1059
+ this.additionalInsuranceTerms = [];
1060
+ this.additionalInsuranceTermsWithout = [];
1061
+ this.signUrl = null;
1062
+ this.affilationResolution = {
1063
+ id: null,
1064
+ processInstanceId: null,
1065
+ number: null,
1066
+ date: null,
1067
+ };
1068
+ this.signedDocumentList = [];
1069
+ this.surveyByHealthBase = null;
1070
+ this.surveyByCriticalBase = null;
1071
+ this.surveyByHealthSecond = null;
1072
+ this.surveyByCriticalSecond = null;
1073
+ this.definedAnswersId = {
1074
+ surveyByHealthBase: {},
1075
+ surveyByCriticalBase: {},
1076
+ };
1071
1077
  this.birthInfos = [];
1072
1078
  this.SaleChanellPolicy = new Value();
1073
1079
  this.AgentData = {
@@ -10,6 +10,7 @@ export class Masks {
10
10
  phone: string = '+7 (7##) ### ## ##';
11
11
  date: string = '##.##.####';
12
12
  post: string = '######';
13
+ threeDigit: string = '###';
13
14
  }
14
15
 
15
16
  export const useMask = () => new Masks();
@@ -77,7 +77,7 @@ export class Styles {
77
77
 
78
78
  // Complex
79
79
  this.flexColNav = 'flex flex-col gap-[10px] px-2 pt-[14px]';
80
- this.emptyBlockCol = 'w-[110px] h-[30%] rounded-[8px] bg-[#f5f5f5]';
80
+ this.emptyBlockCol = 'w-[60px] sm:w-[100px] h-[30%] rounded-[8px] bg-[#f5f5f5]';
81
81
  this.scrollPage = 'max-h-[90vh] overflow-y-scroll';
82
82
  }
83
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.7-beta.20",
3
+ "version": "0.0.7-beta.21",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -61,7 +61,7 @@ export const useDataStore = defineStore('data', {
61
61
  }
62
62
  },
63
63
  getFilesByIIN(iin) {
64
- return iin ? this.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
64
+ return iin ? this.formStore.signedDocumentList.filter(file => file.iin === iin && file.fileTypeName === 'Удостоверение личности') : null;
65
65
  },
66
66
  async getNewAccessToken() {
67
67
  try {
@@ -945,16 +945,15 @@ export const useDataStore = defineStore('data', {
945
945
  try {
946
946
  this.isLoading = true;
947
947
  const anketaToken = await this.api.setSurvey(data);
948
- window.scrollTo({ top: 0, behavior: 'smooth' });
949
948
  this.showToaster('success', this.t('toaster.successSaved'), 2000);
950
949
  return anketaToken;
951
950
  } catch (error) {
952
- ErrorHandler(err);
951
+ return ErrorHandler(err);
953
952
  } finally {
954
953
  this.isLoading = false;
955
954
  }
956
955
  },
957
- async getFromApi(whichField, whichRequest, parameter) {
956
+ async getFromApi(whichField, whichRequest, parameter, reset = false) {
958
957
  const storageValue = JSON.parse(localStorage.getItem(whichField) || 'null');
959
958
  const currentHour = new Date().getHours();
960
959
 
@@ -966,8 +965,7 @@ export const useDataStore = defineStore('data', {
966
965
  if (storageValue && (hasHourKey === false || hasModeKey === false || hasValueKey === false)) return true;
967
966
  if (storageValue && (storageValue.hour !== currentHour || storageValue.mode !== import.meta.env.MODE || storageValue.value.length === 0)) return true;
968
967
  };
969
-
970
- if (getDataCondition()) {
968
+ if (!!getDataCondition() || reset === true) {
971
969
  this[whichField] = [];
972
970
  try {
973
971
  const response = await this.api[whichRequest](parameter);
@@ -1089,7 +1087,7 @@ export const useDataStore = defineStore('data', {
1089
1087
  return await this.getFromApi('processPaymentPeriod', 'getProcessPaymentPeriod', this.processCode);
1090
1088
  },
1091
1089
  async getQuestionRefs(id) {
1092
- return await this.getFromApi('questionRefs', 'getQuestionRefs', id);
1090
+ return await this.getFromApi('questionRefs', 'getQuestionRefs', id, true);
1093
1091
  },
1094
1092
  async getProcessTariff() {
1095
1093
  return await this.getFromApi('processTariff', 'getProcessTariff');
@@ -1097,26 +1095,25 @@ export const useDataStore = defineStore('data', {
1097
1095
  async getAdditionalInsuranceTermsAnswers(questionId) {
1098
1096
  try {
1099
1097
  const answers = await this.api.getAdditionalInsuranceTermsAnswers(this.processCode, questionId);
1100
- answers.unshift(answers.pop());
1101
1098
  return answers;
1102
1099
  } catch (err) {
1103
1100
  console.log(err);
1104
1101
  }
1105
1102
  },
1106
1103
  async getQuestionList(surveyType, processInstanceId, insuredId, baseField, secondaryField) {
1107
- if (!this[baseField].length) {
1104
+ if (!this.formStore[baseField] || (this.formStore[baseField] && !this.formStore[baseField].length)) {
1108
1105
  try {
1109
1106
  const [{ value: baseQuestions }, { value: secondaryQuestions }] = await Promise.allSettled([
1110
1107
  this.api.getQuestionList(surveyType, processInstanceId, insuredId),
1111
- this.api.getQuestionList(`${surveyType}second`, processInstanceId, insuredId),
1108
+ this.api.getQuestionListSecond(`${surveyType}second`, processInstanceId, insuredId),
1112
1109
  ]);
1113
- this[baseField] = baseQuestions;
1114
- this[secondaryField] = secondaryQuestions;
1110
+ this.formStore[baseField] = baseQuestions;
1111
+ this.formStore[secondaryField] = secondaryQuestions;
1115
1112
  } catch (err) {
1116
1113
  console.log(err);
1117
1114
  }
1118
1115
  }
1119
- return this[baseField];
1116
+ return this.formStore[baseField];
1120
1117
  },
1121
1118
  getNumberWithSpaces(n) {
1122
1119
  return n === null ? null : Number((typeof n === 'string' ? n : n.toFixed().toString()).replace(/[^0-9]+/g, '')).toLocaleString('ru');
@@ -1292,18 +1289,6 @@ export const useDataStore = defineStore('data', {
1292
1289
  this.isLoading = false;
1293
1290
  }
1294
1291
  },
1295
- async getDictionaryItems(dictName) {
1296
- try {
1297
- this.isLoading = true;
1298
- if (!this[`${dictName}List`].length) {
1299
- this[`${dictName}List`] = await this.api.getDictionaryItems(dictName);
1300
- }
1301
- } catch (err) {
1302
- console.log(err);
1303
- } finally {
1304
- this.isLoading = false;
1305
- }
1306
- },
1307
1292
  async filterManagerByRegion(dictName, filterName) {
1308
1293
  try {
1309
1294
  this.isLoading = true;
@@ -1317,19 +1302,19 @@ export const useDataStore = defineStore('data', {
1317
1302
  async getUnderwritingCouncilData(id) {
1318
1303
  try {
1319
1304
  const response = await this.api.getUnderwritingCouncilData(id);
1320
- this.affilationResolution.id = response.underwritingCouncilAppDto.id;
1321
- this.affilationResolution.date = response.underwritingCouncilAppDto.date ? reformatDate(response.underwritingCouncilAppDto.date) : null;
1322
- this.affilationResolution.number = response.underwritingCouncilAppDto.number ? response.underwritingCouncilAppDto.number : null;
1305
+ this.formStore.affilationResolution.id = response.underwritingCouncilAppDto.id;
1306
+ this.formStore.affilationResolution.date = response.underwritingCouncilAppDto.date ? reformatDate(response.underwritingCouncilAppDto.date) : null;
1307
+ this.formStore.affilationResolution.number = response.underwritingCouncilAppDto.number ? response.underwritingCouncilAppDto.number : null;
1323
1308
  } catch (err) {
1324
1309
  console.log(err);
1325
1310
  }
1326
1311
  },
1327
1312
  async setConfirmation() {
1328
1313
  const data = {
1329
- id: this.affilationResolution.id,
1330
- processInstanceId: this.affilationResolution.processInstanceId,
1331
- number: this.affilationResolution.number,
1332
- date: formatDate(this.affilationResolution.date)?.toISOString(),
1314
+ id: this.formStore.affilationResolution.id,
1315
+ processInstanceId: this.formStore.affilationResolution.processInstanceId,
1316
+ number: this.formStore.affilationResolution.number,
1317
+ date: formatDate(this.formStore.affilationResolution.date)?.toISOString(),
1333
1318
  };
1334
1319
  try {
1335
1320
  this.isLoading = true;
@@ -1358,14 +1343,14 @@ export const useDataStore = defineStore('data', {
1358
1343
  }
1359
1344
  },
1360
1345
  async definedAnswers(filter, whichSurvey, value = null, index = null) {
1361
- if (!this.definedAnswersId[whichSurvey].hasOwnProperty(filter)) {
1362
- this.definedAnswersId[whichSurvey][filter] = await this.api.definedAnswers(filter);
1346
+ if (!this.formStore.definedAnswersId[whichSurvey].hasOwnProperty(filter)) {
1347
+ this.formStore.definedAnswersId[whichSurvey][filter] = await this.api.definedAnswers(filter);
1363
1348
  }
1364
- if (value !== null && this.definedAnswersId[whichSurvey][filter].length) {
1365
- const answer = this.definedAnswersId[whichSurvey][filter].find(answer => answer.nameRu === value);
1366
- this[whichSurvey].body[index].first.answerId = answer.ids;
1349
+ if (value !== null && this.formStore.definedAnswersId[whichSurvey][filter].length) {
1350
+ const answer = this.formStore.definedAnswersId[whichSurvey][filter].find(answer => answer.nameRu === value);
1351
+ this.formStore[whichSurvey].body[index].first.answerId = answer.ids;
1367
1352
  }
1368
- return this.definedAnswersId[whichSurvey];
1353
+ return this.formStore.definedAnswersId[whichSurvey];
1369
1354
  },
1370
1355
  async getPaymentTable(id) {
1371
1356
  try {
@@ -1405,12 +1390,13 @@ export const useDataStore = defineStore('data', {
1405
1390
  ? this.formStore.productConditionsForm.processIndexRate.id
1406
1391
  : this.processIndexRate.find(i => i.code === '0')?.id,
1407
1392
  paymentPeriodId: this.formStore.productConditionsForm.paymentPeriod.id,
1408
- addCovers: this.additionalInsuranceTermsWithout,
1393
+ addCovers: this.formStore.additionalInsuranceTermsWithout,
1409
1394
  };
1395
+ console.log(calculationData);
1410
1396
  const calculationResponse = await this.api.calculateWithoutApplication(calculationData);
1411
1397
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(calculationResponse.amount);
1412
1398
  this.formStore.productConditionsForm.insurancePremiumPerMonth = this.getNumberWithSpaces(calculationResponse.premium);
1413
- this.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1399
+ this.formStore.additionalInsuranceTermsWithout = calculationResponse.addCovers;
1414
1400
  this.showToaster('success', this.t('toaster.calculated'), 1000);
1415
1401
  } catch (err) {
1416
1402
  ErrorHandler(err);
@@ -1451,7 +1437,7 @@ export const useDataStore = defineStore('data', {
1451
1437
  disabilityAdditive: formatProcents(this.formStore.productConditionsForm.adbAdditive),
1452
1438
  riskGroup: this.formStore.productConditionsForm.riskGroup?.id ? this.formStore.productConditionsForm.riskGroup.id : 1,
1453
1439
  },
1454
- addCoversDto: this.additionalInsuranceTerms,
1440
+ addCoversDto: this.formStore.additionalInsuranceTerms,
1455
1441
  };
1456
1442
 
1457
1443
  try {
@@ -1467,7 +1453,7 @@ export const useDataStore = defineStore('data', {
1467
1453
 
1468
1454
  const applicationData = await this.api.getApplicationData(taskId);
1469
1455
  this.formStore.applicationData = applicationData;
1470
- this.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1456
+ this.formStore.additionalInsuranceTerms = this.formStore.applicationData.addCoverDto;
1471
1457
  if (this.formStore.productConditionsForm.insurancePremiumPerMonth != null) {
1472
1458
  this.formStore.productConditionsForm.requestedSumInsured = this.getNumberWithSpaces(result);
1473
1459
  } else {
@@ -1511,7 +1497,7 @@ export const useDataStore = defineStore('data', {
1511
1497
  return;
1512
1498
  }
1513
1499
  this.formStore.applicationData = applicationData;
1514
- this.additionalInsuranceTerms = applicationData.addCoverDto;
1500
+ this.formStore.additionalInsuranceTerms = applicationData.addCoverDto;
1515
1501
 
1516
1502
  this.formStore.canBeClaimed = await this.api.isClaimTask(taskId);
1517
1503
  this.formStore.applicationTaskId = taskId;
@@ -1842,12 +1828,12 @@ export const useDataStore = defineStore('data', {
1842
1828
  },
1843
1829
  async signToDocument(data) {
1844
1830
  try {
1845
- if (this.signUrl) {
1846
- return this.signUrl;
1831
+ if (this.formStore.signUrl) {
1832
+ return this.formStore.signUrl;
1847
1833
  }
1848
1834
  const result = await this.api.signToDocument(data);
1849
- this.signUrl = result.uri;
1850
- return this.signUrl;
1835
+ this.formStore.signUrl = result.uri;
1836
+ return this.formStore.signUrl;
1851
1837
  } catch (error) {
1852
1838
  this.showToaster('error', this.t('toaster.error') + error?.response?.data, 2000);
1853
1839
  }
@@ -1863,7 +1849,7 @@ export const useDataStore = defineStore('data', {
1863
1849
  async getSignedDocList(processInstanceId) {
1864
1850
  if (processInstanceId !== 0) {
1865
1851
  try {
1866
- this.signedDocumentList = await this.api.getSignedDocList({
1852
+ this.formStore.signedDocumentList = await this.api.getSignedDocList({
1867
1853
  processInstanceId: processInstanceId,
1868
1854
  });
1869
1855
  } catch (err) {
@@ -2012,7 +1998,7 @@ export const useDataStore = defineStore('data', {
2012
1998
  return true;
2013
1999
  },
2014
2000
  validateAnketa(whichSurvey) {
2015
- const list = this[whichSurvey].body;
2001
+ const list = this.formStore[whichSurvey].body;
2016
2002
  if (!list || (list && list.length === 0)) return false;
2017
2003
  let notAnswered = 0;
2018
2004
  for (let x = 0; x < list.length; x++) {
@@ -2027,7 +2013,7 @@ export const useDataStore = defineStore('data', {
2027
2013
  const areMembersValid = await this.validateAllMembers(taskId);
2028
2014
  if (areMembersValid) {
2029
2015
  if (!!this.formStore.productConditionsForm.insurancePremiumPerMonth && !!this.formStore.productConditionsForm.requestedSumInsured) {
2030
- const hasCritical = this.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
2016
+ const hasCritical = this.formStore.additionalInsuranceTerms?.find(cover => cover.coverTypeName === 'Критическое заболевание Застрахованного');
2031
2017
  if (hasCritical && hasCritical.coverSumName !== 'не включено') {
2032
2018
  await Promise.allSettled([
2033
2019
  this.getQuestionList(
@@ -2046,10 +2032,10 @@ export const useDataStore = defineStore('data', {
2046
2032
  ),
2047
2033
  ]);
2048
2034
  await Promise.allSettled([
2049
- ...this.surveyByHealthBase.body.map(async question => {
2035
+ ...this.formStore.surveyByHealthBase.body.map(async question => {
2050
2036
  await this.definedAnswers(question.first.id, 'surveyByHealthBase');
2051
2037
  }),
2052
- ...this.surveyByCriticalBase.body.map(async question => {
2038
+ ...this.formStore.surveyByCriticalBase.body.map(async question => {
2053
2039
  await this.definedAnswers(question.first.id, 'surveyByCriticalBase');
2054
2040
  }),
2055
2041
  ]);