import React from 'react';
import { Form as RegisterForm, Field, FieldArray, FormElement } from '@progress/kendo-react-form';
import { Typography } from '@progress/kendo-react-common';
import { TextBox, Switch } from '@progress/kendo-react-inputs';
import { CircularGauge } from '@progress/kendo-react-gauges';
import { ListBox, ListBoxToolbar, processListBoxData, processListBoxDragAndDrop } from '@progress/kendo-react-listbox';
import { Grid as GridMUI } from '@mui/material';
import moment from 'moment';
import { Grid, GridColumn as Column, GridToolbar } from '@progress/kendo-react-grid';
import { MyCommandCell, setCommandCell } from './DataGrid-Component/myCommandCell';
import { insertItem, getItems, updateItem, deleteItem, setData } from './DataGrid-Component/services';
import { DropDownCell, setDropDownData } from './DataGrid-Component/myDropDownCell';
import { NameCell } from './DataGrid-Component/myNameCell';
import { CircularGaugeCell } from './DataGrid-Component/myCircularGaugeCell';
import { ERCCA } from 'apps/ERCCA/constants';
class D3ContainmentAction extends React.PureComponent {
editField = 'inEdit';
constructor(props) {
super(props);
this._isMounted = false;
this.state = {};
}
componentDidMount() {
this._isMounted = true;
helpers.debounce(`D3ContainmentAction-initialize`, async () => {
this.initialize();
});
}
componentWillUnmount() {
this._isMounted = false;
}
initialize = async () => {
let containmentAction = [];
let [enumValuesString] = await Promise.all([ERCCA.API.getDateType({}, {}, {})]);
let enumValuesArray = enumValuesString.at(0).ENUM_VALUES.split(',');
let formattedEnumValues = enumValuesArray.map((value) => value.replace(/'/g, ''));
let enumValues = formattedEnumValues.map((value, index) => ({
text: value,
value: value,
}));
if (/^MRB-\d{2}-\d{5}$/.test(this.props.id)) {
containmentAction = await ERCCA.model.rccaD3ImmediateAction.find({ ria_rcca_id: this.props.id });
let idCounter = 1;
for (let i = 0; i < containmentAction.length; i++) {
containmentAction[i].id = idCounter;
idCounter++;
}
} else {
}
setData(containmentAction, 'D3ContainmentAction');
setDropDownData([...enumValues.flat()], 'D3ContainmentAction');
setCommandCell('D3ContainmentAction');
this._isMounted &&
this.setState({
containmentAction: containmentAction,
dateTypeLists: [...enumValues.flat()],
});
};
CommandCell = (props) =>
Contains the problem and investigation action.