Domain Notes Feature added
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -372,6 +372,42 @@ ob_start();
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Notes Section -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
||||
<div class="px-4 py-2 border-b border-gray-200 bg-gray-50">
|
||||
<h3 class="text-xs font-semibold text-gray-700 uppercase tracking-wider flex items-center">
|
||||
<i class="fas fa-sticky-note text-gray-400 mr-2" style="font-size: 10px;"></i>
|
||||
Notes
|
||||
</h3>
|
||||
</div>
|
||||
<div class="p-4">
|
||||
<form method="POST" action="/domains/<?= $domain['id'] ?>/update-notes" id="notes-form">
|
||||
<textarea
|
||||
name="notes"
|
||||
id="notes-textarea"
|
||||
rows="6"
|
||||
class="w-full px-3 py-2 text-xs border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent resize-none"
|
||||
placeholder="Add notes about this domain..."><?= htmlspecialchars($domain['notes'] ?? '') ?></textarea>
|
||||
|
||||
<div class="flex gap-2 mt-3">
|
||||
<button
|
||||
type="submit"
|
||||
class="flex-1 inline-flex items-center justify-center px-3 py-2 bg-blue-600 text-white text-xs rounded-lg hover:bg-blue-700 transition-colors font-medium">
|
||||
<i class="fas fa-save mr-1.5"></i>
|
||||
Update Notes
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onclick="resetNotes()"
|
||||
class="flex-1 inline-flex items-center justify-center px-3 py-2 border border-gray-300 text-gray-700 text-xs rounded-lg hover:bg-gray-50 transition-colors font-medium">
|
||||
<i class="fas fa-times mr-1.5"></i>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Notification History -->
|
||||
<div class="bg-white rounded-lg border border-gray-200 overflow-hidden">
|
||||
<div class="px-4 py-2 border-b border-gray-200 bg-gray-50">
|
||||
@@ -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;
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -83,6 +83,7 @@ try {
|
||||
__DIR__ . '/migrations/005_update_tld_import_logs.sql',
|
||||
__DIR__ . '/migrations/006_add_complete_workflow_import_type.sql',
|
||||
__DIR__ . '/migrations/007_add_app_and_email_settings.sql',
|
||||
__DIR__ . '/migrations/008_add_notes_to_domains.sql',
|
||||
];
|
||||
|
||||
foreach ($migrationFiles as $migrationFile) {
|
||||
@@ -108,10 +109,11 @@ try {
|
||||
try {
|
||||
$pdo->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;
|
||||
}
|
||||
|
||||
3
database/migrations/008_add_notes_to_domains.sql
Normal file
3
database/migrations/008_add_notes_to_domains.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- Add notes column to domains table
|
||||
ALTER TABLE domains ADD COLUMN notes TEXT AFTER whois_data;
|
||||
|
||||
@@ -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']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user