Hi,
if someone can correct my front-end custom phone field :
in the past, these custom field worker for a "clicktocall" to cisco spa phone
but with new phone field with "international prefix" .. he bug :
this is a modifed .. a receive the click but i loose all "new feature of phone field".
And i have these warning : model.toJSON is deprecated. Use 'getClonedAttributes' instead.
this warning come with this custom js.
Hope someone can correct
if someone can correct my front-end custom phone field :
in the past, these custom field worker for a "clicktocall" to cisco spa phone
but with new phone field with "international prefix" .. he bug :
this is a modifed .. a receive the click but i loose all "new feature of phone field".
PHP Code:
define('custom:views/fields/phone', ['views/fields/phone'], function (Dep) {
return Dep.extend({
setup() {
Dep.prototype.setup.call(this);
this.events['click [data-action="dial"]'] = (e) => {
e.preventDefault();
let $target = $(e.currentTarget);
let phoneNumber = $target.attr('data-phone-number');
this.dialTo( phoneNumber );
};
},
afterRender: function () {
Dep.prototype.setup.call(this);
},
dialTo: function ( phoneNumber )
{
console.log('OK')
if (!this.getUser().get('ext'))
{
Espo.Ui.notify('Completez votre extension dans User', 'danger', 4000);
return;
}
var scope = this.model.urlRoot;
var foreignLink = 'calls';
//this.notify('Loading...');
//let phoneNumber = $(elem).attr('data-phone-number');
/*
Espo.Ajax
.postRequest('Cisco/:phoneNumber', {
user: this.getUser(),
ext: this.getUser().get('ext'),
phoneNumber: phoneNumber
})
.then(response => {
if (response['status'] == true)
{
Espo.Ui.notify(response['message'], 'success', 8000);
}else{
Espo.Ui.notify( response['message'] , 'error', 2000);
}
});
//this.trigger('sync');
*/
}
});
});
this warning come with this custom js.
Hope someone can correct