Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
0c7f181
RDS new flow request changes button added and different field added f…
Dhirenderchoudhary Feb 10, 2026
5c8e641
Merge branch 'develop' of https://github.com/Dhirenderchoudhary/websi…
Dhirenderchoudhary Feb 10, 2026
31dfffa
feat: Configure environment variable loading for local development, r…
Dhirenderchoudhary Feb 10, 2026
7640cb1
chore: Configure Yarn to use node_modules linker and define packageMa…
Dhirenderchoudhary Feb 10, 2026
848d556
Consolidate application feedback into the update payload, refine API …
Dhirenderchoudhary Feb 11, 2026
e712bda
feat: Add 'changes requested' application status, migrate to Yarn 4, …
Dhirenderchoudhary Feb 11, 2026
aa71f40
feat: Update application feedback handling, refine API interactions, …
Dhirenderchoudhary Feb 11, 2026
4209c6d
chore: refactor CSS selectors
Dhirenderchoudhary Feb 12, 2026
1b6ef9f
feat: Enhance application details with status messages, hide action b…
Dhirenderchoudhary Feb 15, 2026
ed864b9
refactor: upgrade Yarn to v4 and update CSS selectors for the request…
Dhirenderchoudhary Feb 16, 2026
fa59ee9
test: Add comprehensive tests for application 'request changes' flow
Dhirenderchoudhary Feb 16, 2026
43d3ab7
feat: Add feedback display for applications and implement changes req…
Dhirenderchoudhary Feb 17, 2026
ccd2937
feat: Add application score display and last edited timestamp in deta…
Dhirenderchoudhary Feb 19, 2026
fed2c33
feat: Add application highlights, status badges, and request changes …
Dhirenderchoudhary Feb 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions applications/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ <h2>Status</h2>
>
Accept
</button>
<button
class="application-details-request-changes"
aria-label="Request Changes Application"
>
Request Changes
</button>
<button
class="application-details-reject"
aria-label="Reject Application"
Expand Down
132 changes: 110 additions & 22 deletions applications/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
showToast,
updateApplication,
getApplicationById,
addApplicationFeedback,
} from './utils.js';
let nextLink;
let isDataLoading = false;
Expand Down Expand Up @@ -32,6 +33,10 @@ const applicationAcceptButton = document.querySelector(
const applicationRejectButton = document.querySelector(
'.application-details-reject',
);
const applicationRequestChangesButton = document.querySelector(
'.application-details-request-changes',
);

const applyFilterButton = document.getElementById('apply-filter-button');
const applicationContainer = document.querySelector('.application-container');
const clearButton = document.getElementById('clear-button');
Expand Down Expand Up @@ -81,32 +86,63 @@ let currentApplicationId;

let status = 'all';

function updateUserApplication({ isAccepted }) {
function updateUserApplication({ isAccepted, isRequestChanges = false }) {
const applicationTextarea = document.querySelector('.application-textarea');
let status;
const payload = {};

if (isAccepted) status = 'accepted';
else status = 'rejected';
if (isRequestChanges) {
if (!applicationTextarea || !applicationTextarea.value) {
return;
}
updateApplication({
applicationId: currentApplicationId,
applicationPayload: {
feedback: applicationTextarea.value,
},
})
.then(() => {
showToast({
message: 'Changes requested successfully!',
type: 'success',
});
setTimeout(() => closeApplicationDetails(), 1000);
})
.catch((error) => {
showToast({
message: error.message || 'Failed to request changes',
type: 'error',
});
});
return;
}

const applicationStatus = isAccepted ? 'accepted' : 'rejected';
const payload = { status: applicationStatus };

payload['status'] = status;
const promises = [];

if (applicationTextarea.value) {
payload.feedback = applicationTextarea.value;
if (applicationTextarea && applicationTextarea.value) {
promises.push(
addApplicationFeedback(currentApplicationId, {
feedback: applicationTextarea.value,
status: applicationStatus,
}),
);
}

updateApplication({
applicationId: currentApplicationId,
applicationPayload: payload,
})
.then((res) => {
const updatedFeedback = payload.feedback || '';
applicationTextarea.value = updatedFeedback;
promises.push(
updateApplication({
applicationId: currentApplicationId,
applicationPayload: payload,
}),
);

Promise.all(promises)
.then(() => {
showToastMessage({
isDev,
oldToastFunction: showToast,
type: 'success',
message: res.message,
message: 'Application updated successfully!',
});
setTimeout(() => closeApplicationDetails(), 1000);
})
Expand Down Expand Up @@ -166,6 +202,21 @@ function openApplicationDetails(application) {
{
title: 'Status',
description: application.status,
isStatus: true,
},
{
title: 'Application Score',
description:
application.applicationScore !== undefined
? application.applicationScore
: 'N/A',
isHighlight: true,
},
{
title: 'Nudge Count',
description:
application.nudgeCount !== undefined ? application.nudgeCount : 'N/A',
isHighlight: true,
},
{
title: 'Introduction',
Expand Down Expand Up @@ -210,27 +261,52 @@ function openApplicationDetails(application) {

applicationDetailsMain.appendChild(title);

selectedApplication.applicationDetails.forEach((application) => {
const highlightsSection = createElement({
type: 'div',
attributes: { class: 'application-highlights' },
});

selectedApplication.applicationDetails.forEach((detail) => {
const applicationSection = createElement({
type: 'div',
attributes: { class: 'application-section' },
attributes: {
class: detail.isHighlight
? 'application-section application-highlight-item'
: 'application-section',
},
});
const applicationSectionTitle = createElement({
type: 'h2',
attributes: { class: 'section-title' },
innerText: application.title,
innerText: detail.title,
});

let descriptionClass = 'description';
if (detail.isStatus) {
descriptionClass += ` status-${detail.description?.toLowerCase()}`;
}

const applicationSectionDescription = createElement({
type: 'p',
attributes: { class: 'description' },
innerText: application.description,
attributes: { class: descriptionClass },
innerText: detail.description,
});

applicationSection.appendChild(applicationSectionTitle);
applicationSection.appendChild(applicationSectionDescription);
applicationDetailsMain.appendChild(applicationSection);

if (detail.isHighlight) {
highlightsSection.appendChild(applicationSection);
} else {
applicationDetailsMain.appendChild(applicationSection);
}
});

if (highlightsSection.children.length > 0) {
const titleElement = applicationDetailsMain.querySelector('.title');
titleElement.insertAdjacentElement('afterend', highlightsSection);
}

const applicationSection = createElement({
type: 'div',
attributes: { class: 'application-section' },
Expand Down Expand Up @@ -258,6 +334,8 @@ function openApplicationDetails(application) {
if (application.status === 'rejected') {
applicationAcceptButton.classList.add('hidden');
applicationRejectButton.classList.add('hidden');
applicationRequestChangesButton.classList.add('hidden');

const applicationDetailsRejectedMsg = createElement({
type: 'p',
attributes: {
Expand All @@ -269,6 +347,8 @@ function openApplicationDetails(application) {
} else if (application.status === 'accepted') {
applicationAcceptButton.classList.add('hidden');
applicationRejectButton.classList.add('hidden');
applicationRequestChangesButton.classList.add('hidden');

const applicationDetailsAcceptedMsg = createElement({
type: 'p',
attributes: {
Expand All @@ -287,6 +367,11 @@ function openApplicationDetails(application) {
applicationAcceptButton.disabled = false;
applicationAcceptButton.style.cursor = 'pointer';
applicationAcceptButton.classList.remove('disable-button');

applicationRequestChangesButton.classList.remove('hidden');
applicationRequestChangesButton.disabled = false;
applicationRequestChangesButton.style.cursor = 'pointer';
applicationRequestChangesButton.classList.remove('disable-button');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about currentStatus === 'changes_requested'? where is that case being handled?

}
}

Expand Down Expand Up @@ -640,3 +725,6 @@ applicationAcceptButton.addEventListener('click', () =>
applicationRejectButton.addEventListener('click', () =>
updateUserApplication({ isAccepted: false }),
);
applicationRequestChangesButton.addEventListener('click', () => {
updateUserApplication({ isAccepted: false, isRequestChanges: true });
});
Loading
Loading