hl-core 0.0.10-beta.7 → 0.0.10-beta.71

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 (49) hide show
  1. package/README.md +0 -2
  2. package/api/base.api.ts +425 -134
  3. package/api/interceptors.ts +162 -62
  4. package/components/Dialog/Dialog.vue +5 -1
  5. package/components/Dialog/DigitalDocumentsDialog.vue +129 -0
  6. package/components/Dialog/FamilyDialog.vue +15 -4
  7. package/components/Form/DigitalDocument.vue +52 -0
  8. package/components/Form/FormSource.vue +30 -0
  9. package/components/Form/ManagerAttachment.vue +85 -11
  10. package/components/Form/ProductConditionsBlock.vue +12 -6
  11. package/components/Input/Datepicker.vue +5 -0
  12. package/components/Input/FileInput.vue +1 -1
  13. package/components/Input/FormInput.vue +7 -0
  14. package/components/Input/OtpInput.vue +25 -0
  15. package/components/Input/RoundedInput.vue +2 -0
  16. package/components/Input/RoundedSelect.vue +2 -0
  17. package/components/Input/TextAreaField.vue +71 -0
  18. package/components/Input/TextHint.vue +13 -0
  19. package/components/Layout/SettingsPanel.vue +2 -1
  20. package/components/Menu/MenuNav.vue +2 -1
  21. package/components/Pages/Anketa.vue +207 -176
  22. package/components/Pages/Auth.vue +10 -3
  23. package/components/Pages/ContragentForm.vue +24 -18
  24. package/components/Pages/Documents.vue +488 -66
  25. package/components/Pages/MemberForm.vue +1009 -268
  26. package/components/Pages/ProductConditions.vue +1424 -273
  27. package/components/Panel/PanelHandler.vue +329 -126
  28. package/components/Utilities/Chip.vue +1 -1
  29. package/components/Utilities/JsonViewer.vue +1 -2
  30. package/composables/classes.ts +136 -20
  31. package/composables/constants.ts +168 -1
  32. package/composables/index.ts +467 -9
  33. package/composables/styles.ts +8 -24
  34. package/configs/i18n.ts +2 -0
  35. package/configs/pwa.ts +1 -7
  36. package/layouts/clear.vue +1 -1
  37. package/layouts/default.vue +2 -2
  38. package/layouts/full.vue +1 -1
  39. package/locales/kz.json +1239 -0
  40. package/locales/ru.json +133 -21
  41. package/nuxt.config.ts +8 -6
  42. package/package.json +14 -13
  43. package/plugins/head.ts +7 -1
  44. package/plugins/helperFunctionsPlugins.ts +1 -0
  45. package/store/data.store.ts +1080 -552
  46. package/store/member.store.ts +19 -8
  47. package/store/rules.ts +75 -8
  48. package/types/enum.ts +52 -2
  49. package/types/index.ts +143 -6
@@ -11,10 +11,10 @@
11
11
  <div :class="[$styles.flexColNav]">
12
12
  <base-content-block v-if="hasConditionsInfo" class="flex flex-col gap-3">
13
13
  <span
14
- >{{ `Сумма страховой премии ${paymentPeriod}:` }} <b>{{ `${insurancePremiumPerMonth}₸` }}</b></span
14
+ >{{ `Сумма страховой премии ${paymentPeriod}:` }} <b>{{ `${insurancePremiumPerMonth}` }}</b></span
15
15
  >
16
16
  <span
17
- >{{ `Запрашиваемая страховая сумма: ` }} <b>{{ `${requestedSumInsured}₸` }}</b>
17
+ >{{ `Запрашиваемая страховая сумма: ` }} <b>{{ `${requestedSumInsured}` }}</b>
18
18
  </span>
19
19
  </base-content-block>
20
20
  <base-content-block v-if="$dataStore.isLifetrip" class="flex flex-col gap-3">
@@ -23,80 +23,31 @@
23
23
  >
24
24
  </base-content-block>
25
25
  <div class="flex flex-col gap-3" v-if="hasConditionsAction">
26
- <base-btn :text="$dataStore.t('confirm.yes')" @click="handleTask" />
27
- <base-btn :btn="$styles.blueLightBtn" :text="$dataStore.t('confirm.no')" @click="closePanel" />
26
+ <base-btn :text="$dataStore.t('confirm.yes')" :loading="$dataStore.isButtonsLoading" @click="handleTask" />
27
+ <base-btn :btn="$styles.blueLightBtn" :loading="$dataStore.isButtonsLoading" :text="$dataStore.t('confirm.no')" @click="closePanel" />
28
28
  </div>
29
29
  </div>
30
30
  </section>
31
31
  <section v-if="chooseSignActions">
32
- <div v-if="!isElectronicContract && !isPaperContract && !isScansDocuments && !isQr" :class="[$styles.flexColNav]">
32
+ <div v-if="!isElectronicContract && !isPaperContract && !isScansDocuments && !isQr && formStore.signatories.length === 0" :class="[$styles.flexColNav]">
33
33
  <base-btn :text="$dataStore.t('buttons.sendOnPaper')" :disabled="isPaperDisabled" :loading="loading" @click="handleSignAction('paper')" />
34
34
  <base-btn :text="$dataStore.t('buttons.sendElectronically')" :disabled="isElectronicDisabled" :loading="loading" @click="handleSignAction('electronic')" />
