diff --git a/public/css/dashboard.css b/public/css/dashboard.css index 15b6b02..fc52d06 100644 --- a/public/css/dashboard.css +++ b/public/css/dashboard.css @@ -1432,15 +1432,6 @@ tr[data-vaid]:hover { padding: 20px; } -.modal-content { - background: white; - border-radius: 12px; - width: 100%; - max-width: 500px; - max-height: 90vh; - overflow-y: auto; - box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); -} .modal-header { display: flex; diff --git a/src/controllers/va/vaPayroll/vaPaySlip.controller.js b/src/controllers/va/vaPayroll/vaPaySlip.controller.js index 0652de0..640a9c0 100644 --- a/src/controllers/va/vaPayroll/vaPaySlip.controller.js +++ b/src/controllers/va/vaPayroll/vaPaySlip.controller.js @@ -30,7 +30,7 @@ async function va_payslip_data_function(req, res) { res.status(201).json({ success: true, - result + data: result.data }); } catch (error) { console.error("Failed to sync with Salesforce:", error.message); diff --git a/src/controllers/va/vaPayroll/vaPayrollSchedule.controller.js b/src/controllers/va/vaPayroll/vaPayrollSchedule.controller.js index 543abc5..bbe879f 100644 --- a/src/controllers/va/vaPayroll/vaPayrollSchedule.controller.js +++ b/src/controllers/va/vaPayroll/vaPayrollSchedule.controller.js @@ -21,7 +21,7 @@ async function va_payroll_schedule_function(req, res) { res.status(201).json({ success: true, - result + data: result.data }); } catch (error) { console.error("Failed to sync with Salesforce:", error.message); diff --git a/src/controllers/va/vaProfile/vaProfileUpdate.controller.js b/src/controllers/va/vaProfile/vaProfileUpdate.controller.js index 780a7d8..f1d6d20 100644 --- a/src/controllers/va/vaProfile/vaProfileUpdate.controller.js +++ b/src/controllers/va/vaProfile/vaProfileUpdate.controller.js @@ -5,25 +5,23 @@ import { VAModel } from "../../../models/vaModel.js"; // Register a new VA async function va_profile_update_callback(req, res) { try { - const { sf_token } = req.headers.sf_token; + const sf_token = req.headers.sf_token; const accessToken = req.headers.token; let vaUser; let authSource = 'regular'; - if(sf_token) { try { const sfDecoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN); - - if (!sfDecoded?.email && !sfDecoded?.vaId) { + if (!sfDecoded?.email && !sfDecoded?.portalId) { return res.status(400).json({ success: false, message: "Invalid Salesforce token payload" }); } // Find user by email or VA ID from Salesforce token - if (sfDecoded.email) { + if (sfDecoded.portalId) { + vaUser = await VAModel.findById(sfDecoded.portalId); + } else if (sfDecoded.email) { vaUser = await VAModel.findOne({ "userDetails.email": sfDecoded.email }); - } else if (sfDecoded.vaId) { - vaUser = await VAModel.findById(sfDecoded.vaId); } if (!vaUser) { diff --git a/src/routes/v1/va.routes.js b/src/routes/v1/va.routes.js index c020b76..b9c77c9 100644 --- a/src/routes/v1/va.routes.js +++ b/src/routes/v1/va.routes.js @@ -42,7 +42,7 @@ vaRoutes.post("/verify-va-email", va_verify_email); vaRoutes.get("/profile", authValidator, va_profile_callback); // Get VA Profile vaRoutes.patch("/profile", authValidator, va_profile_update_callback); // Update VA Profile -vaRoutes.delete("/:id", va_remove_function); // VA Username Callback +vaRoutes.delete("/profile/:id", va_remove_function); // VA delete Callback // timesheet adjustment routes vaRoutes.get("/timesheet/summary/:projectId/:date/:vaId?", authValidator, va_timesheet_summary_function); // Get Timesheet Adjustment for VA on specific project and date diff --git a/views/client/dashboard-dashboard.ejs b/views/client/dashboard-dashboard.ejs index e317683..e637a04 100644 --- a/views/client/dashboard-dashboard.ejs +++ b/views/client/dashboard-dashboard.ejs @@ -238,7 +238,7 @@ } // Initialize theme - const savedTheme = localStorage.getItem('theme') || getSystemTheme(); + const savedTheme = getSystemTheme(); setTheme(savedTheme); // API base URL diff --git a/views/client/dashboard-profile.ejs b/views/client/dashboard-profile.ejs index 002091e..4355b94 100644 --- a/views/client/dashboard-profile.ejs +++ b/views/client/dashboard-profile.ejs @@ -210,6 +210,19 @@