bbone/application/modules/Asset/views/view_qr.php
2023-01-21 11:02:51 +05:30

56 lines
2.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- Large modal -->
<!-- <button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg" hidden>Large modal</button> -->
<!-- <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-hidden="true"> -->
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">QR Code</h4>
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body" id="DivIdToPrint">
<?php $my_key = 0 ?>
<?php foreach ($data as $key => $value) { ?>
<?php if (count($data) == 1 ) {
?> <img style="margin-top:10px;margin-left:35%;width: 30%;" src="<?php echo $value->qrcode_img ?>" alt="QR Code" />
<p style="text-align: center;color:black;"><?php echo $value->name ?>
<?php
break;
} ?>
<?php if ($key % 4 == 0 ) {
$my_key = $key + 3;
?> <div class="row"> <?php
} ?>
<div class="col">
<img style="width:120px" src="<?php echo $value->qrcode_img ?>" alt="QR Code" />
<p style="color:black;margin-left:10px;"><?php echo $value->name ?></p>
</div>
<?php if ($key == $my_key || $key == count($data) - 1) {
?> </div> <?php
} ?>
<?php } ?>
</div>
<div class="modal-footer">
<button type="button" onclick="printDiv();" class="btn btn-primary">Print</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
</div>
</div>
</div>
<!-- </div> -->
<script>
function printDiv()
{
var divToPrint=document.getElementById('DivIdToPrint');
var newWin=window.open('','Print-Window');
newWin.document.open();
newWin.document.write('<html><body onload="window.print()">'+divToPrint.innerHTML+'</body></html>');
newWin.document.close();
setTimeout(function(){newWin.close();},10);
}
</script>