From fed30daad0c36753ba8ab4b3485a2466c6d3886f Mon Sep 17 00:00:00 2001 From: SimonGschnell Date: Thu, 25 Apr 2024 09:41:32 +0200 Subject: [PATCH] bug fix, only appending the event to the accept and deny action button if they were actually created --- .../Cis/ProfilUpdate/ProfilUpdateView.js | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js index 7063aee83..66420b81a 100644 --- a/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js +++ b/public/js/components/Cis/ProfilUpdate/ProfilUpdateView.js @@ -248,13 +248,16 @@ export default { title: Vue.computed(() => this.$p.t("profilUpdate", "actions")), headerSort: false, formatter: (cell, params) => { + let STATUS_PENDING = + cell.getRow().getData().status == + this.profilUpdateStates["Pending"]; + let html = `
${ - cell.getRow().getData().status == - this.profilUpdateStates["Pending"] && + STATUS_PENDING ? ` - ` + `:'' }
`; @@ -270,16 +273,18 @@ export default { this.showAcceptDenyModal(cell.getRow().getData()); }); - node - .querySelector("#acceptButton") - .addEventListener("click", () => { - this.acceptProfilUpdate(cell.getRow().getData()); - }); - node - .querySelector("#denyButton") - .addEventListener("click", () => { - this.denyProfilUpdate(cell.getRow().getData()); - }); + if (STATUS_PENDING) { + node + .querySelector("#acceptButton") + .addEventListener("click", () => { + this.acceptProfilUpdate(cell.getRow().getData()); + }); + node + .querySelector("#denyButton") + .addEventListener("click", () => { + this.denyProfilUpdate(cell.getRow().getData()); + }); + } return node; },