
<?php $__env->startSection('title'); ?>
<?php echo $variables['header_routes']; ?>

<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-12">
                <div class="card">
                    <div class="card-header">
                        <div class="row align-items-center">
                            <div class="col">
                                <h3 class="card-title mb-0"><?php echo e($variables['judul']); ?></h3>
                            </div>
                            <div class="col-auto">
                                <a href="<?php echo e(route('periods.edit', $data->id)); ?>" class="btn btn-sm btn-warning button-cek-permission" data-permission="periods.edit">
                                    <i class="fas fa-edit"></i> Ubah
                                </a>
                                <a href="<?php echo e(route('periods.index')); ?>" class="btn btn-sm btn-warning ml-2">
                                    <i class="fas fa-arrow-left"></i> Kembali ke Daftar
                                </a>
                            </div>
                        </div>
                    </div>
                    <div class="card-body">
                        <div class="row">
                            <!-- Single Card with All Information -->
                            <div class="col-12">
                                <div class="card card-outline card-warning">
                                    <div class="card-body">
                                        <div class="row">
                                            <!-- Code -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Kode</label>
                                                    <div class="mt-1">
                                                        <span class="badge badge-info"><?php echo e($data->code); ?></span>
                                                    </div>
                                                </div>
                                            </div>

                                            <!-- Name -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Nama</label>
                                                    <div class="mt-1"><?php echo e($data->name); ?></div>
                                                </div>
                                            </div>

                                            <!-- Status -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Status</label>
                                                    <div class="mt-1">
                                                        <span class="badge <?php echo e($data->status_badge); ?>"><?php echo e($data->status); ?></span>
                                                    </div>
                                                </div>
                                            </div>

                                            <!-- Created By -->
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Dibuat Oleh</label>
                                                    <div class="mt-1">
                                                        <small class="text-muted">
                                                            <?php echo e($data->creator->fullname ?? 'System'); ?><br>
                                                            <?php echo e($data->created_at->format('d M Y, H:i')); ?>

                                                        </small>
                                                    </div>
                                                </div>
                                            </div>

                                            <!-- Updated By -->
                                            <?php if($data->modificator): ?>
                                            <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Diubah Oleh</label>
                                                    <div class="mt-1">
                                                        <small class="text-muted">
                                                            <?php echo e($data->modificator->fullname); ?><br>
                                                            <?php echo e($data->updated_at->format('d M Y, H:i')); ?>

                                                        </small>
                                                    </div>
                                                </div>
                                            </div>
                                            <?php endif; ?>

                                            <!-- Description (Full Width) -->
                                            <?php if($data->description): ?>
                                            <div class="col-12 mb-3">
                                                <div class="form-group">
                                                    <label class="font-weight-bold">Deskripsi</label>
                                                    <div class="mt-1"><?php echo e($data->description); ?></div>
                                                </div>
                                            </div>
                                            <?php endif; ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <?php if($data->rawMaterials()->where('delete_flag', false)->count() > 0): ?>
                        <div class="row mt-3">
                            <div class="col-12">
                                <div class="card card-outline card-secondary">
                                    <div class="card-header">
                                        <h5 class="card-title mb-0">Item yang Menggunakan Periode Ini</h5>
                                    </div>
                                    <div class="card-body">
                                        <div class="table-responsive">
                                            <table class="table table-sm table-bordered">
                                                <thead class="bg-light">
                                                    <tr>
                                                        <th>Kode</th>
                                                        <th>Nama</th>
                                                        <th>Kategori</th>
                                                        <th>UOM</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php $__currentLoopData = $data->rawMaterials()->where('delete_flag', false)->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $material): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <tr>
                                                        <td><?php echo e($material->code); ?></td>
                                                        <td><?php echo e($material->name); ?></td>
                                                        <td><?php echo e($material->category); ?></td>
                                                        <td><?php echo e($material->uom); ?></td>
                                                    </tr>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts/base_view', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\LSM\resources\views/m-periods/show.blade.php ENDPATH**/ ?>