baseline starting commit
This commit is contained in:
parent
18bed73881
commit
63fca5987a
@ -76,8 +76,9 @@
|
|||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php" class="nav-link"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -114,7 +115,7 @@
|
|||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>Candidate: <?php echo htmlspecialchars($candidate['candidate_id']); ?></h1>
|
<h1>Candidate: <?php echo htmlspecialchars($candidate['candidate_id']); ?></h1>
|
||||||
<a href="project.php?id=<?php echo htmlspecialchars($candidate['project_id']); ?>" class="btn btn-secondary">Back to Project</a>
|
<a href="project.php?id=<?php echo urlencode($candidate['project_id']); ?>" class="btn btn-secondary">Back to Project</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
@ -122,7 +123,13 @@
|
|||||||
<h5 class="card-title">Candidate Details</h5>
|
<h5 class="card-title">Candidate Details</h5>
|
||||||
<p><strong>Candidate ID:</strong> <?php echo htmlspecialchars($candidate['candidate_id']); ?></p>
|
<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>Run ID:</strong> <?php echo htmlspecialchars($candidate['run_id']); ?></p>
|
||||||
<p><strong>Project ID:</strong> <?php echo htmlspecialchars($candidate['project_id']); ?></p>
|
<p><strong>Project ID:</strong>
|
||||||
|
<?php if (!empty($candidate['project_id'])): ?>
|
||||||
|
<a href="project.php?id=<?php echo urlencode($candidate['project_id']); ?>"><?php echo htmlspecialchars($candidate['project_id']); ?></a>
|
||||||
|
<?php else: ?>
|
||||||
|
<?php echo htmlspecialchars($candidate['project_id']); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</p>
|
||||||
<p><strong>SMILES ID:</strong> <?php echo htmlspecialchars($candidate['smiles_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>Estimated Cost:</strong> <?php echo htmlspecialchars($candidate['estimated_cost']); ?></p>
|
||||||
<p><strong>Generated Time:</strong> <?php echo htmlspecialchars($candidate['generated_time']); ?></p>
|
<p><strong>Generated Time:</strong> <?php echo htmlspecialchars($candidate['generated_time']); ?></p>
|
||||||
@ -135,7 +142,7 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
<h5 class="card-title mb-0">Candidate Assessments</h5>
|
<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>
|
<a href="create_assessment.php?candidate_id=<?php echo urlencode($candidate['candidate_id']); ?>" class="btn btn-primary">Create Assessment</a>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
<?php if (count($assessments) > 0): ?>
|
<?php if (count($assessments) > 0): ?>
|
||||||
|
|||||||
@ -76,8 +76,9 @@
|
|||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php" class="nav-link"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -100,7 +101,7 @@
|
|||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute([$candidate_id, $assessed_by, $assess_date, $assessment, $status]);
|
$stmt->execute([$candidate_id, $assessed_by, $assess_date, $assessment, $status]);
|
||||||
|
|
||||||
header("Location: candidate.php?id=" . $candidate_id);
|
header("Location: candidate.php?id=" . urlencode($candidate_id));
|
||||||
exit();
|
exit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
|
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
|
||||||
@ -131,7 +132,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="status" class="form-label">Status</label>
|
<label for="status" class="form-label">Status</label>
|
||||||
<input type="text" class="form-control" id="status" name="status">
|
<select class="form-control" id="status" name="status" required>
|
||||||
|
<option value="">-- Select Status --</option>
|
||||||
|
<option value="Approved">Approved</option>
|
||||||
|
<option value="Rejected">Rejected</option>
|
||||||
|
<option value="Pending">Pending</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary">Submit Assessment</button>
|
<button type="submit" class="btn btn-primary">Submit Assessment</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@ -73,24 +73,62 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once 'db/config.php';
|
require_once 'db/config.php';
|
||||||
$message = '';
|
$message = '';
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
$organizations = [];
|
||||||
$name = $_POST['name'] ?? '';
|
|
||||||
$description = $_POST['description'] ?? '';
|
|
||||||
|
|
||||||
if (!empty($name) && !empty($description)) {
|
// Fetch all organizations
|
||||||
try {
|
try {
|
||||||
$pdo = db();
|
$pdo = db();
|
||||||
// Hardcoded org_id and created_by_user_id for now
|
$stmt_orgs = $pdo->prepare("SELECT org_id, name FROM Organization ORDER BY name");
|
||||||
$sql = "INSERT INTO Project (name, description, org_id, created_by_user_id, `Start Date`) VALUES (?, ?, ?, ?, CURDATE())";
|
$stmt_orgs->execute();
|
||||||
|
$organizations = $stmt_orgs->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
$message = '<div class="alert alert-danger">Error loading organizations: ' . $e->getMessage() . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
|
$project_id = $_POST['project_id'] ?? '';
|
||||||
|
$name = $_POST['name'] ?? '';
|
||||||
|
$description = $_POST['description'] ?? '';
|
||||||
|
$org_id = $_POST['org_id'] ?? '';
|
||||||
|
$new_org_name = $_POST['new_org_name'] ?? '';
|
||||||
|
|
||||||
|
if (!empty($project_id) && !empty($name) && !empty($description)) {
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
|
||||||
|
// If creating a new organization (org_id is "__NEW__" or empty and new_org_name is provided)
|
||||||
|
if (($org_id === '__NEW__' || empty($org_id)) && !empty($new_org_name)) {
|
||||||
|
// Generate UUID for org_id
|
||||||
|
$new_org_id = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
||||||
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0xffff),
|
||||||
|
mt_rand(0, 0x0fff) | 0x4000,
|
||||||
|
mt_rand(0, 0x3fff) | 0x8000,
|
||||||
|
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Insert organization FIRST
|
||||||
|
$sql_org = "INSERT INTO Organization (org_id, name) VALUES (?, ?)";
|
||||||
|
$stmt_org = $pdo->prepare($sql_org);
|
||||||
|
$stmt_org->execute([$new_org_id, $new_org_name]);
|
||||||
|
$org_id = $new_org_id;
|
||||||
|
} elseif (empty($org_id) || $org_id === '__NEW__') {
|
||||||
|
throw new Exception("Please select an organization or enter a new organization name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert project AFTER organization is created
|
||||||
|
$sql = "INSERT INTO Project (project_id, name, description, org_id, `Start Date`) VALUES (?, ?, ?, ?, CURDATE())";
|
||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute([$name, $description, 1, 1]);
|
$stmt->execute([$project_id, $name, $description, $org_id]);
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit();
|
exit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$message = '<div class="alert alert-danger">Error: ' . $e->getMessage() . '</div>';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = '<div class="alert alert-warning">Please fill in all fields.</div>';
|
$message = '<div class="alert alert-warning">Please fill in all required fields.</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -99,16 +137,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<h3><i class="fa fa-flask"></i> LWM</h3>
|
<h3><i class="fa fa-flask"></i> LWM</h3>
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php"><i class="fa fa-tachometer-alt"></i> Dashboard</a>
|
<hr>
|
||||||
</li>
|
<a href="index.php" class="nav-link active"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<li class="nav-item">
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
<a class="nav-link active" href="#"><i class="fa fa-tasks"></i> Projects</a>
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -125,6 +157,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Project Details</h5>
|
<h5 class="card-title">Project Details</h5>
|
||||||
<form action="create_project.php" method="POST">
|
<form action="create_project.php" method="POST">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="project_id" class="form-label">Project ID</label>
|
||||||
|
<input type="text" class="form-control" id="project_id" name="project_id" required>
|
||||||
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="name" class="form-label">Project Name</label>
|
<label for="name" class="form-label">Project Name</label>
|
||||||
<input type="text" class="form-control" id="name" name="name" required>
|
<input type="text" class="form-control" id="name" name="name" required>
|
||||||
@ -133,6 +169,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<label for="description" class="form-label">Description</label>
|
<label for="description" class="form-label">Description</label>
|
||||||
<textarea class="form-control" id="description" name="description" rows="3" required></textarea>
|
<textarea class="form-control" id="description" name="description" rows="3" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label class="form-label">Organization</label>
|
||||||
|
<?php if (count($organizations) > 0): ?>
|
||||||
|
<select class="form-control mb-2" id="org_id" name="org_id" onchange="toggleNewOrgFields()">
|
||||||
|
<option value="">-- Select Organization --</option>
|
||||||
|
<?php foreach ($organizations as $org): ?>
|
||||||
|
<option value="<?php echo htmlspecialchars($org['org_id']); ?>">
|
||||||
|
<?php echo htmlspecialchars($org['name'] . ' (' . $org['org_id'] . ')'); ?>
|
||||||
|
</option>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<option value="__NEW__">+ Create New Organization</option>
|
||||||
|
</select>
|
||||||
|
<?php endif; ?>
|
||||||
|
<div class="mb-3" id="new_org_fields" style="display: <?php echo count($organizations) === 0 ? 'block' : 'none'; ?>;">
|
||||||
|
<div class="card bg-light">
|
||||||
|
<div class="card-body">
|
||||||
|
<h6 class="card-title">New Organization</h6>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="new_org_name" class="form-label">Organization Name</label>
|
||||||
|
<input type="text" class="form-control" id="new_org_name" name="new_org_name" placeholder="Enter organization name">
|
||||||
|
<small class="form-text text-muted">Organization ID will be auto-generated as UUID</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<button type="submit" class="btn btn-primary" style="background-color: var(--accent-color); border-color: var(--accent-color);">Create Project</button>
|
<button type="submit" class="btn btn-primary" style="background-color: var(--accent-color); border-color: var(--accent-color);">Create Project</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
@ -140,5 +202,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script>
|
||||||
|
function toggleNewOrgFields() {
|
||||||
|
const orgSelect = document.getElementById('org_id');
|
||||||
|
const newOrgFields = document.getElementById('new_org_fields');
|
||||||
|
const newOrgNameInput = document.getElementById('new_org_name');
|
||||||
|
|
||||||
|
if (orgSelect && orgSelect.value === '__NEW__') {
|
||||||
|
newOrgFields.style.display = 'block';
|
||||||
|
newOrgNameInput.required = true;
|
||||||
|
} else {
|
||||||
|
newOrgFields.style.display = 'none';
|
||||||
|
newOrgNameInput.required = false;
|
||||||
|
newOrgNameInput.value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -101,16 +101,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
<h3><i class="fa fa-flask"></i> LWM</h3>
|
<h3><i class="fa fa-flask"></i> LWM</h3>
|
||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php"><i class="fa fa-tachometer-alt"></i> Dashboard</a>
|
<hr>
|
||||||
</li>
|
<a href="index.php" class="nav-link"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<li class="nav-item">
|
<a href="users.php" class="nav-link active"><i class="fa fa-users"></i> User Management</a>
|
||||||
<a class="nav-link" href="index.php"><i class="fa fa-tasks"></i> Projects</a>
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
// Generated by setup_mariadb_project.sh — edit as needed.
|
// Generated by setup_mariadb_project.sh — edit as needed.
|
||||||
define('DB_HOST', '127.0.0.1');
|
define('DB_HOST', '127.0.0.1');
|
||||||
define('DB_NAME', 'app_36852');
|
define('DB_NAME', 'genesys');
|
||||||
define('DB_USER', 'app_36852');
|
define('DB_USER', 'root');
|
||||||
define('DB_PASS', '04f6d7bc-b084-4245-93a3-23e1fa6083c2');
|
define('DB_PASS', 'dslextreme');
|
||||||
|
|
||||||
function db() {
|
function db() {
|
||||||
static $pdo;
|
static $pdo;
|
||||||
|
|||||||
@ -76,8 +76,9 @@
|
|||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php" class="nav-link"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -117,7 +118,7 @@
|
|||||||
$stmt = $pdo->prepare($sql);
|
$stmt = $pdo->prepare($sql);
|
||||||
$stmt->execute([$assessed_by, $assess_date, $assessment, $status, $assessment_id]);
|
$stmt->execute([$assessed_by, $assess_date, $assessment, $status, $assessment_id]);
|
||||||
|
|
||||||
header("Location: candidate.php?id=" . $candidate_id);
|
header("Location: candidate.php?id=" . urlencode($candidate_id));
|
||||||
exit();
|
exit();
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
|
echo '<div class="alert alert-danger">Database error: ' . $e->getMessage() . '</div>';
|
||||||
|
|||||||
17
index.html
Normal file
17
index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<meta http-equiv="Content-Style-Type" content="text/css">
|
||||||
|
<title></title>
|
||||||
|
<meta name="Generator" content="Cocoa HTML Writer">
|
||||||
|
<meta name="CocoaVersion" content="2575.7">
|
||||||
|
<style type="text/css">
|
||||||
|
body {background-color: #f2f2f2}
|
||||||
|
span.s1 {font-kerning: none}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h3 style="margin: 0.0px 0.0px 30.0px 0.0px; text-align: center; font: 20.4px 'Helvetica Neue'; color: #e1e7e8; -webkit-text-stroke: #e1e7e8; background-color: #192433"><span class="s1"><b>In here 2</b><b></b></span></h3>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
14
index.php
14
index.php
@ -88,17 +88,9 @@
|
|||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php" class="active"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php" class="nav-link active"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
</li>
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
<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>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
182
project.php
182
project.php
@ -67,6 +67,27 @@
|
|||||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
.filter-input {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
.sort-indicator {
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--primary-color);
|
||||||
|
display: inline-block;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
.sort-indicator:hover {
|
||||||
|
color: var(--accent-color);
|
||||||
|
}
|
||||||
|
.sort-asc::after {
|
||||||
|
content: " ↑";
|
||||||
|
}
|
||||||
|
.sort-desc::after {
|
||||||
|
content: " ↓";
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -76,8 +97,9 @@
|
|||||||
<ul class="nav flex-column">
|
<ul class="nav flex-column">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php" class="nav-link"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php" class="nav-link"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php" class="nav-link"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="nav-link"><i class="fa fa-users"></i> User Management</a>
|
||||||
|
<a href="#" class="nav-link"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -98,6 +120,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($project):
|
if ($project):
|
||||||
|
// Fetch all candidates for this project
|
||||||
|
$candidates = [];
|
||||||
|
try {
|
||||||
|
$stmt_candidates = $pdo->prepare("SELECT candidate_id, run_id, smiles_id, estimated_cost, generated_time, synthesis_approved, status FROM Candidate WHERE project_id = ? ORDER BY generated_time DESC");
|
||||||
|
$stmt_candidates->execute([$_GET['id']]);
|
||||||
|
$candidates = $stmt_candidates->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
// Error will be handled in display
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<h1>Project: <?php echo htmlspecialchars($project['name']); ?></h1>
|
<h1>Project: <?php echo htmlspecialchars($project['name']); ?></h1>
|
||||||
@ -111,6 +142,67 @@
|
|||||||
<p><strong>Start Date:</strong> <?php echo htmlspecialchars($project['Start Date']); ?></p>
|
<p><strong>Start Date:</strong> <?php echo htmlspecialchars($project['Start Date']); ?></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
|
<h5 class="card-title">Candidates</h5>
|
||||||
|
<?php if (count($candidates) > 0): ?>
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table id="candidatesTable" class="table table-hover table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Candidate ID" data-column="0">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Run ID" data-column="1">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter SMILES ID" data-column="2">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Cost" data-column="3">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Generated Time" data-column="4">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Synthesis Approved" data-column="5">
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<input type="text" class="form-control form-control-sm filter-input" placeholder="Filter Status" data-column="6">
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Candidate ID <span class="sort-indicator" data-column="0">↕</span></th>
|
||||||
|
<th>Run ID <span class="sort-indicator" data-column="1">↕</span></th>
|
||||||
|
<th>SMILES ID <span class="sort-indicator" data-column="2">↕</span></th>
|
||||||
|
<th>Estimated Cost <span class="sort-indicator" data-column="3">↕</span></th>
|
||||||
|
<th>Generated Time <span class="sort-indicator" data-column="4">↕</span></th>
|
||||||
|
<th>Synthesis Approved <span class="sort-indicator" data-column="5">↕</span></th>
|
||||||
|
<th>Status <span class="sort-indicator" data-column="6">↕</span></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($candidates as $candidate): ?>
|
||||||
|
<tr>
|
||||||
|
<td><a href="candidate.php?id=<?php echo urlencode($candidate['candidate_id']); ?>"><?php echo htmlspecialchars($candidate['candidate_id']); ?></a></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['run_id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['smiles_id']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['estimated_cost']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['generated_time']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['synthesis_approved']); ?></td>
|
||||||
|
<td><?php echo htmlspecialchars($candidate['status']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="text-muted">No candidates found for this project.</p>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h5 class="card-title">Generation Runs</h5>
|
<h5 class="card-title">Generation Runs</h5>
|
||||||
@ -163,7 +255,7 @@
|
|||||||
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>';
|
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) {
|
foreach ($candidates as $candidate) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td><a href='candidate.php?id=" . htmlspecialchars($candidate['candidate_id']) . "'>" . htmlspecialchars($candidate['candidate_id']) . "</a></td>";
|
echo "<td><a href='candidate.php?id=" . urlencode($candidate['candidate_id']) . "'>" . htmlspecialchars($candidate['candidate_id']) . "</a></td>";
|
||||||
echo "<td>" . htmlspecialchars($candidate['smiles_id']) . "</td>";
|
echo "<td>" . htmlspecialchars($candidate['smiles_id']) . "</td>";
|
||||||
echo "<td>" . htmlspecialchars($candidate['estimated_cost']) . "</td>";
|
echo "<td>" . htmlspecialchars($candidate['estimated_cost']) . "</td>";
|
||||||
echo "<td>" . htmlspecialchars($candidate['status']) . "</td>";
|
echo "<td>" . htmlspecialchars($candidate['status']) . "</td>";
|
||||||
@ -194,5 +286,89 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script>
|
||||||
|
(function() {
|
||||||
|
const table = document.getElementById('candidatesTable');
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
const tbody = table.querySelector('tbody');
|
||||||
|
const filterInputs = table.querySelectorAll('.filter-input');
|
||||||
|
const sortIndicators = table.querySelectorAll('.sort-indicator');
|
||||||
|
let currentSort = { column: null, direction: 'asc' };
|
||||||
|
let rows = Array.from(tbody.querySelectorAll('tr'));
|
||||||
|
|
||||||
|
// Filter function
|
||||||
|
function filterTable() {
|
||||||
|
const filters = Array.from(filterInputs).map(input => input.value.toLowerCase());
|
||||||
|
|
||||||
|
rows.forEach(row => {
|
||||||
|
const cells = row.querySelectorAll('td');
|
||||||
|
let show = true;
|
||||||
|
|
||||||
|
filters.forEach((filter, index) => {
|
||||||
|
if (filter && cells[index]) {
|
||||||
|
const cellText = cells[index].textContent.toLowerCase();
|
||||||
|
if (!cellText.includes(filter)) {
|
||||||
|
show = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
row.style.display = show ? '' : 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort function
|
||||||
|
function sortTable(columnIndex, direction) {
|
||||||
|
const visibleRows = rows.filter(row => row.style.display !== 'none');
|
||||||
|
|
||||||
|
visibleRows.sort((a, b) => {
|
||||||
|
const aText = a.querySelectorAll('td')[columnIndex]?.textContent.trim() || '';
|
||||||
|
const bText = b.querySelectorAll('td')[columnIndex]?.textContent.trim() || '';
|
||||||
|
|
||||||
|
// Try to parse as number
|
||||||
|
const aNum = parseFloat(aText);
|
||||||
|
const bNum = parseFloat(bText);
|
||||||
|
|
||||||
|
let comparison = 0;
|
||||||
|
if (!isNaN(aNum) && !isNaN(bNum)) {
|
||||||
|
comparison = aNum - bNum;
|
||||||
|
} else {
|
||||||
|
comparison = aText.localeCompare(bText);
|
||||||
|
}
|
||||||
|
|
||||||
|
return direction === 'asc' ? comparison : -comparison;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Clear tbody and re-append sorted rows
|
||||||
|
tbody.innerHTML = '';
|
||||||
|
visibleRows.forEach(row => tbody.appendChild(row));
|
||||||
|
|
||||||
|
// Update sort indicators
|
||||||
|
sortIndicators.forEach((indicator, index) => {
|
||||||
|
indicator.textContent = '↕';
|
||||||
|
indicator.classList.remove('sort-asc', 'sort-desc');
|
||||||
|
if (index === columnIndex) {
|
||||||
|
indicator.classList.add(direction === 'asc' ? 'sort-asc' : 'sort-desc');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
currentSort = { column: columnIndex, direction: direction };
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add filter event listeners
|
||||||
|
filterInputs.forEach(input => {
|
||||||
|
input.addEventListener('input', filterTable);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add sort event listeners
|
||||||
|
sortIndicators.forEach((indicator, index) => {
|
||||||
|
indicator.addEventListener('click', () => {
|
||||||
|
const direction = currentSort.column === index && currentSort.direction === 'asc' ? 'desc' : 'asc';
|
||||||
|
sortTable(index, direction);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -42,7 +42,7 @@ $plan = $stmt->fetch(PDO::FETCH_ASSOC);
|
|||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<div class="alert alert-warning">Synthesis plan not found.</div>
|
<div class="alert alert-warning">Synthesis plan not found.</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<a href="candidate.php?id=<?php echo htmlspecialchars($plan['candidate_id']); ?>" class="btn btn-primary">Back to Candidate</a>
|
<a href="candidate.php?id=<?php echo urlencode($plan['candidate_id']); ?>" class="btn btn-primary">Back to Candidate</a>
|
||||||
|
|
||||||
<div class="card mt-4">
|
<div class="card mt-4">
|
||||||
<div class="card-header">
|
<div class="card-header">
|
||||||
|
|||||||
@ -48,10 +48,11 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-2 sidebar">
|
<div class="col-md-2 sidebar">
|
||||||
<h3 class="text-center">AI Chem Lab</h3>
|
<h3 class="text-center"><i class="fa fa-flask"></i> LWM</h3>
|
||||||
<hr>
|
<hr>
|
||||||
<a href="index.php"><i class="fas fa-tachometer-alt"></i> Dashboard</a>
|
<a href="index.php"><i class="fa fa-tasks"></i> Projects</a>
|
||||||
<a href="users.php" class="active"><i class="fas fa-users"></i> User Management</a>
|
<a href="users.php" class="active"><i class="fa fa-users"></i> User Management</a>
|
||||||
|
<a href="#"><i class="fa fa-cogs"></i> Settings</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-10 main-content">
|
<div class="col-md-10 main-content">
|
||||||
<div class="d-flex justify-content-between align-items-center">
|
<div class="d-flex justify-content-between align-items-center">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user