From 1098540ae4a74513cb4d276c2d4f2bd3fb3e2dba Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 22 Feb 2025 09:03:34 +0200 Subject: [PATCH] ref --- client/src/views/record/detail.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index d76925e3f6..97b895dfab 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -32,6 +32,7 @@ import BaseRecordView from 'views/record/base'; import ViewRecordHelper from 'view-record-helper'; import ActionItemSetup from 'helpers/action-item-setup'; import StickyBarHelper from 'helpers/record/misc/sticky-bar'; +import SelectTemplateModalView from 'views/modals/select-template'; /** * A detail record view. @@ -2474,22 +2475,22 @@ class DetailRecordView extends BaseRecordView { } // noinspection JSUnusedGlobalSymbols - actionPrintPdf() { - this.createView('pdfTemplate', 'views/modals/select-template', { + async actionPrintPdf() { + const view = new SelectTemplateModalView({ entityType: this.entityType, - }, (view) => { - view.render(); + onSelect: models => { + const model = models[0]; - this.listenToOnce(view, 'select', (model) => { - this.clearView('pdfTemplate'); + const url = `?entryPoint=pdf&entityType=${this.entityType}&entityId=${this.model.id}` + + `&templateId=${model.id}`; - window.open( - '?entryPoint=pdf&entityType=' + - this.entityType + '&entityId=' + - this.model.id + '&templateId=' + model.id, '_blank' - ); - }); + window.open(url, '_blank'); + }, }); + + await this.assignView('modal', view); + + await view.render(); } afterSave() {