diff --git a/tine20/Courses/js/CourseEditDialog.js b/tine20/Courses/js/CourseEditDialog.js index c939c94946..726db2f2ae 100644 --- a/tine20/Courses/js/CourseEditDialog.js +++ b/tine20/Courses/js/CourseEditDialog.js @@ -10,6 +10,8 @@ Ext.namespace('Tine.Courses'); +import * as async from 'async' + Tine.Courses.CourseEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, { /** * @private @@ -189,6 +191,10 @@ Tine.Courses.CourseEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, { }); this.record.set('members', members); + + if (this.record.data?.type?.length > 0) { + this.record.set('type', this.record.data.type[0].id); + } }, /** @@ -232,17 +238,25 @@ Tine.Courses.CourseEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, { name:'name', allowBlank: false }, { - xtype:'reccombo', + xtype:'tinerecordspickercombobox', name: 'type', allowBlank: false, fieldLabel: this.app.i18n._('Course / School Type'), + recordClass: Tine.Courses.Model.CourseType, + recordProxy: Tine.Courses.courseTypeBackend, displayField: 'name', - store: new Ext.data.Store({ - fields: Tine.Courses.Model.CourseType, - proxy: Tine.Courses.courseTypeBackend, - reader: Tine.Courses.courseTypeBackend.getReader(), - sortInfo: {field: 'name', direction: 'ASC'} - }) + setValue: function (value, editDialog) { + if (this.vueEventBus) { + this.reset(); + this.suspendEvents(); + const resolvedValue = value.records.results.filter((record) => {return record.id === value.value;} ); + async.forEach(resolvedValue, async (recordData) => { + await this.addRecord(Tine.Tinebase.data.Record.setFromJson(recordData, this.recordClass)) + }).then (() => { + this.resumeEvents() + }) + } + }, }, { name: 'description', fieldLabel: this.app.i18n._('Description'), diff --git a/tine20/Tinebase/Tinebase.jsb2 b/tine20/Tinebase/Tinebase.jsb2 index 86cb84808c..adc2e52b6c 100644 --- a/tine20/Tinebase/Tinebase.jsb2 +++ b/tine20/Tinebase/Tinebase.jsb2 @@ -253,10 +253,6 @@ "text": "index.js", "path": "js/widgets/form/VMultiPicker" }, - { - "text": "RecordsComboBox.js", - "path": "js/ux/form/" - }, { "text": "DateTimeField.js", "path": "js/ux/form/"