35
35
  <base-btn :text="$dataStore.t('buttons.generatePrintedForms')" :disabled="isScansDisabled" :loading="loading" @click="handleSignAction('scans')" />
36
36
  <base-btn v-if="!useEnv().isProduction" :text="$dataStore.t('buttons.sendEgovMob')" :disabled="isQrDisabled" :loading="loading" @click="handleSignAction('qr')" />
37
- <base-btn
38
- v-if="$dataStore.isPension"
39
- :text="$dataStore.t('buttons.signWithSignature')"
40
- :disabled="isSignatureDisabled"
41
- :loading="loading"
42
- @click="handleSignAction('signature')"
43
- />
44
- <base-btn
45
- v-if="$dataStore.isPension && !useEnv().isProduction"
46
- :text="$dataStore.t('buttons.signWithSignatureXML')"
47
- :disabled="isQrXmlDisabled"
48
- :loading="loading"
49
- @click="handleSignAction('qrXml')"
50
- />
51
37
  </div>
52
38
  <div v-if="isPaperContract" :class="[$styles.flexColNav]">
53
39
  <base-btn :text="$dataStore.t('buttons.downloadContract')" :loading="$dataStore.isButtonsLoading" @click="generateDocument" />
54
40
  </div>
55
41
  <div v-if="isScansDocuments" :class="[$styles.flexColNav]">
56
- <div v-if="$dataStore.isPension">
57
- <div v-if="processCode == 19">
58
- <div v-if="formStore.applicationData.statusCode === 'HeadManagerForm' || formStore.applicationData.statusCode === 'ContractSignedFrom'">
59
- <base-btn :text="$dataStore.t('buttons.downloadContract')" :loading="$dataStore.isButtonsLoading" @click="$dataStore.generatePDFDocument('PA_Contract', '38')" />
60
- <base-form-section class="mt-4 flex flex-col !gap-2" :title="$dataStore.t('clients.attachScansSignDocs')">
61
- <base-file-input :label="$dataStore.t('labels.attachContract')" @input.prevent="onFileChangeScans($event, 'pa_contract')" @onClear="onClearFile('pa_contract')" />
62
- </base-form-section>
63
- </div>
64
- <div v-else class="flex flex-col gap-2">
65
- <base-btn :text="$dataStore.t('buttons.downloadStatement')" :loading="$dataStore.isButtonsLoading" @click="$dataStore.generatePDFDocument('PA_Statement', '37')" />
66
- <base-btn :text="$dataStore.t('buttons.downloadAgreement')" :loading="$dataStore.isButtonsLoading" @click="$dataStore.generatePDFDocument('Agreement', '19')" />
67
- <base-form-section class="mt-4 flex flex-col !gap-2" :title="$dataStore.t('clients.attachScansSignDocs')">
68
- <base-file-input :label="$dataStore.t('labels.attachStatement')" @input.prevent="onFileChangeScans($event, 'pa_statement')" @onClear="onClearFile('pa_statement')" />
69
- <base-file-input :label="$dataStore.t('labels.attachAgreement')" @input.prevent="onFileChangeScans($event, 'agreement')" @onClear="onClearFile('agreement')" />
70
- </base-form-section>
71
- </div>
72
- </div>
73
- <div v-if="processCode == 2" class="flex flex-col gap-2">
74
- <base-btn
75
- :text="$dataStore.t('buttons.downloadPARefundStatement')"
76
- :loading="$dataStore.isButtonsLoading"
77
- @click="$dataStore.generatePDFDocument('PA_RefundStatement', '41')"
78
- />
79
- <base-btn
80
- :text="$dataStore.t('buttons.downloadPARefundAgreement')"
81
- :loading="$dataStore.isButtonsLoading"
82
- @click="$dataStore.generatePDFDocument('PA_RefundAgreement', '42')"
83
- />
84
-
42
+ <div v-if="isNewSign">
43
+ <div class="flex flex-col gap-2">
44
+ <base-btn v-for="file in getFilesDownloadButtons" :text="`Скачать ${file.fileName}`" :loading="$dataStore.isButtonsLoading" @click="getDocNew(file)" />
85
45
  <base-form-section class="mt-4 flex flex-col !gap-2" :title="$dataStore.t('clients.attachScansSignDocs')">
86
- <base-file-input
87
- :label="$dataStore.t('buttons.downloadPARefundStatement')"
88
- @input.prevent="onFileChangeScans($event, 'pa_refundstatement')"
89
- @onClear="onClearFile('pa_refundstatement')"
90
- />
91
- <base-file-input
92
- :label="$dataStore.t('buttons.downloadPARefundAgreement')"
93
- @input.prevent="onFileChangeScans($event, 'pa_refundagreement')"
94
- @onClear="onClearFile('pa_refundagreement')"
95
- />
46
+ <base-file-input v-for="file in signingFiles" :label="`Вложить ${file.fileName}`" @input.prevent="onFileChangeScansNew($event, file)" @onClear="onClearFileNew(file)" />
96
47
  </base-form-section>
97
48
  </div>
98
49
  </div>
99
- <div :class="[$styles.flexColNav]" v-else>
50
+ <div v-else :class="[$styles.flexColNav]">
100
51
  <base-btn :text="$dataStore.t('buttons.downloadStatement')" @click="downloadTemplate(constants.documentTypes.statement, 'docx')" />
101
52
  <base-btn :text="$dataStore.t('buttons.downloadContract')" @click="downloadTemplate(constants.documentTypes.contract, 'doc')" />
