Gantt ve Scheduler düzenlemeleri
This commit is contained in:
parent
9055657ef2
commit
aa3a3c7684
2 changed files with 60 additions and 11 deletions
|
|
@ -29,6 +29,7 @@ import { useListFormColumns } from './useListFormColumns'
|
||||||
import CustomStore from 'devextreme/data/custom_store'
|
import CustomStore from 'devextreme/data/custom_store'
|
||||||
import { GridColumnData } from './GridColumnData'
|
import { GridColumnData } from './GridColumnData'
|
||||||
import { Loading } from '@/components/shared'
|
import { Loading } from '@/components/shared'
|
||||||
|
import { usePermission } from '@/utils/hooks/usePermission'
|
||||||
|
|
||||||
interface GanttViewProps {
|
interface GanttViewProps {
|
||||||
listFormCode: string
|
listFormCode: string
|
||||||
|
|
@ -47,6 +48,7 @@ const GanttView = (props: GanttViewProps) => {
|
||||||
const gridRef = useRef<GanttRef>()
|
const gridRef = useRef<GanttRef>()
|
||||||
const refListFormCode = useRef('')
|
const refListFormCode = useRef('')
|
||||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||||
|
const { checkPermission } = usePermission()
|
||||||
|
|
||||||
const [ganttDataSource, setGanttDataSource] = useState<CustomStore<any, any>>()
|
const [ganttDataSource, setGanttDataSource] = useState<CustomStore<any, any>>()
|
||||||
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
||||||
|
|
@ -242,15 +244,16 @@ const GanttView = (props: GanttViewProps) => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Toolbar>
|
<Toolbar>
|
||||||
{/* <Item name="undo" /> */}
|
<Item name="undo" />
|
||||||
{/* <Item name="redo" /> */}
|
<Item name="redo" />
|
||||||
{/* <Item name="separator" /> */}
|
<Item name="separator" />
|
||||||
<Item name="collapseAll" />
|
<Item name="collapseAll" />
|
||||||
<Item name="expandAll" />
|
<Item name="expandAll" />
|
||||||
|
{gridDto.gridOptions.editingOptionDto?.allowAdding && <Item name="addTask" />}
|
||||||
|
{gridDto.gridOptions.editingOptionDto?.allowDeleting && (
|
||||||
|
<Item name="deleteTask" />
|
||||||
|
)}
|
||||||
<Item name="separator" />
|
<Item name="separator" />
|
||||||
{/* <Item name="addTask" /> */}
|
|
||||||
{/* <Item name="deleteTask" /> */}
|
|
||||||
{/* <Item name="separator" /> */}
|
|
||||||
<Item name="zoomIn" />
|
<Item name="zoomIn" />
|
||||||
<Item name="zoomOut" />
|
<Item name="zoomOut" />
|
||||||
<Item name="separator" />
|
<Item name="separator" />
|
||||||
|
|
@ -276,7 +279,9 @@ const GanttView = (props: GanttViewProps) => {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Item location="after" widget="dxButton" options={getRefreshButtonOptions()} />
|
<Item location="after" widget="dxButton" options={getRefreshButtonOptions()} />
|
||||||
|
{checkPermission(gridDto?.gridOptions.permissionDto.u) && (
|
||||||
<Item location="after" widget="dxButton" options={getSettingButtonOptions()} />
|
<Item location="after" widget="dxButton" options={getSettingButtonOptions()} />
|
||||||
|
)}
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
|
|
||||||
<Editing
|
<Editing
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,14 @@ import Container from '@/components/shared/Container'
|
||||||
import { DX_CLASSNAMES } from '@/constants/app.constant'
|
import { DX_CLASSNAMES } from '@/constants/app.constant'
|
||||||
import { GridDto } from '@/proxy/form/models'
|
import { GridDto } from '@/proxy/form/models'
|
||||||
import { useLocalization } from '@/utils/hooks/useLocalization'
|
import { useLocalization } from '@/utils/hooks/useLocalization'
|
||||||
import Scheduler, { Editing, Resource, SchedulerRef, View } from 'devextreme-react/scheduler'
|
import Scheduler, {
|
||||||
|
Editing,
|
||||||
|
Item,
|
||||||
|
Resource,
|
||||||
|
SchedulerRef,
|
||||||
|
Toolbar,
|
||||||
|
View,
|
||||||
|
} from 'devextreme-react/scheduler'
|
||||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||||
import { Helmet } from 'react-helmet'
|
import { Helmet } from 'react-helmet'
|
||||||
import { getList } from '@/services/form.service'
|
import { getList } from '@/services/form.service'
|
||||||
|
|
@ -14,6 +21,7 @@ import { ROUTES_ENUM } from '@/routes/route.constant'
|
||||||
import { usePWA } from '@/utils/hooks/usePWA'
|
import { usePWA } from '@/utils/hooks/usePWA'
|
||||||
import CustomStore from 'devextreme/data/custom_store'
|
import CustomStore from 'devextreme/data/custom_store'
|
||||||
import { Loading } from '@/components/shared'
|
import { Loading } from '@/components/shared'
|
||||||
|
import { usePermission } from '@/utils/hooks/usePermission'
|
||||||
|
|
||||||
interface SchedulerViewProps {
|
interface SchedulerViewProps {
|
||||||
listFormCode: string
|
listFormCode: string
|
||||||
|
|
@ -32,6 +40,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
const schedulerRef = useRef<SchedulerRef>()
|
const schedulerRef = useRef<SchedulerRef>()
|
||||||
const refListFormCode = useRef('')
|
const refListFormCode = useRef('')
|
||||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||||
|
const { checkPermission } = usePermission()
|
||||||
|
|
||||||
const [schedulerDataSource, setSchedulerDataSource] = useState<CustomStore<any, any>>()
|
const [schedulerDataSource, setSchedulerDataSource] = useState<CustomStore<any, any>>()
|
||||||
const [gridDto, setGridDto] = useState<GridDto>()
|
const [gridDto, setGridDto] = useState<GridDto>()
|
||||||
|
|
@ -134,6 +143,16 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
)
|
)
|
||||||
}, [listFormCode, isPwaMode])
|
}, [listFormCode, isPwaMode])
|
||||||
|
|
||||||
|
const handleRefresh = useCallback(() => {
|
||||||
|
const instance = schedulerRef.current?.instance()
|
||||||
|
if (instance) {
|
||||||
|
const dataSource = instance.getDataSource()
|
||||||
|
if (dataSource) {
|
||||||
|
dataSource.reload()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
const onCurrentViewChange = useCallback((value: string) => {
|
const onCurrentViewChange = useCallback((value: string) => {
|
||||||
setCurrentView(value)
|
setCurrentView(value)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
@ -154,8 +173,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
titleTemplate="%s | Erp Platform"
|
titleTemplate="%s | Erp Platform"
|
||||||
title={translate('::' + gridDto?.gridOptions.title)}
|
title={translate('::' + gridDto?.gridOptions.title)}
|
||||||
defaultTitle="Erp Platform"
|
defaultTitle="Erp Platform"
|
||||||
>
|
></Helmet>
|
||||||
</Helmet>
|
|
||||||
)}
|
)}
|
||||||
{!gridDto && (
|
{!gridDto && (
|
||||||
<div className="p-4">
|
<div className="p-4">
|
||||||
|
|
@ -212,6 +230,32 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
||||||
}
|
}
|
||||||
adaptivityEnabled={true}
|
adaptivityEnabled={true}
|
||||||
>
|
>
|
||||||
|
<Toolbar>
|
||||||
|
<Item name="dateNavigator" />
|
||||||
|
<Item name="today" />
|
||||||
|
<Item name="viewSwitcher" />
|
||||||
|
<Item
|
||||||
|
location="after"
|
||||||
|
widget="dxButton"
|
||||||
|
options={{
|
||||||
|
icon: 'refresh',
|
||||||
|
hint: translate('::ListForms.ListForm.Refresh'),
|
||||||
|
onClick: handleRefresh,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
{checkPermission(gridDto?.gridOptions.permissionDto.u) && (
|
||||||
|
<Item
|
||||||
|
location="after"
|
||||||
|
widget="dxButton"
|
||||||
|
options={{
|
||||||
|
icon: 'preferences',
|
||||||
|
hint: 'Settings',
|
||||||
|
onClick: settingButtonClick,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Toolbar>
|
||||||
|
|
||||||
<Editing
|
<Editing
|
||||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding ?? false}
|
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding ?? false}
|
||||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating ?? false}
|
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating ?? false}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue