Skip to content

Commit 4b4898a

Browse files
Merge pull request #3841 from OneCommunityGlobal/anjali-email-fix-separate
Meenashi Takeover Anjali Phase 3 - Optimize Follow-Up Email Templates and Feedback Form
2 parents 6a5582b + 6a5bf82 commit 4b4898a

31 files changed

Lines changed: 1184 additions & 3338 deletions

File tree

package-lock.json

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

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
"rc-slider": "^11.1.8",
7575
"react": "^18.3.1",
7676
"react-autosuggest": "^10.1.0",
77-
"react-beautiful-dnd": "^13.1.1",
7877
"react-bootstrap": "^1.0.1",
7978
"react-chartjs-2": "^5.3.0",
8079
"react-circular-progressbar": "^2.1.0",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import axios from 'axios';
2+
import { ENDPOINTS } from '../../utils/URL';
3+
import {toast} from 'react-toastify';
4+
import { ADD_EVENT_FEEDBACK } from "../../constants/communityPortal/eventFeedbackConstant";
5+
6+
export const addEventFeedback = (eventFeedback) => {
7+
return async dispatch => {
8+
try {
9+
const res = await axios
10+
.post(ENDPOINTS.CP_ADD_EVENT_FEEDBACK, eventFeedback);
11+
if (res.status === 201)
12+
toast.success('Event Feedback submitted successfully!');
13+
dispatch ({
14+
type:ADD_EVENT_FEEDBACK,
15+
payload:eventFeedback
16+
});
17+
}
18+
catch(error) {
19+
if (error.response.status === 500)
20+
toast.error('Error submitting Event Feedback. Please try again.');
21+
else if (error.response.status === 404 ||error.response.status === 403 || error.response.status === 400)
22+
toast.error('Permission or Validation Error. Please check your input or access rights');
23+
else {
24+
toast.error('Error submitting Event Feedback. Please try again.');
25+
}
26+
};
27+
28+
}
29+
30+
}

