hl-core 0.0.10-beta.5 → 0.0.10-beta.50

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 (41) hide show
  1. package/README.md +0 -2
  2. package/api/base.api.ts +327 -137
  3. package/api/interceptors.ts +3 -5
  4. package/components/Dialog/Dialog.vue +5 -1
  5. package/components/Form/DigitalDocument.vue +52 -0
  6. package/components/Form/FormSource.vue +30 -0
  7. package/components/Form/ManagerAttachment.vue +60 -11
  8. package/components/Form/ProductConditionsBlock.vue +12 -6
  9. package/components/Input/Datepicker.vue +5 -0
  10. package/components/Input/FileInput.vue +1 -1
  11. package/components/Input/FormInput.vue +5 -0
  12. package/components/Input/OtpInput.vue +25 -0
  13. package/components/Input/RoundedInput.vue +2 -0
  14. package/components/Input/RoundedSelect.vue +2 -0
  15. package/components/Input/TextAreaField.vue +71 -0
  16. package/components/Menu/MenuNav.vue +1 -1
  17. package/components/Pages/Anketa.vue +207 -176
  18. package/components/Pages/ContragentForm.vue +1 -1
  19. package/components/Pages/Documents.vue +436 -64
  20. package/components/Pages/MemberForm.vue +343 -170
  21. package/components/Pages/ProductConditions.vue +895 -241
  22. package/components/Panel/PanelHandler.vue +282 -124
  23. package/components/Utilities/Chip.vue +1 -1
  24. package/components/Utilities/JsonViewer.vue +1 -2
  25. package/composables/classes.ts +121 -20
  26. package/composables/constants.ts +45 -1
  27. package/composables/index.ts +333 -8
  28. package/composables/styles.ts +8 -24
  29. package/configs/pwa.ts +1 -7
  30. package/layouts/clear.vue +1 -1
  31. package/layouts/default.vue +1 -1
  32. package/layouts/full.vue +1 -1
  33. package/locales/ru.json +82 -19
  34. package/nuxt.config.ts +10 -12
  35. package/package.json +12 -12
  36. package/plugins/head.ts +7 -1
  37. package/store/data.store.ts +867 -525
  38. package/store/member.store.ts +17 -6
  39. package/store/rules.ts +23 -3
  40. package/types/enum.ts +40 -2
  41. package/types/index.ts +110 -56
@@ -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 signingFiles" :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,7 +58,7 @@
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" />
112
63
  </div>
113
64
  <div v-if="isQr" :class="[$styles.flexColNav]">
@@ -121,10 +72,58 @@
121
72
  <base-btn :text="$dataStore.t('buttons.cancel')" :btn="$styles.whiteBtn" @click="closeQrPanel" />
122
73
  </base-form-section>
123
74
  </div>