102
53
  <base-btn :text="$dataStore.t('buttons.downloadApplication')" @click="downloadTemplate(constants.documentTypes.application1, 'vnd.ms-excel')" />
@@ -107,8 +58,15 @@
107
58
  <base-file-input :label="$dataStore.t('labels.attachPowerOfAttorney')" @input.prevent="onFileChangeScans($event, 'attorney')" @onClear="onClearFile('attorney')" />
108
59
  </base-form-section>
109
60
  </div>
110
- <base-btn :text="$dataStore.t('buttons.sign')" :loading="$dataStore.isButtonsLoading" @click="sendFiles" />
61
+ <base-btn :text="$dataStore.t('buttons.sign')" :loading="$dataStore.isButtonsLoading || loading" @click="isNewSign ? sendFilesNew() : sendFiles()" />
111
62
  <base-btn :text="$dataStore.t('buttons.cancel')" :btn="$styles.whiteBtn" @click="isScansDocuments = false" />
63
+ <base-btn
64
+ v-if="isOnlineEnpf === false && $dataStore.isPension && formStore.applicationData.statusCode === 'AttachAppContractForm'"
65
+ class="mt-[2rem]"
66
+ :text="$dataStore.t('buttons.send')"
67
+ :loading="loading"
68
+ @click="$dataStore.panelAction = constants.actions.signed"
69
+ />
112
70
  </div>
113
71
  <div v-if="isQr" :class="[$styles.flexColNav]">
114
72
  <base-form-section :title="''">
@@ -118,13 +76,62 @@
118
76
  <span :class="[$styles.textSimple]" class="mt-3 text-center d-block">{{ $dataStore.t('sign.scanQrCode') }}</span>
119
77
  </div>
120
78
  <base-btn class="mt-10" :loading="loading" :text="$dataStore.t('sign.copyEgov')" @click="$dataStore.copyToClipboard(urlCopy)" />
79
+ <base-btn class="mt-1" :loading="loading" :text="$dataStore.t('sign.sendLink')" @click="sendLink" />
121
80
  <base-btn :text="$dataStore.t('buttons.cancel')" :btn="$styles.whiteBtn" @click="closeQrPanel" />
122
81
  </base-form-section>
123
82
  </div>
83
+ <div v-if="!(formStore.signatories.length === 0) && !isQr && !isScansDocuments" :class="[$styles.flexColNav]">
84
+ <div
85
+ v-if="(processCode === 19 || processCode === 25) && formStore.applicationData.statusCode === 'AttachAppContractForm'"
86
+ :class="[$styles.blueBgLight]"
87
+ class="rounded-lg p-4"
88
+ >
89
+ <base-form-toggle v-model="isOnlineEnpf" title="Онлайн подписание согласия для ЕНПФ" :disabled="isOnlineEnpfDisabled" :has-border="false" @clicked="setActualEnpf" />
90
+ </div>
91
+ <div :class="[$styles.blueBgLight]" class="rounded-lg p-4">
92
+ <v-expansion-panels v-if="formStore.signatories.length" variant="accordion" :multiple="false">
93
+ <v-expansion-panel v-for="(person, index) of formStore.signatories" :key="person.personId!" class="border-[1px]" elevation="0" bg-color="#FFF">
94
+ <v-expansion-panel-title class="h-[80px]" :class="$styles.textTitle">
95
+ {{ person.longName }}
96
+ </v-expansion-panel-title>
97
+ <v-expansion-panel-text class="border-t-[1px]">
98
+ <section class="flex flex-col" :class="$styles.textSimple">
99
+ <v-expansion-panels v-if="person.fileDatas.length" v-model="currentFilePanel" :multiple="false">
100
+ <v-expansion-panel
101
+ v-for="(file, fileIndex) in groupBy(person.fileDatas, 'orderFile')"
102
+ :value="`${index} - ${fileIndex}`"
103
+ :disabled="inSigningOrder(person.fileDatas, fileIndex) || file.every((f: any) => f.isSigned === true)"
104
+ >
105
+ <v-expansion-panel-title v-for="name in file" class="h-[80px]" :class="$styles.textTitle">
106
+ {{ name.fileName }}
107
+ </v-expansion-panel-title>
108
+ <v-expansion-panel-text class="border-t-[1px]">
109
+ <section class="flex flex-col gap-4 py-3" :class="$styles.textSimple">
110
+ <base-btn
111
+ v-for="signtype in file[0].signTypes"
112
+ :text="signtype.documentSignTypeName"
113
+ :btn="$styles.greenBtn"
114
+ @click="newSign(signtype.documentSignTypeValue, file, index, person.iin)"
115
+ :loading="loading"
116
+ />
117
+ </section>
118
+ </v-expansion-panel-text>
119
+ </v-expansion-panel>
120
+ </v-expansion-panels>
121
+ </section>
122
+ </v-expansion-panel-text>
123
+ </v-expansion-panel>
124
+ </v-expansion-panels>
125
+ <base-list-empty v-else />
126
+ </div>
127
+ <base-animation>
128
+ <base-btn v-if="isAllPaperSigned" :text="$dataStore.t('buttons.send')" :loading="loading" @click="$dataStore.panelAction = constants.actions.signed" />
129
+ </base-animation>
130
+ </div>
124
131
  </section>
125
132
  <section v-if="choosePayActions">
126
133
  <div v-if="!isEpayPay && !isOfflinePay" :class="[$styles.flexColNav]">
127
- <base-btn :text="$dataStore.t('buttons.payEpay')" :loading="loading" @click="handlePayAction('epay')" />
134
+ <base-btn v-if="hasEpayPay" :text="$dataStore.t('buttons.payEpay')" :loading="loading" @click="handlePayAction('epay')" />
128
135
  <base-btn :text="$dataStore.t('buttons.payOffline')" :loading="loading" @click="handlePayAction('offline')" />
129
136
  </div>
130
137
  <div v-if="isOfflinePay" :class="[$styles.flexColNav]">
@@ -178,7 +185,7 @@
178
185
  </div>
179
186
  </base-fade-transition>
180
187
  <base-btn
181
- v-if="$dataStore.isPension"
188
+ v-if="isElectronicContract"
182
189
  :text="$dataStore.t('buttons.cancel')"
183
190
  :btn="$styles.whiteBtn"
184
191
  @click="
@@ -254,7 +261,8 @@
254
261
  import { DocumentItem, Value } from '../../composables/classes';
255
262
  import { HubConnectionBuilder } from '@microsoft/signalr';
256
263
  import { uuid } from 'vue-uuid';
257
- import type { Api, SignUrlType } from '../../types';
264
+ import type * as Types from '../../types';
265
+ import { CoreEnums } from '../../types/enum';
258
266
 
