<?php $__env->startSection('title', 'Mesin'); ?>
<?php $__env->startSection('active13', 'active'); ?>
<?php $__env->startSection('menu1', 'open'); ?>
<?php $__env->startSection('content'); ?>

    <style>
        table td {
            font-size: 14px;
        }
    </style>

    <div class="content-wrapper">
        <div class="container-xxl flex-grow-1 container-p-y">

            <!-- Invoice List Table -->
            <div class="card">
                <div class="header-menu d-flex justify-content-between align-items-center">
                    <h4 class="card-header">Data Mesin</h4>
                    <button type="button" class="btn btn-primary me-2" data-bs-toggle="modal"
                        data-bs-target="#staticBackdrop"><i class="bx bx-plus bx-sm"></i> Add</button>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover" id="Mytable">
                        <thead class="table-primary text-center">
                            <tr>
                                <th scope="col">Laundry</th>
                                <th scope="col">Nomor Mesin</th>
                                <th scope="col">Nama Mesin</th>
                                <th scope="col">Ketersediaan</th>
                                <th scope="col">Status</th>
                                <th scope="col">Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__currentLoopData = $data; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $data): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td><?php echo e($data->laundry->nama_laundry); ?></td>
                                    <td><?php echo e($data->no_mesin); ?></td>
                                    <td><?php echo e($data->nama_mesin); ?></td>
                                    <td>
                                        <?php if($data->is_use == '0'): ?>
                                            <span class="badge bg-warning me-1">Tersedia</span>
                                        <?php else: ?>
                                            <span class="badge bg-danger me-1">Sedang Digunakan</span>
                                        <?php endif; ?>

                                    </td>
                                    <td>
                                        <?php if($data->is_active == '1'): ?>
                                            <span class="badge bg-label-success me-1">Aktif</span>
                                        <?php elseif($data->status == 'trial'): ?>
                                            <span class="badge bg-label-danger me-1">Tidak Aktif</span>
                                        <?php endif; ?>
                                    </td>
                                    <td><a href="<?php echo e(route('mesin.edit', $data->id)); ?>"
                                            class="btn btn-sm btn-label-secondary"> <i class="bx bx-edit-alt"></i></a>
                                    </td>

                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </tbody>
                    </table>
                </div>

            </div>
            <!-- Modal -->
            <div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1"
                aria-labelledby="staticBackdropLabel" aria-hidden="true">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content ">
                        <div class="modal-header">
                            <h5 class="modal-title" id="staticBackdropLabel">Tambah Data</h5>
                            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                        </div>
                        <div class="modal-body">
                            <form action="<?php echo e(route('mesin.store')); ?>" method="POST" enctype="multipart/form-data">
                                <?php echo csrf_field(); ?>
                                <div class="row">
                                    <!-- Kolom Kiri -->
                                    <div class="col-md-12">
                                        <?php if(Auth::user()->role == 'admin' || Auth::user()->role == 'superadmin' || Auth::user()->role == 'kepala_toko'): ?>
                                            <div class="mb-3">
                                                <label for="users_id" class="form-label">Pilih Laundry</label>
                                                <select id="pelanggan" name="laundry_id" class="form-select form-control-sm"
                                                    required>
                                                    <?php $__currentLoopData = $laundry; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $Laundry): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                        <option value="<?php echo e($Laundry->id); ?>"><?php echo e($Laundry->id); ?> -
                                                            <?php echo e($Laundry->nama_laundry); ?></option>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                </select>
                                            </div>
                                        <?php else: ?>
                                            <div class="mb-3">
                                                <label for="users_id" class="form-label">Pilih laundry</label>
                                                <input type="text" class="form-control"
                                                    value="<?php echo e($laundry->laundry_id); ?> - <?php echo e($laundry->laundry->nama_laundry); ?>"
                                                    readonly>
                                                <input type="text" class="form-control" id="users_id" name="laundry_id"
                                                    value="<?php echo e($laundry->laundry_id); ?>" hidden>
                                            </div>
                                        <?php endif; ?>
                                        <div class="mb-3">
                                            <label for="nama_parfum" class="form-label">Kode/Nomor Mesin</label>
                                            <input type="text" class="form-control" id="no_mesin" name="no_mesin"
                                                placeholder="Masukkan Keterangan Wangi" required>
                                        </div>
                                        <div class="mb-3">
                                            <label for="nama_parfum" class="form-label">Nama Mesin</label>
                                            <input type="text" class="form-control" id="nama_mesin" name="nama_mesin"
                                                placeholder="Masukkan Nama Mesin" required>
                                        </div>
                                    </div>
                                </div>

                        </div>

                        <div class="modal-footer">
                            
                            <button type="submit" class="btn btn-primary">Simpan</button>
                        </div>
                        </form>
                    </div>
                </div>
            </div>
        <?php $__env->stopSection(); ?>

<?php echo $__env->make('component.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp_2\htdocs\Laundry\resources\views/mesin/index.blade.php ENDPATH**/ ?>