Files
Isuru Bimsara 81d0e65686 first commit
2026-08-14 22:46:02 +05:30

39 lines
978 B
JavaScript

/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/venStat.utill.js
// Function to calculate vendor status based on approval flags
const calVendorStatus = (is_md_approved, is_manager_approved) => {
// 1. Nothing decided yet
if (is_manager_approved === null && is_md_approved === null) {
return "Pending Approval";
}
// 2. Manager decided, MD pending
if (is_md_approved === null) {
if (is_manager_approved === true) return "Manager Approved";
if (is_manager_approved === false) return "Manager Rejected";
}
// 3. MD decision is FINAL (always overrides)
if (is_md_approved === true) {
return "Approved";
}
if (is_md_approved === false) {
return "MD Rejected";
}
return "Pending Approval";
};
module.exports = {
calVendorStatus,
}