hl-core 0.0.8-beta.3 → 0.0.8-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/api/index.ts +81 -18
  2. package/api/interceptors.ts +17 -13
  3. package/components/Dialog/Dialog.vue +7 -37
  4. package/components/Form/FormBlock.vue +65 -28
  5. package/components/Form/FormSection.vue +4 -1
  6. package/components/Form/ManagerAttachment.vue +197 -0
  7. package/components/Form/ProductConditionsBlock.vue +64 -12
  8. package/components/Input/Datepicker.vue +5 -1
  9. package/components/Input/FormInput.vue +28 -7
  10. package/components/Input/PanelInput.vue +5 -0
  11. package/components/Input/RoundedSelect.vue +137 -0
  12. package/components/Layout/Drawer.vue +1 -0
  13. package/components/Layout/Header.vue +40 -4
  14. package/components/Layout/SettingsPanel.vue +39 -9
  15. package/components/Menu/MenuHover.vue +30 -0
  16. package/components/Menu/MenuNav.vue +28 -11
  17. package/components/Menu/MenuNavItem.vue +5 -2
  18. package/components/Pages/Anketa.vue +38 -21
  19. package/components/Pages/Auth.vue +149 -30
  20. package/components/Pages/InvoiceInfo.vue +30 -0
  21. package/components/Pages/MemberForm.vue +381 -144
  22. package/components/Pages/ProductConditions.vue +496 -17
  23. package/components/Panel/PanelHandler.vue +75 -2
  24. package/components/Utilities/Chip.vue +27 -0
  25. package/components/Utilities/JsonViewer.vue +27 -0
  26. package/composables/classes.ts +165 -25
  27. package/composables/constants.ts +13 -1
  28. package/composables/index.ts +58 -2
  29. package/composables/styles.ts +9 -3
  30. package/configs/i18n.ts +19 -0
  31. package/layouts/default.vue +2 -2
  32. package/locales/en.json +583 -0
  33. package/locales/kz.json +583 -0
  34. package/locales/ru.json +585 -0
  35. package/nuxt.config.ts +8 -0
  36. package/package.json +15 -9
  37. package/pages/500.vue +1 -1
  38. package/pages/Token.vue +51 -0
  39. package/plugins/helperFunctionsPlugins.ts +3 -0
  40. package/plugins/storePlugin.ts +0 -1
  41. package/plugins/vuetifyPlugin.ts +8 -1
  42. package/store/data.store.js +705 -624
  43. package/store/member.store.ts +147 -22
  44. package/store/rules.js +41 -3
  45. package/types/index.ts +39 -0
  46. package/store/messages.ts +0 -434
@@ -13,6 +13,7 @@ export const useMemberStore = defineStore('members', {
13
13
  }),
