add qr to admin page
This commit is contained in:
parent
c441d54a7a
commit
0f040f6eca
@ -29,6 +29,7 @@ $translations = [
|
|||||||
'service_rating' => 'Service Rating',
|
'service_rating' => 'Service Rating',
|
||||||
'branch_links' => 'Branch Links',
|
'branch_links' => 'Branch Links',
|
||||||
'copy_link' => 'Copy Link',
|
'copy_link' => 'Copy Link',
|
||||||
|
'print_qr' => 'Print QR',
|
||||||
'link_copied' => 'Copied!',
|
'link_copied' => 'Copied!',
|
||||||
'rating' => 'Rating',
|
'rating' => 'Rating',
|
||||||
'comment' => 'Comment',
|
'comment' => 'Comment',
|
||||||
@ -306,6 +307,7 @@ $translations = [
|
|||||||
'service_rating' => 'تقييم الخدمة',
|
'service_rating' => 'تقييم الخدمة',
|
||||||
'branch_links' => 'روابط الفروع',
|
'branch_links' => 'روابط الفروع',
|
||||||
'copy_link' => 'نسخ الرابط',
|
'copy_link' => 'نسخ الرابط',
|
||||||
|
'print_qr' => 'طباعة QR',
|
||||||
'link_copied' => 'تم النسخ!',
|
'link_copied' => 'تم النسخ!',
|
||||||
'rating' => 'التقييم',
|
'rating' => 'التقييم',
|
||||||
'comment' => 'تعليق',
|
'comment' => 'تعليق',
|
||||||
|
|||||||
55
ratings.php
55
ratings.php
@ -243,9 +243,14 @@ $ratings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
<h6 class="mb-1 fw-bold"><?= htmlspecialchars($br_name) ?></h6>
|
<h6 class="mb-1 fw-bold"><?= htmlspecialchars($br_name) ?></h6>
|
||||||
<a href="<?= htmlspecialchars($br_link) ?>" target="_blank" class="text-decoration-none small text-primary"><?= htmlspecialchars($br_link) ?></a>
|
<a href="<?= htmlspecialchars($br_link) ?>" target="_blank" class="text-decoration-none small text-primary"><?= htmlspecialchars($br_link) ?></a>
|
||||||
</div>
|
</div>
|
||||||
<button class="btn btn-sm btn-outline-secondary text-nowrap" onclick="copyToClipboard('<?= $br_link ?>', this)">
|
<div class="text-nowrap">
|
||||||
<i class="bi bi-clipboard"></i> <span class="d-none d-sm-inline"><?= __('copy_link') ?? 'Copy Link' ?></span>
|
<button class="btn btn-sm btn-outline-secondary me-2" onclick="copyToClipboard('<?= $br_link ?>', this)">
|
||||||
</button>
|
<i class="bi bi-clipboard"></i> <span class="d-none d-sm-inline"><?= __('copy_link') ?? 'Copy Link' ?></span>
|
||||||
|
</button>
|
||||||
|
<button class="btn btn-sm btn-outline-primary" onclick="printQR('<?= $br_link ?>', '<?= addslashes(htmlspecialchars($br_name)) ?>')">
|
||||||
|
<i class="bi bi-qr-code"></i> <span class="d-none d-sm-inline"><?= __('print_qr') ?? 'Print QR' ?></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@ -256,6 +261,50 @@ $ratings = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
function printQR(url, branchName) {
|
||||||
|
let printWindow = window.open('', '_blank', 'width=400,height=600');
|
||||||
|
printWindow.document.write(`
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Print QR - ${branchName}</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: sans-serif; text-align: center; padding: 50px; background: #fff; color: #000; }
|
||||||
|
h2 { margin-bottom: 5px; font-size: 24px; }
|
||||||
|
#qrcode { display: flex; justify-content: center; margin-top: 30px; }
|
||||||
|
#qrcode img { margin: 0 auto; }
|
||||||
|
.rate-text { font-size: 20px; font-weight: bold; margin-top: 20px; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h2>${branchName}</h2>
|
||||||
|
<div id="qrcode"></div>
|
||||||
|
<div class="rate-text">Rate Us / قيمنا</div>
|
||||||
|
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"><\/script>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
new QRCode(document.getElementById("qrcode"), {
|
||||||
|
text: "${url}",
|
||||||
|
width: 200,
|
||||||
|
height: 200,
|
||||||
|
colorDark : "#000000",
|
||||||
|
colorLight : "#ffffff",
|
||||||
|
correctLevel : QRCode.CorrectLevel.M
|
||||||
|
});
|
||||||
|
setTimeout(function() {
|
||||||
|
window.print();
|
||||||
|
window.close();
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
<\/script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
`);
|
||||||
|
printWindow.document.close();
|
||||||
|
}
|
||||||
|
|
||||||
function copyToClipboard(text, btn) {
|
function copyToClipboard(text, btn) {
|
||||||
if (navigator.clipboard) {
|
if (navigator.clipboard) {
|
||||||
navigator.clipboard.writeText(text).then(function() {
|
navigator.clipboard.writeText(text).then(function() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user