|
Server : LiteSpeed System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : elvh3918 ( 1528) PHP Version : 8.2.31 Disable Function : mail Directory : /home/elvh3918/public_html/pmm/storage/framework/views/ |
<?php $__env->startSection('title', $breadcrumbs[count($breadcrumbs) - 1]['name']); ?>
<?php $__env->startSection('content'); ?>
<?php echo $__env->make('components/breadcrumb', ['breadcrumbs' => $breadcrumbs], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<form action="<?php echo e(route('print.index')); ?>" method="GET">
<div class="row">
<div class="col-md-9 mb-2"></div>
<div class="col-md-3 mb-2">
<div class="d-flex flex-row">
<select class="form-control customer_idSelect2 mr-2" name="customer_id" id="customer_id">
</select>
<select class="form-control tenant_idSelect2" name="tenant_id" id="tenant_id" onchange="select_tenant_open_customer()">
<?php if(Auth::user()->model_type == 'App\Models\Bussiness'): ?>
<option value=0 <?php echo e($data_input['tenant_id'] == 0 ? "selected" : ""); ?>>All</option>
<?php endif; ?>
<?php $__currentLoopData = $tenant; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<option value="<?php echo e($data->id); ?>" <?php echo e($data_input['tenant_id'] == $data->id ? "selected" : ""); ?>><?php echo e($data->name); ?></option>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</select>
<button type="submit" class="ml-2 btn btn-primary" onclick='buttonSpin("btn_search", "spinner-border spinner-border-sm")'>
<i id="btn_search" class="fa fa-search"></i>
</button>
</div>
</div>
</div>
<div class="card card-solid">
<div class="card-body">
<table id="example1" class="table table-sm table-bordered">
<thead>
<tr>
<th class="text-center" hidden>ID</th>
<th class="text-center"></th>
<th class="text-center">Data</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $query; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td hidden>
<?php echo e($data->id); ?>
</td>
<td></td>
<td>
<div class="container my-2">
<div class="row">
<div class="col-3 mb-2">
<?php if(isset($data->image)): ?>
<?php if($data->image != null && file_exists(public_path('storage/' . config('app.dir_file_item') . '/' . $data->image))): ?>
<img src=<?php echo e(config('app.url') . '/storage/' . config('app.dir_file_item') . '/' . $data->image); ?> class="rounded">
<?php else: ?>
<img src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
<?php endif; ?>
<?php else: ?>
<img src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
<?php endif; ?>
</div>
<div class="col-9 mb-2">
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">custmr</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize">: <?php echo e($data->customer ? $data->customer->name : ''); ?></span>
</div>
</div>
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">code</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize">: <?php echo e($data->code); ?></span>
</div>
</div>
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">name</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize">: <?php echo e($data->name); ?></span>
</div>
</div>
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">address</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize">: <?php echo e($data->customer ? $data->customer->address : ''); ?></span>
</div>
</div>
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">descript.</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize">: <?php echo e($data->description); ?></span>
</div>
</div>
<div class="row">
<div class="col-3 border-bottom">
<span class="text-capitalize">status</span>
</div>
<div class="col-9 border-bottom">
<span class="text-capitalize <?php echo e($data->is_active == 1 ? "text-primary" : "text-danger"); ?>">: <?php echo e($data->is_active == 1 ? "active" : "non active"); ?></span>
</div>
</div>
</div>
</div>
<div class="row rounded" style="background-color: #F5F5F5;">
<div class="col-md-6 mb-2">
<div class="d-flex justify-content-md-start justify-content-center p-1">
<small class="text-muted text-capitalize mt-2">tenant: <?php echo e($data->customer ? $data->customer->tenant->name : ''); ?>, last updated: <?php echo e($data->created_at); ?></small>
</div>
</div>
<div class="col-md-6 mb-2">
<div class="d-flex justify-content-md-end justify-content-center p-1">
<button type="button" class="text-capitalize btn btn-dark btn-sm mt-2 mr-2" onclick="print(<?php echo e($data); ?>)"><i class="fa fa-print mr-2"></i>print</button>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<div class="p-2 card-footer d-print-none">
<div class="row">
<div class="col-md-6 mb-2">
<div class="d-flex justify-content-md-start justify-content-center text-muted" id="info_print">
Select the data to be printed
</div>
</div>
<div class="col-md-6 mb-2">
<div class="d-flex justify-content-md-end justify-content-center">
<button class="btn btn-primary" type="button" onclick='printAll()'>
<i class="fa fa-print"></i>
<span class="ml-2">Print</span>
</button>
</div>
</div>
</div>
</div>
</div>
</form>
</div><!--/. container-fluid -->
</section>
<!-- /.content -->
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-style'); ?>
<link rel="stylesheet" href="<?php echo e(asset('assets/plugins/datatables-bs4/css/dataTables.bootstrap4.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('assets/plugins/datatables-buttons/css/buttons.bootstrap4.css')); ?>">
<link rel="stylesheet" href="<?php echo e(asset('assets/plugins/datatables-buttons/css/buttons.bootstrap4.css')); ?>">
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script'); ?>
<script src="<?php echo e(asset('assets/plugins/datatables/dataTables.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables/dataTables.bootstrap4.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/dataTables.buttons.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.bootstrap4.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.print.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/jszip.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.html5.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/datatables-buttons/js/buttons.colVis.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/plugins/toastr/toastr.min.js')); ?>"></script>
<script src="<?php echo e(asset('assets/external/load-toastr.js')); ?>"></script>
<script src="<?php echo e(asset('assets/external/button-spin.js')); ?>"></script>
<script>
loadToastr(<?php echo json_encode(Session::get('message')); ?>);
select_tenant_open_customer();
let table = $("#example1").DataTable({
paging: true,
lengthChange: true,
searching: true,
ordering: true,
info: true,
autoWidth: false,
responsive: true,
pageLength: 100,
scrollY: true,
order: [[0, 'desc']],
columnDefs: [
{
data: 'id',
name: 'id',
targets: 0,
className: 'dt-body-left',
visible: false,
}
// ,
// {
// data: 'check',
// name: 'check',
// targets: 1,
// className: 'dt-body-center',
// orderable: false
// },
,
{
data: 'check',
name: 'check',
targets: 1,
// render: DataTable.render.select(),
// render: function ( data, type, row ) {
// if ( type === 'display' ) {
// return '<input type="checkbox" class="editor-active">';
// }
// return data;
// },
render: (data, type, row, meta) => `<input type="checkbox" colindex="${meta.col}" ${data ? 'checked' : ''} style="margin:5px" class="regularchckbx"></input>`,
className: 'dt-body-center',
orderable: false
},
{
data: 'data',
name: 'data',
targets: 2,
className: 'dt-body-left'
}
],
// select: {
// style: 'multi',
// selector: 'td:first-child',
// headerCheckbox: 'select-page'
// },
// select: {
// style: 'os',
// selector: 'td:first-child'
// },
buttons: [
'pageLength',
{
extend: 'collection',
text: 'Control',
buttons: [
'copy', 'excel', 'print',
{
text: 'Visibility',
popoverTitle: 'Control',
extend: 'colvis',
collectionLayout: 'two-column',
postfixButtons: ['colvisRestore']
}
]
}
],
layout: {
topStart: ['buttons']
}
});
let total = 0;
//essential part of the solution OP was looking for
const ifAllChecked = col => table.rows().nodes().toArray().every(row => $(row).find(`td:eq(${col}) [type="checkbox"]`).is(':checked'));
//put 'check all' checkboxes into header
$(table.columns([1]).header()).append(`<input type="checkbox" class="allchecked" style="margin:5px"></input>`);
//set initial header checkboxes state
[1].forEach( col => table.column(col).header().querySelector('[type="checkbox"]').checked = ifAllChecked(col));
//listen for changes and adjust 'check-alls'
$('#example1').on('click', '.regularchckbx', function(){
table.column($(this).attr('colindex')).header().querySelector('[type="checkbox"]').checked = ifAllChecked($(this).attr('colindex'));
total = table.$('input[type="checkbox"]:checked').length;
document.getElementById('info_print').innerHTML = total == 0 ? "Select the data to be printed" : total + " data selected for print";
});
//check/uncheck all
$('.allchecked').on('click', function(){
let col = table.column($(this).closest('th')).index();
let state = this.checked;
table.rows().every(function(){
this.node().querySelector(`[colindex="${col}"]`).checked = state;
});
total = table.$('input[type="checkbox"]:checked').length;
document.getElementById('info_print').innerHTML = total == 0 ? "Select the data to be printed" : total + " data selected for print";
});
function select_tenant_open_customer() {
document.getElementById('customer_id').innerHTML = "";
var id = document.getElementById('tenant_id').value;
id = id ? id : 0;
$.ajax({
dataType: 'json',
type: "GET",
url: '<?php echo e(env('APP_URL')); ?>' + "/api/global/select/tenant-open-customer/" + id,
success: function(res) {
var html ='<option value=0>All</option>';
if (res.length > 0) {
for (let index = 0; index < res.length; index++) {
var selected = <?php echo json_encode($data_input['customer_id']); ?>;
if (selected == res[index]['id']) {
selected = 'selected';
}
html +='<option value="' + res[index]['id'] + '" ' + selected + '>' + res[index]['name'] + '</option>';
}
}
document.getElementById('customer_id').innerHTML = html;
},
error: function(xhr, status, error) {
alert(error);
return;
}
});
}
function select_is_print(value) {
var chk = document.getElementsByClassName('is_view');
for (var i = 0; i < chk.length; i++) {
chk[i].checked = value;
}
}
function print(data) {
// console.log(data);
alert('on development');
}
function printAll() {
if (total == 0) {
alert("Select the data to be printed");
return;
} else {
// console.log("print all");
alert('on development');
}
}
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts/app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /home/elvh3918/public_html/pmm/resources/views/content/print/barcode.blade.php ENDPATH**/ ?>