hl-core 0.0.9-beta.53 → 0.0.9-beta.54

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.
package/api/base.api.ts CHANGED
@@ -959,13 +959,6 @@ export class ApiClass {
959
959
  });
960
960
  }
961
961
 
962
- async getDocument(id: string) {
963
- return await this.axiosCall<any>({
964
- method: Methods.POST,
965
- url: `/${this.productUrl}/api/Application/GetDocument/${id}`,
966
- });
967
- }
968
-
969
962
  async uploadXml(data: any) {
970
963
  return await this.axiosCall<void>({
971
964
  url: `/File/api/Document/UploadXml`,
@@ -1050,4 +1043,18 @@ export class ApiClass {
1050
1043
  data: data,
1051
1044
  });
1052
1045
  }
1046
+
1047
+ async getDocumentsByEdsXmlId(edsXmlId: string) {
1048
+ return await this.axiosCall<any>({
1049
+ method: Methods.GET,
1050
+ url: `/File/api/Sign/GetDocumentsByEdsXmlId/${edsXmlId}`,
1051
+ })
1052
+ }
1053
+
1054
+ async checkSign(id: string) {
1055
+ return await this.axiosCall<SignedState>({
1056
+ method: Methods.POST,
1057
+ url: `/${this.productUrl}/api/Application/CheckSign/${id}`,
1058
+ });
1059
+ }
1053
1060
  }
@@ -8,6 +8,7 @@
8
8
  <v-expansion-panel-text class="border-t-[1px] no-padding">
9
9
  <v-form ref="vForm" class="flex flex-col divide-y">
10
10
  <base-panel-input
11
+ v-if="isSaleChanellShown"
11
12
  class="pl-1 pt-1"
12
13
  v-model="formStore.SaleChanellPolicy"
13
14
  :value="formStore.SaleChanellPolicy?.nameRu"
@@ -19,6 +20,7 @@
19
20
  @append="openPanel('SaleChanellPolicy', $dataStore.t('form.salesChanell'))"
20
21
  />
21
22
  <base-panel-input
23
+ v-if="isRegionShown"
22
24
  class="pl-1 pt-1"
23
25
  v-model="formStore.RegionPolicy"
24
26
  :value="formStore.RegionPolicy?.nameRu"
@@ -30,6 +32,7 @@
30
32
  @append="openPanel('RegionPolicy', $dataStore.t('form.Region'))"
31
33
  />
32
34
  <base-panel-input
35
+ v-if="isManagerShown"
33
36
  class="pl-1 pt-1"
34
37
  v-model="formStore.ManagerPolicy"
35
38
  :value="formStore.ManagerPolicy?.nameRu"
@@ -41,6 +44,7 @@
41
44
  @append="openPanel('ManagerPolicy', $dataStore.t('form.manager'))"
42
45
  />
43
46
  <base-panel-input
47
+ v-if="isAgentShown"
44
48
  class="pl-1 pt-1"
45
49
  v-model="formStore.AgentData"
46
50
  :value="formStore.AgentData?.fullName"
