class TemplatesController extends EICController { constructor() { super() } async search() { app.User.getBusinessPermissions(['/templates']) .then(async payload => { if(payload['/templates'].permissions.length > 0) { let models = { templates: new TemplatesModel(payload['/templates'].permissions) } this.loadWindow('comms/templates/manager/TemplatesManagerView', { title: 'Templates', static: true, expanded: true }, { models: models } ) } else { ui.growl.append('Sorry, you do not have access to this resource', 'danger') } }) } async tplAction(options) { app.User.getBusinessPermissions(['/templates']) .then(async payload => { if(payload['/templates'].permissions.length > 0) { const templateId = options.params.id; let models = { templates: new TemplatesModel(payload['/templates'].permissions) } // Edit template this.loadWindow( 'comms/templates/editor/TemplatesEditorView', { title: 'Edit Template ' + templateId.substring(0, 6), static: true, expanded: true }, { id: templateId, models: models }) } else { ui.growl.append('Sorry, you do not have access to this resource', 'danger') } }) } } app.registerClass('TemplatesController', TemplatesController);