diff --git a/public/js/apps/Cis/ProfilUpdateRequests.js b/public/js/apps/Cis/ProfilUpdateRequests.js index 24e33110e..21bf32444 100755 --- a/public/js/apps/Cis/ProfilUpdateRequests.js +++ b/public/js/apps/Cis/ProfilUpdateRequests.js @@ -11,6 +11,59 @@ const app = Vue.createApp({ return { showAll: false, profil_updates_table_options: { + + + rowContextMenu: (e, component)=>{ + + let menu =[]; + if(component.getData().status === "pending"){ + menu.push( + + { + label:" Accept Request", + action:(e, column)=>{ + Vue.$fhcapi.ProfilUpdate.acceptProfilRequest(column.getData()).then((res) => { + this.$refs.UpdatesTable.tabulator.setData(); + }); + + } + }, + { + separator:true, + }, + { + label:" Deny Request", + action:(e, column)=>{ + + Vue.$fhcapi.ProfilUpdate.denyProfilRequest(column.getData()).then((res) => { + this.$refs.UpdatesTable.tabulator.setData(); + }); + } + }, + { + separator:true, + }, + { + label:" Show Request", + action:(e, column)=>{ + this.showModal(column.getData()); + } + } + + ); + }else{ + menu.push( + { + label:" Show Request", + action:(e, column)=>{ + this.showModal(column.getData()); + } + } + ) + } + return menu; + + } , ajaxURL:FHC_JS_DATA_STORAGE_OBJECT.app_root + FHC_JS_DATA_STORAGE_OBJECT.ci_router + `/Cis/ProfilUpdate/`, @@ -66,8 +119,6 @@ const app = Vue.createApp({ hozAlign: "center", headerFilter: true, formatter: function (cell, para) { - let res = Object.getPrototypeOf(cell); - //console.log(res); switch (cell.getValue()) { case "pending": @@ -95,20 +146,9 @@ const app = Vue.createApp({ hozAlign: "center", cellClick: (e, cell) => { //! function that is called when clicking on a row in the table - let cellData = cell.getRow().getData(); + this.showModal(cellData); - AcceptDenyUpdate.popup({ value: cellData }) - .then((res) => { - console.log("res of the modal: ", res); - //? refetches the data, if any request was denied or accepted - //* setData will call the ajaxURL again to refresh the data - this.$refs.UpdatesTable.tabulator.setData(); - }) - .catch((e) => { - //? catches the rejected Promise if the result of the modal was falsy - console.log("catch of the modal: ", e); - }); }, //responsive:0, }, @@ -130,6 +170,19 @@ const app = Vue.createApp({ } }, methods: { + showModal: function(value){ + AcceptDenyUpdate.popup({ value: value }) + .then((res) => { + console.log("res of the modal: ", res); + //? refetches the data, if any request was denied or accepted + //* setData will call the ajaxURL again to refresh the data + this.$refs.UpdatesTable.tabulator.setData(); + }) + .catch((e) => { + //? catches the rejected Promise if the result of the modal was falsy + console.log("catch of the modal: ", e); + }); + }, updateData: function(event){ this.$refs.UpdatesTable.tabulator.setData(); diff --git a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js index 896a2edf9..0e6c0c3d3 100755 --- a/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js +++ b/public/js/components/Cis/ProfilUpdate/AcceptDenyUpdate.js @@ -49,18 +49,14 @@ export default { }, acceptRequest: function () { Vue.$fhcapi.ProfilUpdate.acceptProfilRequest(this.data).then((res) => { - console.log("res", res); - console.log("res.data", res.data); this.result = true; }); this.hide(); }, denyRequest: function () { - console.log(this.data.profil_update_id); + Vue.$fhcapi.ProfilUpdate.denyProfilRequest(this.data).then((res) => { - console.log("res", res); - console.log("res.data", res.data); this.result = true; }); this.hide(); @@ -129,14 +125,14 @@ export default { -->
-
+
Status:
{{data.status}}
-
+
Date of Status:
{{data.status_timestamp?data.status_timestamp:'-'}} @@ -144,16 +140,19 @@ export default { -
+
UserID:
{{data.uid}}
+
+
Name:
+ {{data.name}} +
- -
+
Topic of Request:
{{data.topic}} @@ -162,7 +161,7 @@ export default { -
+
Date of Request:
{{data.insertamum}}