add val counter

This commit is contained in:
mahdahar 2025-11-18 14:15:41 +07:00
parent fdde6591e4
commit 75062e00a5
9 changed files with 173 additions and 16 deletions

View File

@ -61,7 +61,7 @@ class Filters extends BaseFilters
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
//'toolbar', // Debug Toolbar
'toolbar', // Debug Toolbar
],
];

View File

@ -16,7 +16,7 @@ $routes->get('/', 'Home::index');
$routes->match(['get','post'],'/login', 'Auth::login', ['filter' => 'guest']);
$routes->get('/logout', 'Auth::logout');
$routes->get('result/(:any)', 'Result::show/$1');
// ------------------------------------------------------Page Based on Role------------------------------------------------------ //
$routes->group('admin', ['filter' => 'role:1'], function($routes) {
$routes->get('/', 'Admin::index');

View File

@ -70,6 +70,7 @@ class Admin extends BaseController
'ishardcopy'=> $row['ODR_NFLAGHARDCOPY'] ?? 0,
'isval' => $row['ISVAL'] ?? 0,
'isdelete' => $isDelete,
'val' => $row['VAL'] ?? 0,
];
}

View File

@ -2,17 +2,11 @@
namespace App\Controllers;
class Auth extends BaseController
{
public function login()
{
class Auth extends BaseController {
public function login() {
if ($this->request->getMethod() === 'GET') {
return view('login');
} else if ($this->request->getMethod() === 'POST') {
helper(['form', 'url']);
$session = session();
$db = \Config\Database::connect();
@ -49,8 +43,7 @@ class Auth extends BaseController
}
public function logout()
{
public function logout() {
session()->destroy();
return redirect()->to('/login');
}

View File

@ -0,0 +1,16 @@
<?php
namespace App\Controllers;
class Result extends BaseController {
public function show($accessnumber) {
$db = db_connect();
$data['accessnumber'] = $accessnumber;
$result = $db
->query("SELECT STATS FROM GDC_CMOD.dbo.V_DASHBOARD_DEV WHERE SP_ACCESSNUMBER='$accessnumber'")
->getResultArray();
$data['status'] = $result[0]['STATS'];
return view('result/show',$data);
}
}

View File

@ -136,7 +136,7 @@
<?= $this->renderSection('content'); ?>
<script>
console.log("salam 5panda");
console.log("salam 5panda" );
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>

View File

@ -10,7 +10,7 @@
<div class='row p-1'>
<div class='col fw-bold'>Dashboard</div>
<div class='col text-end'>
Hi, User
Hi, <?=session('userid');?>
<button class="btn btn-sm btn-secondary" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false"><i class="bi bi-list"></i></button>
<div class="dropdown">
<ul class="dropdown-menu" aria-labelledby="dropdownMenuButton1">
@ -97,6 +97,7 @@
}
?>
<tr>
<!--
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['statscode']) ?> </td>
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['reqdate']) ?> </td>
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['patname']) ?> </td>
@ -106,12 +107,16 @@
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['doc']) ?> </td>
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['tests']) ?> </td>
<td class="pointercol" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['odr_cresult_to']) ?> </td>
<td> <h6> <span class="px-3 py-2 badge text-success border border-success bg-success-subtle"> _ </span> </h6>
-->
<td> <?= esc($row['statscode']) ?> </td> <td> <?= esc($row['reqdate']) ?> </td> <td> <?= esc($row['patname']) ?> </td>
<td> <?= esc($row['sp_accessnumber']) ?> </td> <td> <?= esc($row['hostordernumber']) ?> </td> <td> <?= esc($row['reff']) ?> </td>
<td> <?= esc($row['doc']) ?> </td> <td> <?= esc($row['tests']) ?> </td> <td> <?= esc($row['odr_cresult_to']) ?> </td>
<td> <h6> <span class="px-3 py-2 badge text-success border border-success bg-success-subtle"> <?=$row['val'];?> </span> </h6>
<a href="#" class="text-primary">Result</a><br> <a href="#" class="text-primary" disabled>Invalidation</a><br>
</td>
<td class="pointercol <?= esc($class) ?>" data-access="<?= $row['sp_accessnumber'] ?>" data-bs-toggle="modal" data-bs-target="#detailModal"> <?= esc($row['stats']) ?> </td>
<td>
<a href="#" class="text-primary">Preview</a> <br/>
<a href="<?=base_url('result/'.$row['sp_accessnumber']);?>" target="_blank" class="text-primary">Preview</a> <br/>
<a href="#" class="text-danger">Print</a> | <a href="#" class="text-danger">Eng</a> <br/>
<a href="#" class="text-primary">Pdf</a>
</td>

