This commit is contained in:
2025-01-23 20:02:06 +03:00
parent 485c11de5f
commit 08cdf44b67
16 changed files with 240 additions and 23 deletions

View File

@ -22,6 +22,7 @@
<link rel="stylesheet" href="<?= $resources ?>/css/style.css">
<link rel="stylesheet" href="<?= $resources ?>/css/tgApp.css">
<script src="https://telegram.org/js/telegram-web-app.js"></script>
<script src="https://unpkg.com/html5-qrcode" type="text/javascript"></script>
</head>
<body>

View File

@ -0,0 +1,23 @@
<?php
/**
* @var \kernel\app_modules\card\models\Card $card
*/
use kernel\helpers\Html;
?>
<div class="row">
<div class="col-12 m-1">
<?php
echo Html::img(src: "data:image/png;base64, " . \kernel\app_modules\card\services\CardFileService::createCardPNG($card, true));
?>
</div>
</div>
<div class="row">
<div class="col-12 m-1">
<a class="btn btn-primary" href="/miniapp/add_purchase">Добавить покупку</a>
</div>
</div>

View File

@ -0,0 +1,30 @@
<div id="tg_app">
</div>
<div id="scanner_box"></div>
<script>
function domReady(fn) {
if (
document.readyState === "complete" ||
document.readyState === "interactive"
) {
setTimeout(fn, 1000);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}
domReady(function () {
// If found you qr code
function onScanSuccess(decodeText, decodeResult) {
window.location.href = "/miniapp/card_action/" + decodeText;
}
let htmlscanner = new Html5QrcodeScanner(
"scanner_box",
{fps: 10, qrbox: {width: 250, height: 250}},
);
htmlscanner.render(onScanSuccess);
});
</script>