pivi_vault_system/templates/approveView.php

144 lines
5.3 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<?php
//include '../header.php';
include '../config.php';
$user_id = $_GET['user_id'];
$id = $_GET['doc_id'];
$role=$_GET['role'];
$url = "../actions/qrcode.php?id=$id";
$app = $_GET['app'];
switch ($app){
case '1' :
$sql = "SELECT * FROM vault_users WHERE role=$arole2";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$user_mail = $row['email'];
$user_name = $row['name'];
}
break;
case '2':
$sql = "SELECT * FROM vault_users WHERE role=$arole3";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$user_mail = $row['email'];
$user_name = $row['name'];
}
break;
case '3':
$sql = "SELECT * FROM vault_users WHERE role=$arole4";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$user_mail = $row['email'];
$user_name = $row['name'];
}
break;
case '4':
$sql = "SELECT * FROM vault_users WHERE role=$rrole";
$result = $conn->query($sql);
while ($row = $result->fetch_assoc()) {
$user_mail = $row['email'];
$user_name = $row['name'];
}
}
// $sql = "SELECT * FROM vault_users WHERE id=$user_id";
// $result = $conn->query($sql);
// $row = $result->fetch_assoc();
// $user_name = $row['name'];
$sql = "SELECT documents.id,documents.number,type.name as doc_type,
documents.description,department.name as department,company.name as company,
city.name as city,province.name as province,documents.vault,documents.folder,documents.file
FROM documents
LEFT JOIN type on type.id = documents.type
LEFT JOIN department on department.id = documents.department
LEFT JOIN company on company.id = documents.company
LEFT JOIN city on city.id = documents.city
LEFT JOIN province on province.id = documents.province
WHERE documents.id = $id;";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$doc_no = $row['number'];
$doc_type = $row['doc_type'];
$description = $row['description'];
$department = $row['department'];
$company = $row['company'];
$city = $row['city'];
$province = $row['province'];
$folder = $row['folder'];
$vault = $row['vault'];
$file =$row['file'];
$sql = "SELECT request.id,request.type, request.reason,request.document,
request.user_id,request.name,request.date, type.name as doc_type,
documents.number, documents.description
FROM `request` LEFT JOIN documents on documents.id = request.document
LEFT JOIN type on type.id = documents.type ORDER BY id desc limit 1";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
$id = $row['id'];
//$rtype = $row['type'];
if($row['type']==0){
$rtype='View';
}
else if($row['type']==1){
$rtype='Copy';
}else if ($row['type']==2){
$rtype='Original Copy';
}
$reason = $row['reason'];
$requestor = $row['name'];
$document = $row['document'];
$doc_type = $row['doc_type'];
$number = $row['number'];
$description =$row['description'];
// Generate an expiration timestamp (24 hours from now)
$expiration = time() + (1 * 60); // 1 minute from now
// $expiration = time() + (24 * 60 * 60);
// Modify the link to include the expiration timestamp as a query parameter
$url = 'http://192.168.50.3:8000/vault_req?expires=' . $expiration;
// $file .= '?expires=' . $expiration;
?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body class="dt-example dt-example-bootstrap">
<div class="container">
<p>Dear
<?php echo $user_name; ?>,
</p><br>
<p>I hope this email finds you well. I am pleased to inform you that the document request has been approved by the previous approver and is now pending for your approval.
</p>
<p>Here are the details of the document request:</p>
<table class="table table-bordered table-striped">
<tr><th>Request ID</th><td><?php echo $id; ?></td></tr>
<tr><th>Request Type</th><td><?php echo $rtype; ?></td></tr>
<tr><th>Requestor</th><td><?php echo $requestor; ?></td></tr>
<tr><th>Reason</th><td colspan=2><?php echo $reason; ?></td></tr>
<tr><th>Document ID</th><td><?php echo $document; ?></td></tr>
<tr><td><b>Document Type</b></td><td> <?php echo $doc_type;?></td></tr>
<tr><td><b>Document Number</b></td><td><?php echo $number; ?></td></tr>
<tr><td><b>Document Description</b></td><td> <?php echo $description; ?></td></tr>
</table>
<br>
<p>You may visit this URL to approve (or disapprove) this request: http://edms.pivi.com.ph/vault_req</p>
<p>Best regards,</p>
<p>The Vault Management Team</p>
</div>
</body>
</html>