contacts select in meetings

This commit is contained in:
Yuri Kuznetsov
2014-08-05 11:44:10 +03:00
parent 3e9c7056b0
commit dd5fabdfa4
5 changed files with 50 additions and 5 deletions
@@ -52,7 +52,8 @@
},
"contacts": {
"type": "linkMultiple",
"disabled": true
"disabled": true,
"view": "Crm:Meeting.Fields.Contacts"
},
"leads": {
"type": "linkMultiple",
@@ -47,7 +47,8 @@
},
"contacts": {
"type": "linkMultiple",
"disabled": true
"disabled": true,
"view": "Crm:Meeting.Fields.Contacts"
},
"leads": {
"type": "linkMultiple",
@@ -0,0 +1,40 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM - Open Source CRM application.
* Copyright (C) 2014 Yuri Kuznetsov, Taras Machyshyn, Oleksiy Avramenko
* Website: http://www.espocrm.com
*
* EspoCRM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EspoCRM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EspoCRM. If not, see http://www.gnu.org/licenses/.
************************************************************************/
Espo.define('Crm:Views.Meeting.Fields.Contacts', 'Views.Fields.LinkMultiple', function (Dep) {
return Dep.extend({
getSelectFilters: function () {
if (this.model.get('parentType') == 'Account' && this.model.get('parentId')) {
return {
'account': {
type: 'equals',
field: 'accountId',
value: this.model.get('parentId'),
valueName: this.model.get('parentName'),
}
};
}
},
});
});
@@ -74,7 +74,7 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
if (this.mode != 'list') {
this.addActionHandler('selectLink', function () {
Espo.Ui.notify('Loading...');
this.notify('Loading...');
this.createView('dialog', 'Modals.SelectRecords', {
scope: this.foreignScope,
createButton: this.mode != 'search'
@@ -84,12 +84,14 @@ Espo.define('Views.Fields.LinkParent', 'Views.Fields.Base', function (Dep) {
dialog.once('select', function (model) {
self.$elementName.val(model.get('name'));
self.$elementId.val(model.get('id'));
self.trigger('change');
});
});
});
this.addActionHandler('clearLink', function () {
this.$elementName.val('');
this.$elementId.val('');
this.$elementId.val('');
this.trigger('change');
});
this.events['change select[name="' + this.typeName + '"]'] = function (e) {
@@ -62,7 +62,8 @@ Espo.define('Views.Record.Panels.Side', 'View', function (Dep) {
createField: function (field, readOnly) {
var type = this.model.getFieldType(field) || 'base';
this.createView(field, 'Fields.' + Espo.Utils.upperCaseFirst(type), {
var viewName = this.model.getFieldParam(field, 'view') || this.getFieldManager().getViewName(type);
this.createView(field, viewName, {
model: this.model,
el: this.options.el + ' .field-' + field,
defs: {