From 63fca5987ab0d04fd758a518b35650b26ff701ee Mon Sep 17 00:00:00 2001 From: philrodoni Date: Thu, 1 Jan 2026 16:50:41 -0800 Subject: [PATCH] baseline starting commit --- .DS_Store | Bin 0 -> 8196 bytes candidate.php | 17 ++-- create_assessment.php | 14 +++- create_project.php | 108 +++++++++++++++++++++---- create_user.php | 14 +--- db/config.php | 6 +- edit_assessment.php | 7 +- index.html | 17 ++++ index.php | 14 +--- project.php | 182 +++++++++++++++++++++++++++++++++++++++++- synthesis_plan.php | 2 +- users.php | 7 +- 12 files changed, 330 insertions(+), 58 deletions(-) create mode 100644 .DS_Store create mode 100644 index.html diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..36910bb37a63a41df361c5e1bb652f243d2fdbe6 GIT binary patch literal 8196 zcmeHMv2GJV5S=wHoJ5cigp?-INmMiuDX3^JkttH=0}}hr*hc5v$#x{tT_|Yy2PD3L zj)E>qLBS8u@dXG8DjML;?AqR4-$^MV6e+vb?p$_e-tN8`-+3-Xr1nqKU7{@_YN4~- zSi?}!SkHZ_HO$N-NCkg7$nvC{a3JOLRSS!#(HG^Jf3wW~5EhBB3d z((cg5#=g{2yOWZYfn!!yrb1Ds@KBMMlZv$rV_+aKu*?A0?oHaEJ`HK=)$e=I?fjJ{ zj&r-Lzk8VEqe8=7u$b#cdAn`i0knSYz5n>*^=HPh^yysx=iBAu^K(~U3@mI_GWP0h zf7oN6PAI1_^}M})fStY975EHjN*zk@>CuEHu7}$8JnqAzfaRD*bOcZKnc}L0Swutk6r;S@z($Cc{i}i(6wpwt885M4_?4Vd~N12m;O8xW{qyay03E>r(>w; zF3#Hl(Y;pbny#D?FHLMgM0t118 zo63M{wh!C;*d70VscKwnN9f1s+}N(vQd}@dISwi1IOO~vhPaMk%097?rIwgM`|mFT N!t-Bv55w(d;2(YduY~{r literal 0 HcmV?d00001 diff --git a/candidate.php b/candidate.php index bf78c45..609c435 100644 --- a/candidate.php +++ b/candidate.php @@ -76,8 +76,9 @@

  • - Dashboard - User Management + Projects + User Management + Settings
@@ -114,7 +115,7 @@ ?>

Candidate:

- Back to Project + Back to Project
@@ -122,7 +123,13 @@
Candidate Details

Candidate ID:

Run ID:

-

Project ID:

+

Project ID: + + + + + +

SMILES ID:

Estimated Cost:

Generated Time:

@@ -135,7 +142,7 @@
Candidate Assessments
- Create Assessment + Create Assessment

0): ?> diff --git a/create_assessment.php b/create_assessment.php index cd6f35f..901bba0 100644 --- a/create_assessment.php +++ b/create_assessment.php @@ -76,8 +76,9 @@

  • - Dashboard - User Management + Projects + User Management + Settings