src/components/BMDashboard/UtilizationChart/UtilizationChart.jsx

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,17 @@ function UtilizationChart() {
2020

2121
const fetchChartData = async () => {
2222
try {
23-
const response = await axios.get(
24-
`${process.env.REACT_APP_APIENDPOINT}/tools/utilization`,
25-
{
26-
params: {
27-
startDate,
28-
endDate,
29-
tool: toolFilter,
30-
project: projectFilter,
31-
},
32-
headers: {
33-
Authorization: localStorage.getItem('token'),
34-
},
35-
}
36-
);
23+
const response = await axios.get(`${process.env.REACT_APP_APIENDPOINT}/tools/utilization`, {
24+
params: {
25+
startDate,
26+
endDate,
27+
tool: toolFilter,
28+
project: projectFilter,
29+
},
30+
headers: {
31+
Authorization: localStorage.getItem('token'),
32+
},
33+
});
3734
setToolsData(response.data);
3835
} catch (err) {
3936
setError('Failed to load utilization data.');
@@ -143,10 +140,7 @@ function UtilizationChart() {
143140
className={styles.datepickerWrapper}
144141
/>
145142

146-
<button
147-
onClick={handleApplyClick}
148-
className={styles.button}
149-
>
143+
<button onClick={handleApplyClick} className={styles.button}>
150144
Apply
151145
</button>
152146
</div>

src/components/Collaboration/Collaboration.jsx

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { useEffect, useState } from 'react';
2-
import { useSelector, useDispatch } from 'react-redux';
3-
import hasPermission from '~/utils/permissions';
42
import './Collaboration.css';
53
import { toast } from 'react-toastify';
64
import { ApiEndpoint } from '~/utils/URL';
5+
import { useSelector } from 'react-redux';
76
import OneCommunityImage from '../../assets/images/logo2.png';
8-
import JobReorderModal from './JobReorderModal';
97

108
function Collaboration() {
119
const [query, setQuery] = useState('');
@@ -20,12 +18,8 @@ function Collaboration() {
2018
const [showSearchResults, setShowSearchResults] = useState(false);
2119
const [showTooltip, setShowTooltip] = useState(false);
2220
const [tooltipPosition, setTooltipPosition] = useState(null);
23-
const [isReorderModalOpen, setIsReorderModalOpen] = useState(false);
2421

2522
const darkMode = useSelector(state => state.theme.darkMode);
26-
const dispatch = useDispatch();
27-
const userHasPermission = permission => dispatch(hasPermission(permission));
28-
const canReorderJobs = userHasPermission('reorderJobs');
2923

3024
useEffect(() => {
3125
const tooltipDismissed = localStorage.getItem('tooltipDismissed');
@@ -51,18 +45,7 @@ function Collaboration() {
5145
}
5246

5347
const data = await response.json();
54-
55-
const sortedJobs = data.jobs.sort((a, b) => {
56-
if (a.displayOrder !== b.displayOrder) {
57-
return a.displayOrder - b.displayOrder;
58-
}
59-
if (a.featured !== b.featured) {
60-
return b.featured - a.featured; // Featured jobs first
61-
}
62-
return new Date(b.datePosted) - new Date(a.datePosted);
63-
});
64-
65-
setJobAds(sortedJobs);
48+
setJobAds(data.jobs);
6649
setTotalPages(data.pagination.totalPages);
6750
} catch (error) {
6851
toast.error('Error fetching jobs');
@@ -152,15 +135,6 @@ function Collaboration() {
152135
setTooltipPosition('category');
153136
};
154137

155-
const toggleReorderModal = () => {
156-
setIsReorderModalOpen(prevState => !prevState);
157-
};
158-
159-
const handleJobsReordered = () => {
160-
// Refresh job listings after reordering
161-
fetchJobAds(query, category);
162-
};
163-
164138
useEffect(() => {
165139
fetchJobAds(query, category);
166140
fetchCategories();
@@ -191,17 +165,6 @@ function Collaboration() {
191165
<button className="btn btn-secondary" type="submit" onClick={handleSubmit}>
192166
Go
193167
</button>
194-
195-
{/* Only show reorder button for users with permission */}
196-
{canReorderJobs && (
197-
<button
198-
className="btn btn-secondary reorder-button"
199-
type="button"
200-
onClick={toggleReorderModal}
201-
>
202-
Edit to Reorder
203-
</button>
204-
)}
205168
</form>
206169
{showTooltip && tooltipPosition === 'search' && (
207170
<div className="job-tooltip">
@@ -314,14 +277,6 @@ function Collaboration() {
314277
)}
315278
</div>
316279
</div>
317-
318-
{/* Reorder Modal */}
319-
<JobReorderModal
320-
isOpen={isReorderModalOpen}
321-
toggle={toggleReorderModal}
322-
onJobsReordered={handleJobsReordered}
323-
darkMode={darkMode}
324-
/>
325280
</div>
326281
);
327282
}
@@ -350,17 +305,6 @@ function Collaboration() {
350305
<button className="btn btn-secondary" type="submit" onClick={handleSubmit}>
351306
Go
352307
</button>
353-
354-
{/* Only show reorder button for users with permission */}
355-
{canReorderJobs && (
356-
<button
357-
className="btn btn-secondary reorder-button"
358-
type="button"
359-
onClick={toggleReorderModal}
360-
>
361-
Edit to Reorder
362-
</button>
363-
)}
364308
</form>
365309
{showTooltip && tooltipPosition === 'search' && (
366310
<div className="job-tooltip">
@@ -518,14 +462,6 @@ function Collaboration() {
518462
</div>
519463
)}
520464
</div>
521-
522-
{/* Reorder Modal */}
523-
<JobReorderModal
524-
isOpen={isReorderModalOpen}
525-
toggle={toggleReorderModal}
526-
onJobsReordered={handleJobsReordered}
527-
darkMode={darkMode}
528-
/>
529465
</div>
530466
);
531467
}

0 commit comments

Comments
 (0)