diff --git a/ui/src/views/list/SchedulerView.tsx b/ui/src/views/list/SchedulerView.tsx index 5d712257..15a0afae 100644 --- a/ui/src/views/list/SchedulerView.tsx +++ b/ui/src/views/list/SchedulerView.tsx @@ -295,7 +295,12 @@ const SchedulerView = (props: SchedulerViewProps) => { .sort((a: any, b: any) => (a.order >= b.order ? 1 : -1)) sortedFormDto.forEach((group: any) => { - const groupItems = (group.items || []).map((i: EditingFormItemDto) => { + // Items'ları da order'a göre sırala + const sortedItems = (group.items || []) + .slice() + .sort((a: any, b: any) => (a.order >= b.order ? 1 : -1)) + + const groupItems = sortedItems.map((i: EditingFormItemDto) => { let editorOptions: any = {} try { if (i.editorOptions) { @@ -306,13 +311,6 @@ const SchedulerView = (props: SchedulerViewProps) => { const fieldName = i.dataField.split(':')[0] const listFormField = gridDto.columnFormats.find((x: any) => x.fieldName === fieldName) - // Label oluştur - const label: any = { - text: listFormField?.captionName - ? translate('::' + listFormField.captionName) - : i.dataField, - } - // EditorType belirleme - Grid'deki gibi let editorType: any = i.editorType2 || i.editorType if (i.editorType2 === PlatformEditorTypes.dxGridBox) { @@ -376,34 +374,39 @@ const SchedulerView = (props: SchedulerViewProps) => { validationRules.push({ type: 'required' }) } - return { - label, + const item: any = { dataField: i.dataField, + name: i.dataField, editorType, colSpan: i.colSpan, editorOptions, validationRules: validationRules.length > 0 ? validationRules : undefined, } + + // Label sadece caption varsa ekle + if (listFormField?.captionName) { + item.label = { text: translate('::' + listFormField.captionName) } + } + + return item }) if (group.itemType === 'group') { - const groupItem: any = { - itemType: 'group', - colCount: group.colCount || 1, - items: groupItems, - } - // Caption null değilse ekle - if (group.caption) { - groupItem.caption = translate('::' + group.caption) - } - formItems.push(groupItem) + // Grup kullanmadan direkt items'ları ekle - form'un colCount'u geçerli olsun + formItems.push(...groupItems) } else if (group.itemType === 'tabbed') { formItems.push({ itemType: 'tabbed', - tabs: (group.tabs || []).map((tab: any) => ({ - title: translate('::' + tab.title), - colCount: tab.colCount || 2, - items: (tab.items || []).map((i: EditingFormItemDto) => { + tabs: (group.tabs || []).map((tab: any) => { + // Tab items'larını da order'a göre sırala + const sortedTabItems = (tab.items || []) + .slice() + .sort((a: any, b: any) => (a.order >= b.order ? 1 : -1)) + + return { + title: translate('::' + tab.title), + colCount: tab.colCount || 2, + items: sortedTabItems.map((i: EditingFormItemDto) => { // Tab içindeki itemlar için de aynı mapping let editorOptions: any = {} try { @@ -417,12 +420,6 @@ const SchedulerView = (props: SchedulerViewProps) => { (x: any) => x.fieldName === fieldName, ) - const label: any = { - text: listFormField?.captionName - ? translate('::' + listFormField.captionName) - : i.dataField, - } - // EditorType belirleme - Grid'deki gibi let editorType: any = i.editorType2 || i.editorType if (i.editorType2 === PlatformEditorTypes.dxGridBox) { @@ -489,16 +486,24 @@ const SchedulerView = (props: SchedulerViewProps) => { validationRules.push({ type: 'required' }) } - return { - label, + const item: any = { dataField: i.dataField, + name: i.dataField, editorType, colSpan: i.colSpan, editorOptions, validationRules: validationRules.length > 0 ? validationRules : undefined, } + + // Label sadece caption varsa ekle + if (listFormField?.captionName) { + item.label = { text: translate('::' + listFormField.captionName) } + } + + return item }), - })), + } + }), }) } else { // No group, add items directly @@ -507,9 +512,20 @@ const SchedulerView = (props: SchedulerViewProps) => { }) } - // Form'a items'ı set et ve colCount'u ayarla - e.form.option('showValidationSummary', false) - e.form.option('items', formItems) + // Form'u tamamen yeniden yapılandır + const formConfig = { + colCount: gridDto.gridOptions.editingFormDto?.[0]?.colCount || 2, + showValidationSummary: false, + items: formItems, + } + + // Form'u tamamen yeniden baştan yapılandır + e.form.option('colCount', formConfig.colCount) + e.form.option('showValidationSummary', formConfig.showValidationSummary) + e.form.option('items', formConfig.items) + + // Form'u repaint et + e.form.repaint() }, [gridDto, translate, isPopupFullScreen, listFormCode], )