75
+ <div v-if="!(formStore.signatories.length === 0) && !isQr && !isScansDocuments" :class="[$styles.flexColNav]">
76
+ <div
77
+ v-if="(processCode === 19 || processCode === 25) && formStore.applicationData.statusCode === 'AttachAppContractForm'"
78
+ :class="[$styles.blueBgLight]"
79
+ class="rounded-lg p-4"
80
+ >
81
+ <base-form-toggle v-model="isOnlineEnpf" title="Онлайн подписание согласия для ЕНПФ" :has-border="false" @clicked="setActualEnpf" />
82
+ </div>
83
+ <div :class="[$styles.blueBgLight]" class="rounded-lg p-4">
84
+ <v-expansion-panels v-if="formStore.signatories.length" variant="accordion" :multiple="false">
85
+ <v-expansion-panel v-for="(person, index) of formStore.signatories" :key="person.personId!" class="border-[1px]" elevation="0" bg-color="#FFF">
86
+ <v-expansion-panel-title class="h-[80px]" :class="$styles.textTitle">
87
+ {{ person.longName }}
88
+ </v-expansion-panel-title>
89
+ <v-expansion-panel-text class="border-t-[1px]">
90
+ <section class="flex flex-col" :class="$styles.textSimple">
91
+ <v-expansion-panels v-if="person.fileDatas.length" v-model="currentFilePanel" :multiple="false">
92
+ <v-expansion-panel
93
+ v-for="(file, fileIndex) in groupBy(person.fileDatas, 'orderFile')"
94
+ :value="`${index} - ${fileIndex}`"
95
+ :disabled="inSigningOrder(person.fileDatas, fileIndex) || file.every((f: any) => f.isSigned === true)"
96
+ >
97
+ <v-expansion-panel-title v-for="name in file" class="h-[80px]" :class="$styles.textTitle">
98
+ {{ name.fileName }}
99
+ </v-expansion-panel-title>
100
+ <v-expansion-panel-text class="border-t-[1px]">
101
+ <section class="flex flex-col gap-4 py-3" :class="$styles.textSimple">
102
+ <base-btn
103
+ v-for="signtype in file[0].signTypes"
104
+ :text="signtype.documentSignTypeName"
105
+ :btn="$styles.greenBtn"
106
+ @click="newSign(signtype.documentSignTypeValue, file, index)"
107
+ :loading="loading"
108
+ />
109
+ </section>
110
+ </v-expansion-panel-text>
111
+ </v-expansion-panel>
112
+ </v-expansion-panels>
113
+ </section>
114
+ </v-expansion-panel-text>
115
+ </v-expansion-panel>
116
+ </v-expansion-panels>
117
+ <base-list-empty v-else />
118
+ </div>
119
+ <base-animation>
120
+ <base-btn v-if="isAllPaperSigned" :text="$dataStore.t('buttons.send')" :loading="loading" @click="$dataStore.panelAction = constants.actions.signed" />
121
+ </base-animation>
122
+ </div>
124
123
  </section>
125
124
  <section v-if="choosePayActions">
126
125
  <div v-if="!isEpayPay && !isOfflinePay" :class="[$styles.flexColNav]">
127
- <base-btn :text="$dataStore.t('buttons.payEpay')" :loading="loading" @click="handlePayAction('epay')" />
126
+ <base-btn v-if="hasEpayPay" :text="$dataStore.t('buttons.payEpay')" :loading="loading" @click="handlePayAction('epay')" />
128
127
  <base-btn :text="$dataStore.t('buttons.payOffline')" :loading="loading" @click="handlePayAction('offline')" />
129
128
  </div>
130
129
  <div v-if="isOfflinePay" :class="[$styles.flexColNav]">
@@ -178,7 +177,7 @@
178
177
  </div>
179
178
  </base-fade-transition>
180
179
  <base-btn
181
- v-if="$dataStore.isPension"
180
+ v-if="isElectronicContract"
182
181
  :text="$dataStore.t('buttons.cancel')"
183
182
  :btn="$styles.whiteBtn"
184
183
  @click="
@@ -254,7 +253,8 @@
254
253
  import { DocumentItem, Value } from '../../composables/classes';
255
254
  import { HubConnectionBuilder } from '@microsoft/signalr';
256
255
  import { uuid } from 'vue-uuid';
257
- import type { Api, SignUrlType } from '../../types';
256
+ import type * as Types from '../../types';
257
+ import { CoreEnums } from '../../types/enum';
258
258
 
