hl-core 0.0.10-beta.4 → 0.0.10-beta.41

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 (53) hide show
  1. package/README.md +0 -2
  2. package/api/base.api.ts +338 -191
  3. package/api/interceptors.ts +3 -5
  4. package/components/Complex/TextBlock.vue +2 -0
  5. package/components/Dialog/Dialog.vue +7 -1
  6. package/components/Dialog/FamilyDialog.vue +2 -0
  7. package/components/Form/DigitalDocument.vue +52 -0
  8. package/components/Form/DynamicForm.vue +1 -0
  9. package/components/Form/FormData.vue +1 -0
  10. package/components/Form/ManagerAttachment.vue +48 -10
  11. package/components/Form/ProductConditionsBlock.vue +12 -6
  12. package/components/Input/Datepicker.vue +5 -0
  13. package/components/Input/DynamicInput.vue +2 -0
  14. package/components/Input/FormInput.vue +7 -0
  15. package/components/Input/OtpInput.vue +25 -0
  16. package/components/Input/PanelInput.vue +1 -0
  17. package/components/Input/RoundedInput.vue +4 -0
  18. package/components/Input/RoundedSelect.vue +4 -0
  19. package/components/Input/SwitchInput.vue +2 -0
  20. package/components/Input/TextAreaField.vue +71 -0
  21. package/components/Input/TextInput.vue +2 -0
  22. package/components/Layout/Drawer.vue +2 -0
  23. package/components/Menu/MenuNav.vue +1 -1
  24. package/components/Pages/Anketa.vue +168 -169
  25. package/components/Pages/Auth.vue +2 -0
  26. package/components/Pages/ContragentForm.vue +2 -1
  27. package/components/Pages/Documents.vue +432 -59
  28. package/components/Pages/MemberForm.vue +334 -160
  29. package/components/Pages/ProductConditions.vue +838 -226
  30. package/components/Panel/PanelHandler.vue +280 -121
  31. package/components/Transitions/Animation.vue +2 -0
  32. package/components/Utilities/Chip.vue +3 -1
  33. package/components/Utilities/JsonViewer.vue +1 -2
  34. package/composables/classes.ts +143 -49
  35. package/composables/constants.ts +44 -0
  36. package/composables/fields.ts +6 -4
  37. package/composables/index.ts +298 -7
  38. package/composables/styles.ts +8 -24
  39. package/configs/pwa.ts +1 -7
  40. package/layouts/clear.vue +1 -1
  41. package/layouts/default.vue +1 -1
  42. package/layouts/full.vue +1 -1
  43. package/locales/ru.json +80 -19
  44. package/nuxt.config.ts +10 -13
  45. package/package.json +12 -12
  46. package/plugins/head.ts +2 -1
  47. package/store/data.store.ts +802 -531
  48. package/store/member.store.ts +18 -6
  49. package/store/rules.ts +22 -2
  50. package/types/enum.ts +33 -2
  51. package/types/env.d.ts +2 -2
  52. package/types/form.ts +71 -74
  53. package/types/index.ts +924 -873
@@ -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">
@@ -29,74 +29,25 @@
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="getFileNew(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,6 +253,8 @@
254
253
  import { DocumentItem, Value } from '../../composables/classes';
255
254
  import { HubConnectionBuilder } from '@microsoft/signalr';
256
255
  import { uuid } from 'vue-uuid';
256
+ import type * as Types from '../../types';
257
+ import { CoreEnums } from '../../types/enum';
257
258
 
