diff --git a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs index 767bf590..e52a4a19 100644 --- a/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs +++ b/api/src/Erp.Platform.DbMigrator/Seeds/ListFormSeeder_Project.cs @@ -2124,9 +2124,10 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency new() { Order=1, ColCount=2, ColSpan=1, ItemType="group", Items =[ new EditingFormItemDto { Order = 1, DataField="Name", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxTextBox }, - new EditingFormItemDto { Order = 2, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, - new EditingFormItemDto { Order = 3, DataField="StartDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateTimeFormat }, - new EditingFormItemDto { Order = 4, DataField="EndDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateTimeFormat }, + new EditingFormItemDto { Order = 2, DataField="Progress", ColSpan = 1, EditorType2 = EditorTypes.dxNumberBox }, + new EditingFormItemDto { Order = 3, DataField="StartDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateFormat }, + new EditingFormItemDto { Order = 4, DataField="EndDate", ColSpan = 1, IsRequired = true, EditorType2 = EditorTypes.dxDateBox, EditorOptions = EditorOptionValues.DateFormat }, + new EditingFormItemDto { Order = 5, DataField="Description", ColSpan = 2, EditorType2 = EditorTypes.dxTextArea }, ]} }), }, autoSave: true @@ -2209,9 +2210,10 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency new() { ListFormCode = listForm.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, + SourceDbType = DbType.Date, FieldName = "StartDate", - Width = 150, + Alignment = "center", + Width = 100, ListOrderNo = 5, Visible = true, IsActive = true, @@ -2225,9 +2227,10 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency new() { ListFormCode = listForm.ListFormCode, CultureName = LanguageCodes.En, - SourceDbType = DbType.DateTime, + SourceDbType = DbType.Date, FieldName = "EndDate", - Width = 150, + Alignment = "center", + Width = 100, ListOrderNo = 6, Visible = true, IsActive = true, @@ -2243,7 +2246,9 @@ public class ListFormSeeder_Project : IDataSeedContributor, ITransientDependency CultureName = LanguageCodes.En, SourceDbType = DbType.Decimal, FieldName = "Progress", - Width = 100, + Format = "fixedPoint", + Alignment = "right", + Width = 70, ListOrderNo = 7, Visible = true, IsActive = true, diff --git a/ui/src/views/admin/listForm/edit/ChartTabCommonSettings.tsx b/ui/src/views/admin/listForm/edit/ChartTabCommonSettings.tsx index bc44d9a4..760edcbf 100644 --- a/ui/src/views/admin/listForm/edit/ChartTabCommonSettings.tsx +++ b/ui/src/views/admin/listForm/edit/ChartTabCommonSettings.tsx @@ -90,7 +90,16 @@ function ChartTabCommonSettings(props: FormEditProps) { } errorMessage={errors.commonDto?.containerBackgroundColor} > - + + {({ field, form }: FieldProps) => ( + form.setFieldValue(field.name, e.target.value)} + /> + )} + - - - - + + + + { const { listFormCode, searchParams, isSubForm, level, gridDto: extGridDto } = props const { translate } = useLocalization() - const { smaller } = useResponsive() + const isPwaMode = usePWA() - const ganttRef = useRef() + const gridRef = useRef() const refListFormCode = useRef('') const widgetGroupRef = useRef(null) - const [ganttDataSource, setGanttDataSource] = useState>() + const [ganttDataSource, setGanttDataSource] = useState>() + const [columnData, setColumnData] = useState() const [gridDto, setGridDto] = useState() const [widgetGroupHeight, setWidgetGroupHeight] = useState(0) + const [scaleType, setScaleType] = useState('weeks') + const layout = layoutTypes.gantt || 'gantt' useEffect(() => { const initializeGantt = async () => { @@ -59,44 +68,9 @@ const GanttView = (props: GanttViewProps) => { } }, [listFormCode, extGridDto]) - const layout = layoutTypes.gantt || 'gantt' - const { toolbarData, toolbarModalData, setToolbarModalData } = useToolbar({ - gridDto, - listFormCode, - getSelectedRowKeys: () => Promise.resolve([]), - getSelectedRowsData: () => [], - refreshData, - getFilter: () => undefined, - layout, - }) - - const { filterToolbarData, ...filterData } = useFilters({ - gridDto, - gridRef: ganttRef as any, - listFormCode, - }) - - const { createSelectDataSource } = useListFormCustomDataSource({ gridRef: ganttRef as any }) - - function refreshData() { - ganttRef.current?.instance()?.refresh() - } - - function onTaskInserted() { - props.refreshData?.() - } - - function onTaskUpdated() { - props.refreshData?.() - } - - function onTaskDeleted() { - props.refreshData?.() - } - useEffect(() => { - if (ganttRef?.current) { - const instance = ganttRef?.current?.instance() + if (gridRef?.current) { + const instance = gridRef?.current?.instance() if (instance) { instance.option('dataSource', undefined) } @@ -107,6 +81,14 @@ const GanttView = (props: GanttViewProps) => { } }, [listFormCode]) + const { createSelectDataSource } = useListFormCustomDataSource({ gridRef }) + const { getBandedColumns } = useListFormColumns({ + gridDto, + listFormCode, + isSubForm, + gridRef, + }) + useEffect(() => { if (!gridDto) { return @@ -129,7 +111,10 @@ const GanttView = (props: GanttViewProps) => { useEffect(() => { if (!gridDto) return - const customStore = createSelectDataSource( + const cols = getBandedColumns() + setColumnData(cols) + + const dataSource = createSelectDataSource( gridDto.gridOptions, listFormCode, searchParams, @@ -137,12 +122,6 @@ const GanttView = (props: GanttViewProps) => { undefined, ) - // Gantt için DataSource wrapper'ı oluştur - const dataSource = new DataSource({ - store: customStore, - reshapeOnPush: true, - }) - setGanttDataSource(dataSource) }, [gridDto, searchParams, createSelectDataSource]) @@ -171,26 +150,35 @@ const GanttView = (props: GanttViewProps) => { } }, [gridDto?.widgets]) - // Gantt için sütunları oluştur - const getGanttColumns = useCallback(() => { - if (!gridDto?.columnFormats) return [] + const settingButtonClick = useCallback(() => { + window.open( + ROUTES_ENUM.protected.saas.listFormManagement.edit.replace(':listFormCode', listFormCode), + isPwaMode ? '_self' : '_blank', + ) + }, []) - return gridDto.columnFormats - .filter((col) => col.canRead && col.isActive && col.visible) - .map((col) => { - const column: any = { - dataField: col.fieldName, - caption: col.captionName ? translate('::' + col.captionName) : col.fieldName, - width: col.width > 0 ? col.width : undefined, - alignment: col.alignment, - format: col.format, - } + const getSettingButtonOptions = useCallback( + () => ({ + icon: 'preferences', + stylingMode: 'icon', + onClick: () => { + settingButtonClick() + }, + }), + [settingButtonClick], + ) - return column - }) - }, [gridDto, translate]) - - const ganttColumns = getGanttColumns() + const getRefreshButtonOptions = useCallback( + () => ({ + icon: 'refresh', + text: translate('::ListForms.ListForm.Refresh'), + stylingMode: 'icon', + onClick: () => { + gridRef.current?.instance()?.refresh() + }, + }), + [settingButtonClick], + ) return ( <> @@ -208,17 +196,25 @@ const GanttView = (props: GanttViewProps) => { )} - {!gridDto &&
Loading gantt configuration...
} - {gridDto && !ganttDataSource &&
Loading data source...
} - {gridDto && ganttDataSource && ( + {!gridDto && ( +
+ Loading gantt configuration... +
+ )} + {gridDto && !ganttDataSource && ( +
+ Loading data source... +
+ )} + {gridDto && columnData && ganttDataSource && ( <>
{ ? gridDto.gridOptions.height : gridDto.gridOptions.fullHeight ? `calc(100vh - ${170 + widgetGroupHeight}px)` - : 700 + : undefined } - showResources={true} - showDependencies={true} - onTaskInserted={onTaskInserted} - onTaskUpdated={onTaskUpdated} - onTaskDeleted={onTaskDeleted} > { /> - - - + {/* */} + {/* */} + {/* */} - - - + {/* */} + {/* */} + {/* */} + + setScaleType(e.value), + }} + /> + + - - + + + + + - {ganttColumns.map((col: any) => ( - - ))} + {columnData + .filter((col) => col.type != 'buttons') + .map((col: any) => ( + + ))}
)} - - setToolbarModalData(undefined)} - onRequestClose={() => setToolbarModalData(undefined)} - > - {toolbarModalData?.content} - ) diff --git a/ui/src/views/list/Grid.tsx b/ui/src/views/list/Grid.tsx index 5debffb6..6c0deeb4 100644 --- a/ui/src/views/list/Grid.tsx +++ b/ui/src/views/list/Grid.tsx @@ -70,6 +70,7 @@ import { getList } from '@/services/form.service' import { layoutTypes } from '../admin/listForm/edit/types' import { useListFormCustomDataSource } from './useListFormCustomDataSource' import { useListFormColumns } from './useListFormColumns' +import { Loading } from '@/components/shared' interface GridProps { listFormCode: string @@ -811,10 +812,20 @@ const Grid = (props: GridProps) => { defaultTitle="Erp Platform" > )} - {!gridDto &&
Loading grid configuration...
} - {gridDto && !columnData &&
Loading columns...
} + {!gridDto && ( +
+ Loading grid configuration... +
+ )} + {gridDto && !columnData && ( +
+ Loading columns... +
+ )} {gridDto && columnData && !gridDataSource && ( -
Loading data source...
+
+ Loading data source... +
)} {gridDto && columnData && diff --git a/ui/src/views/list/List.tsx b/ui/src/views/list/List.tsx index 6fb9612a..b11cfaa5 100644 --- a/ui/src/views/list/List.tsx +++ b/ui/src/views/list/List.tsx @@ -96,7 +96,8 @@ const List = () => {
{gridDto?.gridOptions?.layoutDto.gantt && - gridDto?.gridOptions?.treeOptionDto?.parentIdExpr && ( + gridDto?.gridOptions?.treeOptionDto?.parentIdExpr && + gridDto?.gridOptions?.treeOptionDto?.titleExpr && (