259
267
  export default defineComponent({
260
268
  emits: ['task'],
@@ -276,14 +284,17 @@ export default defineComponent({
276
284
  const isOfflinePay = ref<boolean>(false);
277
285
  const isQrDialog = ref<boolean>(false);
278
286
  const email = ref<string>('');
287
+ const signOptions = ref<Types.Api.Sign.New.Response>();
288
+ const signingFiles = ref<Types.Api.Sign.New.FileDatas[]>([]);
289
+ const isOnlineEnpf = ref<boolean>(true);
290
+ const currentFilePanel = ref<string[]>([]);
291
+ const selectedContragent = ref<string>('');
279
292
 
280
293
  const vForm = ref<any>();
281
294
  const isSendNumberOpen = ref<boolean>(false);
282
295
  const phoneNumber = ref<string | null>(formStore.policyholderForm.phoneNumber ?? '');
283
- const selectedClient = ref<SignUrlType>();
296
+ const selectedClient = ref<Types.SignUrlType>();
284
297
  const documentDict = computed(() => dataStore.dicFileTypeList.find(i => i.nameRu === 'Решение АС'));
285
- const pensionForm = formStore.applicationData?.pensionApp ?? undefined;
286
- const consentGiven = computed(() => !!formStore.signedDocumentList.find(i => i.fileTypeCode === '43' && i.signed === true));
287
298
  const affiliationDocument = computed(() => formStore.signedDocumentList.find((file: DocumentItem) => file.fileTypeName === 'Решение АС'));
288
299
  const affiliationData = ref<{
289
300
  processInstanceId: string | number;
@@ -298,9 +309,18 @@ export default defineComponent({
298
309
  const affiliationFormData = ref(new FormData());
299
310
  const scansFormData = ref(new FormData());
300
311
  const scansFiles = ref<any[]>([]);
312
+ const isAllPaperSigned = computed(() => formStore.signatories.every((person: any) => person.fileDatas.every((file: any) => file.isSigned === true && file.signedType === 2)));
301
313
  const processCode = formStore.applicationData.processCode;
314
+ const getFilesDownloadButtons = computed(() => {
315
+ if (isOnlineEnpf.value === false && dataStore.isPension && formStore.applicationData.statusCode === 'ContractSignedFrom') {
316
+ return signingFiles.value.filter(i => i.fileType === 6);
317
+ } else {
318
+ return signingFiles.value;
319
+ }
320
+ });
321
+ const isOnlineEnpfDisabled = computed(() => (dataStore.isPension && formStore.hasRepresentative ? true : false));
302
322
 
303
- const openSmsPanel = (signInfo: SignUrlType) => {
323
+ const openSmsPanel = (signInfo: Types.SignUrlType) => {
304
324
  if (signInfo) {
305
325
  isSendNumberOpen.value = true;
306
326
  selectedClient.value = signInfo;
@@ -328,10 +348,53 @@ export default defineComponent({
328
348
  }
329
349
  };
330
350
 
331
- const onFileChangeScans = async (
332
- event: InputEvent,
333
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
334
- ) => {
351
+ const inSigningOrder = (files: any, index: number) => {
352
+ for (
353
+ let i = 0;
354
+ i <
355
+ files.sort(function (a: any, b: any) {
356
+ return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
357
+ }).length;
358
+ i++
359
+ ) {
360
+ if (!files[i].isSigned) {
361
+ return files[i].orderFile != index;
362
+ }
363
+ }
364
+ };
365
+
366
+ const getDocNew = async (file: any) => {
367
+ const newFile = signOptions.value?.signIds.find((i: any) => i.fileType == file.fileType);
368
+ if (newFile) await dataStore.getDocNew(newFile.id, 2, false, file.fileName);
369
+ };
370
+
371
+ const onFileChangeScansNew = async (event: InputEvent, file: any) => {
372
+ if (event.target) {
373
+ const files = (event.target as HTMLInputElement).files;
374
+ if (files && files.length) {
375
+ if (files[0].type !== 'application/pdf') return dataStore.showToaster('error', dataStore.t('toaster.onlyPDF'), 6000);
376
+ const { execute: getBase64 } = useBase64(files[0]);
377
+ const base64 = (await getBase64()).slice(28);
378
+ const data = {
379
+ FileBytes: base64,
380
+ FileName: file.fileName,
381
+ FileTypeCode: file.fileType,
382
+ };
383
+ if (!signOptions.value) return dataStore.showToaster('error', dataStore.t('pension.fileError'), 6000);
384
+ scansFiles.value.push({
385
+ groupId: signOptions.value.signIds.find((i: any) => i.fileType == data.FileTypeCode)?.id,
386
+ data: data,
387
+ });
388
+ }
389
+ }
390
+ };
391
+
392
+ const onClearFileNew = async (file: any) => {
393
+ const result = scansFiles.value.filter(i => i.data.FileTypeCode !== file.fileType);
394
+ scansFiles.value = result;
395
+ };
396
+
397
+ const onFileChangeScans = async (event: InputEvent, type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
335
398
  if (event.target) {
336
399
  const files = (event.target as HTMLInputElement).files;
337
400
  if (files && files.length) {
@@ -353,31 +416,20 @@ export default defineComponent({
353
416
  }
354
417
  };
355
418
 
356
- const onClearFile = async (
357
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
358
- ) => {
419
+ const onClearFile = async (type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
359
420
  const doc = await selectedDocument(type);
360
421
  const result = scansFiles.value.filter(i => JSON.parse(i.fileData)[0].fileTypeCode !== doc.code);
361
422
  scansFiles.value = result;
362
423
  };
363
424
 
364
- const selectedDocument = (type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
425
+ const selectedDocument = (type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
365
426
  let selectedDocument: any;
366
427
  if (type === 'statement') {
367
428
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '32');
368
429
  }
369
- if (type === 'pa_statement') {
370
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '37');
371
- }
372
- if (type === 'pa_refundstatement') {
373
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '41');
374
- }
375
430
  if (type === 'contract') {
376
431
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '6');
377
432
  }
378
- if (type === 'pa_contract') {
379
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '38');
380
- }
381
433
  if (type === 'pa_refundagreement') {
382
434
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '42');
383
435
  }
@@ -393,14 +445,29 @@ export default defineComponent({
393
445
  return selectedDocument;
394
446
  };
395
447
 
448
+ const sendFilesNew = async () => {
449
+ if (scansFiles.value.length !== signingFiles.value.length) {
450
+ dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
451
+ return;
452
+ }
453
+ try {
454
+ await Promise.allSettled(
455
+ Object.values(scansFiles.value).map(async f => {
456
+ await dataStore.api.file.uploadFilesNew(f.groupId, f.data);
457
+ }),
458
+ );
459
+ await checkIfAllSigned(true);
460
+ scansFiles.value = [];
461
+ isScansDocuments.value = false;
462
+ dataStore.showToaster('info', 'Документы загружены успешно');
463
+ } catch (err) {
464
+ return ErrorHandler(err);
465
+ }
466
+ };
467
+
396
468
  const sendFiles = async () => {
397
- if (
398
- dataStore.isPension
399
- ? formStore.applicationData.statusCode === 'ContractSignedFrom'
400
- ? scansFiles.value.length !== 1
401
- : scansFiles.value.length !== 2
402
- : scansFiles.value.length !== 4
403
- ) {
469
+ loading.value = true;
470
+ if (scansFiles.value.length !== 4) {
404
471
  dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
405
472
  return;
406
473
  }
@@ -412,7 +479,8 @@ export default defineComponent({
412
479
  }
413
480
  closePanel();
414
481
  dataStore.showToaster('success', dataStore.t('toaster.successOperation'));
415
- await dataStore.handleTask(dataStore.isPension ? constants.actions.accept : constants.actions.signed, route.params.taskId as string, 'scans');
482
+ await dataStore.handleTask(constants.actions.signed, route.params.taskId as string, 'scans');
483
+ loading.value = false;
416
484
  };
417
485
  const submitForm = async () => {
418
486
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
@@ -452,7 +520,17 @@ export default defineComponent({
452
520
  // loading.value = false;
453
521
  // return;
454
522
  // }
455
- if (dataStore.isAML || dataStore.isCheckContract || dataStore.isCheckContragent || dataStore.isDas || dataStore.isPrePension || dataStore.isUU) {
523
+ if (
524
+ dataStore.isAML ||
525
+ dataStore.isCheckContract ||
526
+ dataStore.isCheckContragent ||
527
+ dataStore.isDas ||
528
+ dataStore.isPrePension ||
529
+ dataStore.isCritical ||
530
+ dataStore.isUU ||
531
+ dataStore.isReInsurance ||
532
+ dataStore.isReporting
533
+ ) {
456
534
  emit('task', [dataStore.panelAction, route.params.taskId as string, actionCause.value]);
457
535
  } else {
458
536
  await dataStore.handleTask(dataStore.panelAction, route.params.taskId as string, actionCause.value);
@@ -462,12 +540,15 @@ export default defineComponent({
462
540
 
463
541
  const onInit = async () => {
464
542
  if (dataStore.controls.hasChooseSign) {
465
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
543
+ if (dataStore.isBaiterek || dataStore.isMycar || dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
466
544
  isElectronicContract.value = false;
467
545
  }
468
546
  }
469
547
  if (dataStore.isPension) {
470
- await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
548
+ if (formStore.applicationData.pensionApp) {
549
+ const isOnlineEnpfAgreement = formStore.applicationData.pensionApp.isOnlineEnpfAgreement;
550
+ isOnlineEnpf.value = formStore.hasRepresentative ? false : true;
551
+ }
471
552
  }
472
553
  };
473
554
 
@@ -482,7 +563,7 @@ export default defineComponent({
482
563
  case constants.actions.rejectclient:
483
564
  return dataStore.t('buttons.rejectStatement');
484
565
  case constants.actions.return:
485
- return dataStore.t('buttons.returnStatement');
566
+ return dataStore.isReInsurance ? 'Перевыгрузить' : dataStore.t('buttons.returnStatement');
486
567
  case constants.actions.accept:
487
568
  return dataStore.t('buttons.approve');
488
569
  case constants.actions.sign:
@@ -523,25 +604,43 @@ export default defineComponent({
523
604
  dataStore.panelAction === constants.actions.return ||
524
605
  dataStore.panelAction === constants.actions.rejectclient,
525
606
  );
526
- const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
607
+ const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept || (dataStore.isPension && dataStore.panelAction === constants.actions.signed));
527
608
  const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
528
609
  const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
529
610
  const affiliateActions = computed(() => dataStore.panelAction === constants.actions.affiliate);
530
611
  const chooseSignActions = computed(() => dataStore.controls.hasChooseSign && dataStore.panelAction === constants.actions.chooseSign);
531
612
  const choosePayActions = computed(() => dataStore.controls.hasChoosePay && dataStore.panelAction === constants.actions.choosePay);
532
-
613
+ // TODO на все продукты новое подписание
614
+ const isNewSign = computed(() => dataStore.isPension || dataStore.isGons || dataStore.isBaiterek || dataStore.isMycar);
533
615
  const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
534
- const insurancePremiumPerMonth = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.insurancePremiumPerMonth));
616
+ const insurancePremiumPerMonth = computed(() => {
617
+ if (dataStore.isGons && formStore.productConditionsForm.currency.code === 'USD') {
618
+ return `${formStore.productConditionsForm.insurancePremiumPerMonthInDollar}$`;
619
+ }
620
+ return `${formStore.productConditionsForm.insurancePremiumPerMonth}₸`;
621
+ });
535
622
  const requestedSumInsured = computed(() => {
536
623
  if ((dataStore.isLifeBusiness || dataStore.isGns) && formStore.productConditionsForm.requestedSumInsured === null) {
537
624
  return dataStore.getNumberWithSpaces(formStore.applicationData.policyAppDto!.mainInsSum);
538
625
  }
539
- return dataStore.getNumberWithSpaces(formStore.productConditionsForm.requestedSumInsured);
626
+ if (dataStore.isGons && formStore.productConditionsForm.currency.code === 'USD') {
627
+ return `${formStore.productConditionsForm.requestedSumInsuredInDollar}$`;
628
+ }
629
+ return `${formStore.productConditionsForm.requestedSumInsured}₸`;
540
630
  });
541
631
  const price = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.calculatorForm.price));
542
632
  const insuredAmount = computed(() => formStore.productConditionsForm.calculatorForm.amount!.nameRu! + dataStore.currency);
543
633
  const hasConditionsInfo = computed(() => {
544
- if (dataStore.isLifetrip || dataStore.isDas || dataStore.isUU || dataStore.isPrePension) {
634
+ if (
635
+ dataStore.isLifetrip ||
636
+ dataStore.isDas ||
637
+ dataStore.isReporting ||
638
+ dataStore.isUU ||
639
+ dataStore.isReInsurance ||
640
+ dataStore.isPrePension ||
641
+ dataStore.isCritical ||
642
+ dataStore.isPension
643
+ ) {
545
644
  return false;
546
645
  }
547
646
  if (dataStore.isFinCenter()) {
@@ -550,7 +649,7 @@ export default defineComponent({
550
649
  return true;
551
650
  });
552
651
  const hasConditionsAction = computed(() => {
553
- if (dataStore.isPrePension) {
652
+ if (dataStore.isPrePension || dataStore.isCritical) {
554
653
  return false;
555
654
  }
556
655
  return true;
@@ -562,7 +661,7 @@ export default defineComponent({
562
661
  return true;
563
662
  });
564
663
  const isElectronicDisabled = computed(() => {
565
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns || dataStore.isPension) {
664
+ if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns) {
566
665
  return true;
567
666
  }
568
667
  return false;
@@ -571,28 +670,22 @@ export default defineComponent({
571
670
  if (dataStore.isGons) {
572
671
  return true;
573
672
  }
574
- if ((!consentGiven.value || formStore.applicationData.statusCode === 'HeadManagerForm') && dataStore.isPension && processCode !== 2) {
575
- return true;
576
- }
577
673
  return false;
578
674
  });
579
675
  const isQrDisabled = computed(() => {
580
- if (consentGiven.value && dataStore.isPension && processCode !== 2) {
581
- return false;
582
- }
583
676
  return true;
584
677
  });
585
678
  const isQrXmlDisabled = computed(() => {
586
- if (!consentGiven.value && dataStore.isPension && processCode !== 2) {
587
- return false;
588
- }
589
679
  if (dataStore.isLifeBusiness || dataStore.isGns) {
590
680
  return false;
591
681
  }
592
682
  return true;
593
683
  });
594
684
  const isSignatureDisabled = computed(() => {
595
- if ((!consentGiven.value || formStore.applicationData.statusCode === 'HeadManagerForm') && dataStore.isPension && processCode !== 2) {
685
+ return true;
686
+ });
687
+ const hasEpayPay = computed(() => {
688
+ if (dataStore.isLifeBusiness || dataStore.isGns) {
596
689
  return false;
597
690
  }
598
691
  return true;
@@ -601,7 +694,7 @@ export default defineComponent({
601
694
  await dataStore.downloadTemplate(documentType, fileType, formStore.applicationData.processInstanceId);
602
695
  };
603
696
 
604
- const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml' | 'signature') => {
697
+ const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml') => {
605
698
  loading.value = true;
606
699
  if (type === 'electronic') {
607
700
  await dataStore.signDocument();
@@ -630,9 +723,6 @@ export default defineComponent({
630
723
  isQr.value = true;
631
724
  }
632
725
  }
633
- if (type === 'signature') {
634
- await dataStore.signDocument('signature');
635
- }
636
726
  loading.value = false;
637
727
  };
638
728
 
@@ -661,7 +751,7 @@ export default defineComponent({
661
751
  urlCopy.value = `https://egovbusiness.page.link/?link=${linkToCopy.value}?mgovSign&amp;apn=kz.mobile.mgov.business&amp;isi=1597880144&amp;ibi=kz.mobile.mgov.business`;
662
752
  } else {
663
753
  //для физ лиц
664
- urlCopy.value = `https://mgovsign.page.link/?link=${linkToCopy.value}?mgovSign&amp;apn=kz.mobile.mgov&amp;isi=1476128386&amp;ibi=kz.egov.mobile`;
754
+ urlCopy.value = `https://m.egov.kz/mobileSign/?link=${encodeURIComponent(linkToCopy.value)}?mgovSign`;
665
755
  }
666
756
 
667
757
  await startConnection(uuidV4, groupId);
@@ -680,11 +770,7 @@ export default defineComponent({
680
770
  isQrLoading.value = true;
681
771
  } else if (message === 'Signed') {
682
772
  isQrLoading.value = false;
683
- if (dataStore.isPension) {
684
- dataStore.showToaster('info', dataStore.t('pension.signInProcess'));
685
- } else {
686
- dataStore.showToaster('success', dataStore.t('sign.successQrSigned'));
687
- }
773
+ dataStore.showToaster('success', dataStore.isPension ? 'Подписание прошло успешно' : dataStore.t('sign.successQrSigned'));
688
774
  qrUrl.value = '';
689
775
  isQr.value = false;
690
776
  dataStore.panel.open = false;
@@ -706,7 +792,7 @@ export default defineComponent({
706
792
  data.append('name', 'PAEnpf_Agreement');
707
793
  data.append('format', 'xml');
708
794
  data.append('EdsXmlId', groupId ?? '');
709
- await dataStore.api.uploadXml(data);
795
+ await dataStore.api.file.uploadXml(data);
710
796
  await dataStore.getSignedDocList(dataStore.formStore.applicationData.processInstanceId);
711
797
  dataStore.showToaster('success', dataStore.t('pension.consentGiven'), 3000);
712
798
  }
@@ -742,7 +828,7 @@ export default defineComponent({
742
828
  await dataStore.generateDocument();
743
829
  };
744
830
 
745
- const convertQr = async (url: string | null, template?: Api.GenerateShortLink.Templates) => {
831
+ const convertQr = async (url: string | null, template?: Types.Api.GenerateShortLink.Templates) => {
746
832
  if (url) {
747
833
  const shortedUrl = await dataStore.generateShortLink(url, template);
748
834
  qrUrl.value = typeof shortedUrl === 'string' && !!shortedUrl ? shortedUrl : url;
@@ -793,6 +879,106 @@ export default defineComponent({
793
879
  dataStore.panelAction = constants.actions.pay;
794
880
  };
795
881
 
882
+ const groupBy = (data: any, key: string) => {
883
+ return data.reduce((results: any, item: any) => {
884
+ results[item[key]] = results[item[key]] || [];
885
+ results[item[key]].push(item);
886
+ return results;
887
+ }, {});
888
+ };
889
+
890
+ const checkIfAllSigned = async (sendTask: boolean = false) => {
891
+ await dataStore.generateSign(route.params.taskId as string);
892
+ formStore.signatories.find(async (person: any) => {
893
+ if (person.fileDatas.find((file: any) => file.isSigned === false) === undefined) {
894
+ if (formStore.applicationData.statusCode !== 'ContractSignedFrom') {
895
+ // TODO better if condition
896
+ // dataStore.showToaster(
897
+ // 'success',
898
+ // dataStore.t(`pension.${formStore.applicationData.statusCode === 'HeadManagerForm' ? 'signInProcessManager' : 'signInProcess'}`),
899
+ // 30000,
900
+ // );
901
+ }
902
+ }
903
+ });
904
+ };
905
+
906
+ const newSign = async (signType: number, file: any, index: number, iin: string) => {
907
+ loading.value = true;
908
+ selectedContragent.value = iin;
909
+ const data = {
910
+ ...formStore.signatories[index],
911
+ signType: signType,
912
+ fileDatas: file,
913
+ } as Types.Api.Sign.New.GeneralResponse;
914
+ try {
915
+ signOptions.value = await dataStore.generalSign(data);
916
+ if (signOptions.value) {
917
+ switch (signType) {
918
+ case CoreEnums.Sign.Types.electronic:
919
+ // @ts-ignore
920
+ formStore.signUrls = [signOptions.value];
921
+ isElectronicContract.value = true;
922
+ dataStore.panelAction = constants.actions.sign;
923
+ break;
924
+ case CoreEnums.Sign.Types.scans:
925
+ isScansDocuments.value = true;
926
+ signingFiles.value = data.fileDatas && Array.isArray(data.fileDatas) ? data.fileDatas.filter(i => i.isSigned !== true) : [];
927
+ break;
928
+ case CoreEnums.Sign.Types.qr:
929
+ if (!signOptions.value.signatureDocumentGroupId) return dataStore.showToaster('error', 'Ошибка при подписании документов через eGov mobile', 10000);
930
+ await generateQR(signOptions.value.signatureDocumentGroupId);
931
+ isQr.value = true;
932
+ break;
933
+ case CoreEnums.Sign.Types.qrXml:
934
+ if (!signOptions.value.edsXmlId) return dataStore.showToaster('error', 'Ошибка при подписании документов через eGov mobile для ENPF', 10000);
935
+ await generateQR(signOptions.value.edsXmlId, 'xml');
936
+ isQr.value = true;
937
+ break;
938
+ case CoreEnums.Sign.Types.nclayer:
939
+ for (let each of file.filter((i: any) => i.isSigned !== true)) {
940
+ const signingFile = signOptions.value.signIds.find((i: any) => Number(i.fileType) === Number(each.fileType));
941
+ if (signingFile) {
942
+ const response = await dataStore.nclayerSign(signingFile.id, signType, Number(each.fileType) === 43);
943
+ if (response === null) {
944
+ dataStore.showToaster('error', 'Ошибка при подключении к приложению «NCALayer». Убедитесь, что запустили приложение «NCALayer»', 10000);
945
+ break;
946
+ }
947
+ if (!response) break;
948
+ if (response === true) dataStore.showToaster('success', 'Подписание прошло успешно');
949
+ } else {
950
+ dataStore.showToaster('error', 'Не найдены данные для подписания файла');
951
+ }
952
+ }
953
+ break;
954
+ default:
955
+ break;
956
+ }
957
+ }
958
+ await checkIfAllSigned();
959
+ currentFilePanel.value = [];
960
+ } catch (err) {
961
+ ErrorHandler(err);
962
+ }
963
+ loading.value = false;
964
+ };
965
+
966
+ const setActualEnpf = useDebounceFn(async () => {
967
+ try {
968
+ await dataStore.api.file.setActualEnpf({ processId: String(formStore.applicationData.processInstanceId), isOnlineEnpfAgreement: isOnlineEnpf.value });
969
+ await dataStore.generateSign(String(route.params.taskId));
970
+ } catch (err) {
971
+ ErrorHandler(err);
972
+ }
973
+ currentFilePanel.value = [];
974
+ }, 1000);
975
+
976
+ const sendLink = async () => {
977
+ const contragents = [formStore.policyholderForm, ...formStore.beneficiaryForm, ...formStore.insuredForm];
978
+ const person = contragents.find(item => item.iin!.replace(/-/g, '') === selectedContragent.value);
979
+ await dataStore.sendSMS('SignUrl', person!.phoneNumber!, urlCopy.value, person!.iin!.replace(/-/g, ''));
980
+ };
981
+
796
982
  return {
797
983
  // State
798
984
  formStore,
@@ -814,8 +1000,13 @@ export default defineComponent({
814
1000
  processCode,
815
1001
  isQrDialog,
816
1002
  email,
1003
+ signOptions,
1004
+ signingFiles,
1005
+ isOnlineEnpf,
1006
+ currentFilePanel,
817
1007
 
818
1008
  // Functions
1009
+ sendLink,
819
1010
  closePanel,
820
1011
  submitForm,
821
1012
  handleTask,
@@ -825,11 +1016,13 @@ export default defineComponent({
825
1016
  downloadTemplate,
826
1017
  onFileChangeScans,
827
1018
  sendFiles,
1019
+ sendFilesNew,
828
1020
  onClearFile,
829
1021
  closeQrPanel,
830
1022
  handlePayAction,
831
1023
  payEpay,
832
1024
  convertQr,
1025
+ setActualEnpf,
833
1026
  sendInvoiceToEmail,
834
1027
  hasConditionsAction,
835
1028
 
@@ -842,6 +1035,7 @@ export default defineComponent({
842
1035
  affiliateActions,
843
1036
  chooseSignActions,
844
1037
  paymentPeriod,
1038
+ isAllPaperSigned,
845
1039
  insurancePremiumPerMonth,
846
1040
  requestedSumInsured,
847
1041
  affiliationDocument,
@@ -858,7 +1052,16 @@ export default defineComponent({
858
1052
  isQrXmlDisabled,
859
1053
  isSignatureDisabled,
860
1054
  choosePayActions,
861
- consentGiven,
1055
+ groupBy,
1056
+ newSign,
1057
+ onFileChangeScansNew,
1058
+ onClearFileNew,
1059
+ getDocNew,
1060
+ inSigningOrder,
1061
+ isNewSign,
1062
+ hasEpayPay,
1063
+ isOnlineEnpfDisabled,
1064
+ getFilesDownloadButtons,
862
1065
  };
863
1066
  },
864
1067
  });