This commit is contained in:
Yuri Kuznetsov
2025-02-23 17:08:31 +02:00
parent e79e9d6ce1
commit 4ee79811bc
7 changed files with 243 additions and 295 deletions
@@ -26,48 +26,48 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/call/fields/contacts', ['crm:views/meeting/fields/contacts'], function (Dep) {
import AttendeesFieldView from 'modules/crm/views/meeting/fields/attendees';
return Dep.extend({
export default class extends AttendeesFieldView {
getAttributeList: function () {
let list = Dep.prototype.getAttributeList.call(this);
getAttributeList() {
return [
...super.getAttributeList(),
'phoneNumbersMap',
]
}
list.push('phoneNumbersMap');
getDetailLinkHtml(id, name) {
const html = super.getDetailLinkHtml(id, name);
return list;
},
const key = this.foreignScope + '_' + id;
const phoneNumbersMap = this.model.get('phoneNumbersMap') || {};
getDetailLinkHtml: function (id, name) {
let html = Dep.prototype.getDetailLinkHtml.call(this, id, name);
if (!(key in phoneNumbersMap)) {
return html;
}
let key = this.foreignScope + '_' + id;
let phoneNumbersMap = this.model.get('phoneNumbersMap') || {};
const number = phoneNumbersMap[key];
if (!(key in phoneNumbersMap)) {
return html;
}
const $item = $(html);
let number = phoneNumbersMap[key];
// @todo Format phone number.
let $item = $(html);
$item
.append(
' ',
$('<span>').addClass('text-muted middle-dot'),
' ',
$('<a>')
.attr('href', 'tel:' + number)
.attr('data-phone-number', number)
.attr('data-action', 'dial')
.addClass('small')
.text(number)
)
$item
.append(
' ',
$('<span>').addClass('text-muted middle-dot'),
' ',
$('<a>')
.attr('href', 'tel:' + number)
.attr('data-phone-number', number)
.attr('data-action', 'dial')
.addClass('small')
.text(number)
)
return $('<div>')
.append($item)
.get(0).outerHTML;
},
});
});
return $('<div>')
.append($item)
.get(0).outerHTML;
}
}
@@ -26,43 +26,6 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/call/fields/leads', ['crm:views/meeting/fields/attendees', 'crm:views/call/fields/contacts'],
function (Dep, Contacts) {
import ContactsFieldView from 'modules/crm/views/call/fields/contacts';
return Dep.extend({
getAttributeList: function () {
let list = Dep.prototype.getAttributeList.call(this);
list.push('phoneNumbersMap');
return list;
},
getDetailLinkHtml: function (id, name) {
return Contacts.prototype.getDetailLinkHtml.call(this, id, name);
},
getDetailLinkHtml1: function (id, name) {
var html = Dep.prototype.getDetailLinkHtml.call(this, id, name);
var key = this.foreignScope + '_' + id;
var number = null;
var phoneNumbersMap = this.model.get('phoneNumbersMap') || {};
if (key in phoneNumbersMap) {
number = phoneNumbersMap[key];
var innerHtml = $(html).html();
innerHtml += (
' <span class="text-muted middle-dot"></span> ' +
'<a href="tel:' + number + '" class="small" data-phone-number="' + number + '" data-action="dial">' +
number + '</a>'
);
html = '<div>' + innerHtml + '</div>';
}
return html;
},
});
});
export default class extends ContactsFieldView {}
@@ -26,9 +26,6 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/call/record/edit-small', ['views/record/edit'], function (Dep) {
import EditRecordView from 'views/record/edit';
return Dep.extend({
});
});
export default class extends EditRecordView {}
+100 -108
View File
@@ -26,119 +26,111 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/call/record/list', ['views/record/list'], function (Dep) {
import ListRecordView from 'views/record/list';
return Dep.extend({
export default class extends ListRecordView {
rowActionsView: 'crm:views/call/record/row-actions/default',
rowActionsView = 'modules/crm/views/call/record/row-actions/default'
setup: function () {
Dep.prototype.setup.call(this);
setup() {
super.setup();
if (
this.getAcl().checkScope(this.entityType, 'edit') &&
this.getAcl().checkField(this.entityType, 'status', 'edit')
) {
this.massActionList.push('setHeld');
this.massActionList.push('setNotHeld');
if (
this.getAcl().checkScope(this.entityType, 'edit') &&
this.getAcl().checkField(this.entityType, 'status', 'edit')
) {
this.massActionList.push('setHeld');
this.massActionList.push('setNotHeld');
}
}
/**
* @protected
* @param {Record} data
*/
async actionSetHeld(data) {
const id = data.id;
if (!id) {
return;
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
await model.save({status: 'Held'}, {patch: true});
Espo.Ui.success(this.translate('Saved'));
}
/**
* @protected
* @param {Record} data
*/
async actionSetNotHeld(data) {
const id = data.id;
if (!id) {
return;
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
await model.save({status: 'Not Held'}, {patch: true});
Espo.Ui.success(this.translate('Saved'));
}
// noinspection JSUnusedGlobalSymbols
async massActionSetHeld() {
const data = {};
data.ids = this.checkedList;
Espo.Ui.notify(this.translate('saving', 'messages'));
await Espo.Ajax.postRequest(`${this.collection.entityType}/action/massSetHeld`, data);
Espo.Ui.success(this.translate('Saved'));
await this.collection.fetch();
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
},
});
}
actionSetHeld: function (data) {
let id = data.id;
// noinspection JSUnusedGlobalSymbols
async massActionSetNotHeld() {
const data = {};
if (!id) {
return;
data.ids = this.checkedList;
Espo.Ui.notify(this.translate('saving', 'messages'));
await Espo.Ajax.postRequest(`${this.collection.entityType}/action/massSetNotHeld`, data);
Espo.Ui.success(this.translate('Saved'));
await this.collection.fetch();
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
var model = this.collection.get(id);
if (!model) {
return;
}
model.set('status', 'Held');
this.listenToOnce(model, 'sync', () => {
Espo.Ui.notify(false);
this.collection.fetch();
});
Espo.Ui.notifyWait();
model.save();
},
actionSetNotHeld: function (data) {
let id = data.id;
if (!id) {
return;
}
let model = this.collection.get(id);
if (!model) {
return;
}
model.set('status', 'Not Held');
this.listenToOnce(model, 'sync', () => {
Espo.Ui.notify(false);
this.collection.fetch();
});
Espo.Ui.notify(this.translate('saving', 'messages'));
model.save();
},
massActionSetHeld: function () {
Espo.Ui.notify(this.translate('saving', 'messages'));
let data = {};
data.ids = this.checkedList;
Espo.Ajax.postRequest(this.collection.entityType + '/action/massSetHeld', data)
.then(() => {
Espo.Ui.notify(false);
this.listenToOnce(this.collection, 'sync', () => {
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
});
});
this.collection.fetch();
});
},
massActionSetNotHeld: function () {
Espo.Ui.notify(this.translate('saving', 'messages'));
let data = {};
data.ids = this.checkedList;
Espo.Ajax.postRequest(this.collection.entityType + '/action/massSetNotHeld', data)
.then(() => {
Espo.Ui.notify(false);
this.listenToOnce(this.collection, 'sync', () => {
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
});
});
this.collection.fetch();
});
},
});
});
});
}
}
@@ -26,8 +26,6 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/meeting/fields/contacts', ['crm:views/meeting/fields/attendees'], function (Dep) {
import AttendeesFieldView from 'modules/crm/views/meeting/fields/attendees';
/** Left for bc. */
return Dep.extend({});
});
export default class extends AttendeesFieldView {}
@@ -26,10 +26,6 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/meeting/record/edit-small', ['views/record/edit'], function (Dep) {
return Dep.extend({
});
});
import EditRecordView from 'views/record/edit';
export default class extends EditRecordView {}
@@ -26,109 +26,111 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('crm:views/meeting/record/list', ['views/record/list'], function (Dep) {
import ListRecordView from 'views/record/list';
return Dep.extend({
export default class extends ListRecordView {
rowActionsView: 'crm:views/meeting/record/row-actions/default',
rowActionsView = 'modules/crm/views/meeting/record/row-actions/default'
setup: function () {
Dep.prototype.setup.call(this);
setup() {
super.setup();
if (
this.getAcl().checkScope(this.entityType, 'edit') &&
this.getAcl().checkField(this.entityType, 'status', 'edit')
) {
this.massActionList.push('setHeld');
this.massActionList.push('setNotHeld');
if (
this.getAcl().checkScope(this.entityType, 'edit') &&
this.getAcl().checkField(this.entityType, 'status', 'edit')
) {
this.massActionList.push('setHeld');
this.massActionList.push('setNotHeld');
}
}
/**
* @protected
* @param {Record} data
*/
async actionSetHeld(data) {
const id = data.id;
if (!id) {
return;
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
await model.save({status: 'Held'}, {patch: true});
Espo.Ui.success(this.translate('Saved'));
}
/**
* @protected
* @param {Record} data
*/
async actionSetNotHeld(data) {
const id = data.id;
if (!id) {
return;
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
await model.save({status: 'Not Held'}, {patch: true});
Espo.Ui.success(this.translate('Saved'));
}
// noinspection JSUnusedGlobalSymbols
async massActionSetHeld() {
const data = {};
data.ids = this.checkedList;
Espo.Ui.notify(this.translate('saving', 'messages'));
await Espo.Ajax.postRequest(`${this.collection.entityType}/action/massSetHeld`, data);
Espo.Ui.success(this.translate('Saved'));
await this.collection.fetch();
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
},
});
}
actionSetHeld: function (data) {
const id = data.id;
// noinspection JSUnusedGlobalSymbols
async massActionSetNotHeld() {
const data = {};
if (!id) {
return;
data.ids = this.checkedList;
Espo.Ui.notify(this.translate('saving', 'messages'));
await Espo.Ajax.postRequest(`${this.collection.entityType}/action/massSetNotHeld`, data);
Espo.Ui.success(this.translate('Saved'));
await this.collection.fetch();
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
model.save({status: 'Held'}, {patch: true}).then(() => {
Espo.Ui.success(this.translate('Saved'));
this.collection.fetch();
});
},
actionSetNotHeld: function (data) {
const id = data.id;
if (!id) {
return;
}
const model = this.collection.get(id);
if (!model) {
return;
}
Espo.Ui.notify(this.translate('saving', 'messages'));
model.save({status: 'Not Held'}, {patch: true}).then(() => {
Espo.Ui.success(this.translate('Saved'));
this.collection.fetch();
});
},
massActionSetHeld: function () {
Espo.Ui.notify(this.translate('saving', 'messages'));
const data = {ids: this.checkedList};
Espo.Ajax.postRequest(this.collection.entityType + '/action/massSetHeld', data)
.then(() => {
Espo.Ui.notify(false);
this.listenToOnce(this.collection, 'sync', () => {
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
});
});
this.collection.fetch();
});
},
massActionSetNotHeld: function () {
Espo.Ui.notify(this.translate('saving', 'messages'));
const data = {ids: this.checkedList};
Espo.Ajax.postRequest(this.collection.entityType + '/action/massSetNotHeld', data)
.then(() => {
Espo.Ui.notify(false);
this.listenToOnce(this.collection, 'sync', () => {
data.ids.forEach(id => {
if (this.collection.get(id)) {
this.checkRecord(id);
}
});
});
this.collection.fetch();
});
},
});
});
});
}
}