auto reply on detail view

This commit is contained in:
Yuri Kuznetsov
2025-08-18 12:02:32 +03:00
parent 569f909362
commit 41e52c96fc
3 changed files with 35 additions and 6 deletions
@@ -408,7 +408,8 @@
"type": "bool",
"readOnly": true,
"customizationDisabled": true,
"layoutDefaultSidePanelDisabled": true
"layoutDefaultSidePanelDisabled": true,
"layoutDetailDisabled": true
},
"parent": {
"type": "linkParent",
@@ -446,7 +447,9 @@
"isAutoReply": {
"type": "bool",
"readOnly": true,
"fieldManagerParamList": []
"fieldManagerParamList": [],
"layoutDefaultSidePanelDisabled": true,
"layoutDetailDisabled": true
},
"createdAt": {
"type": "datetime",
@@ -33,6 +33,10 @@ export default class extends DefaultSidePanelView {
setupFields() {
super.setupFields();
this.fieldList.push({
name: 'isAutoReply',
});
this.fieldList.push({
name: 'hasAttachment',
view: 'views/email/fields/has-attachment',
@@ -40,15 +44,17 @@ export default class extends DefaultSidePanelView {
});
this.controlHasAttachmentField();
this.listenTo(this.model, 'change:hasAttachment', () => this.controlHasAttachmentField());
this.controlIsAutoReply();
this.listenTo(this.model, 'change:isAutoReply', () => this.controlIsAutoReply());
}
/**
* @private
*/
controlHasAttachmentField() {
if (this.model.get('hasAttachment')) {
if (this.model.attributes.hasAttachment) {
this.recordViewObject.showField('hasAttachment');
return;
@@ -56,4 +62,17 @@ export default class extends DefaultSidePanelView {
this.recordViewObject.hideField('hasAttachment');
}
/**
* @private
*/
controlIsAutoReply() {
if (this.model.attributes.isAutoReply) {
this.recordViewObject.showField('isAutoReply');
return;
}
this.recordViewObject.hideField('isAutoReply');
}
}
+9 -2
View File
@@ -115,6 +115,12 @@ class SidePanelView extends View {
*/
defs
/**
* @protected
* @type {import('views/record/base').default}
*/
recordViewObject
events = {
/** @this SidePanelView */
'click .action': function (e) {
@@ -152,8 +158,9 @@ class SidePanelView extends View {
this.readOnly = this.readOnly || this.options.readOnly;
this.inlineEditDisabled = this.inlineEditDisabled || this.options.inlineEditDisabled;
/** @type {import('views/record/base').default} */
this.recordViewObject = this.options.recordViewObject;
this.recordViewObject = /** @type {import('views/record/base').default} */
this.options.recordViewObject;
}
setup() {