Scheduler Appointment View Group düzeldi.
This commit is contained in:
parent
98d748c398
commit
149f28bda6
1 changed files with 52 additions and 36 deletions
|
|
@ -295,7 +295,12 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
.sort((a: any, b: any) => (a.order >= b.order ? 1 : -1))
|
||||||
|
|
||||||
sortedFormDto.forEach((group: any) => {
|
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 = {}
|
let editorOptions: any = {}
|
||||||
try {
|
try {
|
||||||
if (i.editorOptions) {
|
if (i.editorOptions) {
|
||||||
|
|
@ -306,13 +311,6 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
const fieldName = i.dataField.split(':')[0]
|
const fieldName = i.dataField.split(':')[0]
|
||||||
const listFormField = gridDto.columnFormats.find((x: any) => x.fieldName === fieldName)
|
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
|
// EditorType belirleme - Grid'deki gibi
|
||||||
let editorType: any = i.editorType2 || i.editorType
|
let editorType: any = i.editorType2 || i.editorType
|
||||||
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||||
|
|
@ -376,34 +374,39 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
validationRules.push({ type: 'required' })
|
validationRules.push({ type: 'required' })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const item: any = {
|
||||||
label,
|
|
||||||
dataField: i.dataField,
|
dataField: i.dataField,
|
||||||
|
name: i.dataField,
|
||||||
editorType,
|
editorType,
|
||||||
colSpan: i.colSpan,
|
colSpan: i.colSpan,
|
||||||
editorOptions,
|
editorOptions,
|
||||||
validationRules: validationRules.length > 0 ? validationRules : undefined,
|
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') {
|
if (group.itemType === 'group') {
|
||||||
const groupItem: any = {
|
// Grup kullanmadan direkt items'ları ekle - form'un colCount'u geçerli olsun
|
||||||
itemType: 'group',
|
formItems.push(...groupItems)
|
||||||
colCount: group.colCount || 1,
|
|
||||||
items: groupItems,
|
|
||||||
}
|
|
||||||
// Caption null değilse ekle
|
|
||||||
if (group.caption) {
|
|
||||||
groupItem.caption = translate('::' + group.caption)
|
|
||||||
}
|
|
||||||
formItems.push(groupItem)
|
|
||||||
} else if (group.itemType === 'tabbed') {
|
} else if (group.itemType === 'tabbed') {
|
||||||
formItems.push({
|
formItems.push({
|
||||||
itemType: 'tabbed',
|
itemType: 'tabbed',
|
||||||
tabs: (group.tabs || []).map((tab: any) => ({
|
tabs: (group.tabs || []).map((tab: any) => {
|
||||||
title: translate('::' + tab.title),
|
// Tab items'larını da order'a göre sırala
|
||||||
colCount: tab.colCount || 2,
|
const sortedTabItems = (tab.items || [])
|
||||||
items: (tab.items || []).map((i: EditingFormItemDto) => {
|
.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
|
// Tab içindeki itemlar için de aynı mapping
|
||||||
let editorOptions: any = {}
|
let editorOptions: any = {}
|
||||||
try {
|
try {
|
||||||
|
|
@ -417,12 +420,6 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
(x: any) => x.fieldName === fieldName,
|
(x: any) => x.fieldName === fieldName,
|
||||||
)
|
)
|
||||||
|
|
||||||
const label: any = {
|
|
||||||
text: listFormField?.captionName
|
|
||||||
? translate('::' + listFormField.captionName)
|
|
||||||
: i.dataField,
|
|
||||||
}
|
|
||||||
|
|
||||||
// EditorType belirleme - Grid'deki gibi
|
// EditorType belirleme - Grid'deki gibi
|
||||||
let editorType: any = i.editorType2 || i.editorType
|
let editorType: any = i.editorType2 || i.editorType
|
||||||
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
if (i.editorType2 === PlatformEditorTypes.dxGridBox) {
|
||||||
|
|
@ -489,16 +486,24 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
validationRules.push({ type: 'required' })
|
validationRules.push({ type: 'required' })
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const item: any = {
|
||||||
label,
|
|
||||||
dataField: i.dataField,
|
dataField: i.dataField,
|
||||||
|
name: i.dataField,
|
||||||
editorType,
|
editorType,
|
||||||
colSpan: i.colSpan,
|
colSpan: i.colSpan,
|
||||||
editorOptions,
|
editorOptions,
|
||||||
validationRules: validationRules.length > 0 ? validationRules : undefined,
|
validationRules: validationRules.length > 0 ? validationRules : undefined,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Label sadece caption varsa ekle
|
||||||
|
if (listFormField?.captionName) {
|
||||||
|
item.label = { text: translate('::' + listFormField.captionName) }
|
||||||
|
}
|
||||||
|
|
||||||
|
return item
|
||||||
}),
|
}),
|
||||||
})),
|
}
|
||||||
|
}),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// No group, add items directly
|
// No group, add items directly
|
||||||
|
|
@ -507,9 +512,20 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Form'a items'ı set et ve colCount'u ayarla
|
// Form'u tamamen yeniden yapılandır
|
||||||
e.form.option('showValidationSummary', false)
|
const formConfig = {
|
||||||
e.form.option('items', formItems)
|
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],
|
[gridDto, translate, isPopupFullScreen, listFormCode],
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue