Skip to content

Commit

Permalink
Merge branch 'pu/ccheng/fix_course' into '2024.11'
Browse files Browse the repository at this point in the history
fix(Course/js): use record picker for course type field

See merge request tine20/tine20!6555
  • Loading branch information
ccheng-dev committed Feb 6, 2025
2 parents 0451880 + c8f6879 commit 8595a01
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
28 changes: 21 additions & 7 deletions tine20/Courses/js/CourseEditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

Ext.namespace('Tine.Courses');

import * as async from 'async'

Tine.Courses.CourseEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
/**
* @private
Expand Down Expand Up @@ -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);
}
},

/**
Expand Down Expand Up @@ -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'),
Expand Down
4 changes: 0 additions & 4 deletions tine20/Tinebase/Tinebase.jsb2
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down

0 comments on commit 8595a01

Please sign in to comment.