Add MCU report template mapping flow

This commit is contained in:
sas.fajri
2026-04-29 15:38:26 +07:00
parent 6ae695d053
commit 37dea1f398
4 changed files with 177 additions and 11 deletions

View File

@@ -54,7 +54,7 @@ class Resumeindividucponev7 extends MY_Controller
Published_McuDasboardLastUpdatedUserID = VALUES(Published_McuDasboardLastUpdatedUserID)";
$this->db_onedev->query($sql, array($orderID, $userID, $userID));
}
public function getsetup()
public function getsetup()
{
try {
// if (!$this->isLogin) {
@@ -78,8 +78,68 @@ class Resumeindividucponev7 extends MY_Controller
} catch (Exception $exc) {
$message = $exc->getMessage();
$this->sys_error($message);
}
}
}
}
function get_report_mcu()
{
if (!$this->isLogin) {
$this->sys_error("Invalid Token");
exit;
}
$prm = $this->sys_input;
$mgmMcuID = 0;
if (isset($prm['Mgm_McuID'])) {
$mgmMcuID = intval($prm['Mgm_McuID']);
} else if (isset($prm['setupID'])) {
$mgmMcuID = intval($prm['setupID']);
}
if ($mgmMcuID <= 0) {
$this->sys_error("Mgm_McuID is required");
exit;
}
$sql = "SELECT
t.Mcu_ReportUrlTemplateID AS id,
t.Mcu_ReportUrlTemplateName AS reportName,
t.Mcu_ReportUrlTemplateType AS reportType,
t.Mcu_ReportUrlTemplateUrl AS reportUrl,
t.Mcu_ReportUrlTemplateParams AS reportParams,
IF(mr.Mgm_McuReportMcu_ReportUrlTemplateID = t.Mcu_ReportUrlTemplateID, 'Y', 'N') AS selected
FROM mcu_report_url_template t
LEFT JOIN mgm_mcureport mr
ON mr.Mgm_McuReportMcu_ReportUrlTemplateID = t.Mcu_ReportUrlTemplateID
AND mr.Mgm_McuReportMgm_McuID = ?
AND mr.Mgm_McuReportIsActive = 'Y'
WHERE t.Mcu_ReportUrlTemplateIsActive = 'Y'
ORDER BY t.Mcu_ReportUrlTemplateName ASC";
$query = $this->db_onedev->query($sql, array($mgmMcuID));
if (!$query) {
$message = $this->db_onedev->error();
$message['qry'] = $this->db_onedev->last_query();
$this->sys_error($message);
exit;
}
$rows = $query->result_array();
$selected = null;
foreach ($rows as $row) {
if ($row['selected'] === 'Y') {
$selected = $row;
break;
}
}
$result = array(
"total" => count($rows),
"records" => $rows,
"selected" => $selected
);
$this->sys_ok($result);
exit;
}
function search()
{
if (!$this->isLogin) {