id: 35e3a9ac-3024-4716-b588-c580429d2097 formKey: wfutl:initiatorInternalSigningTask title: en: UTL initiator internal signing task description: en: '' customModule: null typeRef: '' width: default i18n: ru: signing: Подписать comment: Комментировать en: signing: Sign comment: Comment definition: components: - key: panel2 type: panel input: false components: - label: comment clearOnHide: false defaultValue: '' key: comment type: textarea input: true - label: outcome clearOnHide: false hidden: true defaultValue: '' key: outcome properties: attribute: wfutl_initiatorSigningOutcome type: textfield input: true - inlineColumns: true columns: - components: - label: outcome_signing removeIndents: true action: custom state: '' showValidations: false custom: | data.outcome = "signing"; instance.root.submit(); block: true disableOnInvalid: true clearOnHide: false refreshOn: [] key: outcome_signing type: button input: true md: 3 type: column input: false key: column label: Column index: 0 clearOnHide: true conditional: show: null when: null hidden: true key: columns2 type: columns input: false - inlineColumns: true columns: - components: - label: signing removeIndents: true action: custom state: '' showValidations: false custom: |- const {options} = instance || {}; const {recordId} = options || {}; instance.currentForm.loading = true; Citeck.Records.get(recordId).load('document?id').then(docId => { const req = `${Alfresco.constants.PROXY_URI}citeck/get-document-package?nodeRef=${docId}`; fetch(req, {method: 'GET'}) .then(res => res.json()) .then(res => { const {status, message} = res || {}; const {code} = status || {}; if (_.isNumber(code) && code !== 200) { instance.currentForm.loading = false; throw `Server returned error. GET: ${req}. Code: ${code}. Message: ${message}.`; } const {currentForm} = instance || {}; const {components} = currentForm || {}; const btn = utils.getComponent(components, 'outcome_signing'); if (_.isArray(res)) { Citeck.Esign.sign(res, { onSigned: () => { instance.currentForm.loading = false; btn.buttonElement.click(); } }); } else { instance.currentForm.loading = false; throw `Response is not array. GET: ${req}. Response: ${res}`; } }).catch(e => { console.error(e); instance.currentForm.loading = false; instance.currentForm.showErrors(e); }); }); theme: primary block: true disableOnInvalid: true clearOnHide: false refreshOn: [] key: signing type: button input: true md: 3 type: column input: false key: column label: Column index: 0 clearOnHide: true conditional: show: null when: null key: columns3 type: columns input: false attributes: {}