@@ -134,22 +138,37 @@ export default defineComponent({
134
138
  (route.params.taskId !== '0' && (!dataStore.isProcessEditable(formStore.applicationData.statusCode) || !dataStore.isTask())),
135
139
  );
136
140
  const isSaleChanellReadonly = computed(() => {
137
- if (dataStore.isGons) return isReadonly.value || !dataStore.isServiceManager();
141
+ if (dataStore.isGons) return isReadonly.value && dataStore.isServiceManager();
138
142
  return isReadonly.value;
139
143
  });
140
144
  const isRegionReadonly = computed(() => {
141
- if (dataStore.isGons) return isReadonly.value || !dataStore.isServiceManager();
145
+ if (dataStore.isGons) return isReadonly.value && (dataStore.isServiceManager() || dataStore.isAgent());
142
146
  return isReadonly.value;
143
147
  });
144
148
  const isManagerReadonly = computed(() => {
145
- if (dataStore.isGons) return isReadonly.value || !dataStore.isServiceManager();
149
+ if (dataStore.isGons) return isReadonly.value && dataStore.isServiceManager();
146
150
  return isReadonly.value;
147
151
  });
148
152
  const isAgentReadonly = computed(() => {
149
- if (dataStore.isGons || dataStore.isPension) return isReadonly.value || !dataStore.isAgent();
153
+ if (dataStore.isGons || dataStore.isPension) return isReadonly.value && dataStore.isServiceManager();
150
154
  return isReadonly.value;
151
155
  });
152
-
156
+ const isSaleChanellShown = computed(() => {
157
+ if (dataStore.isGons) return dataStore.isServiceManager();
158
+ return true;
159
+ });
160
+ const isRegionShown = computed(() => {
161
+ if (dataStore.isGons) return dataStore.isServiceManager() || dataStore.isAgent();
162
+ return true;
163
+ });
164
+ const isManagerShown = computed(() => {
165
+ if (dataStore.isGons) return dataStore.isServiceManager();
166
+ return true;
167
+ });
168
+ const isAgentShown = computed(() => {
169
+ if (dataStore.isGons || dataStore.isPension) return dataStore.isServiceManager();
170
+ return true;
171
+ });
153
172
  const openPanel = async (currentDict: ManagerAttachmentFiels, title: string) => {
154
173
  searchQuery.value = '';
155
174
  if (dataStore.isTask() && !props.disabled) {
@@ -204,7 +223,9 @@ export default defineComponent({
204
223
  () => formStore.RegionPolicy,
205
224
  (val, oldVal) => {
206
225
  if (val.ids !== oldVal.ids) {
207
- formStore.ManagerPolicy = new Value();
226
+ if (!dataStore.isGons) {
227
+ formStore.ManagerPolicy = new Value();
228
+ }
208
229
  }
209
230
  },
210
231
  );
@@ -244,7 +265,10 @@ export default defineComponent({
244
265
  isRegionReadonly,
245
266
  isManagerReadonly,
246
267
  isAgentReadonly,
247
-
268
+ isSaleChanellShown,
269
+ isRegionShown,
270
+ isManagerShown,
271
+ isAgentShown,
248
272
  // Functions
249
273
  openPanel,
250
274
  searchAgent,
@@ -460,7 +460,7 @@
460
460
  v-model="member.documentIssuers"
461
461
  :value="member.documentIssuers?.nameRu"
462
462
  :label="$dataStore.t('form.documentIssuers')"
463
- :readonly="isDisabled || !!member.parsedDocument?.documentIssuer"
463
+ :readonly="isDisabled"
464
464
  :clearable="!isDisabled"
465
465
  :rules="$rules.objectRequired"
466
466
  append-inner-icon="mdi mdi-chevron-right"
@@ -383,6 +383,7 @@
383
383
  class="pension-guaranteed-period"
384
384
  :readonly="isDisabled"
385
385
  :clearable="!isDisabled"
386
+ :rules="$rules.notZero"
386
387
  :label="$dataStore.t('pension.guaranteedPeriod')"
387
388
  :items="guaranteedPeriodList"
388
389
  :hide-details="true"
@@ -34,7 +34,13 @@
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 :text="$dataStore.t('buttons.sendEgovMob')" :disabled="isQrDisabled" :loading="loading" @click="handleSignAction('qr')" />
37
- <base-btn v-if="$dataStore.isPension" :text="$dataStore.t('buttons.signWithSignature')" :loading="loading" @click="handleSignAction('signature')" />
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
+ />
38
44
  <base-btn
39
45
  v-if="$dataStore.isPension"
40
46
  :text="$dataStore.t('buttons.signWithSignatureXML')"
@@ -49,16 +55,18 @@
49
55
  <div v-if="isScansDocuments" :class="[$styles.flexColNav]">
50
56
  <div v-if="$dataStore.isPension">
51
57
  <div v-if="processCode == 19">
52
- <div v-if="formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson' || formStore.applicationData.statusCode === 'ContractSignedFrom'">
58
+ <div v-if="formStore.applicationData.statusCode === 'HeadManagerForm' || formStore.applicationData.statusCode === 'ContractSignedFrom'">
53
59
  <base-btn :text="$dataStore.t('buttons.downloadContract')" :loading="$dataStore.isButtonsLoading" @click="$dataStore.generatePDFDocument('PA_Contract', '38')" />
54
60
  <base-form-section class="mt-4 flex flex-col !gap-2" :title="$dataStore.t('clients.attachScansSignDocs')">
55
61
  <base-file-input :label="$dataStore.t('labels.attachContract')" @input.prevent="onFileChangeScans($event, 'pa_contract')" @onClear="onClearFile('pa_contract')" />
56
62
  </base-form-section>
57
63
  </div>
58
- <div v-else>
64
+ <div v-else class="flex flex-col gap-2">
59
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')" />
60
67
  <base-form-section class="mt-4 flex flex-col !gap-2" :title="$dataStore.t('clients.attachScansSignDocs')">
61
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')" />
62
70
  </base-form-section>
63
71
  </div>
64
72
  </div>
@@ -277,7 +285,7 @@ export default defineComponent({
277
285
  (pensionForm.compulsoryProfContractAmount && pensionForm.compulsoryProfContractAmount !== 0) ||
278
286
  (pensionForm.voluntaryContractAmount && pensionForm.voluntaryContractAmount !== 0)),
279
287
  );
280
- const consentGiven = computed(() => !!formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed && needsAgreement.value);
288
+ const consentGiven = computed(() => !!formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed);
281
289
  const affiliationDocument = computed(() => formStore.signedDocumentList.find((file: DocumentItem) => file.fileTypeName === 'Решение АС'));
282
290
  const affiliationData = ref<{
283
291
  processInstanceId: string | number;
@@ -324,7 +332,7 @@ export default defineComponent({
324
332
 
325
333
  const onFileChangeScans = async (
326
334
  event: InputEvent,
327
- type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney',
335
+ type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
328
336
  ) => {
329
337
  if (event.target) {
330
338
  const files = (event.target as HTMLInputElement).files;
@@ -344,13 +352,15 @@ export default defineComponent({
344
352
  }
345
353
  };
346
354
 
347
- const onClearFile = async (type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney') => {
355
+ const onClearFile = async (
356
+ type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement',
357
+ ) => {
348
358
  const doc = await selectedDocument(type);
349
359
  const result = scansFiles.value.filter(i => JSON.parse(i.fileData)[0].fileTypeCode !== doc.code);
350
360
  scansFiles.value = result;
351
361
  };
352
362
 
353
- const selectedDocument = (type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney') => {
363
+ const selectedDocument = (type: 'statement' | 'pa_statement' | 'pa_refundstatement' | 'contract' | 'pa_contract' | 'pa_refundagreement' | 'app' | 'attorney' | 'agreement') => {
354
364
  let selectedDocument: any;
355
365
  if (type === 'statement') {
356
366
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '32');
@@ -376,11 +386,20 @@ export default defineComponent({
376
386
  if (type === 'attorney') {
377
387
  selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '34');
378
388
  }
389
+ if (type === 'agreement') {
390
+ selectedDocument = dataStore.dicFileTypeList.find((i: Value) => i.code === '19');
391
+ }
379
392
  return selectedDocument;
380
393
  };
381
394
 
382
395
  const sendFiles = async () => {
383
- if (dataStore.isPension ? scansFiles.value.length !== 1 : scansFiles.value.length !== 4) {
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
+ ) {
384
403
  dataStore.showToaster('warning', dataStore.t('toaster.notAllDocumentsAttached'));
385
404
  return;
386
405
  }
@@ -542,41 +561,39 @@ export default defineComponent({
542
561
  return true;
543
562
  });
544
563
  const isElectronicDisabled = computed(() => {
545
- if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns) {
564
+ if (dataStore.isGons || dataStore.isLifeBusiness || dataStore.isGns || dataStore.isPension) {
546
565
  return true;
547
566
  }
548
- if (formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson') {
549
- return true;
550
- }
551
- if (needsAgreement.value) {
552
- if (!consentGiven.value && dataStore.isPension) {
553
- return true;
554
- }
555
- }
556
567
  return false;
557
568
  });
558
569
  const isScansDisabled = computed(() => {
559
570
  if (dataStore.isGons) {
560
571
  return true;
561
572
  }
562
- if (needsAgreement.value) {
563
- if (!consentGiven.value && dataStore.isPension && formStore.applicationData.statusCode !== 'ContractSignedFrom') {
564
- return true;
565
- }
573
+ if (!consentGiven.value && dataStore.isPension) {
574
+ return true;
566
575
  }
567
576
  return false;
568
577
  });
569
578
  const isQrDisabled = computed(() => {
570
- if (needsAgreement.value) {
571
- if (!consentGiven.value && dataStore.isPension) {
572
- return true;
573
- }
579
+ if (dataStore.isPension) {
580
+ return !!needsAgreement.value && !consentGiven.value;
574
581
  }
575
582
  return true;
576
583
  });
577
584
  const isQrXmlDisabled = computed(() => {
578
- if (consentGiven.value && needsAgreement.value) {
579
- return false;
585
+ if (dataStore.isPension) {
586
+ if (consentGiven.value && needsAgreement.value) {
587
+ return false;
588
+ }
589
+ }
590
+ return true;
591
+ });
592
+ const isSignatureDisabled = computed(() => {
593
+ if (dataStore.isPension) {
594
+ if (!consentGiven.value) {
595
+ return false;
596
+ }
580
597
  }
581
598
  return true;
582
599
  });
@@ -651,7 +668,7 @@ export default defineComponent({
651
668
  };
652
669
 
653
670
  const startConnection = async (uuid: string, groupId?: string) => {
654
- connection.value = new HubConnectionBuilder().withUrl(`https://test-sign.halyklife.kz/qrhub/${uuid}`).withAutomaticReconnect().build();
671
+ connection.value = new HubConnectionBuilder().withUrl(`${getStrValuePerEnv('qrHubUrl')}/${uuid}`).withAutomaticReconnect().build();
655
672
  try {
656
673
  await connection.value.start();
657
674
  console.log('SignalR connection started.');
@@ -668,7 +685,7 @@ export default defineComponent({
668
685
  await stopConnection();
669
686
  } else {
670
687
  console.log('message from SignalR', message);
671
- if (message.signed) {
688
+ if (message.signed === true) {
672
689
  isQrLoading.value = false;
673
690
  qrUrl.value = '';
674
691
  isQr.value = false;
@@ -687,6 +704,10 @@ export default defineComponent({
687
704
  dataStore.showToaster('success', dataStore.t('pension.consentGiven'), 3000);
688
705
  }
689
706
  await stopConnection();
707
+ } else {
708
+ if (message.error) {
709
+ dataStore.showToaster('error', message.error, 3000);
710
+ }
690
711
  }
691
712
  }
692
713
  });
@@ -828,6 +849,7 @@ export default defineComponent({
828
849
  isScansDisabled,
829
850
  isQrDisabled,
830
851
  isQrXmlDisabled,
852
+ isSignatureDisabled,
831
853
  choosePayActions,
832
854
  consentGiven,
833
855
  needsAgreement,
@@ -26,37 +26,44 @@ export const constants = Object.freeze({
26
26
  extractedProducts: ['dso', 'uu'],
27
27
  editableStatuses: [Statuses.StartForm, Statuses.EditBeneficiaryForm, Statuses.EditForm, Statuses.InputDataForm],
28
28
  documentsLinkVisibleStatuses: [
29
- Statuses.DocumentsSignedFrom,
30
- Statuses.DocumentsSignedClientFrom,
29
+ Statuses.Completed,
31
30
  Statuses.UnderwriterForm,
31
+ Statuses.DocumentsSignedFrom,
32
32
  Statuses.AffilationResolutionForm,
33
- Statuses.Completed,
33
+ Statuses.DocumentsSignedClientFrom,
34
34
  Statuses.InsurancePremiumOnlinePaid,
35
35
  ],
36
36
  returnStatementStatuses: [
37
- Statuses.DocumentsSignedFrom,
38
- Statuses.DocumentsSignedClientFrom,
39
- Statuses.ContractSignedFrom,
40
- Statuses.WaitingInsurancePremiumForm,
41
- Statuses.UnderwriterForm,
42
37
  Statuses.ApproveForm,
43
38
  Statuses.ActuaryForm,
44
- Statuses.ControllerDpForm,
45
39
  Statuses.DsoUsnsForm,
46
40
  Statuses.AccountantForm,
41
+ Statuses.UnderwriterForm,
42
+ Statuses.ControllerDpForm,
43
+ Statuses.ContractSignedFrom,
44
+ Statuses.DocumentsSignedFrom,
45
+ Statuses.DocumentsSignedClientFrom,
46
+ Statuses.WaitingInsurancePremiumForm,
47
47
  ],
48
48
  cancelApplicationStatuses: [
49
- Statuses.StartForm,
50
49
  Statuses.EditForm,
50
+ Statuses.StartForm,
51
+ Statuses.ContractSignedFrom,
51
52
  Statuses.EditBeneficiaryForm,
52
- Statuses.WaitingInsurancePremiumForm,
53
53
  Statuses.DocumentsSignedFrom,
54
+ Statuses.AttachAppContractForm,
55
+ Statuses.PreparationDossierForm,
54
56
  Statuses.DocumentsSignedClientFrom,
57
+ Statuses.WaitingInsurancePremiumForm,
58
+ ],
59
+ rejectApplicationStatuses: [
60
+ Statuses.StartForm,
61
+ Statuses.DsoUsnsForm,
62
+ Statuses.AccountantForm,
63
+ Statuses.HeadManagerForm,
55
64
  Statuses.ContractSignedFrom,
56
65
  Statuses.AttachAppContractForm,
57
- Statuses.PreparationDossierForm,
58
66
  ],
59
- rejectApplicationStatuses: [Statuses.StartForm, Statuses.AttachAppContractForm, Statuses.DsoUsnsForm, Statuses.AccountantForm, Statuses.ContractSignedByAuthorizedPerson, Statuses.ContractSignedFrom],
60
67
  gbdErrors: ['INVALID', 'TIMEOUT', 'ERROR', 'NOT_FOUND'],
61
68
  roles: Roles,
62
69
  actions: Actions,
@@ -341,6 +341,7 @@ export const getLastDayOfMonth = (year: number, month: number) => {
341
341
  };
342
342
 
343
343
  type WhichValuePerEnv =
344
+ | 'qrHubUrl'
344
345
  | 'qrGenUrl'
345
346
  | 'qrXmlGenUrl'
346
347
  | 'gatewayApiUrl'
@@ -358,6 +359,11 @@ export const getStrValuePerEnv = (which: WhichValuePerEnv) => {
358
359
  [key in EnvModes]: string;
359
360
  };
360
361
  } = {
362
+ qrHubUrl: {
363
+ production: 'https://prod-sign.halyklife.kz/qrhub',
364
+ development: 'https://test-sign.halyklife.kz/qrhub',
365
+ test: 'https://test-sign.halyklife.kz/qrhub',
366
+ },
361
367
  qrGenUrl: {
362
368
  production: 'https://prod-sign.halyklife.kz/EgovQrCms',
363
369
  development: 'https://test-sign.halyklife.kz/EgovQrCms',
package/locales/ru.json CHANGED
@@ -218,6 +218,7 @@
218
218
  "fromKGD": "КГД",
219
219
  "generatePrintedForms": "Сформировать печатные формы",
220
220
  "downloadStatement": "Скачать заявление",
221
+ "downloadAgreement": "Скачать согласие",
221
222
  "downloadApplication": "Скачать приложение №1",
222
223
  "downloadPowerOfAttorney": "Скачать доверенность",
223
224
  "downloadPARefundStatement": "Скачать заявление на страхование возврат в ЕНПФ ПА",
@@ -806,6 +807,7 @@
806
807
  "inDetails": "Подробно",
807
808
  "attachContract": "Вложить договор",
808
809
  "attachStatement": "Вложить заявление",
810
+ "attachAgreement": "Вложить согласие",
809
811
  "attachApplication": "Вложить приложение №1",
810
812
  "attachPowerOfAttorney": "Вложить доверенность",
811
813
  "noDocuments": "Нет документов для просмотра",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hl-core",
3
- "version": "0.0.9-beta.53",
3
+ "version": "0.0.9-beta.54",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "main": "nuxt.config.ts",
@@ -2527,7 +2527,7 @@ export const useDataStore = defineStore('data', {
2527
2527
  },
2528
2528
  ];
2529
2529
  }
2530
- case 'ContractSignedByAuthorizedPerson':
2530
+ case 'HeadManagerForm':
2531
2531
  return [
2532
2532
  {
2533
2533
  processInstanceId: String(this.formStore.applicationData.processInstanceId),
@@ -2559,19 +2559,20 @@ export const useDataStore = defineStore('data', {
2559
2559
  return signData;
2560
2560
  } else if (type === 'signature') {
2561
2561
  const ncaLayerClient = new NCALayerClient();
2562
+ const formTemplate = new FormData();
2563
+ formTemplate.append('format', 'pdf');
2564
+ formTemplate.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2562
2565
  let activeTokens;
2563
2566
  try {
2564
2567
  await ncaLayerClient.connect();
2565
2568
  activeTokens = await ncaLayerClient.getActiveTokens();
2566
2569
  const storageType = activeTokens[0] || NCALayerClient.fileStorageType;
2567
- if (this.formStore.applicationData.statusCode === 'ContractSignedByAuthorizedPerson') {
2570
+ if (this.formStore.applicationData.statusCode === 'HeadManagerForm') {
2568
2571
  const document = await this.generatePDFDocument('PAEnpf_Agreement', '40', 'pdf');
2569
2572
  const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2570
- const formData = new FormData();
2573
+ const formData = formTemplate;
2571
2574
  formData.append('base64EncodedSignature', base64EncodedSignature);
2572
- formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2573
2575
  formData.append('name', 'PAEnpf_Agreement');
2574
- formData.append('format', 'pdf');
2575
2576
  try {
2576
2577
  await this.api.uploadDigitalCertifijcate(formData);
2577
2578
  await this.handleTask('accept', String(this.formStore.applicationTaskId));
@@ -2582,11 +2583,9 @@ export const useDataStore = defineStore('data', {
2582
2583
  } else if (this.formStore.applicationData.statusCode === 'ContractSignedFrom') {
2583
2584
  const document = await this.generatePDFDocument('PA_Contract', '38', 'pdf');
2584
2585
  const base64EncodedSignature = await ncaLayerClient.basicsSignCMS(storageType, document, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2585
- const formData = new FormData();
2586
+ const formData = formTemplate;
2586
2587
  formData.append('base64EncodedSignature', base64EncodedSignature);
2587
- formData.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2588
2588
  formData.append('name', 'PA_Contract');
2589
- formData.append('format', 'pdf');
2590
2589
  try {
2591
2590
  await this.api.uploadDigitalCertifijcate(formData);
2592
2591
  await this.handleTask('accept', String(this.formStore.applicationTaskId));
@@ -2595,24 +2594,41 @@ export const useDataStore = defineStore('data', {
2595
2594
  return;
2596
2595
  }
2597
2596
  } else {
2598
- const agreementXml = await this.getDocument(this.formStore.applicationData.processInstanceId as string);
2599
- const wnd = window.open('about:blank', '', '_blank');
2600
- wnd?.document.write(agreementXml as any);
2601
- const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml, 'SIGNATURE', '');
2602
- const document = {
2603
- processInstanceId: String(this.formStore.applicationData.processInstanceId),
2604
- name: 'PAEnpf_Agreement',
2605
- format: 'xml',
2606
- };
2607
- const signData = await this.api.signXml([document]);
2608
- const data = new FormData();
2609
- data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2610
- data.append('xmlData', signedAgreement);
2611
- data.append('name', 'PAEnpf_Agreement');
2612
- data.append('format', 'xml');
2613
- data.append('EdsXmlId', signData.data);
2614
- await this.api.uploadXml(data);
2615
- await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2597
+ if (!!this.formStore.signedDocumentList.find(i => i.fileTypeCode === '43')?.signed) {
2598
+ const statement = await this.generatePDFDocument('PA_Statement', '37', 'pdf');
2599
+ const statementSignature = await ncaLayerClient.basicsSignCMS(storageType, statement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2600
+ const statementData = formTemplate;
2601
+ statementData.append('base64EncodedSignature', statementSignature);
2602
+ statementData.append('name', 'PA_Statement');
2603
+ await this.api.uploadDigitalCertifijcate(statementData);
2604
+ const agreement = await this.generatePDFDocument('Agreement', '19', 'pdf');
2605
+ const agreementSignature = await ncaLayerClient.basicsSignCMS(storageType, agreement, NCALayerClient.basicsCMSParams, NCALayerClient.basicsSignerSignAny);
2606
+ const agreementData = formTemplate;
2607
+ agreementData.append('base64EncodedSignature', agreementSignature);
2608
+ agreementData.append('name', 'Agreement');
2609
+ await this.api.uploadDigitalCertifijcate(agreementData);
2610
+ await this.handleTask('accept', String(this.formStore.applicationTaskId));
2611
+ } else {
2612
+ const document = {
2613
+ processInstanceId: String(this.formStore.applicationData.processInstanceId),
2614
+ name: 'PAEnpf_Agreement',
2615
+ format: 'xml',
2616
+ };
2617
+ const signData = await this.api.signXml([document]);
2618
+ const agreementXml = await this.api.getDocumentsByEdsXmlId(signData.data);
2619
+ const wnd = window.open('about:blank', '', '_blank');
2620
+ wnd?.document.write(agreementXml.data.document.documentXml);
2621
+ const signedAgreement = await ncaLayerClient.signXml(storageType, agreementXml.data.document.documentXml, 'SIGNATURE', '');
2622
+ const data = new FormData();
2623
+ data.append('processInstanceId', String(this.formStore.applicationData.processInstanceId));
2624
+ data.append('xmlData', signedAgreement);
2625
+ data.append('name', 'PAEnpf_Agreement');
2626
+ data.append('format', 'xml');
2627
+ data.append('EdsXmlId', signData.data);
2628
+ await this.api.uploadXml(data);
2629
+ await this.getSignedDocList(this.formStore.applicationData.processInstanceId);
2630
+ this.showToaster('success', this.t('pension.consentGiven'), 3000);
2631
+ }
2616
2632
  }
2617
2633
  } catch (error) {
2618
2634
  this.showToaster('error', String(error));
@@ -3760,14 +3776,6 @@ export const useDataStore = defineStore('data', {
3760
3776
  return ErrorHandler(err);
3761
3777
  }
3762
3778
  },
3763
- async getDocument(id: string) {
3764
- try {
3765
- const response = await this.api.getDocument(id);
3766
- return response;
3767
- } catch (err) {
3768
- return ErrorHandler(err);
3769
- }
3770
- },
3771
3779
  async generateShortLink(url: string) {
3772
3780
  try {
3773
3781
  const response = await this.api.generateShortLink({
package/types/enum.ts CHANGED
@@ -121,7 +121,7 @@ export enum Statuses {
121
121
  ActuaryForm = 'ActuaryForm',
122
122
  DsoUsnsForm = 'DsoUsnsForm',
123
123
  AccountantForm = 'AccountantForm',
124
- ContractSignedByAuthorizedPerson = 'ContractSignedByAuthorizedPerson',
124
+ HeadManagerForm = 'HeadManagerForm',
125
125
  }
126
126
 
127
127
  export enum MemberCodes {
package/types/index.ts CHANGED
@@ -755,4 +755,11 @@ declare global {
755
755
  };
756
756
 
757
757
  type ResponseStructure<T> = { code: 0; message: 'OK'; data: T };
758
+
759
+ type SignedState = {
760
+ isOnline: boolean;
761
+ signValue: number;
762
+ signName: string;
763
+ code: string;
764
+ };
758
765
  }