14
14
  actions: {
15
15
  isStatementEditible(whichForm: string, showToaster: boolean = false) {
16
+ if (!this.validateInitiator(false)) return false;
16
17
  if (this.formStore.isDisabled[whichForm as keyof typeof this.formStore.isDisabled] === true) {
17
18
  if (showToaster) this.dataStore.showToaster('error', this.dataStore.t('toaster.viewErrorText'), 2000);
18
19
  return false;
@@ -27,16 +28,28 @@ export const useMemberStore = defineStore('members', {
27
28
  return true;
28
29
  },
29
30
  hasMemberData(whichForm: MemberKeys, whichIndex?: number, key: string = 'id', emptyValue: any = 0) {
30
- if (!this.validateInitiator(false)) return false;
31
31
  if (!this.isStatementEditible(whichForm)) return false;
32
32
  return typeof whichIndex === 'number' ? this.formStore[whichForm][whichIndex][key] != emptyValue : this.formStore[whichForm][key] != emptyValue;
33
33
  },
34
+ canMemberCleared(whichForm: MemberKeys, whichIndex?: number) {
35
+ if (!whichForm) return false;
36
+ if (!this.isStatementEditible(whichForm)) return false;
37
+ if (typeof whichIndex === 'number') {
38
+ return this.formStore[whichForm][whichIndex].id === 0 && (!!this.formStore[whichForm][whichIndex].iin || !!this.formStore[whichForm][whichIndex].phoneNumber);
39
+ } else {
40
+ return this.formStore[whichForm].id === 0 && (!!this.formStore[whichForm].iin || !!this.formStore[whichForm].phoneNumber);
41
+ }
42
+ },
34
43
  canMemberDeleted(whichForm: MemberKeys, whichIndex?: number) {
35
44
  if (!whichForm) return false;
36
45
  if (!this.isStatementEditible(whichForm)) return false;
37
- if (!this.validateInitiator(false)) return false;
38
- if (typeof whichIndex === 'number' && whichIndex > 0) {
39
- return true;
46
+ if (typeof whichIndex === 'number') {
47
+ if (whichIndex > 0) {
48
+ return true;
49
+ }
50
+ if (whichIndex === 0) {
51
+ return this.hasMemberData(whichForm, whichIndex);
52
+ }
40
53
  }
41
54
  if (this.dataStore.isTask() && this.dataStore.isProcessEditable(this.formStore.applicationData.statusCode)) {
42
55
  if (whichForm !== this.formStore.policyholderFormKey) {
@@ -113,26 +126,39 @@ export const useMemberStore = defineStore('members', {
113
126
  return 'Spokesman';
114
127
  }
115
128
  },
129
+ getMemberApplicationCode(whichForm: MemberKeys) {
130
+ switch (whichForm) {
131
+ case this.formStore.policyholderFormKey:
132
+ return 'clientApp';
133
+ case this.formStore.insuredFormKey:
134
+ return 'insuredApp';
135
+ case this.formStore.beneficiaryFormKey:
136
+ return 'beneficiaryApp';
137
+ case this.formStore.beneficialOwnerFormKey:
138
+ return 'beneficialOwnerApp';
139
+ case this.formStore.policyholdersRepresentativeFormKey:
140
+ return 'spokesmanApp';
141
+ }
142
+ },
116
143
  clearMember(whichForm: MemberKeys, whichIndex?: number) {
117
144
  if (!whichForm) return false;
118
145
  if (!this.isStatementEditible(whichForm)) return false;
119
- if (!this.validateInitiator()) return false;
120
146
  if (whichForm === this.formStore.policyholderFormKey || whichForm === this.formStore.policyholdersRepresentativeFormKey) {
121
- this.formStore[whichForm].resetMember();
147
+ //@ts-ignore
148
+ this.formStore[whichForm] = this.getMemberClass(whichForm);
122
149
  }
123
150
  if (typeof whichIndex === 'number') {
124
151
  if (this.formStore[whichForm].length === 1) {
125
- this.formStore[whichForm][whichIndex].resetMember();
152
+ this.formStore[whichForm][whichIndex] = this.getMemberClass(whichForm);
126
153
  } else {
127
154
  this.formStore[whichForm].splice(whichIndex, 1);
128
155
  }
129
156
  }
130
157
  return true;
131
158
  },
132
- async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number) {
159
+ async deleteMember(taskId: string, whichForm: MemberKeys, whichIndex?: number, refetch: boolean = true) {
133
160
  if (!whichForm) return false;
134
161
  if (!this.isStatementEditible(whichForm)) return false;
135
- if (!this.validateInitiator()) return false;
136
162
  try {
137
163
  const memberCode = this.getMemberCode(whichForm);
138
164
  const memberData = this.getMemberFromApplication(whichForm, whichIndex);
@@ -142,20 +168,116 @@ export const useMemberStore = defineStore('members', {
142
168
  await this.dataStore.api.deleteMember(memberCode, this.formStore.applicationData.processInstanceId);
143
169
  }
144
170
  } else {
145
- if (memberData) await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
171
+ if (memberData) {
172
+ if (whichForm === this.formStore.insuredFormKey) {
173
+ await this.dataStore.deleteInsuredLogic();
174
+ }
175
+ await this.dataStore.api.deleteMember(memberCode, memberData.id as number);
176
+ }
146
177
  }
147
- if (memberData) await this.dataStore.getApplicationData(taskId, true, true, true, false);
148
- return this.clearMember(whichForm, whichIndex);
178
+ const cleared = this.clearMember(whichForm, whichIndex);
179
+ if (memberData && refetch) await this.dataStore.getApplicationData(taskId, true, true, true, true);
180
+ return cleared;
149
181
  } catch (err) {
150
182
  console.log(err);
151
183
  return ErrorHandler(err);
152
184
  }
153
185
  },
186
+ async transferPolicyholder(to: MemberKeys) {
187
+ if (!to) return false;
188
+ if (!this.validateInitiator()) return false;
189
+ const fromMember = this.formStore.policyholderForm;
190
+ const successTranser = ref<boolean>(false);
191
+ const toIndex = ref<number | null>(null);
192
+ const taskId = useRoute().params.taskId as string;
193
+ const deletedBefore = ref<boolean>(false);
194
+
195
+ if (this.dataStore.members[this.getMemberApplicationCode(to)!].isMultiple === false) {
196
+ if (this.formStore[to][0].id !== 0 && this.formStore[to][0].iin !== fromMember.iin) {
197
+ deletedBefore.value = await this.deleteMember(taskId, to, 0, false);
198
+ }
199
+ this.formStore[to][0] = fromMember;
200
+ toIndex.value = 0;
201
+ successTranser.value = true;
202
+ } else {
203
+ if (this.formStore[to].every((member: Member) => member.id !== 0)) {
204
+ this.formStore[to].push(fromMember);
205
+ toIndex.value = this.formStore[to].length - 1;
206
+ successTranser.value = true;
207
+ } else {
208
+ const index = this.formStore[to].findIndex((member: Member) => member.id === 0);
209
+ if (index !== -1) {
210
+ this.formStore[to][index] = fromMember;
211
+ toIndex.value = index;
212
+ successTranser.value = true;
213
+ } else {
214
+ this.formStore[to].push(fromMember);
215
+ toIndex.value = this.formStore[to].length - 1;
216
+ successTranser.value = true;
217
+ }
218
+ }
219
+ }
220
+
221
+ if (successTranser.value === true) {
222
+ if (toIndex.value !== null && taskId !== '0' && this.formStore.applicationData.processInstanceId !== 0) {
223
+ if (
224
+ typeof this.formStore[to][toIndex.value].id !== 'number' ||
225
+ (typeof this.formStore[to][toIndex.value].id === 'number' && this.formStore[to][toIndex.value].id > 0 === false)
226
+ ) {
227
+ return false;
228
+ }
229
+ const hasSaved = await this.dataStore.saveMember(this.formStore[to][toIndex.value], this.getMemberCode(to), this.getMemberFromApplication(to, toIndex.value));
230
+ if (hasSaved) {
231
+ await this.dataStore.getApplicationData(taskId, false, true, true, deletedBefore.value);
232
+ this.dataStore.showToaster('warning', this.dataStore.t('toaster.formFieldEmptyWarning'));
233
+ this.dataStore.showToaster('success', this.dataStore.t('toaster.successSaved'));
234
+ return true;
235
+ } else {
236
+ this.dataStore.showToaster('error', this.dataStore.t('error.memberSave'));
237
+ return false;
238
+ }
239
+ } else {
240
+ return true;
241
+ }
242
+ } else {
243
+ this.dataStore.showToaster('error', this.dataStore.t('error.memberCopy'));
244
+ return false;
245
+ }
246
+ },
247
+ async retransferPolicyholder(from: MemberKeys) {
248
+ if (!from) return false;
249
+ if (!this.validateInitiator()) return false;
250
+ const client = this.formStore.policyholderForm;
251
+ const index = this.formStore[from].findIndex((member: Member) => member.id === client.id);
252
+ const taskId = useRoute().params.taskId as string;
253
+ if (index !== -1) {
254
+ const fromCode = this.getMemberApplicationCode(from);
255
+ const fromMember = this.formStore[from][index];
256
+ const applicationList = this.formStore.applicationData[fromCode!];
257
+ const fromIndex = applicationList && applicationList.length ? applicationList.findIndex((member: any) => member.insisId === fromMember.id) : null;
258
+ if (fromMember.id !== 0 && fromIndex !== -1) {
259
+ await this.deleteMember(taskId, from, index);
260
+ } else {
261
+ this.clearMember(from, index);
262
+ }
263
+ } else {
264
+ // @ts-ignore
265
+ this.formStore[from] = [this.getMemberClass(from)];
266
+ }
267
+ },
154
268
  addMember(whichForm: MemberKeys) {
155
269
  if (!whichForm) return false;
156
270
  if (!this.isStatementEditible(whichForm)) return false;
157
- if (!this.validateInitiator()) return false;
158
- this.formStore[whichForm].push(this.getMemberClass(whichForm));
271
+ const limit = this.dataStore.members[this.getMemberApplicationCode(whichForm)!].limit;
272
+ if (typeof limit === 'number') {
273
+ if (this.formStore[whichForm].length < limit) {
274
+ this.formStore[whichForm].push(this.getMemberClass(whichForm));
275
+ } else {
276
+ this.dataStore.showToaster('error', this.dataStore.t('toaster.membersLimit', { text: limit }));
277
+ }
278
+ } else {
279
+ this.formStore[whichForm].push(this.getMemberClass(whichForm));
280
+ }
159
281
  },
160
282
  async getOtpStatus(iin: string, phone: string, processInstanceId: string | number | null = null) {
161
283
  try {
@@ -198,8 +320,14 @@ export const useMemberStore = defineStore('members', {
198
320
  // TODO Доработать и менять значение hasAgreement.value => true
199
321
  this.dataStore.showToaster(otpResponse.status !== 2 ? 'error' : 'success', otpResponse.statusName, 3000);
200
322
  if (otpResponse.status === 2) {
323
+ member.otpCode = null;
201
324
  return true;
202
325
  }
326
+ if (otpResponse.status === 4 || otpResponse.status === 5) {
327
+ member.otpCode = null;
328
+ member.otpTokenId = null;
329
+ return false;
330
+ }
203
331
  }
204
332
  }
205
333
  return false;
@@ -213,7 +341,7 @@ export const useMemberStore = defineStore('members', {
213
341
  async sendOtp(member: Member, processInstanceId: string | number | null = null, onInit: boolean = false) {
214
342
  if (!this.validateInitiator()) return null;
215
343
  this.dataStore.isLoading = true;
216
- let otpStatus: boolean = false;
344
+ let otpStatus: boolean | null = null;
217
345
  let otpResponse: SendOtpResponse = {};
218
346
  try {
219
347
  if (member.iin && member.phoneNumber && member.iin.length === useMask().iin.length && member.phoneNumber.length === useMask().phone.length) {
@@ -241,30 +369,27 @@ export const useMemberStore = defineStore('members', {
241
369
  if (!!otpResponse) {
242
370
  if ('errMessage' in otpResponse && otpResponse.errMessage !== null) {
243
371
  this.dataStore.showToaster('error', otpResponse.errMessage, 3000);
244
- return { otpStatus };
372
+ return { otpStatus: false };
245
373
  }
246
374
  if ('result' in otpResponse && otpResponse.result === null) {
247
375
  if ('statusName' in otpResponse && !!otpResponse.statusName) {
248
376
  this.dataStore.showToaster('error', otpResponse.statusName, 3000);
249
- return { otpStatus };
377
+ return { otpStatus: false };
250
378
  }
251
379
  if ('status' in otpResponse && !!otpResponse.status) {
252
380
  this.dataStore.showToaster('error', otpResponse.status, 3000);
253
- return { otpStatus };
381
+ return { otpStatus: false };
254
382
  }
255
383
  }
256
384
  if ('tokenId' in otpResponse && otpResponse.tokenId) {
257
385
  member.otpTokenId = otpResponse.tokenId;
258
386
  this.dataStore.showToaster('success', this.dataStore.t('toaster.successOtp'), 3000);
259
387
  }
260
- } else {
261
- this.dataStore.showToaster('error', this.dataStore.t('error.noOtpResponse'), 3000);
262
- return { otpStatus };
263
388
  }
264
389
  }
265
390
  } else {
266
391
  if (onInit === false) {
267
- this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField').replace('{text}', 'Номер телефона, ИИН'));
392
+ this.dataStore.showToaster('error', this.dataStore.t('toaster.errorFormField', { text: 'Номер телефона, ИИН' }));
268
393
  this.dataStore.isLoading = false;
269
394
  }
270
395
  }
package/store/rules.js CHANGED
@@ -1,9 +1,11 @@
1
- import { t } from './messages';
1
+ import { i18n } from '@/configs/i18n';
2
2
  import { formatDate } from '../composables';
3
3
 
4
+ const t = i18n.t;
5
+
4
6
  export const rules = {
5
- recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher').replace('{text}', '100')],
6
- recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween').replace('{floor}', '0').replace('{ceil}', '100')],
7
+ recalculationMultiply: [v => (v !== null && v !== '' && v >= 100) || t('toaster.valueShouldBeHigher', { text: '100' })],
8
+ recalculationAdditive: [v => (v !== null && v !== '' && v <= 100 && v >= 0) || t('toaster.valueShouldBeBetween', { floor: '0', ceil: '100' })],
7
9
  required: [v => !!v || t('rules.required')],
8
10
  objectRequired: [
9
11
  v => {
@@ -13,6 +15,14 @@ export const rules = {
13
15
  return t('rules.required');
14
16
  },
15
17
  ],
18
+ agentDataRequired: [
19
+ v => {
20
+ if (!!v && 'fullName' in v && v.fullName != null) {
21
+ return true;
22
+ }
23
+ return t('rules.required');
24
+ },
25
+ ],
16
26
  noResident: [
17
27
  v => {
18
28
  if (!!v && 'nameRu' in v && v.nameRu === 'Нерезидент') {
@@ -25,6 +35,14 @@ export const rules = {
25
35
  },
26
36
  ],
27
37
  cyrillic: [v => v === null || /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic')],
38
+ cyrillicNonRequired: [
39
+ v => {
40
+ if (!v) return true;
41
+ else {
42
+ return /^[\u0400-\u04FF ]+$/.test(v) || t('rules.cyrillic');
43
+ }
44
+ },
45
+ ],
28
46
  email: [
29
47
  v => {
30
48
  if (v === '' || v === null) {
@@ -86,6 +104,8 @@ export const rules = {
86
104
  },
87
105
  ],
88
106
  age: [v => /^\d+$/.test(v) || t('rules.age')],
107
+ age18: [v => v >= 18 || t('rules.age18')],
108
+ age18ByDate: [v => Math.abs(new Date(Date.now() - new Date(formatDate(v)).getTime()).getUTCFullYear() - 1970) >= 18 || t('rules.age18')],
89
109
  birthDate: [
90
110
  v => {
91
111
  if (new Date(formatDate(v)) > new Date(Date.now())) return t('rules.exceedDate');
@@ -108,6 +128,18 @@ export const rules = {
108
128
  }
109
129
  },
110
130
  ],
131
+ coverPeriodFrom2to20: [
132
+ v => {
133
+ if (v !== null) {
134
+ if (v < 2 || v > 20) {
135
+ return t('productConditionsForm.coverPeriodFrom2to20');
136
+ }
137
+ return true;
138
+ } else {
139
+ return t('productConditionsForm.coverPeriodFrom2to20');
140
+ }
141
+ },
142
+ ],
111
143
  coverPeriodFrom3to20: [
112
144
  v => {
113
145
  if (v !== null) {
@@ -143,4 +175,10 @@ export const rules = {
143
175
  ],
144
176
  policyholderAgeLimit: [v => v >= 18 || t('rules.policyholderAgeLimit')],
145
177
  beneficiaryAgeLimit: [v => v <= 15 || t('rules.beneficiaryAgeLimit')],
178
+ guaranteedPeriodLimit(v, termAnnuityPayments) {
179
+ if (Number(v) > Number(termAnnuityPayments)) {
180
+ return t('rules.guaranteedPeriodLimit');
181
+ }
182
+ return true;
183
+ },
146
184
  };
package/types/index.ts CHANGED
@@ -271,6 +271,8 @@ declare global {
271
271
  text: string;
272
272
  };
273
273
 
274
+ type RegNumberDataType = { processInstanceId: string; regNumber: string; date: string };
275
+
274
276
  type EpayShortResponse = {
275
277
  id: string;
276
278
  link: string;
@@ -300,4 +302,41 @@ declare global {
300
302
  taskId: string;
301
303
  comment?: string;
302
304
  };
305
+
306
+ type AgentData = {
307
+ agentId?: number | null;
308
+ manId?: number;
309
+ fullName?: string;
310
+ officeId?: number | null;
311
+ officeCode?: string | null;
312
+ saleChannel?: string;
313
+ staffId?: number;
314
+ managerName?: string;
315
+ mainAgentId?: string | null;
316
+ agentNo?: string;
317
+ iin?: string | null;
318
+ };
319
+
320
+ type UserDocument = {
321
+ id: number | null;
322
+ contragentId: number | null;
323
+ type: string;
324
+ typeName: string;
325
+ serial: string | number | null;
326
+ number: string;
327
+ issueDate: string;
328
+ expireDate: string;
329
+ issuerId: number;
330
+ issuerName: string;
331
+ issuerNameRu: string;
332
+ description: string | null;
333
+ note: string | null;
334
+ verifyType: string;
335
+ verifyDate: string;
336
+ };
337
+
338
+ type ChipComponent = {
339
+ title: string;
340
+ description?: string;
341
+ };
303
342
  }