

<?php $__env->startSection('content'); ?>
<div class="container">
    <div class="container-header">
        <h1><?php echo e($title); ?></h1>
    </div>

    <div class="card mb-25">
        <div class="card-body">
            <form action="<?php echo e(route('backend.custom-prices.store')); ?>" method="post">
                <?php echo csrf_field(); ?>
                <div class="row">
                    <div class="form-group width-50">
                        <label class="form-label">User<span class="required">*</span></label>
                        <select class="form-control" name="user_id" required>
                            <option value="">Select user</option>
                            <?php $__currentLoopData = \App\Models\User::orderBy('email')->get(); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $u): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <option value="<?php echo e($u->id); ?>"><?php echo e($u->email); ?></option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <div class="form-group width-50">
                        <label class="form-label">Service ID<span class="required">*</span></label>
                        <input type="text" class="form-control" name="service_id" placeholder="e.g. wa" required>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group width-50">
                        <label class="form-label">Server ID<span class="required">*</span></label>
                        <input type="text" class="form-control" name="server_id" placeholder="e.g. 1" required>
                    </div>
                    <div class="form-group width-50">
                        <label class="form-label">Type<span class="required">*</span></label>
                        <select class="form-control" name="type">
                            <option value="flat">Flat price</option>
                            <option value="percent">Discount %</option>
                        </select>
                    </div>
                </div>
                <div class="row">
                    <div class="form-group width-50">
                        <label class="form-label">Value (flat amount or %)<span class="required">*</span></label>
                        <input type="number" step="0.01" class="form-control" name="discount" placeholder="0" required>
                    </div>
                </div>
                <button type="submit" class="btn btn-primary">Add custom price</button>
            </form>
        </div>
    </div>

    <div class="card table-card">
        <div class="table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>User</th>
                        <th>Service ID</th>
                        <th>Server ID</th>
                        <th>Type</th>
                        <th>Value</th>
                        <th>Action</th>
                    </tr>
                </thead>
                <tbody>
                    <?php $__empty_1 = true; $__currentLoopData = $customPrices; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $cp): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                    <tr>
                        <td><?php echo e($loop->iteration); ?></td>
                        <td><?php echo e($cp->user->email ?? $cp->user_id); ?></td>
                        <td><?php echo e($cp->service_id); ?></td>
                        <td><?php echo e($cp->server_id); ?></td>
                        <td><?php echo e($cp->type); ?></td>
                        <td><?php echo e($cp->discount); ?></td>
                        <td>
                            <form action="<?php echo e(route('backend.custom-prices.destroy', $cp->id)); ?>" method="post" class="d-inline" onsubmit="return confirm('Remove?');">
                                <?php echo csrf_field(); ?>
                                <?php echo method_field('DELETE'); ?>
                                <button type="submit" class="table-btn"><i class="las la-trash"></i></button>
                            </form>
                        </td>
                    </tr>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                    <tr><td colspan="7" class="text-center">No custom prices yet.</td></tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('backend.layout.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH C:\Users\HP\Desktop\nbverify\mine\resources\views/backend/custom-prices/index.blade.php ENDPATH**/ ?>