This commit is contained in:
Flatlogic Bot 2025-12-12 23:16:50 +00:00
parent f9e53284ac
commit 7dcb29de25
10 changed files with 1850 additions and 144 deletions

330
candidate.php Normal file
View File

@ -0,0 +1,330 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Candidate Details</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<hr>
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
</li>
</ul>
</div>
<div class="main-content">
<?php
require_once 'db/config.php';
$candidate = null;
$assessments = [];
if (isset($_GET['id'])) {
try {
$pdo = db();
// Fetch candidate details
$stmt = $pdo->prepare("SELECT * FROM Candidate WHERE candidate_id = ?");
$stmt->execute([$_GET['id']]);
$candidate = $stmt->fetch(PDO::FETCH_ASSOC);
// Fetch candidate assessments
$stmt_assessments = $pdo->prepare("SELECT assessment_id, candidate_id, assessed_by, assess_date, assessment, status FROM Candidate_Assessment WHERE candidate_id = ? ORDER BY assess_date DESC");
$stmt_assessments->execute([$_GET['id']]);
$assessments = $stmt_assessments->fetchAll(PDO::FETCH_ASSOC);
// Fetch candidate synthesis plans
$stmt_plans = $pdo->prepare("SELECT * FROM Candidate_Synthesis_Plan WHERE candidate_id = ? ORDER BY plan_id DESC");
$stmt_plans->execute([$_GET['id']]);
$plans = $stmt_plans->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
}
}
if ($candidate):
?>
<div class="header">
<h1>Candidate: <?php echo htmlspecialchars($candidate['candidate_id']); ?></h1>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Candidate Details</h5>
<p><strong>Candidate ID:</strong> <?php echo htmlspecialchars($candidate['candidate_id']); ?></p>
<p><strong>Run ID:</strong> <?php echo htmlspecialchars($candidate['run_id']); ?></p>
<p><strong>Project ID:</strong> <?php echo htmlspecialchars($candidate['project_id']); ?></p>
<p><strong>SMILES ID:</strong> <?php echo htmlspecialchars($candidate['smiles_id']); ?></p>
<p><strong>Estimated Cost:</strong> <?php echo htmlspecialchars($candidate['estimated_cost']); ?></p>
<p><strong>Generated Time:</strong> <?php echo htmlspecialchars($candidate['generated_time']); ?></p>
<p><strong>Synthesis Approved:</strong> <?php echo htmlspecialchars($candidate['synthesis_approved']); ?></p>
<p><strong>Status:</strong> <?php echo htmlspecialchars($candidate['status']); ?></p>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center">
<h5 class="card-title mb-0">Candidate Assessments</h5>
<a href="create_assessment.php?candidate_id=<?php echo htmlspecialchars($candidate['candidate_id']); ?>" class="btn btn-primary">Create Assessment</a>
</div>
<hr>
<?php if (count($assessments) > 0): ?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Assessment ID</th>
<th>Comments</th>
<th>Assessor Name</th>
<th>Date</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($assessments as $assessment): ?>
<tr>
<td><?php echo htmlspecialchars($assessment['assessment_id']); ?></td>
<td><?php echo htmlspecialchars($assessment['assessment']); ?></td>
<td><?php echo htmlspecialchars($assessment['assessed_by']); ?></td>
<td><?php echo htmlspecialchars($assessment['assess_date']); ?></td>
<td><?php echo htmlspecialchars($assessment['status']); ?></td>
<td>
<a href="edit_assessment.php?id=<?php echo $assessment['assessment_id']; ?>" class="btn btn-sm btn-outline-primary">Edit</a>
</td>
</tr> <?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p>No assessments found for this candidate.</p>
<?php endif; ?>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Candidate Synthesis Plans</h5>
<hr>
<?php if (count($plans) > 0): ?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Plan ID</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php foreach ($plans as $plan): ?>
<tr>
<td><?php echo htmlspecialchars($plan['plan_id']); ?></td>
<td>
<a href="synthesis_plan.php?plan_id=<?php echo $plan['plan_id']; ?>" class="btn btn-sm btn-outline-primary">View</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p>No synthesis plans found for this candidate.</p>
<?php endif; ?>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Sample Wells</h5>
<hr>
<?php
// Fetch Sample Well data related to the candidate
$stmt_sample_wells = $pdo->prepare("
SELECT
sw.sample_id,
wp.Temperature,
wp.incubation_start,
wp.incubation_end,
sol.name as solution_name,
wsn.amount as solution_amount,
wsn.units as solution_units,
sv.name as solvent_name,
wsv.amount as solvent_amount,
wsv.units as solvent_units,
cat.name as catalyst_name,
wcat.amount as catalyst_amount,
wcat.units as catalyst_units,
sld.name as solid_name,
wsd.amount as solid_amount,
wsd.units as solid_units,
pxrd.character_id as pxrd_characterization_id
FROM
Candidate c
JOIN
Candidate_Synthesis_Plan csp ON c.candidate_id = csp.candidate_id
JOIN
Well_Plate wp ON csp.plan_id = wp.plan_id
JOIN
Sample_Well sw ON wp.well_plate_id = sw.well_plate_id
LEFT JOIN
Well_Solution wsn ON sw.sample_id = wsn.sample_id
LEFT JOIN
Preprep_vial sol ON wsn.vial_id = sol.vial_id
LEFT JOIN
Well_Solvents wsv ON sw.sample_id = wsv.sample_id
LEFT JOIN
Solvent sv ON wsv.solvent_id = sv.solvent_id
LEFT JOIN
Well_Catalysts wcat ON sw.sample_id = wcat.sample_id
LEFT JOIN
Catalyst cat ON wcat.catalyst_id = cat.catalyst_id
LEFT JOIN
Well_Solids wsd ON sw.sample_id = wsd.sample_id
LEFT JOIN
Solid sld ON wsd.solid_id = sld.solid_id
LEFT JOIN
PXRD_Characterization pxrd ON sw.sample_id = pxrd.sample_id
WHERE
c.candidate_id = ?
");
$stmt_sample_wells->execute([$_GET['id']]);
$sample_wells = $stmt_sample_wells->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC);
if ($sample_wells && count($sample_wells) > 0):
?>
<div class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th>Sample ID</th>
<th>Composition</th>
<th>Incubation</th>
<th>PXRD Characterization</th>
</tr>
</thead>
<tbody>
<?php foreach ($sample_wells as $sample_id => $rows):
$first_row = $rows[0];
$incubation_start = new DateTime($first_row['incubation_start']);
$incubation_end = new DateTime($first_row['incubation_end']);
$incubation_duration = $incubation_start->diff($incubation_end);
?>
<tr>
<td><?php echo htmlspecialchars($sample_id); ?></td>
<td>
<ul>
<?php foreach ($rows as $row): ?>
<?php if ($row['solution_name']): ?>
<li><strong>Solution:</strong> <?php echo htmlspecialchars($row['solution_name'] . ' (' . $row['solution_amount'] . ' ' . $row['solution_units'] . ')'); ?></li>
<?php endif; ?>
<?php if ($row['solvent_name']): ?>
<li><strong>Solvent:</strong> <?php echo htmlspecialchars($row['solvent_name'] . ' (' . $row['solvent_amount'] . ' ' . $row['solvent_units'] . ')'); ?></li>
<?php endif; ?>
<?php if ($row['catalyst_name']): ?>
<li><strong>Catalyst:</strong> <?php echo htmlspecialchars($row['catalyst_name'] . ' (' . $row['catalyst_amount'] . ' ' . $row['catalyst_units'] . ')'); ?></li>
<?php endif; ?>
<?php if ($row['solid_name']): ?>
<li><strong>Solid:</strong> <?php echo htmlspecialchars($row['solid_name'] . ' (' . $row['solid_amount'] . ' ' . $row['solid_units'] . ')'); ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</td>
<td>
<?php echo htmlspecialchars($first_row['Temperature']); ?>°C for
<?php echo $incubation_duration->format('%h hours, %i minutes'); ?>
</td>
<td>
<?php if ($first_row['pxrd_characterization_id']): ?>
<a href="pxrd_characterization.php?id=<?php echo $first_row['pxrd_characterization_id']; ?>" class="btn btn-sm btn-outline-primary">View</a>
<?php else: ?>
N/A
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php else: ?>
<p>No sample wells found for this candidate.</p>
<?php endif; ?>
</div>
</div>
<?php else: ?>
<div class="alert alert-warning">Candidate not found or ID not provided.</div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

