<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            <div class="card shadow-sm">
                <div class="card-header bg-primary text-white">
                    <div class="d-flex justify-content-between align-items-center">
                        <h4 class="mb-0">
                            <i class="fas fa-copy mr-2"></i>Manage Copies for:
                            <span class="font-weight-bold"><?php echo e($book->name); ?></span>
                        </h4>
                        <a href="<?php echo e(route('books.index')); ?>" class="btn btn-light btn-sm">
                            <i class="fas fa-arrow-left mr-1"></i> Back to Books
                        </a>
                    </div>
                </div>

                <div class="card-body">
                    <?php if(session('success')): ?>
                        <div class="alert alert-success alert-dismissible fade show">
                            <i class="fas fa-check-circle mr-2"></i><?php echo e(session('success')); ?>

                            <button type="button" class="close" data-dismiss="alert">
                                <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                    <?php endif; ?>

                    <div class="mb-4 p-4 bg-light rounded">
                        <h5 class="text-primary mb-3">
                            <i class="fas fa-plus-circle mr-2"></i>Add New Copies
                        </h5>
                        <form action="<?php echo e(route('books.copies.store', $book->id)); ?>" method="POST" class="form-inline">
                            <?php echo csrf_field(); ?>
                            <div class="form-group mr-3 mb-2">
                                <label for="quantity" class="sr-only">Quantity</label>
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text bg-white">
                                            <i class="fas fa-copy text-primary"></i>
                                        </span>
                                    </div>
                                    <input type="number" name="quantity" id="quantity"
                                           class="form-control form-control-lg"
                                           placeholder="Number of copies" min="1" max="100" required>
                                </div>
                            </div>
                            <button type="submit" class="btn btn-primary mb-2">
                                <i class="fas fa-plus mr-1"></i> Add Copies
                            </button>
                        </form>
                        <small class="text-muted">Enter how many copies you want to add (1-100)</small>
                    </div>

                    <div class="table-responsive rounded">
                        <table class="table table-hover table-bordered">
                            <thead class="thead-dark">
                                <tr>
                                    <th class="text-center">ID</th>
                                    <th>Book ID</th>
                                    <th>Book Name</th>
                                    <th>Barcode</th>
                                    <th class="text-center">Status</th>
                                    <th class="text-center">Actions</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php $__currentLoopData = $copies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $copy): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="text-center"><?php echo e($copy->id); ?></td>
                                    <td><?php echo e($copy->book_id); ?></td>
                                    <td class="font-weight-bold"><?php echo e($copy->book->name); ?></td>
                                    <td>
    <span class="badge badge-light border text-dark">
        <i class="fas fa-barcode mr-1"></i><?php echo e($copy->barcode); ?>

    </span>
</td>
                                    <td class="text-center">
    <span class="badge badge-pill badge-<?php echo e($copy->status === 'available' ? 'success' : 'warning'); ?> text-dark">
        <?php echo e(ucfirst($copy->status)); ?>

    </span>
</td>

                                    <td class="text-center">
                                        <form action="<?php echo e(route('copies.destroy', $copy->id)); ?>" method="POST" class="d-inline">
                                            <?php echo csrf_field(); ?>
                                            <?php echo method_field('DELETE'); ?>
                                            <button type="submit" class="btn btn-sm btn-outline-danger"
                                                onclick="return confirm('Are you sure you want to delete this copy?')">
                                                <i class="far fa-trash-alt mr-1"></i> Delete
                                            </button>
                                        </form>
                                    </td>
                                </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>

                    <?php if($copies->isEmpty()): ?>
                        <div class="alert alert-info text-center mt-4">
                            <i class="fas fa-info-circle mr-2"></i> No copies found for this book.
                        </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('styles'); ?>
<style>
    .card {
        border: none;
        border-radius: 10px;
        overflow: hidden;
    }
    .card-header {
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    .table th {
        border-top: none;
    }
    .badge-border {
        border: 1px solid #dee2e6;
    }
    .form-control-lg {
        height: calc(2.5em + .75rem + 2px);
    }
    .table-hover tbody tr:hover {
        background-color: rgba(0,123,255,0.05);
    }
</style>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH C:\xampp\htdocs\library\resources\views/books/copies.blade.php ENDPATH**/ ?>