Skip to content

Commit ba0d769

Browse files
Revert "Merge branch 'development' into shashank-madan-change-css-to-module-css"
This reverts commit 863428d, reversing changes made to 7d7100d.
1 parent 863428d commit ba0d769

49 files changed

Lines changed: 2691 additions & 9988 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"dependencies": {
1010
"@babel/runtime": "^7.27.6",
1111
"@babel/runtime-corejs3": "^7.27.6",
12+
"@changey/react-leaflet-markercluster": "^4.0.0-rc1",
1213
"@date-io/dayjs": "^3.2.0",
1314
"@emotion/react": "^11.8.1",
1415
"@emotion/styled": "^11.14.0",
@@ -81,7 +82,6 @@
8182
"react-dom": "^18.3.1",
8283
"react-icons": "^4.12.0",
8384
"react-leaflet": "4.2.1",
84-
"react-leaflet-cluster": "^3.1.1",
8585
"react-multi-select-component": "^4.0.2",
8686
"react-phone-input-2": "^2.14.0",
8787
"react-redux": "^7.2.0",
@@ -106,7 +106,6 @@
106106
"redux-concatenate-reducers": "^1.0.0",
107107
"redux-persist": "^5.10.0",
108108
"redux-thunk": "^2.4.2",
109-
"reselect": "^5.1.1",
110109
"semver": "^7.7.2",
111110
"stream-browserify": "^3.0.0",
112111
"tinymce": "^7.2.0",

public/avatar.png

-15.4 KB
Binary file not shown.

src/__tests__/mockStates.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,8 @@ export const userProfileMock = {
593593
},
594594
mediaUrl: 'http://dropbox.com',
595595
weeklySummariesCount: 0,
596-
savedTangibleHrs: [
597-
0, 0, 0, 0, 0, 0, 0, 0
596+
savedTangibleHrs:[
597+
0,0,0,0,0,0,0,0
598598
],
599599
};
600600

@@ -1095,7 +1095,6 @@ export const rolesMock = {
10951095
'swapTask',
10961096
'deleteTask',
10971097
'updateNum',
1098-
'viewTaskExtensionCount',
10991098
// Teams
11001099
'postTeam',
11011100
'deleteTeam',
@@ -1255,7 +1254,6 @@ export const rolesMock = {
12551254
'updateTask',
12561255
'swapTask',
12571256
'deleteTask',
1258-
'viewTaskExtensionCount',
12591257
'postTeam',
12601258
'deleteTeam',
12611259
'putTeam',
@@ -1329,9 +1327,9 @@ export const createAuthMocks = (permissions) => {
13291327
frontPermissions: []
13301328
},
13311329
firstName: 'Dev',
1332-
profilePic: ''
1330+
profilePic:''
13331331
};
1334-
const onlyPermissions = { ...authTemplate, permissions: { frontPermissions: permissions } };
1335-
const allOtherPermissions = { ...authTemplate, permissions: { frontPermissions: allPermissionsExcept(permissions) } };
1332+
const onlyPermissions = {...authTemplate, permissions: {frontPermissions: permissions}};
1333+
const allOtherPermissions = {...authTemplate, permissions: {frontPermissions: allPermissionsExcept(permissions)}};
13361334
return [onlyPermissions, allOtherPermissions];
13371335
};

src/components/ApplicantVolunteerRatio/ApplicantVolunteerRatio.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function ApplicantVolunteerRatio() {
3030
// Set all roles as selected by default
3131
setSelectedRoles(roleOptions);
3232
} catch (err) {
33-
// Error fetching all roles
33+
console.error('Error fetching all roles:', err);
3434
setError('Failed to load roles. Please try again.');
3535
}
3636
};
@@ -73,7 +73,7 @@ function ApplicantVolunteerRatio() {
7373

7474
setData(transformedData);
7575
} catch (err) {
76-
// Error fetching applicant volunteer ratio data
76+
console.error('Error fetching applicant volunteer ratio data:', err);
7777
setError('Failed to load data. Please try again.');
7878
} finally {
7979
setLoading(false);

src/components/BMDashboard/UpdateConsumables/UpdateConsumable.jsx

Lines changed: 38 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,62 @@ function UpdateConsumable({ record, setModal }) {
1010
const dispatch = useDispatch();
1111
const postConsumableUpdateResult = useSelector(state => state.bmConsumables.updateConsumables);
1212
const { purchaseRecord, stockAvailable, updateRecord: _, ...rest } = record;
13-
1413
const recordInitialState = {
1514
date: moment(new Date()).format('YYYY-MM-DD'),
1615
quantityUsed: '0',
1716
quantityWasted: '0',
1817
qtyUsedLogUnit: 'unit',
1918
qtyWastedLogUnit: 'unit',
20-
reasonWastage: '',
21-
usedBy: '',
2219
consumable: rest,
2320
newAvailable: undefined,
2421
};
25-
2622
const validationsInitialState = {
2723
quantityUsed: '',
2824
quantityWasted: '',
2925
quantityTogether: '',
3026
};
31-
3227
const [updateRecord, setUpdateRecord] = useState(recordInitialState);
3328
const [validations, setValidations] = useState(validationsInitialState);
3429
const [availableCount, setAvailableCount] = useState(undefined);
3530
const [changeOccured, setChangeOccured] = useState(false);
3631

32+
useEffect(() => {
33+
setUpdateRecord({ ...recordInitialState });
34+
setValidations({ ...validationsInitialState });
35+
}, []);
36+
37+
useEffect(() => {
38+
if (postConsumableUpdateResult.loading === false && postConsumableUpdateResult.error === true) {
39+
toast.error(`${postConsumableUpdateResult.result}`);
40+
setModal(false);
41+
} else if (
42+
postConsumableUpdateResult.loading === false &&
43+
postConsumableUpdateResult.result !== null
44+
) {
45+
toast.success(`Updated ${record?.itemType?.name} successfully`);
46+
setModal(false);
47+
}
48+
}, [postConsumableUpdateResult]);
49+
50+
useEffect(() => {
51+
const qtyUsedFloat = parseFloat(updateRecord.quantityUsed);
52+
const qtyWastedFloat = parseFloat(updateRecord.quantityWasted);
53+
54+
if (qtyUsedFloat || qtyWastedFloat) {
55+
setChangeOccured(true);
56+
} else {
57+
setChangeOccured(false);
58+
}
59+
60+
// eslint-disable-next-line no-use-before-define
61+
validate(
62+
updateRecord.quantityUsed,
63+
updateRecord.quantityWasted,
64+
updateRecord.qtyUsedLogUnit,
65+
updateRecord.qtyWastedLogUnit,
66+
);
67+
}, [updateRecord]);
68+
3769
const validate = (_qtyUsed, _qtyWasted, qtyUsedLogUnit, qtyWastedLogUnit) => {
3870
let unitsUsed = _qtyUsed === '' ? 0 : parseFloat(_qtyUsed);
3971
let unitsWasted = _qtyWasted === '' ? 0 : parseFloat(_qtyWasted);
@@ -50,16 +82,12 @@ function UpdateConsumable({ record, setModal }) {
5082

5183
if (unitsUsed > stockAvailable) {
5284
tempValidations.quantityUsed = 'Quantity Used exceeds the available stock';
53-
} else if (unitsUsed < 0) {
54-
tempValidations.quantityUsed = 'Quantity Used cannot be negative';
5585
} else {
5686
tempValidations.quantityUsed = '';
5787
}
5888

5989
if (unitsWasted > stockAvailable) {
6090
tempValidations.quantityWasted = 'Quantity Wasted exceeds the available stock';
61-
} else if (unitsWasted < 0) {
62-
tempValidations.quantityWasted = 'Quantity Wasted cannot be negative';
6391
} else {
6492
tempValidations.quantityWasted = '';
6593
}
@@ -80,42 +108,6 @@ function UpdateConsumable({ record, setModal }) {
80108
}
81109
};
82110

83-
useEffect(() => {
84-
setUpdateRecord({ ...recordInitialState });
85-
setValidations({ ...validationsInitialState });
86-
}, []);
87-
88-
useEffect(() => {
89-
if (postConsumableUpdateResult.loading === false && postConsumableUpdateResult.error === true) {
90-
toast.error(`${postConsumableUpdateResult.result}`);
91-
setModal(false);
92-
} else if (
93-
postConsumableUpdateResult.loading === false &&
94-
postConsumableUpdateResult.result !== null
95-
) {
96-
toast.success(`Updated ${record?.itemType?.name} successfully`);
97-
setModal(false);
98-
}
99-
}, [postConsumableUpdateResult]);
100-
101-
useEffect(() => {
102-
const qtyUsedFloat = parseFloat(updateRecord.quantityUsed);
103-
const qtyWastedFloat = parseFloat(updateRecord.quantityWasted);
104-
105-
if (qtyUsedFloat || qtyWastedFloat) {
106-
setChangeOccured(true);
107-
} else {
108-
setChangeOccured(false);
109-
}
110-
111-
validate(
112-
updateRecord.quantityUsed,
113-
updateRecord.quantityWasted,
114-
updateRecord.qtyUsedLogUnit,
115-
updateRecord.qtyWastedLogUnit,
116-
);
117-
}, [updateRecord]);
118-
119111
const submitHandler = () => {
120112
if (
121113
validations.quantityUsed === '' &&
@@ -130,8 +122,6 @@ function UpdateConsumable({ record, setModal }) {
130122
quantityWasted:
131123
updateRecord.quantityWasted === '' ? 0 : parseFloat(updateRecord.quantityWasted),
132124
qtyWastedLogUnit: updateRecord.qtyWastedLogUnit,
133-
reasonWastage: updateRecord.reasonWastage,
134-
usedBy: updateRecord.usedBy,
135125
stockAvailable,
136126
consumable: updateRecord.consumable,
137127
};
@@ -146,6 +136,7 @@ function UpdateConsumable({ record, setModal }) {
146136
if (Number(value) < 0) return;
147137
const tempRecord = { ...updateRecord };
148138
tempRecord[name] = value;
139+
149140
setUpdateRecord(tempRecord);
150141
};
151142

@@ -175,7 +166,6 @@ function UpdateConsumable({ record, setModal }) {
175166
{record?.project.name}
176167
</Col>
177168
</FormGroup>
178-
179169
<FormGroup row className="align-items-center justify-content-start">
180170
<Label for="updateConsumableDate" sm={4} className={`${styles.consumableFormLabel}`}>
181171
Date
@@ -212,7 +202,6 @@ function UpdateConsumable({ record, setModal }) {
212202
</Col>
213203
</FormGroup>
214204
)}
215-
216205
<FormGroup row>
217206
<Label
218207
for="updateConsumableQuantityUsed"
@@ -230,12 +219,6 @@ function UpdateConsumable({ record, setModal }) {
230219
value={updateRecord.quantityUsed}
231220
onChange={e => changeRecordHandler(e)}
232221
min={0}
233-
onKeyDown={e => {
234-
if (e.key === '+' || e.key === '-') e.preventDefault();
235-
}}
236-
onInput={e => {
237-
e.target.value = e.target.value.replace(/[^\d.]/g, '');
238-
}}
239222
/>
240223
</Col>
241224
<Col sm={{ size: 4 }} className={`${styles.consumableFormValue}`}>
@@ -279,12 +262,6 @@ function UpdateConsumable({ record, setModal }) {
279262
value={updateRecord.quantityWasted}
280263
onChange={e => changeRecordHandler(e)}
281264
min={0}
282-
onKeyDown={e => {
283-
if (e.key === '+' || e.key === '-') e.preventDefault();
284-
}}
285-
onInput={e => {
286-
e.target.value = e.target.value.replace(/[^\d.]/g, '');
287-
}}
288265
/>
289266
</Col>
290267
<Col sm={{ size: 4 }} className={`${styles.consumableFormValue}`}>
@@ -309,42 +286,6 @@ function UpdateConsumable({ record, setModal }) {
309286
</Label>
310287
)}
311288
</FormGroup>
312-
313-
<FormGroup row>
314-
<Label for="updateConsumableReasonWastage" sm={4} className="consumableFormLabel">
315-
Reason for Wastage
316-
</Label>
317-
<Col sm={8} className="consumableFormValue">
318-
<Input
319-
id="updateConsumableReasonWastage"
320-
name="reasonWastage"
321-
type="select"
322-
value={updateRecord.reasonWastage}
323-
onChange={e => changeRecordHandler(e)}
324-
>
325-
<option value="">Select Reason</option>
326-
<option value="expired">Expired</option>
327-
<option value="damaged">Damaged</option>
328-
<option value="overstock">Overstock</option>
329-
</Input>
330-
</Col>
331-
</FormGroup>
332-
333-
<FormGroup row>
334-
<Label for="updateConsumableUsedBy" sm={4} className="consumableFormLabel">
335-
Used By
336-
</Label>
337-
<Col sm={8} className="consumableFormValue">
338-
<Input
339-
id="updateConsumableUsedBy"
340-
name="usedBy"
341-
type="text"
342-
value={updateRecord.usedBy}
343-
onChange={e => changeRecordHandler(e)}
344-
/>
345-
</Col>
346-
</FormGroup>
347-
348289
{validations.quantityTogether !== '' &&
349290
validations.quantityUsed === '' &&
350291
validations.quantityWasted === '' && (

0 commit comments

Comments
 (0)