This commit is contained in:
Yuri Kuznetsov
2025-02-21 16:09:03 +02:00
parent 71daa4ce2f
commit dc527c2cf6
2 changed files with 30 additions and 6 deletions
+26 -6
View File
@@ -27,6 +27,7 @@
************************************************************************/
import View from 'view';
import RecordModal from 'helpers/record-modal';
class QuickCreateNavbarView extends View {
@@ -90,15 +91,34 @@ class QuickCreateNavbarView extends View {
return this.list.length > 0;
}
processCreate(scope) {
/**
* @private
* @param {string} scope
*/
async processCreate(scope) {
Espo.Ui.notifyWait();
const type = this.getMetadata().get(['clientDefs', scope, 'quickCreateModalType']) || 'edit';
const viewName = this.getMetadata().get(['clientDefs', scope, 'modalViews', type]) || 'views/modals/edit';
const type = this.getMetadata().get(`clientDefs.${scope}.quickCreateModalType`);
this.createView('dialog', viewName , {scope: scope})
.then(view => view.render())
.then(() => Espo.Ui.notify(false));
if (type) {
const viewName = this.getMetadata().get(`clientDefs.${scope}.modalViews.${type}`);
if (viewName) {
const view = await this.createView('modal', viewName , {scope: scope});
await view.render();
Espo.Ui.notify();
return;
}
}
const helper = new RecordModal();
await helper.showCreate(this, {
entityType: scope,
});
}
}
+4
View File
@@ -74,6 +74,10 @@
"type": "string"
}
},
"quickCreateModalType": {
"type": "string",
"description": "A modal view type to be used for quick create."
},
"listViewModeList": {
"type": "array",
"items": {