hl-core 0.0.10-beta.6 → 0.0.10-beta.60

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