You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
5.3 KiB
PHTML
155 lines
5.3 KiB
PHTML
@extends('temp.admin')
|
|
@php
|
|
use NN\Module\DB;
|
|
@endphp
|
|
@section("content")
|
|
|
|
<div class="content-header row">
|
|
<div class="content-header-left col-md-6 col-12 mb-2 breadcrumb-new">
|
|
<h3 class="content-header-title mb-0 d-inline-block">Module</h3>
|
|
<div class="row breadcrumbs-top d-inline-block">
|
|
<div class="breadcrumb-wrapper col-12">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item active">Print Direct</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="content-header-right col-md-6 col-12">
|
|
<div class="btn-group float-md-right">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="content-body">
|
|
<section id="dasbor">
|
|
<div class="row">
|
|
<div class="col-md-12 col-sm-12">
|
|
<div class="card border-top-3 border-top-vds">
|
|
<div class="card-header bg-primary white">
|
|
<h4 class="card-title text-white">Setup</h4>
|
|
</div>
|
|
<div class="card-content collapse show">
|
|
<div class="card-body">
|
|
<div style="display:grid;grid-template-columns: auto 100px">
|
|
<div>Allow direct print</div>
|
|
<div>
|
|
<label for="allowprint" class="toggle-switchy">
|
|
<input id="allowprint" type="checkbox">
|
|
<span class="toggle">
|
|
<span class="switch"></span>
|
|
</span>
|
|
</label>
|
|
</div>
|
|
<div class="mt-1">Pilih printer untuk struk</div>
|
|
<div>
|
|
<div class="mt-1">
|
|
<button onclick="window.changeprinter()" class="btn btn-primary btn-sm"><span id="printer">Not Change</span></button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
|
|
<div class="modal" id="choseprinter" tabindex="-1" role="dialog">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Daftar Printer</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body" id="listprinter">
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@endsection
|
|
|
|
@section('script')
|
|
<script>
|
|
|
|
const _listPrinter = _id('listprinter');
|
|
const _activePrinter = _id('printer');
|
|
|
|
Array.from(document.querySelectorAll('.numrp')).forEach(function(t){
|
|
t.innerHTML = t.innerHTML.number(2).currency(0);
|
|
});
|
|
|
|
window.changeprinter = function(){
|
|
qz.printers.find().then(function(data) {
|
|
var list = [];
|
|
for(var i = 0; i < data.length; i++) {
|
|
list.push(data[i]);
|
|
}
|
|
console.log(list);
|
|
$("#choseprinter").modal('show');
|
|
_listPrinter.innerHTML = '';
|
|
list.forEach(function(q){
|
|
_listPrinter.appendChild(
|
|
el('div')
|
|
.css({
|
|
cursor:'pointer',
|
|
borderBottom:'1px solid #ddd',
|
|
})
|
|
.addModule('kode', q)
|
|
.text('printer : ' + q)
|
|
.click(function(e){
|
|
var kode = e.target.kode;
|
|
_App.posprint(kode);
|
|
$("#choseprinter").modal('toggle');
|
|
})
|
|
.get()
|
|
)
|
|
})
|
|
}).catch(function(err){
|
|
console.log(err);
|
|
});
|
|
return true;
|
|
};
|
|
|
|
setTimeout(() => {
|
|
if(localStorage.getItem('active-print-direct') === "true"){
|
|
_id('allowprint').checked = true;
|
|
console.log('ok');
|
|
if (_App.qzStatus() === true) {
|
|
console.log('run');
|
|
}else{
|
|
launchQZ();
|
|
}
|
|
};
|
|
}, 100);
|
|
|
|
|
|
_id('allowprint').addEventListener('change', function(){
|
|
if(this.checked === true){
|
|
if (_App.qzStatus() === true) {
|
|
Swal('info', 'AQz Tray activated', 'info');
|
|
}else{
|
|
Swal('Warning', 'AQz Tray deactive, please run app', 'warning');
|
|
}
|
|
_App.QZprinter(true)
|
|
}else{
|
|
localStorage.setItem('active-print-direct', false);
|
|
_App.QZprinter(false)
|
|
};
|
|
},false);
|
|
|
|
setInterval(() => {
|
|
var printer = _App.posprintget();
|
|
if(printer === 'undefined'){
|
|
printer = 'No Changer';
|
|
}
|
|
_activePrinter.innerHTML = printer;
|
|
}, 100);
|
|
|
|
</script>
|
|
@endsection |