148
create_assessment.php Normal file
View File

@ -0,0 +1,148 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Candidate Assessment</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<hr>
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
</li>
</ul>
</div>
<div class="main-content">
<?php
require_once 'db/config.php';
$candidate_id = isset($_GET['candidate_id']) ? $_GET['candidate_id'] : null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$candidate_id = $_POST['candidate_id'];
$assessed_by = $_POST['assessed_by'];
$assess_date = $_POST['assess_date'];
$assessment = $_POST['assessment'];
$status = $_POST['status'];
try {
$pdo = db();
$sql = "INSERT INTO Candidate_Assessment (candidate_id, assessed_by, assess_date, assessment, status) VALUES (?, ?, ?, ?, ?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$candidate_id, $assessed_by, $assess_date, $assessment, $status]);
header("Location: candidate.php?id=" . $candidate_id);
exit();
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
}
}
if ($candidate_id):
?>
<div class="header">
<h1>Create Assessment for Candidate: <?php echo htmlspecialchars($candidate_id); ?></h1>
</div>
<div class="card">
<div class="card-body">
<form action="create_assessment.php" method="post">
<input type="hidden" name="candidate_id" value="<?php echo htmlspecialchars($candidate_id); ?>">
<div class="mb-3">
<label for="assessed_by" class="form-label">Assessor Name</label>
<input type="text" class="form-control" id="assessed_by" name="assessed_by" required>
</div>
<div class="mb-3">
<label for="assess_date" class="form-label">Assessment Date</label>
<input type="date" class="form-control" id="assess_date" name="assess_date" required>
</div>
<div class="mb-3">
<label for="assessment" class="form-label">Comments</label>
<textarea class="form-control" id="assessment" name="assessment" rows="3"></textarea>
</div>
<div class="mb-3">
<label for="status" class="form-label">Status</label>
<input type="text" class="form-control" id="status" name="status">
</div>
<button type="submit" class="btn btn-primary">Submit Assessment</button>
</form>
</div>
</div>
<?php else: ?>
<div class="alert alert-warning">Candidate ID not provided.</div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

144
create_project.php Normal file
View File

@ -0,0 +1,144 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Project - Lab Workflow Manager</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<?php
require_once 'db/config.php';
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$name = $_POST['name'] ?? '';
$description = $_POST['description'] ?? '';
if (!empty($name) && !empty($description)) {
try {
$pdo = db();
// Hardcoded org_id and created_by_user_id for now
$sql = "INSERT INTO Project (name, description, org_id, created_by_user_id, `Start Date`) VALUES (?, ?, ?, ?, CURDATE())";
$stmt = $pdo->prepare($sql);
$stmt->execute([$name, $description, 1, 1]);
header("Location: index.php");
exit();
} catch (PDOException $e) {
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-warning">Please fill in all fields.</div>';
}
}
?>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="index.php"><i class="fa fa-tachometer-alt"></i> Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="#"><i class="fa fa-tasks"></i> Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-users"></i> Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-cogs"></i> Settings</a>
</li>
</ul>
</div>
<div class="main-content">
<div class="header">
<h1>Create New Project</h1>
<a href="index.php" class="btn btn-secondary"><i class="fa fa-arrow-left"></i> Back to Projects</a>
</div>
<?php echo $message; ?>
<div class="card">
<div class="card-body">
<h5 class="card-title">Project Details</h5>
<form action="create_project.php" method="POST">
<div class="mb-3">
<label for="name" class="form-label">Project Name</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="mb-3">
<label for="description" class="form-label">Description</label>
<textarea class="form-control" id="description" name="description" rows="3" required></textarea>
</div>
<button type="submit" class="btn btn-primary" style="background-color: var(--accent-color); border-color: var(--accent-color);">Create Project</button>
</form>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

151
create_user.php Normal file
View File

@ -0,0 +1,151 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create User - Lab Workflow Manager</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<?php
require_once 'db/config.php';
$message = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$role = $_POST['role'] ?? '';
// Dummy password - in a real application, this should be handled securely.
$password = password_hash('password123', PASSWORD_DEFAULT);
if (!empty($username) && !empty($role)) {
try {
$pdo = db();
// Hardcoded org_id for now
$sql = "INSERT INTO Users (username, password, role, org_id) VALUES (?, ?, ?, ?)";
$stmt = $pdo->prepare($sql);
$stmt->execute([$username, $password, $role, 1]);
header("Location: users.php");
exit();
} catch (PDOException $e) {
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
}
} else {
$message = '<div class="alert alert-warning">Please fill in all fields.</div>';
}
}
?>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="index.php"><i class="fa fa-tachometer-alt"></i> Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php"><i class="fa fa-tasks"></i> Projects</a>
</li>
<li class="nav-item">
<a class="nav-link active" href="users.php"><i class="fa fa-users"></i> Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-cogs"></i> Settings</a>
</li>
</ul>
</div>
<div class="main-content">
<div class="header">
<h1>Create New User</h1>
<a href="users.php" class="btn btn-secondary"><i class="fa fa-arrow-left"></i> Back to Users</a>
</div>
<?php echo $message; ?>
<div class="card">
<div class="card-body">
<h5 class="card-title">User Details</h5>
<form action="create_user.php" method="POST">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="role" class="form-label">Role</label>
<select class="form-select" id="role" name="role" required>
<option value="">Select a role</option>
<option value="Admin">Admin</option>
<option value="User">User</option>
<option value="Read-Only">Read-Only</option>
</select>
</div>
<button type="submit" class="btn btn-primary" style="background-color: var(--accent-color); border-color: var(--accent-color);">Create User</button>
</form>
</div>
</div>
</div>
<script src="https://cdn..net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

292
db/schema.sql Normal file
View File