@@ -100,7 +101,7 @@ $stmt = $pdo->prepare($sql); $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(); } catch (PDOException $e) { echo '
Database error: ' . $e->getMessage() . '
'; @@ -131,7 +132,12 @@
- +
diff --git a/create_project.php b/create_project.php index 0ca0120..cd4c139 100644 --- a/create_project.php +++ b/create_project.php @@ -73,24 +73,62 @@ prepare("SELECT org_id, name FROM Organization ORDER BY name"); + $stmt_orgs->execute(); + $organizations = $stmt_orgs->fetchAll(PDO::FETCH_ASSOC); +} catch (PDOException $e) { + $message = '
Error loading organizations: ' . $e->getMessage() . '
'; +} + 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($name) && !empty($description)) { + if (!empty($project_id) && !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())"; + + // 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->execute([$name, $description, 1, 1]); + $stmt->execute([$project_id, $name, $description, $org_id]); header("Location: index.php"); exit(); } catch (PDOException $e) { $message = '
Error: ' . $e->getMessage() . '
'; + } catch (Exception $e) { + $message = '
Error: ' . $e->getMessage() . '
'; } } else { - $message = '
Please fill in all fields.
'; + $message = '
Please fill in all required fields.
'; } } ?> @@ -99,16 +137,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

LWM

  • - Dashboard -
  • -
  • - Projects -
  • -
  • - Users -
  • -
  • - Settings +
    + Projects + User Management + Settings
@@ -125,6 +157,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
Project Details
+
+ + +
@@ -133,6 +169,32 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
+
+ + 0): ?> + + +
+
+
+
New Organization
+
+ + + Organization ID will be auto-generated as UUID +
+
+
+
+
@@ -140,5 +202,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { + diff --git a/create_user.php b/create_user.php index 09edea5..220cbde 100644 --- a/create_user.php +++ b/create_user.php @@ -101,16 +101,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {

LWM

  • - Dashboard -
  • -
  • - Projects -
  • -
  • - Users -
  • -
  • - Settings +
    + Projects + User Management + Settings
diff --git a/db/config.php b/db/config.php index 86254a1..cbe3083 100644 --- a/db/config.php +++ b/db/config.php @@ -1,9 +1,9 @@

  • - Dashboard - User Management + Projects + User Management + Settings
  • @@ -117,7 +118,7 @@ $stmt = $pdo->prepare($sql); $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(); } catch (PDOException $e) { echo '
    Database error: ' . $e->getMessage() . '
    '; diff --git a/index.html b/index.html new file mode 100644 index 0000000..7ec4d0c --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + + +

    In here 2

    + + diff --git a/index.php b/index.php index a262f2f..b96936e 100644 --- a/index.php +++ b/index.php @@ -88,17 +88,9 @@

    • - Dashboard - User Management -
    • -
    • - Projects -
    • -
    • - Users -
    • -
    • - Settings + Projects + User Management + Settings
    diff --git a/project.php b/project.php index a71dca2..8e795d0 100644 --- a/project.php +++ b/project.php @@ -67,6 +67,27 @@ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); 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: " ↓"; + } @@ -76,8 +97,9 @@

    • - Dashboard - User Management + Projects + User Management + Settings
    @@ -98,6 +120,15 @@ } 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 + } ?>

    Project:

    @@ -111,6 +142,67 @@

    Start Date:

    + +
    +
    +
    Candidates
    + 0): ?> +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    Candidate ID ↕Run ID ↕SMILES ID ↕Estimated Cost ↕Generated Time ↕Synthesis Approved ↕Status ↕
    +
    + +

    No candidates found for this project.

    + +
    +
    Generation Runs
    @@ -163,7 +255,7 @@ echo ''; foreach ($candidates as $candidate) { echo ""; - echo ""; + echo ""; echo ""; echo ""; echo ""; @@ -194,5 +286,89 @@ + diff --git a/synthesis_plan.php b/synthesis_plan.php index e9ee564..9ceece0 100644 --- a/synthesis_plan.php +++ b/synthesis_plan.php @@ -42,7 +42,7 @@ $plan = $stmt->fetch(PDO::FETCH_ASSOC);
    Synthesis plan not found.
    - Back to Candidate + Back to Candidate
    diff --git a/users.php b/users.php index 27e29e9..8cf6a79 100644 --- a/users.php +++ b/users.php @@ -48,10 +48,11 @@ $users = $stmt->fetchAll(PDO::FETCH_ASSOC);
    -

    AI Chem Lab

    +

    LWM


    - Dashboard - User Management + Projects + User Management + Settings
    Candidate IDSMILES IDEst. CostStatus
    " . htmlspecialchars($candidate['candidate_id']) . "" . htmlspecialchars($candidate['candidate_id']) . "" . htmlspecialchars($candidate['smiles_id']) . "" . htmlspecialchars($candidate['estimated_cost']) . "" . htmlspecialchars($candidate['status']) . "