diff --git a/client/modules/crm/res/templates/lead/convert.tpl b/client/modules/crm/res/templates/lead/convert.tpl index 6b371fda2d..8ae85eff7b 100644 --- a/client/modules/crm/res/templates/lead/convert.tpl +++ b/client/modules/crm/res/templates/lead/convert.tpl @@ -1,10 +1,4 @@ - + {{#each scopeList}}
diff --git a/client/modules/crm/src/views/lead/convert.js b/client/modules/crm/src/views/lead/convert.js index b5397d9e5e..2988db5aff 100644 --- a/client/modules/crm/src/views/lead/convert.js +++ b/client/modules/crm/src/views/lead/convert.js @@ -26,20 +26,22 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -import View from 'view'; +import ManinView from 'views/main'; -class ConvertLeadView extends View { +class ConvertLeadView extends ManinView { template = 'crm:lead/convert' data() { return { scopeList: this.scopeList, - scope: this.model.entityType, + scope: this.scope, }; } setup() { + this.scope = 'Lead'; + this.addHandler('change', 'input.check-scope', (e, /** HTMLInputElement */target) => { const scope = target.dataset.scope; const $div = this.$el.find(`.edit-container-${Espo.Utils.toDom(scope)}`); @@ -57,6 +59,13 @@ class ConvertLeadView extends View { this.getRouter().navigate(`#Lead/view/${this.id}`, {trigger: true}); }); + this.createView('header', 'views/header', { + model: this.model, + fullSelector: '#main > .header', + scope: this.scope, + fontSizeFlexible: true, + }); + this.wait(true); this.id = this.options.id; @@ -234,6 +243,38 @@ class ConvertLeadView extends View { process(data); } + + getHeader() { + const headerIconHtml = this.getHeaderIconHtml(); + const scopeLabel = this.getLanguage().translate(this.model.entityType, 'scopeNamesPlural'); + + const $root = + $('') + .append( + $('') + .attr('href', '#Lead') + .text(scopeLabel) + ); + + if (headerIconHtml) { + $root.prepend(headerIconHtml); + } + + const name = this.model.get('name') || this.model.id; + const url = `#${this.model.entityType}/view/${this.model.id}`; + + const $name = + $('') + .attr('href', url) + .addClass('action') + .append($('').text(name)); + + return this.buildHeaderHtml([ + $root, + $name, + $('').text(this.translate('convert', 'labels', 'Lead')) + ]); + } } export default ConvertLeadView;