Skip to content

Commit

Permalink
buttons corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
BHS-Harish committed Aug 7, 2024
1 parent bc5fd09 commit 843e362
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,34 @@ export function AnswersModel(props) {
</div>
<p>{ans.answer}</p>
<div className={"button-group"}>
<button
className={ans?.isApproved ? "button-delete" : "button-approve"}
id={`${ans?._id}`}
onClick={(e) => updateAnswer(e.currentTarget.id, !ans?.isApproved)}
>
{ans?.isApproved ? "Reject" : "Approve"}
</button>
{ans.isApproved == true &&
<button
name={`${ans?._id}`}
onClick={(e) => handleDeleteAnswer(e.currentTarget.name)}
className={"button-delete"}
>
Delete
</button>}
{
ans.isApproved ?
<button
name={`${ans?._id}`}
onClick={(e) => handleDeleteAnswer(e.currentTarget.name)}
className={"button-delete"}
>
Delete
</button>
:
<>
<button
className={"button-delete"}
id={`${ans?._id}`}
onClick={(e) => handleDeleteAnswer(e.currentTarget.id)}
>
Reject
</button>
<button
className={"button-delete"}
id={`${ans?._id}`}
onClick={(e) => updateAnswer(e.currentTarget.id, true)}
>
Approve
</button>
</>

}
</div>
</div>
)
Expand Down
40 changes: 25 additions & 15 deletions frontend/src/pages/Admin/Components/Faq/Q&A/QandA.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,32 @@ export function QandA() {
</div>
</div>
<div className={style["button-group"]}>
<button
className={qns?.isApproved ? style["button-delete"] : style["button-approve"]}
id={`${qns?._id}`}
onClick={(e) => updateQuestion(e.currentTarget.id, !qns?.isApproved)}
>
{qns?.isApproved ? "Reject" : "Approve"}
</button>
{
qns.isApproved == true &&
<button
name={`${qns?._id}`}
onClick={(e) => handleOpenConfirmModal(e.currentTarget.name)}
className={style["button-delete"]}
>
Delete
</button>
qns.isApproved ?
<button
name={`${qns?._id}`}
onClick={(e) => handleOpenConfirmModal(e.currentTarget.name)}
className={style["button-delete"]}
>
Delete
</button>
:
<>
<button
className={style["button-delete"]}
id={`${qns?._id}`}
onClick={(e) => handleOpenConfirmModal(e.currentTarget.id)}
>
Reject
</button>
<button
className={style["button-delete"]}
id={`${qns?._id}`}
onClick={(e) => updateQuestion(e.currentTarget.id, true)}
>
Approve
</button>
</>
}
</div>
<button
Expand Down

0 comments on commit 843e362

Please sign in to comment.