Skip to content

Commit

Permalink
Comments and Numbers in Deliverables
Browse files Browse the repository at this point in the history
  • Loading branch information
Sowmya-Raghuram committed Dec 28, 2024
1 parent 73cda6a commit 5d04981
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
10 changes: 10 additions & 0 deletions src/main/frontend/src/components/Nominations/Nominations.css
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,16 @@
color: #333; /* Dark text color */
}

.link-input {
width: 120px; /* Set a fixed width */
max-width: 100%; /* Ensure it doesn't overflow */
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
margin: 2px;
font-size: 14px;
}

.backToNoms button {
background-color: #0080BC; /* Green background */
color: white; /* White icon color */
Expand Down
57 changes: 50 additions & 7 deletions src/main/frontend/src/components/Nominations/Nominations.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,17 @@ const Nominations = ({ needData, openPopup }) => {
"startTime": formData[index].startTime,
"endTime": formData[index].endTime
})
axios.post(`${configData.SERVE_NEED}/deliverable-output/create`, {
"needDeliverableId": formData[index].deliverableId,
"numberOfAttendees": formData[index].numStudents,
"submittedUrl": "",
"remarks": ""
})
axios.put(
`${configData.NEEDPLAN_DELIVERABLES}/update/${formData[index].deliverableId}`,
{
"needPlanId":planId,
"comments":'',
"comments":formData[index].comments,
"status": formData[index].status,
"deliverableDate":currentDate
}
Expand All @@ -263,6 +269,7 @@ const Nominations = ({ needData, openPopup }) => {
softwarePlatform: inParas.length ? inParas[index].softwarePlatform : '',
inputUrl: inParas.length ? inParas[index].inputUrl : '',
status: item.status,
comments: item.comments,
}));
setFormData(initialFormData);
}, [deliverables, inParas]);
Expand Down Expand Up @@ -424,6 +431,7 @@ const Nominations = ({ needData, openPopup }) => {
type="text"
value={data.inputUrl}
onChange={(e) => handleDeliverableChange(e, index, 'inputUrl')}
className="link-input"
/>
) : (
data.inputUrl.toLowerCase() === "to be added soon".toLowerCase() ? (
Expand All @@ -434,12 +442,47 @@ const Nominations = ({ needData, openPopup }) => {
)}
</div>

<div className="deliv-status">
{index === editIndex ?
<input type="text" value={data.status} onChange={(e) => handleDeliverableChange(e, index, 'status')} />
: data.status
}
</div>
<div className="deliv-status">
{index === editIndex ? (
<>
<div className="field-group">
<select
id={`status-${index}`}
value={data.status}
onChange={(e) => handleDeliverableChange(e, index, 'status')}
className="link-input"
>
<option value="Planned">Planned</option>
<option value="Completed">Completed</option>
<option value="Cancelled">Cancelled</option>
</select>
</div>
<div className="field-group">
<input
id={`comments-${index}`}
value={data.comments || ''}
onChange={(e) => handleDeliverableChange(e, index, 'comments')}
className="link-input"
placeholder="Add comments"
/>
</div>
<div className="field-group">
<input
id={`students-${index}`}
type="number"
value={data.numStudents || ''}
onChange={(e) => handleDeliverableChange(e, index, 'numStudents')}
className="link-input"
placeholder="Students Number"
/>
</div>
</>
) : (
<div>
{data.status}
</div>
)}
</div>
{!!inParas.length && <div className="deliv-action">
{index === editIndex ?
<button onClick={() => handleDoneDeliverable(index)}><DoneIcon className="done-icon" /></button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const VolunteerProfileDeliverable = props => {

useEffect(() => {
const filteredDeliverables = filterDeliverablesByMonth(deliverables, selectedMonth);
setTodoDeliverables(filteredDeliverables && filteredDeliverables.filter(item => item.status === 'NotStarted'));
setTodoDeliverables(filteredDeliverables && filteredDeliverables.filter(item => item.status === 'NotStarted' || item.status === 'Planned'));
setCompletedDeliverables(filteredDeliverables && filteredDeliverables.filter(item => item.status === 'Completed'));
setCancelledDeliverables(filteredDeliverables && filteredDeliverables.filter(item => item.status === 'Cancelled'));
}, [deliverables, selectedMonth,dstat]); // Depend on both deliverables and selectedMonth
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/src/state/entitySlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const initialState = {
export const fetchEntities = createAsyncThunk('needtypes/fetchEntities',
async ()=> {
try {
const response = await axios.get(`${configData.ENTITY_GET}/?page=0&size=100&status=Active`)
const response = await axios.get(`${configData.ENTITY_GET}/?page=0&size=200&status=Active`)
return response.data
} catch(error){
throw error
Expand Down

0 comments on commit 5d04981

Please sign in to comment.