Skip to content

Commit

Permalink
fix (projectDetails): task_priority_str added to statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
NSUWAL123 committed Dec 5, 2023
1 parent 65afbfe commit 9f5c4ef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/frontend/src/components/DialogTaskActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import ProjectTaskStatus from '../api/ProjectTaskStatus';
import MapStyles from '../hooks/MapStyles';
import CoreModules from '../shared/CoreModules';
import { CommonActions } from '../store/slices/CommonSlice';
import { task_priority_str } from '../types/enums';

export default function Dialog({ taskId, feature, map, view }) {
// const featureStatus = feature.id_ != undefined ? feature.id_.replace("_", ",").split(',')[1] : null;
const projectData = CoreModules.useAppSelector((state) => state.project.projectTaskBoundries);
const token = CoreModules.useAppSelector((state) => state.login.loginToken);
const loading = CoreModules.useAppSelector((state) => state.common.loading);
const [list_of_task_status, set_list_of_task_status] = useState([]);
const [task_status, set_task_status] = useState('READY');
const [task_status, set_task_status] = useState(task_priority_str['READY']);

const geojsonStyles = MapStyles();
const dispatch = CoreModules.useAppDispatch();
Expand All @@ -32,11 +34,11 @@ export default function Dialog({ taskId, feature, map, view }) {
})[0],
};
const findCorrectTaskStatusIndex = environment.tasksStatus.findIndex(
(data) => data.label == currentStatus.task_status,
(data) => data.label == task_priority_str[currentStatus.task_status],
);
const tasksStatus =
feature.id_ != undefined ? environment.tasksStatus[findCorrectTaskStatusIndex]?.['label'] : '';
set_task_status(tasksStatus);
set_task_status(task_priority_str[tasksStatus]);
const tasksStatusList =
feature.id_ != undefined ? environment.tasksStatus[findCorrectTaskStatusIndex]?.['action'] : [];

Expand All @@ -49,7 +51,7 @@ export default function Dialog({ taskId, feature, map, view }) {
// });

const handleOnClick = (event) => {
const status = event.target.id;
const status = task_priority_str[event.target.id];
const body = token != null ? { ...token } : {};
const geoStyle = geojsonStyles[status];
if (event.target.id != undefined) {
Expand Down Expand Up @@ -100,7 +102,8 @@ export default function Dialog({ taskId, feature, map, view }) {
</CoreModules.Stack>
<CoreModules.Stack direction={'row'} pl={1}>
<CoreModules.Typography variant="h3">
{`STATUS : ${task_status?.toString()?.replaceAll('_', ' ')}`}
{/* {`STATUS : ${task_status?.toString()?.replaceAll('_', ' ')}`} */}
{`STATUS : ${task_priority_str[task_status]}`}
</CoreModules.Typography>
</CoreModules.Stack>
<CoreModules.Link
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/utilfunctions/getTaskStatusStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Fill, Icon, Stroke, Style } from 'ol/style';
import { transform } from 'ol/proj';
import { Point } from 'ol/geom';
import AssetModules from '../shared/AssetModules';
import { task_priority_str } from '../types/enums';

function createPolygonStyle(fillColor, strokeColor) {
return new Style({
Expand Down Expand Up @@ -34,7 +35,7 @@ const strokeColor = 'rgb(0,0,0,0.5)';

const getTaskStatusStyle = (feature, mapTheme) => {
let id = feature.getId().toString().replace('_', ',');
const status = id.split(',')[1];
const status = task_priority_str[id.split(',')[1]];
const lockedPolygonStyle = createPolygonStyle(mapTheme.palette.mapFeatureColors.locked_for_mapping_rgb, strokeColor);
const lockedValidationStyle = createPolygonStyle(
mapTheme.palette.mapFeatureColors.locked_for_validation_rgb,
Expand Down

0 comments on commit 9f5c4ef

Please sign in to comment.