From 307e5c7d4e3c7804877a9422f752d018c3b024eb Mon Sep 17 00:00:00 2001 From: Bhaskar Date: Thu, 4 Sep 2025 13:45:08 +0530 Subject: [PATCH] changes --- src/controllers/departmentController.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/controllers/departmentController.js b/src/controllers/departmentController.js index 46a0376f..49c825f8 100644 --- a/src/controllers/departmentController.js +++ b/src/controllers/departmentController.js @@ -434,7 +434,19 @@ exports.addDepartment = async (request, reply) => { let finalReportingManagerEmail = reportingManager_email; if (reportingManager?.toLowerCase() === "self") { - finalReportingManager = `${firstName || ""} ${lastName || ""} - (${phone}) - ${city}`; + // Default format + let managerString = `${firstName || ""} ${lastName || ""} - (${phone}) - ${city}`; + + // If departmentName is "Head Office" or "Branch Office" → add departmentName + if ( + ["head office", "branch office"].includes( + (departmentName || "").toLowerCase().trim() + ) + ) { + managerString += ` - ${departmentName}`; + } + + finalReportingManager = managerString; finalReportingManagerMobile = phone; finalReportingManagerEmail = email; } @@ -481,6 +493,7 @@ exports.addDepartment = async (request, reply) => { } }; + exports.getDetails = async (request, reply) => { try {