|
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/tenant/storage/framework/views/ |
<?php $__env->startSection('content-modal-item'); ?>
<div class="modal fade" id="modal_item">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">item</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<table id="tbl_modal_item" class="table table-sm table-bordered table-striped">
<thead>
<tr>
<th class="text-center">Photo</th>
<th class="text-center">Type</th>
<th class="text-center">Code</th>
<th class="text-center">Name</th>
<th class="text-center">Description</th>
<th class="text-center">Active</th>
<th class="text-center">Updated</th>
<th class="text-center d-print-none">#</th>
</tr>
</thead>
<tbody>
<?php $__currentLoopData = $item; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
<tr>
<td>
<?php if(isset($data->photo)): ?>
<?php if($data->photo != null && file_exists(public_path('storage/' . config('app.dir_file_items') . '/' . $data->photo))): ?>
<img width="50" height="50" src=<?php echo e(config('app.url') . '/storage/' . config('app.dir_file_items') . '/' . $data->photo); ?> class="rounded">
<?php else: ?>
<img width="50" height="50" src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
<?php endif; ?>
<?php else: ?>
<img width="50" height="50" src=<?php echo e(asset(config('app.img_not_found'))); ?> class="rounded">
<?php endif; ?>
</td>
<td>
<?php echo e($data->type); ?>
</td>
<td>
<?php echo e($data->code); ?>
</td>
<td>
<?php echo e($data->name); ?>
</td>
<td>
<?php echo e($data->description); ?>
</td>
<td>
<input type="checkbox" <?php echo e($data->is_active == 1 ? 'checked' : ''); ?> disabled />
</td>
<td>
<?php echo e($data->updated_at); ?>
</td>
<td class="d-print-none">
<a href="#" onclick='selectModalItem(<?php echo e($data); ?>)'><span class="badge bg-warning p-1"><i class="fa fa-arrow-right mr-1"></i>Select</span></a>
</td>
</tr>
<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
</tbody>
</table>
</div>
<div class="modal-footer d-flex justify-content-start justify-content-md-end d-print-none">
<button type="button" class="btn btn-warning" data-dismiss="modal" onclick='selectModalItemAll(<?php echo e($item); ?>)'><i class="fa fa-arrow-right mr-1"></i>Select All</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('page-script-modal-item'); ?>
<script>
new DataTable('#tbl_modal_item', {
order: [[1, 'asc']],
columns: [
{
data: 'photo',
name: 'photo',
targets: 0,
className: 'dt-body-center'
},
{
data: 'type',
name: 'type',
targets: 1,
className: 'dt-body-left'
},
{
data: 'code',
name: 'code',
targets: 2,
className: 'dt-body-left'
},
{
data: 'name',
name: 'name',
targets: 3,
className: 'dt-body-left'
},
{
data: 'description',
name: 'description',
targets: 4,
className: 'dt-body-left'
},
{
data: 'is_active',
name: 'is_active',
targets: 5,
className: 'dt-body-center'
},
{
data: 'updated_at',
name: 'updated_at',
targets: 6,
className: 'dt-body-left',
width: 150,
},
{
data: 'action',
name: 'action',
targets: 7,
className: 'dt-body-center',
width: 150,
orderable: false,
}
]
});
function selectModalItemAll(data) {
if (formType == 'create') {
document.getElementById("tbody-item").innerHTML = "";
for (let index = 0; index < data.length; index++) {
selectModalItem(data[index], true);
}
} else if (formType == 'edit') {
alert('This action is not available in edit mode!');
return;
}
}
function selectModalItem(data, all = false) {
var type = 'item';
if (formType == 'create') {
if (dataExists_ByClassname_FromTable(type, type + '_id', data.id, 'rowCount' + type) == true) {
alert('Data already exists!');
return;
}
var html="";
var total_element = $(".rowCount" + type).length;
if (total_element == 0) {
document.getElementById("tbody-" + type).innerHTML = "";
}
var total_element = $(".rowCount" + type).length;
var rows = 1;
if (total_element > 0) {
var lastid = $(".rowCount" + type + ":last").attr("id");
var split_id = lastid.split("_");
rows = Number(split_id[1]) + 1;
}
html="";
html +='<tr class="rowCount' + type + '" id="rowCount' + type + '_' + rows + '">';
html +='<td>';
html +='<input type="hidden" class="form-control" id="' + type + '[' + rows + '][item_id]" name="' + type + '[' + rows + '][item_id]" value=' + data.id + ' />';
html +=data.type;
html +='</td>';
html +='<td>' + data.name + '</td>';
html +='<td>';
html +='<input type="number" step="any" class="form-control" id="' + type + '[' + rows + '][price]" name="' + type + '[' + rows + '][price]" value="0" style="text-align: right;" />';
html +='</td>';
html +='<td class="text-center"><a href="#" onclick="removeSelectitem(`' + type + '`, ' + rows + ')"><span class="text-danger"><i class="fa fa-trash"></i></span></a></td>';
html +='</tr>';
$("#tbody-" + type).append(html);
} else if (formType == 'edit') {
document.getElementById("item_id").value = data.id;
document.getElementById("item_name").value = data.name;
}
if (!all) {
$('#modal_item').modal('hide');
}
}
function removeSelectitem(type, rows) {
if (document.getElementById("rowCount" + type + "_" + rows)) {
document.getElementById("rowCount" + type + "_" + rows).remove();
}
var total_element = $(".rowCount" + type).length;
if (total_element == 0) {
resetTableDetail(type);
}
}
function fill_data_detail_item() {
var data;
var type = 'item';
if ($i_detail_item) {
data = $i_detail_item;
Object.keys(data).forEach(key => {
var items = <?php echo json_encode($item); ?>;
for (let index = 0; index < items.length; index++) {
if (items[index]['id'] == data[key]['item_id']) {
selectModalItem(items[index], true);
var rows = 1;
var lastid = $(".rowCount" + type + ":last").attr("id");
var split_id = lastid.split("_");
rows = Number(split_id[1]);
document.getElementById(type + '[' + rows + '][price]').value = data[key]['price'];
break;
}
}
});
}
}
</script>
<?php $__env->stopSection(); ?><?php /**PATH /home/elvh3918/public_html/tenant/resources/views/content/trans/price/partials/modal/item.blade.php ENDPATH**/ ?>