109
app/Views/result/show.php Normal file
View File

@ -0,0 +1,109 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive HTML Iframe Demo</title>
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
sans: ['Inter', 'sans-serif'],
},
}
}
}
</script>
</head>
<?php
$userid = session('userid');
$verif = 0;
if(strpos(strtolower($status), "verif") !== false) { $verif = 1; }
?>
<body class="bg-gray-50 flex items-start justify-center">
<div class="w-full max-w-4xl min-h-screen flex flex-col ">
<div class="flex-1 flex flex-col h-full bg-white rounded-2xl shadow-2xl space-y-6 p-3 m-2">
<header>
<p class="text-end">user : <?=$userid;?></p>
<p>Result lab# <?=$accessnumber;?><br />Status : <?=$status;?></p>
</header>
<div class='flex-1 flex flex-col relative shadow-inner bg-gray-100 border border-gray-300'>
<iframe
id="result-iframe"
title="PHP Embedded Content Demo"
class="flex-1"
src="http://glenlis/spooler_db/main_dev.php?acc=<?=$accessnumber;?>">
<p>Your browser does not support iframes. Please contact the technical support.</p>
</iframe>
<?php if($verif == 0) { ?>
<div class="absolute inset-0 flex items-center justify-center pointer-events-none z-20">
<span class="text-7xl font-black text-gray-600 opacity-20 transform rotate-[-30deg] select-none">
Trial - please contact 5panda
</span>
</div>
<?php } ?>
</div>
<footer>
<?php if($verif == 0) { ?>
<p class='text-end'>
<button id='result-button'
class='bg-blue-500 text-white py-2 px-3 text-sm rounded-md
disabled:opacity-50 disabled:cursor-not-allowed disabled:bg-gray-400 disabled:text-gray-200'
disabled onclick="validate()">Validate</button>
</p>
<?php } ?>
<p class="mt-2 text-gray-500 text-xs text-center">&copy; 2025 - 5panda</p>
</footer>
</div>
</div>
<script>
<?php if($verif == 0) { ?>
const iframe = document.getElementById('result-iframe');
const button = document.getElementById('result-button');
iframe.addEventListener('load', () => {
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
const scrollElement = iframeDoc.scrollingElement || iframeDoc.documentElement;
iframeDoc.addEventListener('scroll', () => {
const scrollTop = scrollElement.scrollTop;
const scrollHeight = scrollElement.scrollHeight;
const clientHeight = scrollElement.clientHeight;
// Check if scrolled to bottom
if (scrollTop + clientHeight >= scrollHeight - 2) {
button.disabled = false;
}
});
});
function validate() {
const ok = confirm('Are you sure?');
if (!ok) return;
fetch('inc/result_validate.php?accessnumber=<?=$accessnumber;?>&userid=<?=$userid;?>', {
method: 'GET'
})
.then(function (response) {
if (!response.ok) throw new Error('Failed to send data');
//return response.json();
})
.then(function (data) {
location.reload();
})
.catch(function (error) {
alert('Error: ' + error.message);
});
}
<?php }?>
</script>
</body>
</html>

33
public/web.config Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(.+)/$" ignoreCase="false" />
</conditions>
<action type="Redirect" url="{C:1}" redirectType="Permanent" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTPS}" pattern="^on$" ignoreCase="false" negate="true" />
<add input="{HTTP_HOST}" pattern="^www\.(.+)$" />
</conditions>
<action type="Redirect" url="http://{C:1}{URL}" redirectType="Permanent" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="^([\s\S]*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>