259
259
  export default defineComponent({
260
260
  emits: ['task'],
@@ -276,14 +276,16 @@ export default defineComponent({
276
276
  const isOfflinePay = ref<boolean>(false);
277
277
  const isQrDialog = ref<boolean>(false);
278
278
  const email = ref<string>('');
279
+ const signOptions = ref<Types.Api.Sign.New.Response>();
280
+ const signingFiles = ref<Types.Api.Sign.New.FileDatas[]>([]);
281
+ const isOnlineEnpf = ref<boolean>(true);
282
+ const currentFilePanel = ref<string[]>([]);
279
283
 
280
284
  const vForm = ref<any>();
281
285
  const isSendNumberOpen = ref<boolean>(false);
282
286
  const phoneNumber = ref<string | null>(formStore.policyholderForm.phoneNumber ?? '');
283
- const selectedClient = ref<SignUrlType>();
287
+ const selectedClient = ref<Types.SignUrlType>();
284
288
  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
289
  const affiliationDocument = computed(() => formStore.signedDocumentList.find((file: DocumentItem) => file.fileTypeName === 'Решение АС'));
288
290
  const affiliationData = ref<{
289
291
  processInstanceId: string | number;
@@ -298,9 +300,10 @@ export default defineComponent({
298
300
  const affiliationFormData = ref(new FormData());
299
301
  const scansFormData = ref(new FormData());
300
302
  const scansFiles = ref<any[]>([]);
303
+ const isAllPaperSigned = computed(() => formStore.signatories.every((person: any) => person.fileDatas.every((file: any) => file.isSigned === true && file.signedType === 2)));
301
304
  const processCode = formStore.applicationData.processCode;
302
305
 
303
- const openSmsPanel = (signInfo: SignUrlType) => {
306
+ const openSmsPanel = (signInfo: Types.SignUrlType) => {
304
307
  if (signInfo) {
305
308
  isSendNumberOpen.value = true;
306
309
  selectedClient.value = signInfo;
@@ -328,10 +331,53 @@ export default defineComponent({
328
331
  }
329
332
  };
330
333
 
331
- const onFileChangeScans = async (
332
- event: InputEvent,
333
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
334
- ) => {
334
+ const inSigningOrder = (files: any, index: number) => {
335
+ for (
336
+ let i = 0;
337
+ i <
338
+ files.sort(function (a: any, b: any) {
339
+ return a.orderFile > b.orderFile ? 1 : b.orderFile > a.orderFile ? -1 : 0;
340
+ }).length;
341
+ i++
342
+ ) {
343
+ if (!files[i].isSigned) {
344
+ return files[i].orderFile != index;
345
+ }
346
+ }
347
+ };
348
+
349
+ const getDocNew = async (file: any) => {
350
+ const newFile = signOptions.value?.signIds.find((i: any) => i.fileType == file.fileType);
351
+ if (newFile) await dataStore.getDocNew(newFile.id, 2, false, file.fileName);
352
+ };
353
+
354
+ const onFileChangeScansNew = async (event: InputEvent, file: any) => {
355
+ if (event.target) {
356
+ const files = (event.target as HTMLInputElement).files;
357
+ if (files && files.length) {
358
+ if (files[0].type !== 'application/pdf') return dataStore.showToaster('error', dataStore.t('toaster.onlyPDF'), 6000);
359
+ const { execute: getBase64 } = useBase64(files[0]);
360
+ const base64 = (await getBase64()).slice(28);
361
+ const data = {
362
+ FileBytes: base64,
363
+ FileName: file.fileName,
364
+ FileTypeCode: file.fileType,
365
+ };
366
+ if (!signOptions.value) return dataStore.showToaster('error', dataStore.t('pension.fileError'), 6000);
367
+ scansFiles.value.push({
368
+ groupId: signOptions.value.signIds.find((i: any) => i.fileType == data.FileTypeCode)?.id,
369
+ data: data,
370
+ });
371
+ }
372
+ }
373
+ };
374
+
375
+ const onClearFileNew = async (file: any) => {
376
+ const result = scansFiles.value.filter(i => i.data.FileTypeCode !== file.fileType);
377
+ scansFiles.value = result;
378
+ };
379
+
380
+ const onFileChangeScans = async (event: InputEvent, type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
335
381
  if (event.target) {
336
382
  const files = (event.target as HTMLInputElement).files;
337
383
  if (files && files.length) {
@@ -353,31 +399,20 @@ export default defineComponent({
353
399
  }
354
400
  };
355
401
 
356
- const onClearFile = async (
357
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
358
- ) => {
402
+ const onClearFile = async (type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
359
403
  const doc = await selectedDocument(type);
360
404
  const result = scansFiles.value.filter(i => JSON.parse(i.fileData)[0].fileTypeCode !== doc.code);
361
405
  scansFiles.value = result;
362
406
  };
363
407
 
364
- const selectedDocument = (type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
408
+ const selectedDocument = (type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
365
409
  let selectedDocument: any;
366
410
  if (type === 'statement') {
367
411
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '32');
368
412
  }
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
413
  if (type === 'contract') {
376
414
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '6');
377
415
  }
378
- if (type === 'pa_contract') {
379
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '38');
380
- }
381
416
  if (type === 'pa_refundagreement') {
382
417
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '42');
383
418
  }
@@ -393,14 +428,29 @@ export default defineComponent({
393
428
  return selectedDocument;
394
429
  };
395
430
 
431
+ const sendFilesNew = async () => {
432
+ if (scansFiles.value.length !== signingFiles.value.length) {
433
+ dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
434
+ return;
435
+ }
436
+ try {
437
+ await Promise.allSettled(
438
+ Object.values(scansFiles.value).map(async f => {
439
+ await dataStore.api.file.uploadFilesNew(f.groupId, f.data);
440
+ }),
441
+ );
442
+ await checkIfAllSigned(true);
443
+ scansFiles.value = [];
444
+ isScansDocuments.value = false;
445
+ dataStore.showToaster('info', 'Документы загружены успешно');
446
+ } catch (err) {
447
+ return ErrorHandler(err);
448
+ }
449
+ };
450
+
396
451
  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
- ) {
452
+ loading.value = true;
453
+ if (scansFiles.value.length !== 4) {
404
454
  dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
405
455
  return;
406
456
  }
@@ -412,7 +462,8 @@ export default defineComponent({
412
462
  }
413
463
  closePanel();
414
464
  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');
465
+ await dataStore.handleTask(constants.actions.signed, route.params.taskId as string, 'scans');
466
+ loading.value = false;
416
467
  };
417
468
  const submitForm = async () => {
418
469
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
@@ -452,7 +503,7 @@ export default defineComponent({
452
503
  // loading.value = false;
453
504
  // return;
454
505
  // }
455
- if (dataStore.isAML || dataStore.isCheckContract || dataStore.isCheckContragent || dataStore.isDas || dataStore.isPrePension || dataStore.isUU) {
506
+ if (dataStore.isAML || dataStore.isCheckContract || dataStore.isCheckContragent || dataStore.isDas || dataStore.isPrePension || dataStore.isCritical || dataStore.isUU) {
456
507
  emit('task', [dataStore.panelAction, route.params.taskId as string, actionCause.value]);
457
508
  } else {
458
509
  await dataStore.handleTask(dataStore.panelAction, route.params.taskId as string, actionCause.value);
@@ -462,12 +513,16 @@ export default defineComponent({
462
513
 
463
514
  const onInit = async () => {
464
515
  if (dataStore.controls.hasChooseSign) {
465
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
516
+ if (dataStore.isBaiterek || dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
466
517
  isElectronicContract.value = false;
467
518
  }
468
519
  }
469
520
  if (dataStore.isPension) {
470
- await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
521
+ if (formStore.applicationData.pensionApp) {
522
+ const isOnlineEnpfAgreement = formStore.applicationData.pensionApp.isOnlineEnpfAgreement;
523
+ isOnlineEnpf.value = isOnlineEnpfAgreement === null ? true : isOnlineEnpfAgreement;
524
+ await dataStore.getSignedDocList(formStore.applicationData.processInstanceId);
525
+ }
471
526
  }
472
527
  };
473
528
 
@@ -523,25 +578,34 @@ export default defineComponent({
523
578
  dataStore.panelAction === constants.actions.return ||
524
579
  dataStore.panelAction === constants.actions.rejectclient,
525
580
  );
526
- const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
581
+ const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept || (dataStore.isPension && dataStore.panelAction === constants.actions.signed));
527
582
  const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
528
583
  const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
529
584
  const affiliateActions = computed(() => dataStore.panelAction === constants.actions.affiliate);
530
585
  const chooseSignActions = computed(() => dataStore.controls.hasChooseSign && dataStore.panelAction === constants.actions.chooseSign);
531
586
  const choosePayActions = computed(() => dataStore.controls.hasChoosePay && dataStore.panelAction === constants.actions.choosePay);
532
-
587
+ // TODO на все продукты новое подписание
588
+ const isNewSign = computed(() => dataStore.isPension || dataStore.isGons || dataStore.isBaiterek);
533
589
  const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
534
- const insurancePremiumPerMonth = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.insurancePremiumPerMonth));
590
+ const insurancePremiumPerMonth = computed(() => {
591
+ if (dataStore.isGons && formStore.productConditionsForm.currency.code === 'USD') {
592
+ return `${formStore.productConditionsForm.insurancePremiumPerMonthInDollar}$`;
593
+ }
594
+ return `${formStore.productConditionsForm.insurancePremiumPerMonth}₸`;
595
+ });
535
596
  const requestedSumInsured = computed(() => {
536
597
  if ((dataStore.isLifeBusiness || dataStore.isGns) && formStore.productConditionsForm.requestedSumInsured === null) {
537
598
  return dataStore.getNumberWithSpaces(formStore.applicationData.policyAppDto!.mainInsSum);
538
599
  }
539
- return dataStore.getNumberWithSpaces(formStore.productConditionsForm.requestedSumInsured);
600
+ if (dataStore.isGons && formStore.productConditionsForm.currency.code === 'USD') {
601
+ return `${formStore.productConditionsForm.requestedSumInsuredInDollar}$`;
602
+ }
603
+ return `${formStore.productConditionsForm.requestedSumInsured}₸`;
540
604
  });
541
605
  const price = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.calculatorForm.price));
542
606
  const insuredAmount = computed(() => formStore.productConditionsForm.calculatorForm.amount!.nameRu! + dataStore.currency);
543
607
  const hasConditionsInfo = computed(() => {
544
- if (dataStore.isLifetrip || dataStore.isDas || dataStore.isUU || dataStore.isPrePension) {
608
+ if (dataStore.isLifetrip || dataStore.isDas || dataStore.isUU || dataStore.isPrePension || dataStore.isCritical || dataStore.isPension) {
545
609
  return false;
546
610
  }
547
611
  if (dataStore.isFinCenter()) {
@@ -550,7 +614,7 @@ export default defineComponent({
550
614
  return true;
551
615
  });
552
616
  const hasConditionsAction = computed(() => {
553
- if (dataStore.isPrePension) {
617
+ if (dataStore.isPrePension || dataStore.isCritical) {
554
618
  return false;
555
619
  }
556
620
  return true;
@@ -562,7 +626,7 @@ export default defineComponent({
562
626
  return true;
563
627
  });
564
628
  const isElectronicDisabled = computed(() => {
565
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns || dataStore.isPension) {
629
+ if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns) {
566
630
  return true;
567
631
  }
568
632
  return false;
@@ -571,28 +635,22 @@ export default defineComponent({
571
635
  if (dataStore.isGons) {
572
636
  return true;
573
637
  }
574
- if ((!consentGiven.value || formStore.applicationData.statusCode === 'HeadManagerForm') && dataStore.isPension && processCode !== 2) {
575
- return true;
576
- }
577
638
  return false;
578
639
  });
579
640
  const isQrDisabled = computed(() => {
580
- if (consentGiven.value && dataStore.isPension && processCode !== 2) {
581
- return false;
582
- }
583
641
  return true;
584
642
  });
585
643
  const isQrXmlDisabled = computed(() => {
586
- if (!consentGiven.value && dataStore.isPension && processCode !== 2) {
587
- return false;
588
- }
589
644
  if (dataStore.isLifeBusiness || dataStore.isGns) {
590
645
  return false;
591
646
  }
592
647
  return true;
593
648
  });
594
649
  const isSignatureDisabled = computed(() => {
595
- if ((!consentGiven.value || formStore.applicationData.statusCode === 'HeadManagerForm') && dataStore.isPension && processCode !== 2) {
650
+ return true;
651
+ });
652
+ const hasEpayPay = computed(() => {
653
+ if (dataStore.isLifeBusiness || dataStore.isGns) {
596
654
  return false;
597
655
  }
598
656
  return true;
@@ -601,7 +659,7 @@ export default defineComponent({
601
659
  await dataStore.downloadTemplate(documentType, fileType, formStore.applicationData.processInstanceId);
602
660
  };
603
661
 
604
- const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml' | 'signature') => {
662
+ const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml') => {
605
663
  loading.value = true;
606
664
  if (type === 'electronic') {
607
665
  await dataStore.signDocument();
@@ -630,9 +688,6 @@ export default defineComponent({
630
688
  isQr.value = true;
631
689
  }
632
690
  }
633
- if (type === 'signature') {
634
- await dataStore.signDocument('signature');
635
- }
636
691
  loading.value = false;
637
692
  };
638
693
 
@@ -680,11 +735,7 @@ export default defineComponent({
680
735
  isQrLoading.value = true;
681
736
  } else if (message === 'Signed') {
682
737
  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
- }
738
+ dataStore.showToaster('success', dataStore.isPension ? 'Подписание прошло успешно' : dataStore.t('sign.successQrSigned'));
688
739
  qrUrl.value = '';
689
740
  isQr.value = false;
690
741
  dataStore.panel.open = false;
@@ -706,7 +757,7 @@ export default defineComponent({
706
757
  data.append('name', 'PAEnpf_Agreement');
707
758
  data.append('format', 'xml');
708
759
  data.append('EdsXmlId', groupId ?? '');
709
- await dataStore.api.uploadXml(data);
760
+ await dataStore.api.file.uploadXml(data);
710
761
  await dataStore.getSignedDocList(dataStore.formStore.applicationData.processInstanceId);
711
762
  dataStore.showToaster('success', dataStore.t('pension.consentGiven'), 3000);
712
763
  }
@@ -742,7 +793,7 @@ export default defineComponent({
742
793
  await dataStore.generateDocument();
743
794
  };
744
795
 
745
- const convertQr = async (url: string | null, template?: Api.GenerateShortLink.Templates) => {
796
+ const convertQr = async (url: string | null, template?: Types.Api.GenerateShortLink.Templates) => {
746
797
  if (url) {
747
798
  const shortedUrl = await dataStore.generateShortLink(url, template);
748
799
  qrUrl.value = typeof shortedUrl === 'string' && !!shortedUrl ? shortedUrl : url;
@@ -793,6 +844,99 @@ export default defineComponent({
793
844
  dataStore.panelAction = constants.actions.pay;
794
845
  };
795
846
 
847
+ const groupBy = (data: any, key: string) => {
848
+ return data.reduce((results: any, item: any) => {
849
+ results[item[key]] = results[item[key]] || [];
850
+ results[item[key]].push(item);
851
+ return results;
852
+ }, {});
853
+ };
854
+
855
+ const checkIfAllSigned = async (sendTask: boolean = false) => {
856
+ await dataStore.generateSign(route.params.taskId as string);
857
+ formStore.signatories.find(async (person: any) => {
858
+ if (person.fileDatas.find((file: any) => file.isSigned === false) === undefined) {
859
+ if (formStore.applicationData.statusCode !== 'ContractSignedFrom') {
860
+ // TODO better if condition
861
+ // dataStore.showToaster(
862
+ // 'success',
863
+ // dataStore.t(`pension.${formStore.applicationData.statusCode === 'HeadManagerForm' ? 'signInProcessManager' : 'signInProcess'}`),
864
+ // 30000,
865
+ // );
866
+ }
867
+ }
868
+ });
869
+ };
870
+
871
+ const newSign = async (signType: number, file: any, index: number) => {
872
+ loading.value = true;
873
+ const data = {
874
+ ...formStore.signatories[index],
875
+ signType: signType,
876
+ fileDatas: file,
877
+ } as Types.Api.Sign.New.GeneralResponse;
878
+ try {
879
+ signOptions.value = await dataStore.generalSign(data);
880
+ if (signOptions.value) {
881
+ switch (signType) {
882
+ case CoreEnums.Sign.Types.electronic:
883
+ // @ts-ignore
884
+ formStore.signUrls = [signOptions.value];
885
+ isElectronicContract.value = true;
886
+ dataStore.panelAction = constants.actions.sign;
887
+ break;
888
+ case CoreEnums.Sign.Types.scans:
889
+ isScansDocuments.value = true;
890
+ signingFiles.value = data.fileDatas && Array.isArray(data.fileDatas) ? data.fileDatas.filter(i => i.isSigned !== true) : [];
891
+ break;
892
+ case CoreEnums.Sign.Types.qr:
893
+ if (!signOptions.value.signatureDocumentGroupId) return dataStore.showToaster('error', 'Ошибка при подписании документов через eGov mobile', 10000);
894
+ await generateQR(signOptions.value.signatureDocumentGroupId);
895
+ isQr.value = true;
896
+ break;
897
+ case CoreEnums.Sign.Types.qrXml:
898
+ if (!signOptions.value.edsXmlId) return dataStore.showToaster('error', 'Ошибка при подписании документов через eGov mobile для ENPF', 10000);
899
+ await generateQR(signOptions.value.edsXmlId, 'xml');
900
+ isQr.value = true;
901
+ break;
902
+ case CoreEnums.Sign.Types.nclayer:
903
+ for (let each of file.filter((i: any) => i.isSigned !== true)) {
904
+ const signingFile = signOptions.value.signIds.find((i: any) => Number(i.fileType) === Number(each.fileType));
905
+ if (signingFile) {
906
+ const response = await dataStore.nclayerSign(signingFile.id, signType, Number(each.fileType) === 43);
907
+ if (response === null) {
908
+ dataStore.showToaster('error', 'Ошибка при подключении к приложению «NCALayer». Убедитесь, что запустили приложение «NCALayer»', 10000);
909
+ break;
910
+ }
911
+ if (!response) break;
912
+ if (response === true) dataStore.showToaster('success', 'Подписание прошло успешно');
913
+ } else {
914
+ dataStore.showToaster('error', 'Не найдены данные для подписания файла');
915
+ }
916
+ }
917
+ break;
918
+ default:
919
+ break;
920
+ }
921
+ }
922
+ await checkIfAllSigned();
923
+ currentFilePanel.value = [];
924
+ } catch (err) {
925
+ ErrorHandler(err);
926
+ }
927
+ loading.value = false;
928
+ };
929
+
930
+ const setActualEnpf = useDebounceFn(async () => {
931
+ try {
932
+ await dataStore.api.file.setActualEnpf({ processId: String(formStore.applicationData.processInstanceId), isOnlineEnpfAgreement: isOnlineEnpf.value });
933
+ await dataStore.generateSign(String(route.params.taskId));
934
+ } catch (err) {
935
+ ErrorHandler(err);
936
+ }
937
+ currentFilePanel.value = [];
938
+ }, 1000);
939
+
796
940
  return {
797
941
  // State
798
942
  formStore,
@@ -814,6 +958,10 @@ export default defineComponent({
814
958
  processCode,
815
959
  isQrDialog,
816
960
  email,
961
+ signOptions,
962
+ signingFiles,
963
+ isOnlineEnpf,
964
+ currentFilePanel,
817
965
 
818
966
  // Functions
819
967
  closePanel,
@@ -825,11 +973,13 @@ export default defineComponent({
825
973
  downloadTemplate,
826
974
  onFileChangeScans,
827
975
  sendFiles,
976
+ sendFilesNew,
828
977
  onClearFile,
829
978
  closeQrPanel,
830
979
  handlePayAction,
831
980
  payEpay,
832
981
  convertQr,
982
+ setActualEnpf,
833
983
  sendInvoiceToEmail,
834
984
  hasConditionsAction,
835
985
 
@@ -842,6 +992,7 @@ export default defineComponent({
842
992
  affiliateActions,
843
993
  chooseSignActions,
844
994
  paymentPeriod,
995
+ isAllPaperSigned,
845
996
  insurancePremiumPerMonth,
846
997
  requestedSumInsured,
847
998
  affiliationDocument,
@@ -858,7 +1009,14 @@ export default defineComponent({
858
1009
  isQrXmlDisabled,
859
1010
  isSignatureDisabled,
860
1011
  choosePayActions,
861
- consentGiven,
1012
+ groupBy,
1013
+ newSign,
1014
+ onFileChangeScansNew,
1015
+ onClearFileNew,
1016
+ getDocNew,
1017
+ inSigningOrder,
1018
+ isNewSign,
1019
+ hasEpayPay,
862
1020
  };
863
1021
  },
864
1022
  });