Commit b416bc8f authored by Ilya Veselov's avatar Ilya Veselov

Add new file

parent a1856483
AS.FORMS.bus.on(AS.FORMS.EVENT_TYPE.formShow, (event, model, view) => {
const openAttachments = async documentID => {
let attachments = await AS.FORMS.ApiUtils.simpleAsyncGet(`rest/api/docflow/doc/attachments?documentID=${documentID}`);
if(attachments.work_files.length){
$(`table[document_id="${documentID}"]`)
.closest('.window-body')
.find('img[src*="images/close.png"]')
.closest('table')
.get(0)
.click();
window.location.href = '#' + jQuery.param({
submodule: 'common',
action: 'open_document',
document_identifier: documentID,
file_identifier: attachments.work_files[0].uuid
});
}
}
let documentID = AS.getUrlParam('document_identifier');
if(!documentID){
model.on(AS.FORMS.EVENT_TYPE.dataLoad, async () => {
const documentID = await AS.FORMS.ApiUtils.getDocumentIdentifier(model.asfDataId);
openAttachments(documentID);
});
}else{
openAttachments(documentID);
}
});
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment