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 { GridColumnData } from './GridColumnData'
|
||||
import { Loading } from '@/components/shared'
|
||||
import { usePermission } from '@/utils/hooks/usePermission'
|
||||
|
||||
interface GanttViewProps {
|
||||
listFormCode: string
|
||||
|
|
@ -47,6 +48,7 @@ const GanttView = (props: GanttViewProps) => {
|
|||
const gridRef = useRef<GanttRef>()
|
||||
const refListFormCode = useRef('')
|
||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||
const { checkPermission } = usePermission()
|
||||
|
||||
const [ganttDataSource, setGanttDataSource] = useState<CustomStore<any, any>>()
|
||||
const [columnData, setColumnData] = useState<GridColumnData[]>()
|
||||
|
|
@ -242,15 +244,16 @@ const GanttView = (props: GanttViewProps) => {
|
|||
/>
|
||||
|
||||
<Toolbar>
|
||||
{/* <Item name="undo" /> */}
|
||||
{/* <Item name="redo" /> */}
|
||||
{/* <Item name="separator" /> */}
|
||||
<Item name="undo" />
|
||||
<Item name="redo" />
|
||||
<Item name="separator" />
|
||||
<Item name="collapseAll" />
|
||||
<Item name="expandAll" />
|
||||
{gridDto.gridOptions.editingOptionDto?.allowAdding && <Item name="addTask" />}
|
||||
{gridDto.gridOptions.editingOptionDto?.allowDeleting && (
|
||||
<Item name="deleteTask" />
|
||||
)}
|
||||
<Item name="separator" />
|
||||
{/* <Item name="addTask" /> */}
|
||||
{/* <Item name="deleteTask" /> */}
|
||||
{/* <Item name="separator" /> */}
|
||||
<Item name="zoomIn" />
|
||||
<Item name="zoomOut" />
|
||||
<Item name="separator" />
|
||||
|
|
@ -276,7 +279,9 @@ const GanttView = (props: GanttViewProps) => {
|
|||
}}
|
||||
/>
|
||||
<Item location="after" widget="dxButton" options={getRefreshButtonOptions()} />
|
||||
<Item location="after" widget="dxButton" options={getSettingButtonOptions()} />
|
||||
{checkPermission(gridDto?.gridOptions.permissionDto.u) && (
|
||||
<Item location="after" widget="dxButton" options={getSettingButtonOptions()} />
|
||||
)}
|
||||
</Toolbar>
|
||||
|
||||
<Editing
|
||||
|
|
|
|||
|
|
@ -2,7 +2,14 @@ import Container from '@/components/shared/Container'
|
|||
import { DX_CLASSNAMES } from '@/constants/app.constant'
|
||||
import { GridDto } from '@/proxy/form/models'
|
||||
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 { Helmet } from 'react-helmet'
|
||||
import { getList } from '@/services/form.service'
|
||||
|
|
@ -14,6 +21,7 @@ import { ROUTES_ENUM } from '@/routes/route.constant'
|
|||
import { usePWA } from '@/utils/hooks/usePWA'
|
||||
import CustomStore from 'devextreme/data/custom_store'
|
||||
import { Loading } from '@/components/shared'
|
||||
import { usePermission } from '@/utils/hooks/usePermission'
|
||||
|
||||
interface SchedulerViewProps {
|
||||
listFormCode: string
|
||||
|
|
@ -32,6 +40,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
const schedulerRef = useRef<SchedulerRef>()
|
||||
const refListFormCode = useRef('')
|
||||
const widgetGroupRef = useRef<HTMLDivElement>(null)
|
||||
const { checkPermission } = usePermission()
|
||||
|
||||
const [schedulerDataSource, setSchedulerDataSource] = useState<CustomStore<any, any>>()
|
||||
const [gridDto, setGridDto] = useState<GridDto>()
|
||||
|
|
@ -134,6 +143,16 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
)
|
||||
}, [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) => {
|
||||
setCurrentView(value)
|
||||
}, [])
|
||||
|
|
@ -154,8 +173,7 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
titleTemplate="%s | Erp Platform"
|
||||
title={translate('::' + gridDto?.gridOptions.title)}
|
||||
defaultTitle="Erp Platform"
|
||||
>
|
||||
</Helmet>
|
||||
></Helmet>
|
||||
)}
|
||||
{!gridDto && (
|
||||
<div className="p-4">
|
||||
|
|
@ -212,6 +230,32 @@ const SchedulerView = (props: SchedulerViewProps) => {
|
|||
}
|
||||
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
|
||||
allowAdding={gridDto.gridOptions.editingOptionDto?.allowAdding ?? false}
|
||||
allowUpdating={gridDto.gridOptions.editingOptionDto?.allowUpdating ?? false}
|
||||
|
|
|
|||
Loading…
Reference in a new issue