add recent messages view

This commit is contained in:
mahdahar 2025-01-28 11:00:05 +07:00
parent e69a60c39a
commit 16b0c781c5
3 changed files with 47 additions and 332 deletions

View File

@ -5,7 +5,13 @@ namespace App\Controllers;
class Pages extends BaseController {
public function home() {
echo "this site is made for Technidata integration with Transmedic";
$db = \Config\Database::connect();
$sql = "select top 10 * from cmod.dbo.CM_TM_LOGS order by LOGDATE desc";
$query = $db->query($sql);
$results = $query->getResultArray();
$data['messages'] = $results;
return view('recent_messages', $data);
}
}

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Your Page Title</title>
<meta name="description" content="Technidata with Transmedic">
<meta name="author" content="miluzakaria">
<link rel="icon" href="assets/favicon.ico" type="image/x-icon">
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
pre {
background: #f4f4f4;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
}
</style>
</head>
<body>
<h3>Recent Request from TM</h3>
<?php
foreach($messages as $data) {
$logdate = $data['LOGDATE'];
$body = $data['BODY'];
if (!empty($body)) {
$msg = json_decode($body);
if (json_last_error() === JSON_ERROR_NONE) {
$prettyjson = json_encode($msg, JSON_PRETTY_PRINT);
echo "<p> date : $logdate<pre>".htmlspecialchars($prettyjson)."</pre> </p>";
}
}
}
?>
</body>
</html>

File diff suppressed because one or more lines are too long