Skip to content

Commit

Permalink
Merge pull request #2433 from airqo-platform/hotfix-demo-feedback
Browse files Browse the repository at this point in the history
[Netmanager] Added maintenance type field to add logs table
  • Loading branch information
Baalmart authored Jan 31, 2025
2 parents c06dcca + 87e1894 commit 5c1351f
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
const [description, setDescription] = useState('');
const [tags, setTags] = useState([]);
const [selectedDate, setSelectedDate] = useState(new Date());
const [maintenanceType, setMaintenanceType] = useState('preventive');

const createTagOption = (tag) => ({ label: tag, value: tag });

Expand Down Expand Up @@ -267,6 +268,7 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
tags: extracted_tags,
description: description,
userName: parsedData.email,
maintenanceType: maintenanceType,
email: parsedData.email,
firstName: parsedData.firstName,
lastName: parsedData.lastName
Expand Down Expand Up @@ -336,6 +338,10 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
toggleShow();
};

const handleMaintenanceTypeChange = (event) => {
setMaintenanceType(event.target.value);
};

return (
<Paper style={{ minHeight: '400px', padding: '5px 10px' }}>
<h4>Add Log</h4>
Expand All @@ -362,6 +368,25 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
onChange={(event) => setDescription(event.target.value)}
/>
</div>
<div>
<TextField
select
fullWidth
label="Maintenance Type"
style={{ margin: '10px 0' }}
value={maintenanceType}
onChange={handleMaintenanceTypeChange}
SelectProps={{
native: true,
style: { width: '100%', height: '50px' }
}}
required
variant="outlined"
>
<option value="preventive">Preventive</option>
<option value="corrective">Corrective</option>
</TextField>
</div>
<div style={{ marginTop: '5px' }}>
<CreatableLabelledSelect
label={'Tags'}
Expand Down Expand Up @@ -437,6 +462,12 @@ export default function DeviceLogs({ deviceName, deviceLocation }) {
return <div className={'table-truncate'}>{rowData.tags && rowData.tags.join(', ')}</div>;
}
},
{
title: 'Maintenance Type',
field: 'maintenanceType',
cellStyle: { width: 100, maxWidth: 100 },
render: (rowData) => <div className={'table-truncate'}>{rowData.maintenanceType}</div>
},
{
title: 'Created On',
field: 'createdAt',
Expand Down

0 comments on commit 5c1351f

Please sign in to comment.