<?php
include 'includes/header.php'; // auth.php is included in here
require_permission('about_page_edit');
include '../includes/db.php';
// Fetch existing content
$sql = "SELECT * FROM about_content";
$result = $conn->query($sql);
$content = [];
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$content[$row['section']] = $row;
}
}
?>
<div class="container-fluid">
<h1 class="h3 mb-4 text-gray-800">تعديل محتوى صفحة "من نحن"</h1>
<form action="about_process.php" method="POST">
<!-- Hero Section -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">القسم الرئيسي (Hero)</h6>
</div>
<div class="card-body">
<div class="form-group">
<label>العنوان الرئيسي</label>
<input type="text" name="hero_title" class="form-control" value="<?php echo htmlspecialchars($content['hero']['title'] ?? ''); ?>">
</div>
<div class="form-group">
<label>النص الفرعي</label>
<input type="text" name="hero_content" class="form-control" value="<?php echo htmlspecialchars($content['hero']['content'] ?? ''); ?>">
</div>
</div>
</div>
<!-- Story Section -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">قسم "قصتنا"</h6>
</div>
<div class="card-body">
<div class="form-group">
<label>عنوان القصة</label>
<input type="text" name="story_title" class="form-control" value="<?php echo htmlspecialchars($content['story']['title'] ?? ''); ?>">
</div>
<div class="form-group">
<label>محتوى القصة</label>
<textarea name="story_content" class="form-control" rows="5"><?php echo htmlspecialchars($content['story']['content'] ?? ''); ?></textarea>
</div>
<div class="form-group">
<label>رابط صورة القصة</label>
<input type="text" name="story_image_url" class="form-control" value="<?php echo htmlspecialchars($content['story']['image_url'] ?? ''); ?>">
</div>
</div>
</div>
<!-- Vision Section -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">قسم "رؤيتنا ومهمتنا"</h6>
</div>
<div class="card-body">
<div class="form-group">
<label>عنوان الرؤية والمهمة</label>
<input type="text" name="vision_title" class="form-control" value="<?php echo htmlspecialchars($content['vision']['title'] ?? ''); ?>">
</div>
<div class="form-group">
<label>محتوى الرؤية والمهمة</label>
<textarea name="vision_content" class="form-control" rows="5"><?php echo htmlspecialchars($content['vision']['content'] ?? ''); ?></textarea>
</div>
<div class="form-group">
<label>رابط صورة الرؤية</label>
<input type="text" name="vision_image_url" class="form-control" value="<?php echo htmlspecialchars($content['vision']['image_url'] ?? ''); ?>">
</div>
</div>
</div>
<button type="submit" class="btn btn-primary">حفظ التغييرات</button>
</form>
</div>
<?php include 'includes/footer.php'; ?>