Updated api
This commit is contained in:
parent
9de7384020
commit
84871c7236
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@
|
|||
}
|
||||
|
||||
// Initialize theme
|
||||
const savedTheme = localStorage.getItem('theme') || getSystemTheme();
|
||||
const savedTheme = getSystemTheme();
|
||||
setTheme(savedTheme);
|
||||
|
||||
// API base URL
|
||||
|
|
|
|||
|
|
@ -210,6 +210,19 @@
|
|||
</div>
|
||||
|
||||
<script>
|
||||
// Theme management
|
||||
function setTheme(theme) {
|
||||
document.documentElement.setAttribute('data-theme', theme);
|
||||
localStorage.setItem('theme', theme);
|
||||
}
|
||||
|
||||
function getSystemTheme() {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
}
|
||||
|
||||
// Initialize theme
|
||||
const savedTheme = getSystemTheme();
|
||||
setTheme(savedTheme);
|
||||
// API base URL
|
||||
const API_BASE = '/api/v1/client';
|
||||
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@
|
|||
}
|
||||
|
||||
// Initialize theme
|
||||
const savedTheme = localStorage.getItem('theme') || getSystemTheme();
|
||||
const savedTheme = getSystemTheme();
|
||||
setTheme(savedTheme);
|
||||
|
||||
// API base URL
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@
|
|||
}
|
||||
|
||||
// Initialize theme
|
||||
const savedTheme = localStorage.getItem('theme') || getSystemTheme();
|
||||
const savedTheme = getSystemTheme();
|
||||
setTheme(savedTheme);
|
||||
|
||||
// API base URL
|
||||
|
|
|
|||
Loading…
Reference in New Issue