adding landing page for rating
This commit is contained in:
parent
df53811d22
commit
c6d83786d4
@ -31,6 +31,13 @@ $translations = [
|
||||
'comment' => 'Comment',
|
||||
'rating_type' => 'Type',
|
||||
'staff' => 'Staff',
|
||||
'rate_us' => 'Rate Us',
|
||||
'rate_staff' => 'Rate Staff',
|
||||
'rate_services' => 'Rate Our Services',
|
||||
'clear_ratings' => 'Clear Ratings',
|
||||
'confirm_clear_ratings' => 'Are you sure you want to clear all ratings?',
|
||||
'ratings_cleared' => 'All ratings have been cleared successfully.',
|
||||
'error_clearing_ratings' => 'Error clearing ratings.',
|
||||
'service' => 'Service',
|
||||
'average_rating' => 'Average Rating',
|
||||
'total_ratings' => 'Total Ratings',
|
||||
@ -214,6 +221,13 @@ $translations = [
|
||||
'ready_orders' => 'Ready Orders',
|
||||
'recent_orders' => 'Recent Orders',
|
||||
'reports' => 'Reports',
|
||||
'rate_us' => 'Rate Us',
|
||||
'rate_staff' => 'Rate Staff',
|
||||
'rate_services' => 'Rate Our Services',
|
||||
'clear_ratings' => 'Clear Ratings',
|
||||
'confirm_clear_ratings' => 'Are you sure you want to clear all ratings?',
|
||||
'ratings_cleared' => 'All ratings have been cleared successfully.',
|
||||
'error_clearing_ratings' => 'Error clearing ratings.',
|
||||
'service' => 'Service',
|
||||
'service_pricing' => 'Service Pricing',
|
||||
'services_management' => 'Services Management',
|
||||
@ -291,6 +305,13 @@ $translations = [
|
||||
'comment' => 'تعليق',
|
||||
'rating_type' => 'النوع',
|
||||
'staff' => 'موظف',
|
||||
'rate_us' => 'قيمنا',
|
||||
'rate_staff' => 'تقييم الموظفين',
|
||||
'rate_services' => 'تقييم خدماتنا',
|
||||
'clear_ratings' => 'مسح التقييمات',
|
||||
'confirm_clear_ratings' => 'هل أنت متأكد من مسح جميع التقييمات؟',
|
||||
'ratings_cleared' => 'تم مسح جميع التقييمات بنجاح.',
|
||||
'error_clearing_ratings' => 'حدث خطأ أثناء مسح التقييمات.',
|
||||
'service' => 'خدمة',
|
||||
'average_rating' => 'متوسط التقييم',
|
||||
'total_ratings' => 'إجمالي التقييمات',
|
||||
@ -474,6 +495,13 @@ $translations = [
|
||||
'ready_orders' => 'طلبات جاهزة',
|
||||
'recent_orders' => 'آخر الطلبات',
|
||||
'reports' => 'التقارير',
|
||||
'rate_us' => 'قيمنا',
|
||||
'rate_staff' => 'تقييم الموظفين',
|
||||
'rate_services' => 'تقييم خدماتنا',
|
||||
'clear_ratings' => 'مسح التقييمات',
|
||||
'confirm_clear_ratings' => 'هل أنت متأكد من مسح جميع التقييمات؟',
|
||||
'ratings_cleared' => 'تم مسح جميع التقييمات بنجاح.',
|
||||
'error_clearing_ratings' => 'حدث خطأ أثناء مسح التقييمات.',
|
||||
'service' => 'خدمة',
|
||||
'service_pricing' => 'أسعار الخدمات',
|
||||
'services_management' => 'إدارة الخدمات',
|
||||
|
||||
130
rate.php
Normal file
130
rate.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
if (session_status() === PHP_SESSION_NONE) {
|
||||
session_start();
|
||||
}
|
||||
if (!isset($_SESSION["lang"]) && !isset($_GET["lang"])) {
|
||||
$_SESSION["lang"] = "ar";
|
||||
}
|
||||
require_once __DIR__ . "/db/config.php";
|
||||
require_once __DIR__ . '/includes/lang.php';
|
||||
|
||||
$branch_id_get = isset($_GET['branch_id']) ? (int)$_GET['branch_id'] : null;
|
||||
$info = null;
|
||||
|
||||
if ($branch_id_get) {
|
||||
$stmt = db()->prepare("SELECT b.id AS branch_id, b.name_en AS branch_name_en, b.name_ar AS branch_name_ar, c.id AS company_id, c.name_en AS comp_name_en, c.name_ar AS comp_name_ar, c.logo FROM branches b JOIN companies c ON b.company_id = c.id WHERE b.id = ?");
|
||||
$stmt->execute([$branch_id_get]);
|
||||
$info = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
if (empty($info)) {
|
||||
$stmt = db()->query("SELECT b.id AS branch_id, b.name_en AS branch_name_en, b.name_ar AS branch_name_ar, c.id AS company_id, c.name_en AS comp_name_en, c.name_ar AS comp_name_ar, c.logo FROM branches b JOIN companies c ON b.company_id = c.id LIMIT 1");
|
||||
$info = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
$branch_id = $info['branch_id'] ?? null;
|
||||
$company_name = $_SESSION['lang'] === 'ar' ? ($info['comp_name_ar'] ?? '') : ($info['comp_name_en'] ?? '');
|
||||
$branch_name = $_SESSION['lang'] === 'ar' ? ($info['branch_name_ar'] ?? '') : ($info['branch_name_en'] ?? '');
|
||||
$logo = $info['logo'] ?? null;
|
||||
|
||||
$branch_query = $branch_id ? '?branch_id=' . $branch_id : '';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= $_SESSION['lang'] ?>" dir="<?= $_SESSION['lang'] === 'ar' ? 'rtl' : 'ltr' ?>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?= __('rate_us') ?></title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
|
||||
<style>
|
||||
body { background-color: #f8f9fc; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; display: flex; flex-direction: column; min-height: 100vh; }
|
||||
.rating-card { max-width: 600px; margin: 40px auto; border-radius: 15px; border: none; box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15); padding: 40px 30px; background: white; }
|
||||
.main-content { flex: 1; }
|
||||
.footer { background-color: white; border-top: 1px solid #eaecf4; padding: 1.5rem 0; color: #858796; text-align: center; }
|
||||
|
||||
.option-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
border-radius: 15px;
|
||||
padding: 30px 20px;
|
||||
text-decoration: none;
|
||||
color: #4e73df;
|
||||
background-color: #f8f9fc;
|
||||
border: 2px solid #eaecf4;
|
||||
transition: all 0.3s ease;
|
||||
height: 100%;
|
||||
}
|
||||
.option-btn:hover {
|
||||
border-color: #4e73df;
|
||||
background-color: #eaecf4;
|
||||
color: #2e59d9;
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.option-icon {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 15px;
|
||||
color: inherit;
|
||||
}
|
||||
.option-text {
|
||||
font-size: 1.25rem;
|
||||
font-weight: 600;
|
||||
color: #5a5c69;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="container py-5">
|
||||
|
||||
<div class="text-end mb-3">
|
||||
<?php if ($_SESSION['lang'] === 'ar'): ?>
|
||||
<a href="?lang=en<?= $branch_id ? '&branch_id=' . $branch_id : '' ?>" class="text-decoration-none btn btn-sm btn-outline-secondary">English</a>
|
||||
<?php else: ?>
|
||||
<a href="?lang=ar<?= $branch_id ? '&branch_id=' . $branch_id : '' ?>" class="text-decoration-none btn btn-sm btn-outline-secondary">العربية</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="rating-card text-center">
|
||||
<?php if ($logo): ?>
|
||||
<img src="<?= htmlspecialchars($logo) ?>" alt="<?= htmlspecialchars($company_name) ?>" class="mb-3" style="max-height: 90px; max-width: 100%; object-fit: contain;">
|
||||
<?php endif; ?>
|
||||
<h3 class="mb-1 fw-bold"><?= htmlspecialchars($company_name) ?></h3>
|
||||
<?php if ($branch_name): ?>
|
||||
<p class="text-muted mb-4 small"><i class="bi bi-geo-alt-fill text-danger me-1"></i><?= htmlspecialchars($branch_name) ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h4 class="mb-5 text-primary border-top pt-4 mt-2"><?= __('rate_us') ?></h4>
|
||||
|
||||
<div class="row g-4 justify-content-center">
|
||||
<div class="col-sm-6">
|
||||
<a href="staff_rating.php<?= $branch_query ?>" class="option-btn">
|
||||
<i class="bi bi-person-badge option-icon"></i>
|
||||
<span class="option-text"><?= __('rate_staff') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<a href="service_rating.php<?= $branch_query ?>" class="option-btn">
|
||||
<i class="bi bi-stars option-icon"></i>
|
||||
<span class="option-text"><?= __('rate_services') ?></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<span>© <?= date('Y') ?> <?= htmlspecialchars($company_name) ?>. <?= __('all_rights_reserved') ?></span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
38
ratings.php
38
ratings.php
@ -2,6 +2,18 @@
|
||||
$title = 'ratings';
|
||||
require_once __DIR__ . '/includes/header.php';
|
||||
|
||||
$success_msg = '';
|
||||
$error_msg = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'clear_ratings') {
|
||||
$stmt = db()->prepare("DELETE FROM ratings");
|
||||
if ($stmt->execute()) {
|
||||
$success_msg = __('ratings_cleared');
|
||||
} else {
|
||||
$error_msg = __('error_clearing_ratings');
|
||||
}
|
||||
}
|
||||
|
||||
$from_date = $_GET['from_date'] ?? date('Y-m-01');
|
||||
$to_date = $_GET['to_date'] ?? date('Y-m-t');
|
||||
$type_filter = $_GET['type'] ?? 'all';
|
||||
@ -40,13 +52,31 @@ $ratings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
?>
|
||||
|
||||
<div class="container-fluid py-4">
|
||||
<?php if ($success_msg): ?>
|
||||
<div class="alert alert-success alert-dismissible fade show" role="alert">
|
||||
<?= htmlspecialchars($success_msg) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($error_msg): ?>
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
<?= htmlspecialchars($error_msg) ?>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="row mb-4 align-items-center">
|
||||
<div class="col">
|
||||
<h1 class="h3 mb-0 text-gray-800"><?= __('ratings') ?></h1>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<a href="staff_rating.php" target="_blank" class="btn btn-sm btn-outline-primary"><i class="bi bi-box-arrow-up-right"></i> <?= __('staff_rating') ?> Page</a>
|
||||
<a href="service_rating.php" target="_blank" class="btn btn-sm btn-outline-primary"><i class="bi bi-box-arrow-up-right"></i> <?= __('service_rating') ?> Page</a>
|
||||
<a href="rate.php" target="_blank" class="btn btn-sm btn-outline-info"><i class="bi bi-box-arrow-up-right"></i> <?= __('rate_us') ?></a>
|
||||
<a href="staff_rating.php" target="_blank" class="btn btn-sm btn-outline-primary"><i class="bi bi-box-arrow-up-right"></i> <?= __('staff_rating') ?></a>
|
||||
<a href="service_rating.php" target="_blank" class="btn btn-sm btn-outline-primary"><i class="bi bi-box-arrow-up-right"></i> <?= __('service_rating') ?></a>
|
||||
<form method="POST" class="d-inline" onsubmit="return confirm('<?= __('confirm_clear_ratings') ?>');">
|
||||
<input type="hidden" name="action" value="clear_ratings">
|
||||
<button type="submit" class="btn btn-sm btn-danger ms-2"><i class="bi bi-trash"></i> <?= __('clear_ratings') ?></button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -133,7 +163,7 @@ $ratings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
<tbody>
|
||||
<?php if (empty($ratings)): ?>
|
||||
<tr>
|
||||
<td colspan="4" class="text-center text-muted"><?= __('no_data_available') ?></td>
|
||||
<td colspan="4" class="text-center text-muted"><?= __('no_data_available') ?? 'No data available' ?></td>
|
||||
</tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($ratings as $r): ?>
|
||||
@ -163,4 +193,4 @@ $ratings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
</div>
|
||||
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
<?php require_once __DIR__ . '/includes/footer.php'; ?>
|
||||
Loading…
x
Reference in New Issue
Block a user