@ -0,0 +1,292 @@
CREATE TABLE IF NOT EXISTS `Solvent` (
`solvent_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
PRIMARY KEY (`solvent_id`)
);
CREATE TABLE IF NOT EXISTS `Preprep_vial` (
`vial_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`type` text,
PRIMARY KEY (`vial_id`)
);
CREATE TABLE IF NOT EXISTS `Catalyst` (
`catalyst_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
PRIMARY KEY (`catalyst_id`)
);
CREATE TABLE IF NOT EXISTS `Vial_Catalyst` (
`vial_id` Int,
`catalyst_id` Int,
`vial_catalyst_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`type` text,
PRIMARY KEY (`vial_catalyst_id`),
FOREIGN KEY (`vial_id`)
REFERENCES `Preprep_vial`(`vial_id`),
FOREIGN KEY (`catalyst_id`)
REFERENCES `Catalyst`(`catalyst_id`)
);
CREATE TABLE IF NOT EXISTS `Incubator` (
`incubator_id` Int NOT NULL AUTO_INCREMENT,
`type` text,
`name` text,
PRIMARY KEY (`incubator_id`)
);
CREATE TABLE IF NOT EXISTS `Organization` (
`org_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`address` text,
`contact_info` text,
PRIMARY KEY (`org_id`)
);
CREATE TABLE IF NOT EXISTS `Project` (
`org_id` Int,
`project_id` Int NOT NULL AUTO_INCREMENT,
`mdr_id` text,
`name` text,
`description` text,
`Start Date` date,
PRIMARY KEY (`project_id`),
FOREIGN KEY (`org_id`)
REFERENCES `Organization`(`org_id`)
);
CREATE TABLE IF NOT EXISTS `Generation_Run` (
`project_id` Int,
`run_id` Int NOT NULL AUTO_INCREMENT,
`repository` text,
`rounds` int,
`status` text,
`run_start` Timestamp,
`run_end` Timestamp,
`compute_consumed` float,
`wandb_link` text,
PRIMARY KEY (`run_id`),
FOREIGN KEY (`project_id`)
REFERENCES `Project`(`project_id`)
);
CREATE TABLE IF NOT EXISTS `Candidate` (
`run_id` Int,
`candidate_id` Int NOT NULL AUTO_INCREMENT,
`project_id` Int,
`smiles_id` text,
`estimated_cost` float,
`generated_time` Timestamp,
`synthesis_approved` Timestamp,
`status` text,
PRIMARY KEY (`candidate_id`),
FOREIGN KEY (`run_id`)
REFERENCES `Generation_Run`(`run_id`)
);
CREATE TABLE IF NOT EXISTS `Candidate_Synthesis_Plan` (
`candidate_id` Int,
`plan_id` Int NOT NULL AUTO_INCREMENT,
`conditions_doc_link` text,
PRIMARY KEY (`plan_id`),
FOREIGN KEY (`candidate_id`)
REFERENCES `Candidate`(`candidate_id`)
);
CREATE TABLE IF NOT EXISTS `Laboratory` (
`lab_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`description` text,
`location` text,
PRIMARY KEY (`lab_id`)
);
CREATE TABLE IF NOT EXISTS `Well_Plate` (
`plan_id` Int,
`lab_id` Int,
`well_plate_id` Int NOT NULL AUTO_INCREMENT,
`incubation_start` Timestamp,
`incubation_end` Timestamp,
`Temperature` float,
`incubator_id` Int,
`status` text,
PRIMARY KEY (`well_plate_id`),
FOREIGN KEY (`plan_id`)
REFERENCES `Candidate_Synthesis_Plan`(`plan_id`),
FOREIGN KEY (`lab_id`)
REFERENCES `Laboratory`(`lab_id`)
);
CREATE TABLE IF NOT EXISTS `Sample_Well` (
`well_plate_id` Int,
`sample_id` Int NOT NULL AUTO_INCREMENT,
`picture_url` text,
PRIMARY KEY (`sample_id`),
FOREIGN KEY (`well_plate_id`)
REFERENCES `Well_Plate`(`well_plate_id`)
);
CREATE TABLE IF NOT EXISTS `Well_Solution` (
`sample_id` Int,
`vial_id` Int,
`well_solution_id` Int NOT NULL AUTO_INCREMENT,
`units` text,
`amount` Float,
PRIMARY KEY (`well_solution_id`),
FOREIGN KEY (`vial_id`)
REFERENCES `Preprep_vial`(`vial_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `Well_Catalysts` (
`sample_id` Int,
`catalyst_id` Int,
`well_catalyst_id` Int NOT NULL AUTO_INCREMENT,
`units` text,
`amount` Float,
PRIMARY KEY (`well_catalyst_id`),
FOREIGN KEY (`catalyst_id`)
REFERENCES `Catalyst`(`catalyst_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `MDR` (
`mdr_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`description` text,
`date_approved` date,
PRIMARY KEY (`mdr_id`)
);
CREATE TABLE IF NOT EXISTS `Well_Solvents` (
`sample_id` Int,
`solvent_id` Int,
`well_solvent_id` Int NOT NULL AUTO_INCREMENT,
`units` text,
`amount` Float,
PRIMARY KEY (`well_solvent_id`),
FOREIGN KEY (`solvent_id`)
REFERENCES `Solvent`(`solvent_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `MDR_Goals` (
`goal_id` Int NOT NULL AUTO_INCREMENT,
`mdr_id` Int,
`goal_name` text,
`operator` text,
`measurement` float,
PRIMARY KEY (`goal_id`),
FOREIGN KEY (`mdr_id`)
REFERENCES `MDR`(`mdr_id`)
);
CREATE TABLE IF NOT EXISTS `Vial_Solvent` (
`vial_id` Int,
`solvent_id` Int,
`vial_solvent_id` Int NOT NULL AUTO_INCREMENT,
`units` text,
`amount` Float,
PRIMARY KEY (`vial_solvent_id`),
FOREIGN KEY (`solvent_id`)
REFERENCES `Solvent`(`solvent_id`),
FOREIGN KEY (`vial_id`)
REFERENCES `Preprep_vial`(`vial_id`)
);
CREATE TABLE IF NOT EXISTS `Solid` (
`solid_id` Int NOT NULL AUTO_INCREMENT,
`name` text,
`smiles_id` text,
PRIMARY KEY (`solid_id`)
);
CREATE TABLE IF NOT EXISTS `Well_Solids` (
`sample_id` Int,
`solid_id` Int,
`well_solid_id` Int NOT NULL AUTO_INCREMENT,
`units` text,
`amount` Float,
PRIMARY KEY (`well_solid_id`),
FOREIGN KEY (`solid_id`)
REFERENCES `Solid`(`solid_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `Users` (
`user_id` Int NOT NULL AUTO_INCREMENT,
`org_id` Int,
`username` text,
`password` text,
`role` text,
PRIMARY KEY (`user_id`),
FOREIGN KEY (`org_id`)
REFERENCES `Organization`(`org_id`)
);
CREATE TABLE IF NOT EXISTS `TGA_Analysis` (
`sample_id` Int,
`tga_id` Int NOT NULL AUTO_INCREMENT,
`temp_comp_array` Int,
`date` Timestamp,
PRIMARY KEY (`tga_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `tga_scorecard` (
`tag_id` Int,
`tga_score_id` Int NOT NULL AUTO_INCREMENT,
`hashtable` Int,
PRIMARY KEY (`tga_score_id`),
FOREIGN KEY (`tag_id`)
REFERENCES `TGA_Analysis`(`tga_id`)
);
CREATE TABLE IF NOT EXISTS `PXRD_Characterization` (
`sample_id` Int,
`character_id` Int NOT NULL AUTO_INCREMENT,
`point_array` Int,
`pxrd_score` float,
`date` Timestamp,
PRIMARY KEY (`character_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `Sample_Post_Instrumentation_Analysis` (
`sample_id` Int,
`analysis_id` Int NOT NULL AUTO_INCREMENT,
`summary` text,
`last_updated` Timestamp,
PRIMARY KEY (`analysis_id`),
FOREIGN KEY (`sample_id`)
REFERENCES `Sample_Well`(`sample_id`)
);
CREATE TABLE IF NOT EXISTS `Candidate_Assessment` (
`candidate_id` Int,
`assessment_id` Int NOT NULL AUTO_INCREMENT,
`assessment` text,
`assessed_by` text,
`assess_date` Timestamp,
`status` text,
PRIMARY KEY (`assessment_id`),
FOREIGN KEY (`candidate_id`)
REFERENCES `Candidate`(`candidate_id`)
);
CREATE TABLE IF NOT EXISTS `pxrd_scorecard` (
`character_id` Int,
`pxrd_score_id` Int NOT NULL AUTO_INCREMENT,
`hashtable` text,
PRIMARY KEY (`pxrd_score_id`),
FOREIGN KEY (`character_id`)
REFERENCES `PXRD_Characterization`(`character_id`)
);

168
edit_assessment.php Normal file
View File

@ -0,0 +1,168 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Candidate Assessment</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<hr>
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
</li>
</ul>
</div>
<div class="main-content">
<?php
require_once 'db/config.php';
$assessment_id = isset($_GET['id']) ? $_GET['id'] : null;
$candidate_id = null;
$assessment_data = null;
if ($assessment_id) {
try {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM Candidate_Assessment WHERE assessment_id = ?");
$stmt->execute([$assessment_id]);
$assessment_data = $stmt->fetch(PDO::FETCH_ASSOC);
if ($assessment_data) {
$candidate_id = $assessment_data['candidate_id'];
}
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$assessment_id = $_POST['assessment_id'];
$assessed_by = $_POST['assessed_by'];
$assess_date = $_POST['assess_date'];
$assessment = $_POST['assessment'];
$status = $_POST['status'];
$candidate_id = $_POST['candidate_id'];
try {
$pdo = db();
$sql = "UPDATE Candidate_Assessment SET assessed_by = ?, assess_date = ?, assessment = ?, status = ? WHERE assessment_id = ?";
$stmt = $pdo->prepare($sql);
$stmt->execute([$assessed_by, $assess_date, $assessment, $status, $assessment_id]);
header("Location: candidate.php?id=" . $candidate_id);
exit();
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
}
}
if ($assessment_data):
?>
<div class="header">
<h1>Edit Assessment for Candidate: <?php echo htmlspecialchars($candidate_id); ?></h1>
</div>
<div class="card">
<div class="card-body">
<form action="edit_assessment.php" method="post">
<input type="hidden" name="assessment_id" value="<?php echo htmlspecialchars($assessment_id); ?>">
<input type="hidden" name="candidate_id" value="<?php echo htmlspecialchars($candidate_id); ?>">
<div class="mb-3">
<label for="assessed_by" class="form-label">Assessor Name</label>
<input type="text" class="form-control" id="assessed_by" name="assessed_by" value="<?php echo htmlspecialchars($assessment_data['assessed_by']); ?>" required>
</div>
<div class="mb-3">
<label for="assess_date" class="form-label">Assessment Date</label>
<input type="date" class="form-control" id="assess_date" name="assess_date" value="<?php echo htmlspecialchars($assessment_data['assess_date']); ?>" required>
</div>
<div class="mb-3">
<label for="assessment" class="form-label">Comments</label>
<textarea class="form-control" id="assessment" name="assessment" rows="3"><?php echo htmlspecialchars($assessment_data['assessment']); ?></textarea>
</div>
<div class="mb-3">
<label for="status" class="form-label">Status</label>
<input type="text" class="form-control" id="status" name="status" value="<?php echo htmlspecialchars($assessment_data['status']); ?>">
</div>
<button type="submit" class="btn btn-primary">Update Assessment</button>
</form>
</div>
</div>
<?php elseif (!$assessment_id): ?>
<div class="alert alert-warning">Assessment ID not provided.</div>
<?php else: ?>
<div class="alert alert-warning">Assessment not found.</div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

298
index.php
View File

@ -1,150 +1,160 @@
<?php <!DOCTYPE html>
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<!doctype html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Style</title> <title>Lab Workflow Manager</title>
<?php <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
// Read project preview data from environment <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <style>
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; :root {
?> --primary-color: #2a3f54;
<?php if ($projectDescription): ?> --secondary-color: #73879C;
<!-- Meta description --> --background-color: #F7F7F7;
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> --surface-color: #FFFFFF;
<!-- Open Graph meta tags --> --accent-color: #1ABB9C;
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> }
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" /> body {
<?php endif; ?> display: flex;
<?php if ($projectImageUrl): ?> background-color: var(--background-color);
<!-- Open Graph image --> font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> }
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> .sidebar {
<?php endif; ?> width: 250px;
<link rel="preconnect" href="https://fonts.googleapis.com"> height: 100vh;
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> position: fixed;
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet"> top: 0;
<style> left: 0;
:root { background-color: var(--primary-color);
--bg-color-start: #6a11cb; color: #ECF0F1;
--bg-color-end: #2575fc; padding-top: 20px;
--text-color: #ffffff; }
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1); .sidebar h3 {
} text-align: center;
body { margin-bottom: 30px;
margin: 0; font-weight: bold;
font-family: 'Inter', sans-serif; }
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color); .sidebar .nav-link {
display: flex; color: #ECF0F1;
justify-content: center; padding: 10px 20px;
align-items: center; transition: background-color 0.3s;
min-height: 100vh; }
text-align: center;
overflow: hidden; .sidebar .nav-link:hover, .sidebar .nav-link.active {
position: relative; background-color: var(--accent-color);
} color: var(--surface-color);
body::before { }
content: ''; .sidebar .nav-link .fa {
position: absolute; margin-right: 10px;
top: 0; }
left: 0;
width: 100%; .main-content {
height: 100%; margin-left: 250px;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>'); padding: 20px;
animation: bg-pan 20s linear infinite; width: calc(100% - 250px);
z-index: -1; }
}
@keyframes bg-pan { .header {
0% { background-position: 0% 0%; } display: flex;
100% { background-position: 100% 100%; } justify-content: space-between;
} align-items: center;
main { margin-bottom: 20px;
padding: 2rem; }
}
.card { .header h1 {
background: var(--card-bg-color); font-weight: bold;
border: 1px solid var(--card-border-color); color: var(--primary-color);
border-radius: 16px; }
padding: 2rem;
backdrop-filter: blur(20px); .card {
-webkit-backdrop-filter: blur(20px); border: none;
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); border-radius: 8px;
} box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
.loader { }
margin: 1.25rem auto 1.25rem; .table thead th {
width: 48px; background-color: var(--primary-color);
height: 48px; color: white;
border: 3px solid rgba(255, 255, 255, 0.25); }
border-top-color: #fff; </style>
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</head> </head>
<body> <body>
<main>
<div class="card"> <div class="sidebar">
<h1>Analyzing your requirements and generating your website…</h1> <h3><i class="fa fa-flask"></i> LWM</h3>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes"> <ul class="nav flex-column">
<span class="sr-only">Loading…</span> <li class="nav-item">
</div> <hr>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p> <a href="index.php" class="active"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<p class="hint">This page will update automatically as the plan is implemented.</p> <a href="users.php"><i class="fas fa-users"></i> User Management</a>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p> </li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-tasks"></i> Projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-users"></i> Users</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fa fa-cogs"></i> Settings</a>
</li>
</ul>
</div>
<div class="main-content">
<div class="header">
<h1>Projects Dashboard</h1>
<a href="create_project.php" class="btn btn-primary" style="background-color: var(--accent-color); border-color: var(--accent-color);">
<i class="fa fa-plus"></i> Create New Project
</a>
</div> </div>
</main>
<footer> <div class="card">
Page updated: <?= htmlspecialchars($now) ?> (UTC) <div class="card-body">
</footer> <h5 class="card-title">All Projects</h5>
<div class="table-responsive">
<table class="table table-hover">
<thead class="table-dark">
<tr>
<th>ID</th>
<th>Name</th>
<th>Description</th>
<th>Start Date</th>
</tr>
</thead>
<tbody>
<?php
require_once 'db/config.php';
try {
$pdo = db();
$stmt = $pdo->query("SELECT project_id, name, description, `Start Date` FROM Project ORDER BY `Start Date` DESC");
$projects = $stmt->fetchAll(PDO::FETCH_ASSOC);
if (count($projects) > 0) {
foreach ($projects as $project) {
echo "<tr>";
echo "<td>" . htmlspecialchars($project['project_id']) . "</td>";
echo "<td><a href='project.php?id=" . htmlspecialchars($project['project_id']) . "'>" . htmlspecialchars($project['name']) . "</a></td>";
echo "<td>" . htmlspecialchars($project['description']) . "</td>";
echo "<td>" . htmlspecialchars($project['Start Date']) . "</td>";
echo "</tr>";
}
} else {
echo '<tr><td colspan="4" class="text-center">No projects found.</td></tr>';
}
} catch (PDOException $e) {
echo '<tr><td colspan="4" class="text-center text-danger">Database error: ' . $e->getMessage() . '</td></tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body> </body>
</html> </html>

198
project.php Normal file
View File

@ -0,0 +1,198 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Project Details</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
<style>
:root {
--primary-color: #2a3f54;
--secondary-color: #73879C;
--background-color: #F7F7F7;
--surface-color: #FFFFFF;
--accent-color: #1ABB9C;
}
body {
display: flex;
background-color: var(--background-color);
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
width: 250px;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: var(--primary-color);
color: #ECF0F1;
padding-top: 20px;
}
.sidebar h3 {
text-align: center;
margin-bottom: 30px;
font-weight: bold;
}
.sidebar .nav-link {
color: #ECF0F1;
padding: 10px 20px;
transition: background-color 0.3s;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
background-color: var(--accent-color);
color: var(--surface-color);
}
.sidebar .nav-link .fa {
margin-right: 10px;
}
.main-content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20px;
}
.header h1 {
font-weight: bold;
color: var(--primary-color);
}
.card {
border: none;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
}
</style>
</head>
<body>
<div class="sidebar">
<h3><i class="fa fa-flask"></i> LWM</h3>
<ul class="nav flex-column">
<li class="nav-item">
<hr>
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
</li>
</ul>
</div>
<div class="main-content">
<?php
require_once 'db/config.php';
$project = null;
if (isset($_GET['id'])) {
try {
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM Project WHERE project_id = ?");
$stmt->execute([$_GET['id']]);
$project = $stmt->fetch(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
}
}
if ($project):
?>
<div class="header">
<h1>Project: <?php echo htmlspecialchars($project['name']); ?></h1>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Project Details</h5>
<p><strong>ID:</strong> <?php echo htmlspecialchars($project['project_id']); ?></p>
<p><strong>Description:</strong> <?php echo htmlspecialchars($project['description']); ?></p>
<p><strong>Start Date:</strong> <?php echo htmlspecialchars($project['Start Date']); ?></p>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title">Generation Runs</h5>
<?php
try {
$stmt_runs = $pdo->prepare("
SELECT
gr.run_id,
gr.repository,
gr.rounds,
gr.status,
gr.run_start,
gr.run_end,
COUNT(c.candidate_id) AS candidate_count
FROM
Generation_Run gr
LEFT JOIN
Candidate c ON gr.run_id = c.run_id
WHERE
gr.project_id = ?
GROUP BY
gr.run_id
ORDER BY
gr.run_start DESC
");
$stmt_runs->execute([$_GET['id']]);
$runs = $stmt_runs->fetchAll(PDO::FETCH_ASSOC);
if (count($runs) > 0) {
echo '<div class="table-responsive"><table class="table table-hover"><thead><tr><th>Run ID</th><th>Repository</th><th>Rounds</th><th>Status</th><th>Start Time</th><th>End Time</th><th>Candidates</th><th></th></tr></thead><tbody>';
foreach ($runs as $run) {
echo "<tr>";
echo "<td>" . htmlspecialchars($run['run_id']) . "</td>";
echo "<td>" . htmlspecialchars($run['repository']) . "</td>";
echo "<td>" . htmlspecialchars($run['rounds']) . "</td>";
echo "<td>" . htmlspecialchars($run['status']) . "</td>";
echo "<td>" . htmlspecialchars($run['run_start']) . "</td>";
echo "<td>" . htmlspecialchars($run['run_end']) . "</td>";
echo "<td>" . htmlspecialchars($run['candidate_count']) . "</td>";
echo "<td><button class='btn btn-sm btn-info' data-bs-toggle='collapse' data-bs-target='#candidates-" . $run['run_id'] . "'>View Candidates</button></td>";
echo "</tr>";
echo "<tr class='collapse' id='candidates-" . $run['run_id'] . "'><td colspan='8'>";
// Candidate table will go here
try {
$stmt_candidates = $pdo->prepare("SELECT candidate_id, smiles_id, estimated_cost, status FROM Candidate WHERE run_id = ?");
$stmt_candidates->execute([$run['run_id']]);
$candidates = $stmt_candidates->fetchAll(PDO::FETCH_ASSOC);
if (count($candidates) > 0) {
echo '<table class="table table-sm table-bordered"><thead><tr><th>Candidate ID</th><th>SMILES ID</th><th>Est. Cost</th><th>Status</th></tr></thead><tbody>';
foreach ($candidates as $candidate) {
echo "<tr>";
echo "<td><a href='candidate.php?id=" . htmlspecialchars($candidate['candidate_id']) . "'>" . htmlspecialchars($candidate['candidate_id']) . "</a></td>";
echo "<td>" . htmlspecialchars($candidate['smiles_id']) . "</td>";
echo "<td>" . htmlspecialchars($candidate['estimated_cost']) . "</td>";
echo "<td>" . htmlspecialchars($candidate['status']) . "</td>";
echo "</tr>";
}
echo '</tbody></table>';
} else {
echo '<p class="text-muted">No candidates found for this run.</p>';
}
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error fetching candidates: ' . $e->getMessage() . '</div>';
}
echo "</td></tr>";
}
echo '</tbody></table></div>';
} else {
echo '<p>No generation runs found for this project.</p>';
}
} catch (PDOException $e) {
echo '<div class="alert alert-danger">Database error fetching generation runs: ' . $e->getMessage() . '</div>';
}
?>
</div>
</div>
<?php else: ?>
<div class="alert alert-warning">Project not found or ID not provided.</div>
<?php endif; ?>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

165
synthesis_plan.php Normal file
View File

@ -0,0 +1,165 @@
<?php
require_once 'db/config.php';
// Get plan_id from URL
$plan_id = isset($_GET['plan_id']) ? (int)$_GET['plan_id'] : 0;
// Fetch synthesis plan details
$stmt = db()->prepare("SELECT * FROM Candidate_Synthesis_Plan WHERE plan_id = ?");
$stmt->execute([$plan_id]);
$plan = $stmt->fetch(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Candidate Synthesis Plan Details</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h2>Candidate Synthesis Plan Details</h2>
<?php if ($plan): ?>
<table class="table table-bordered">
<tbody>
<tr>
<th>Plan ID</th>
<td><?php echo htmlspecialchars($plan['plan_id']); ?></td>
</tr>
<tr>
<th>Candidate ID</th>
<td><?php echo htmlspecialchars($plan['candidate_id']); ?></td>
</tr>
<tr>
<th>Conditions Document</th>
<td><a href="<?php echo htmlspecialchars($plan['conditions_doc_link']); ?>" target="_blank">View Document</a></td>
</tr>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-warning">Synthesis plan not found.</div>
<?php endif; ?>
<a href="candidate.php?id=<?php echo htmlspecialchars($plan['candidate_id']); ?>" class="btn btn-primary">Back to Candidate</a>
<div class="card mt-4">
<div class="card-header">
<h5>Well Plates</h5>
</div>
<div class="card-body">
<?php
$stmt_well_plate = db()->prepare("SELECT wp.*, l.name as laboratory_name FROM Well_Plate wp JOIN Laboratory l ON wp.lab_id = l.lab_id WHERE wp.plan_id = ?");
$stmt_well_plate->execute([$plan_id]);
$well_plates = $stmt_well_plate->fetchAll(PDO::FETCH_ASSOC);
?>
<?php if ($well_plates): ?>
<table class="table table-bordered">
<thead>
<tr>
<th>Well Plate ID</th>
<th>Laboratory Name</th>
<th>Incubation Start</th>
<th>Incubation End</th>
<th>Temperature</th>
<th>Incubator ID</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php foreach ($well_plates as $well_plate): ?>
<tr>
<td><?php echo htmlspecialchars($well_plate['well_plate_id']); ?></td>
<td><?php echo htmlspecialchars($well_plate['laboratory_name']); ?></td>
<td><?php echo htmlspecialchars($well_plate['incubation_start']); ?></td>
<td><?php echo htmlspecialchars($well_plate['incubation_end']); ?></td>
<td><?php echo htmlspecialchars($well_plate['Temperature']); ?></td>
<td><?php echo htmlspecialchars($well_plate['incubator_id']); ?></td>
<td><?php echo htmlspecialchars($well_plate['status']); ?></td>
</tr>
<tr>
<td colspan="7">
<?php
$stmt_sample_well = db()->prepare("SELECT * FROM Sample_Well WHERE well_plate_id = ?");
$stmt_sample_well->execute([$well_plate['well_plate_id']]);
$sample_wells = $stmt_sample_well->fetchAll(PDO::FETCH_ASSOC);
?>
<?php if ($sample_wells): ?>
<h6>Sample Wells</h6>
<table class="table table-sm table-bordered">
<thead>
<tr>
<th>Sample ID</th>
<th>Picture</th>
<th>Solutions</th>
<th>Solvents</th>
<th>Catalysts</th>
<th>Solids</th>
</tr>
</thead>
<tbody>
<?php foreach ($sample_wells as $sample_well): ?>
<tr>
<td><?php echo htmlspecialchars($sample_well['sample_id']); ?></td>
<td><img src="<?php echo htmlspecialchars($sample_well['picture_url']); ?>" alt="Sample Well" style="max-width: 100px;"></td>
<td>
<?php
$stmt_solutions = db()->prepare("SELECT ws.*, s.name FROM Well_Solution ws JOIN Preprep_vial s ON ws.vial_id = s.vial_id WHERE ws.sample_id = ?");
$stmt_solutions->execute([$sample_well['sample_id']]);
$solutions = $stmt_solutions->fetchAll(PDO::FETCH_ASSOC);
foreach ($solutions as $solution) {
echo htmlspecialchars($solution['name']) . ' (' . htmlspecialchars($solution['amount']) . ' ' . htmlspecialchars($solution['units']) . ')<br>';
}
?>
</td>
<td>
<?php
$stmt_solvents = db()->prepare("SELECT ws.*, s.name FROM Well_Solvents ws JOIN Solvent s ON ws.solvent_id = s.solvent_id WHERE ws.sample_id = ?");
$stmt_solvents->execute([$sample_well['sample_id']]);
$solvents = $stmt_solvents->fetchAll(PDO::FETCH_ASSOC);
foreach ($solvents as $solvent) {
echo htmlspecialchars($solvent['name']) . ' (' . htmlspecialchars($solvent['amount']) . ' ' . htmlspecialchars($solvent['units']) . ')<br>';
}
?>
</td>
<td>
<?php
$stmt_catalysts = db()->prepare("SELECT wc.*, c.name FROM Well_Catalysts wc JOIN Catalyst c ON wc.catalyst_id = c.catalyst_id WHERE wc.sample_id = ?");
$stmt_catalysts->execute([$sample_well['sample_id']]);
$catalysts = $stmt_catalysts->fetchAll(PDO::FETCH_ASSOC);
foreach ($catalysts as $catalyst) {
echo htmlspecialchars($catalyst['name']) . ' (' . htmlspecialchars($catalyst['amount']) . ' ' . htmlspecialchars($catalyst['units']) . ')<br>';
}
?>
</td>
<td>
<?php
$stmt_solids = db()->prepare("SELECT ws.*, s.name FROM Well_Solids ws JOIN Solid s ON ws.solid_id = s.solid_id WHERE ws.sample_id = ?");
$stmt_solids->execute([$sample_well['sample_id']]);
$solids = $stmt_solids->fetchAll(PDO::FETCH_ASSOC);
foreach ($solids as $solid) {
echo htmlspecialchars($solid['name']) . ' (' . htmlspecialchars($solid['amount']) . ' ' . htmlspecialchars($solid['units']) . ')<br>';
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-info">No sample wells found for this well plate.</div>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php else: ?>
<div class="alert alert-info">No well plates found for this synthesis plan.</div>
<?php endif; ?>
</div>
</div>
</div>
</body>
</html>

100
users.php Normal file
View File

@ -0,0 +1,100 @@
<?php
require_once 'db/config.php';
// Fetch users from the database
$pdoconn = db();
$stmt = $pdoconn->query("SELECT user_id, username, role, org_id FROM Users");
$users = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Management</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" rel="stylesheet">
<style>
body {
background-color: #F7F7F7;
font-family: "Helvetica Neue", Roboto, Arial, sans-serif;
}
.sidebar {
background-color: #2a3f54;
color: white;
height: 100vh;
padding-top: 20px;
}
.sidebar a {
color: #dcdcdc;
text-decoration: none;
display: block;
padding: 10px 15px;
transition: background-color 0.3s;
}
.sidebar a:hover, .sidebar a.active {
background-color: #1ABB9C;
color: white;
}
.main-content {
padding: 20px;
}
.table-custom {
background-color: white;
}
</style>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2 sidebar">
<h3 class="text-center">AI Chem Lab</h3>
<hr>
<a href="index.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
<a href="users.php" class="active"><i class="fas fa-users"></i> User Management</a>
</div>
<div class="col-md-10 main-content">
<div class="d-flex justify-content-between align-items-center">
<h1>User Management</h1>
<a href="create_user.php" class="btn btn-primary">Create New User</a>
</div>
<hr>
<div class="table-responsive">
<table class="table table-striped table-bordered table-custom">
<thead class="table-dark">
<tr>
<th>User ID</th>
<th>Username</th>
<th>Role</th>
<th>Organization ID</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php if (empty($users)): ?>
<tr>
<td colspan="5" class="text-center">No users found.</td>
</tr>
<?php else: ?>
<?php foreach ($users as $user): ?>
<tr>
<td><?= htmlspecialchars($user['user_id']) ?></td>
<td><?= htmlspecialchars($user['username']) ?></td>
<td><?= htmlspecialchars($user['role']) ?></td>
<td><?= htmlspecialchars($user['org_id']) ?></td>
<td>
<button class="btn btn-sm btn-info" disabled>Edit</button>
<button class="btn btn-sm btn-danger" disabled>Delete</button>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>