diff --git a/app/Controllers/DomainController.php b/app/Controllers/DomainController.php
index 8d38a00..296385f 100644
--- a/app/Controllers/DomainController.php
+++ b/app/Controllers/DomainController.php
@@ -570,5 +570,31 @@ class DomainController extends Controller
$_SESSION['success'] = "Monitoring $status for $updated domain(s)";
$this->redirect('/domains');
}
+
+ public function updateNotes($params = [])
+ {
+ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
+ $this->redirect('/domains');
+ return;
+ }
+
+ $id = (int)($params['id'] ?? 0);
+ $domain = $this->domainModel->find($id);
+
+ if (!$domain) {
+ $_SESSION['error'] = 'Domain not found';
+ $this->redirect('/domains');
+ return;
+ }
+
+ $notes = $_POST['notes'] ?? '';
+
+ $this->domainModel->update($id, [
+ 'notes' => $notes
+ ]);
+
+ $_SESSION['success'] = 'Notes updated successfully';
+ $this->redirect('/domains/' . $id);
+ }
}
diff --git a/app/Views/domains/view.php b/app/Views/domains/view.php
index 6967e52..19fc3f1 100644
--- a/app/Views/domains/view.php
+++ b/app/Views/domains/view.php
@@ -372,6 +372,42 @@ ob_start();
+
+
@@ -453,6 +489,11 @@ function toggleWhoisData() {
dataDiv.classList.toggle('hidden');
chevron.classList.toggle('rotate-180');
}
+
+function resetNotes() {
+ const originalNotes = = json_encode($domain['notes'] ?? '') ?>;
+ document.getElementById('notes-textarea').value = originalNotes;
+}
exec($statement);
} catch (PDOException $e) {
- // Check if it's a "column already exists" error for migrations 003 and 005
+ // Check if it's a "column already exists" error for migrations 003, 005, and 008
if (strpos($e->getMessage(), 'Duplicate column name') !== false &&
(basename($migrationFile) === '003_add_whois_fields.sql' ||
- basename($migrationFile) === '005_update_tld_import_logs.sql')) {
+ basename($migrationFile) === '005_update_tld_import_logs.sql' ||
+ basename($migrationFile) === '008_add_notes_to_domains.sql')) {
echo " ⚠ Column already exists, skipping: " . $e->getMessage() . "\n";
continue;
}
diff --git a/database/migrations/008_add_notes_to_domains.sql b/database/migrations/008_add_notes_to_domains.sql
new file mode 100644
index 0000000..9465694
--- /dev/null
+++ b/database/migrations/008_add_notes_to_domains.sql
@@ -0,0 +1,3 @@
+-- Add notes column to domains table
+ALTER TABLE domains ADD COLUMN notes TEXT AFTER whois_data;
+
diff --git a/routes/web.php b/routes/web.php
index a4bdf85..71838ab 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -45,6 +45,7 @@ $router->post('/domains/store', [DomainController::class, 'store']);
$router->get('/domains/{id}', [DomainController::class, 'show']);
$router->get('/domains/{id}/edit', [DomainController::class, 'edit']);
$router->post('/domains/{id}/update', [DomainController::class, 'update']);
+$router->post('/domains/{id}/update-notes', [DomainController::class, 'updateNotes']);
$router->post('/domains/{id}/refresh', [DomainController::class, 'refresh']);
$router->post('/domains/{id}/delete', [DomainController::class, 'delete']);