258
259
  export default defineComponent({
259
260
  emits: ['task'],
@@ -275,14 +276,16 @@ export default defineComponent({
275
276
  const isOfflinePay = ref<boolean>(false);
276
277
  const isQrDialog = ref<boolean>(false);
277
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[]>([]);
278
283
 
279
284
  const vForm = ref<any>();
280
285
  const isSendNumberOpen = ref<boolean>(false);
281
286
  const phoneNumber = ref<string | null>(formStore.policyholderForm.phoneNumber ?? '');
282
- const selectedClient = ref<SignUrlType>();
287
+ const selectedClient = ref<Types.SignUrlType>();
283
288
  const documentDict = computed(() => dataStore.dicFileTypeList.find(i => i.nameRu === 'Решение АС'));
284
- const pensionForm = formStore.applicationData?.pensionApp ?? undefined;
285
- const consentGiven = computed(() => !!formStore.signedDocumentList.find(i => i.fileTypeCode === '43' && i.signed === true));
286
289
  const affiliationDocument = computed(() => formStore.signedDocumentList.find((file: DocumentItem) => file.fileTypeName === 'Решение АС'));
287
290
  const affiliationData = ref<{
288
291
  processInstanceId: string | number;
@@ -297,9 +300,10 @@ export default defineComponent({
297
300
  const affiliationFormData = ref(new FormData());
298
301
  const scansFormData = ref(new FormData());
299
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)));
300
304
  const processCode = formStore.applicationData.processCode;
301
305
 
302
- const openSmsPanel = (signInfo: SignUrlType) => {
306
+ const openSmsPanel = (signInfo: Types.SignUrlType) => {
303
307
  if (signInfo) {
304
308
  isSendNumberOpen.value = true;
305
309
  selectedClient.value = signInfo;
@@ -327,10 +331,53 @@ export default defineComponent({
327
331
  }
328
332
  };
329
333
 
330
- const onFileChangeScans = async (
331
- event: InputEvent,
332
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
333
- ) => {
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 getFileNew = async (file: any) => {
350
+ const newFile = signOptions.value?.signIds.find((i: any) => i.fileType == file.fileType);
351
+ if (newFile) await dataStore.getFileNew(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') => {
334
381
  if (event.target) {
335
382
  const files = (event.target as HTMLInputElement).files;
336
383
  if (files && files.length) {
@@ -352,31 +399,20 @@ export default defineComponent({
352
399
  }
353
400
  };
354
401
 
355
- const onClearFile = async (
356
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
357
- ) => {
402
+ const onClearFile = async (type: 'statement' | 'contract' | 'pa_refundstatement' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
358
403
  const doc = await selectedDocument(type);
359
404
  const result = scansFiles.value.filter(i => JSON.parse(i.fileData)[0].fileTypeCode !== doc.code);
360
405
  scansFiles.value = result;
361
406
  };
362
407
 
363
- 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') => {
364
409
  let selectedDocument: any;
365
410
  if (type === 'statement') {
366
411
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '32');
367
412
  }
368
- if (type === 'pa_statement') {
369
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '37');
370
- }
371
- if (type === 'pa_refundstatement') {
372
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '41');
373
- }
374
413
  if (type === 'contract') {
375
414
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '6');
376
415
  }
377
- if (type === 'pa_contract') {
378
- selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '38');
379
- }
380
416
  if (type === 'pa_refundagreement') {
381
417
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '42');
382
418
  }
@@ -392,14 +428,29 @@ export default defineComponent({
392
428
  return selectedDocument;
393
429
  };
394
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
+
395
451
  const sendFiles = async () => {
396
- if (
397
- dataStore.isPension
398
- ? formStore.applicationData.statusCode === 'ContractSignedFrom'
399
- ? scansFiles.value.length !== 1
400
- : scansFiles.value.length !== 2
401
- : scansFiles.value.length !== 4
402
- ) {
452
+ loading.value = true;
453
+ if (scansFiles.value.length !== 4) {
403
454
  dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
404
455
  return;
405
456
  }
@@ -411,7 +462,8 @@ export default defineComponent({
411
462
  }
412
463
  closePanel();
413
464
  dataStore.showToaster('success', dataStore.t('toaster.successOperation'));
414
- 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;
415
467
  };
416
468
  const submitForm = async () => {
417
469
  await vForm.value.validate().then(async (v: { valid: Boolean; errors: any }) => {
@@ -451,7 +503,7 @@ export default defineComponent({
451
503
  // loading.value = false;
452
504
  // return;
453
505
  // }
454
- 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) {
455
507
  emit('task', [dataStore.panelAction, route.params.taskId as string, actionCause.value]);
456
508
  } else {
457
509
  await dataStore.handleTask(dataStore.panelAction, route.params.taskId as string, actionCause.value);
@@ -461,12 +513,16 @@ export default defineComponent({
461
513
 
462
514
  const onInit = async () => {
463
515
  if (dataStore.controls.hasChooseSign) {
464
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
516
+ if (dataStore.isBaiterek || dataStore.isGons || dataStore.isLifeBusiness || dataStore.isPension || dataStore.isGns) {
465
517
  isElectronicContract.value = false;
466
518
  }
467
519
  }
468
520
  if (dataStore.isPension) {
469
- 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
+ }
470
526
  }
471
527
  };
472
528
 
@@ -522,25 +578,34 @@ export default defineComponent({
522
578
  dataStore.panelAction === constants.actions.return ||
523
579
  dataStore.panelAction === constants.actions.rejectclient,
524
580
  );
525
- const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept);
581
+ const acceptAction = computed(() => dataStore.panelAction === constants.actions.accept || (dataStore.isPension && dataStore.panelAction === constants.actions.signed));
526
582
  const signingActions = computed(() => dataStore.panelAction === constants.actions.sign);
527
583
  const payingActions = computed(() => dataStore.panelAction === constants.actions.pay);
528
584
  const affiliateActions = computed(() => dataStore.panelAction === constants.actions.affiliate);
529
585
  const chooseSignActions = computed(() => dataStore.controls.hasChooseSign && dataStore.panelAction === constants.actions.chooseSign);
530
586
  const choosePayActions = computed(() => dataStore.controls.hasChoosePay && dataStore.panelAction === constants.actions.choosePay);
531
-
587
+ // TODO на все продукты новое подписание
588
+ const isNewSign = computed(() => dataStore.isPension || dataStore.isGons || dataStore.isBaiterek);
532
589
  const paymentPeriod = computed(() => formStore.productConditionsForm.paymentPeriod.nameRu);
533
- 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
+ });
534
596
  const requestedSumInsured = computed(() => {
535
597
  if ((dataStore.isLifeBusiness || dataStore.isGns) && formStore.productConditionsForm.requestedSumInsured === null) {
536
598
  return dataStore.getNumberWithSpaces(formStore.applicationData.policyAppDto!.mainInsSum);
537
599
  }
538
- 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}₸`;
539
604
  });
540
605
  const price = computed(() => dataStore.getNumberWithSpaces(formStore.productConditionsForm.calculatorForm.price));
541
606
  const insuredAmount = computed(() => formStore.productConditionsForm.calculatorForm.amount!.nameRu! + dataStore.currency);
542
607
  const hasConditionsInfo = computed(() => {
543
- if (dataStore.isLifetrip || dataStore.isDas || dataStore.isUU || dataStore.isPrePension) {
608
+ if (dataStore.isLifetrip || dataStore.isDas || dataStore.isUU || dataStore.isPrePension || dataStore.isCritical || dataStore.isPension) {
544
609
  return false;
545
610
  }
546
611
  if (dataStore.isFinCenter()) {
@@ -549,7 +614,7 @@ export default defineComponent({
549
614
  return true;
550
615
  });
551
616
  const hasConditionsAction = computed(() => {
552
- if (dataStore.isPrePension) {
617
+ if (dataStore.isPrePension || dataStore.isCritical) {
553
618
  return false;
554
619
  }
555
620
  return true;
@@ -561,7 +626,7 @@ export default defineComponent({
561
626
  return true;
562
627
  });
563
628
  const isElectronicDisabled = computed(() => {
564
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns || dataStore.isPension) {
629
+ if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns) {
565
630
  return true;
566
631
  }
567
632
  return false;
@@ -570,28 +635,22 @@ export default defineComponent({
570
635
  if (dataStore.isGons) {
571
636
  return true;
572
637
  }
573
- if ((!consentGiven.value || formStore.applicationData.statusCode === 'HeadManagerForm') && dataStore.isPension && processCode !== 2) {
574
- return true;
575
- }
576
638
  return false;
577
639
  });
578
640
  const isQrDisabled = computed(() => {
579
- if (consentGiven.value && dataStore.isPension && processCode !== 2) {
580
- return false;
581
- }
582
641
  return true;
583
642
  });
584
643
  const isQrXmlDisabled = computed(() => {
585
- if (!consentGiven.value && dataStore.isPension && processCode !== 2) {
586
- return false;
587
- }
588
644
  if (dataStore.isLifeBusiness || dataStore.isGns) {
589
645
  return false;
590
646
  }
591
647
  return true;
592
648
  });
593
649
  const isSignatureDisabled = computed(() => {
594
- 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) {
595
654
  return false;
596
655
  }
597
656
  return true;
@@ -600,7 +659,7 @@ export default defineComponent({
600
659
  await dataStore.downloadTemplate(documentType, fileType, formStore.applicationData.processInstanceId);
601
660
  };
602
661
 
603
- const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml' | 'signature') => {
662
+ const handleSignAction = async (type: 'paper' | 'electronic' | 'scans' | 'qr' | 'qrXml') => {
604
663
  loading.value = true;
605
664
  if (type === 'electronic') {
606
665
  await dataStore.signDocument();
@@ -629,9 +688,6 @@ export default defineComponent({
629
688
  isQr.value = true;
630
689
  }
631
690
  }
632
- if (type === 'signature') {
633
- await dataStore.signDocument('signature');
634
- }
635
691
  loading.value = false;
636
692
  };
637
693
 
@@ -679,11 +735,7 @@ export default defineComponent({
679
735
  isQrLoading.value = true;
680
736
  } else if (message === 'Signed') {
681
737
  isQrLoading.value = false;
682
- if (dataStore.isPension) {
683
- dataStore.showToaster('info', dataStore.t('pension.signInProcess'));
684
- } else {
685
- dataStore.showToaster('success', dataStore.t('sign.successQrSigned'));
686
- }
738
+ dataStore.showToaster('success', dataStore.isPension ? 'Подписание прошло успешно' : dataStore.t('sign.successQrSigned'));
687
739
  qrUrl.value = '';
688
740
  isQr.value = false;
689
741
  dataStore.panel.open = false;
@@ -705,7 +757,7 @@ export default defineComponent({
705
757
  data.append('name', 'PAEnpf_Agreement');
706
758
  data.append('format', 'xml');
707
759
  data.append('EdsXmlId', groupId ?? '');
708
- await dataStore.api.uploadXml(data);
760
+ await dataStore.api.file.uploadXml(data);
709
761
  await dataStore.getSignedDocList(dataStore.formStore.applicationData.processInstanceId);
710
762
  dataStore.showToaster('success', dataStore.t('pension.consentGiven'), 3000);
711
763
  }
@@ -741,7 +793,7 @@ export default defineComponent({
741
793
  await dataStore.generateDocument();
742
794
  };
743
795
 
744
- const convertQr = async (url: string | null, template?: Api.GenerateShortLink.Templates) => {
796
+ const convertQr = async (url: string | null, template?: Types.Api.GenerateShortLink.Templates) => {
745
797
  if (url) {
746
798
  const shortedUrl = await dataStore.generateShortLink(url, template);
747
799
  qrUrl.value = typeof shortedUrl === 'string' && !!shortedUrl ? shortedUrl : url;
@@ -792,6 +844,99 @@ export default defineComponent({
792
844
  dataStore.panelAction = constants.actions.pay;
793
845
  };
794
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
+
795
940
  return {
796
941
  // State
797
942
  formStore,
@@ -813,6 +958,10 @@ export default defineComponent({
813
958
  processCode,
814
959
  isQrDialog,
815
960
  email,
961
+ signOptions,
962
+ signingFiles,
963
+ isOnlineEnpf,
964
+ currentFilePanel,
816
965
 
817
966
  // Functions
818
967
  closePanel,
@@ -824,11 +973,13 @@ export default defineComponent({
824
973
  downloadTemplate,
825
974
  onFileChangeScans,
826
975
  sendFiles,
976
+ sendFilesNew,
827
977
  onClearFile,
828
978
  closeQrPanel,
829
979
  handlePayAction,
830
980
  payEpay,
831
981
  convertQr,
982
+ setActualEnpf,
832
983
  sendInvoiceToEmail,
833
984
  hasConditionsAction,
834
985
 
@@ -841,6 +992,7 @@ export default defineComponent({
841
992
  affiliateActions,
842
993
  chooseSignActions,
843
994
  paymentPeriod,
995
+ isAllPaperSigned,
844
996
  insurancePremiumPerMonth,
845
997
  requestedSumInsured,
846
998
  affiliationDocument,
@@ -857,7 +1009,14 @@ export default defineComponent({
857
1009
  isQrXmlDisabled,
858
1010
  isSignatureDisabled,
859
1011
  choosePayActions,
860
- consentGiven,
1012
+ groupBy,
1013
+ newSign,
1014
+ onFileChangeScansNew,
1015
+ onClearFileNew,
1016
+ getFileNew,
1017
+ inSigningOrder,
1018
+ isNewSign,
1019
+ hasEpayPay,
861
1020
  };
862
1021
  },
863
1022
  });