<?php $__env->startSection('content'); ?>
<div class="breadcrumbbar">
    <div class="row align-items-center">
        <div class="col-md-8 col-lg-8">
            <h4 class="page-title">Agents</h4>
            <div class="breadcrumb-list">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard')); ?>">Home</a></li>
                    <li class="breadcrumb-item"><a href="#">Master</a></li>
                    <li class="breadcrumb-item active" aria-current="page">Agents</li>
                </ol>
            </div>
        </div>
    </div>          
</div>
<div class="row">
    <div class="col-lg-4">
        <div class="card m-b-30">
            <div class="card-header">
                <h5 class="card-title mb-0">Add Agent</h5>
            </div>
            <div class="card-body">
                <form method="POST" action="<?php echo e(route('agents.store')); ?>">
                    <?php echo csrf_field(); ?>
                    <div class="mb-3">
                        <label class="form-label" for="name">Name</label>
                        <input class="form-control" id="name" name="name" placeholder="Agent Name" value="<?php echo e(old('name')); ?>" required>
                    </div>
                    <div class="mb-3">
                        <label class="form-label" for="country">Currency</label>
                        <select class="form-select" id="country" name="country">
                            <option value="">Select currency</option>
                            <?php $__currentLoopData = $currencies; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $currency): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <option value="<?php echo e($currency->code); ?>" <?php if(old('country') == $currency->code): echo 'selected'; endif; ?>>
                                    <?php echo e($currency->code); ?> - <?php echo e($currency->name); ?>

                                </option>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </select>
                    </div>
                    <button class="btn btn-primary" type="submit">Add Agent</button>
                </form>
            </div>
        </div>
    </div>

    <div class="col-lg-8">
        <div class="card m-b-30">
            <div class="card-header">
                <h5 class="card-title mb-0">Agents List</h5>
            </div>
            <div class="card-body">
                <div class="table-responsive">
                    <table class="table table-striped align-middle">
                        <thead>
                            <tr>
                                <th>Name</th>
                                <th>Currency</th>
                                <th>Created</th>
                                <th class="text-end">Actions</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php $__empty_1 = true; $__currentLoopData = $agents; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $agent): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                <tr>
                                    <td class="fw-semibold"><?php echo e($agent->name); ?></td>
                                    <td><?php echo e($agent->country ?? 'N/A'); ?></td>
                                    <td><?php echo e($agent->created_at->format('Y-m-d')); ?></td>
                                    <td class="text-end">
                                        <div class="btn-group">
                                            <a class="btn btn-outline-primary btn-sm" href="<?php echo e(route('agents.edit', $agent)); ?>">Edit</a>
                                            <form action="<?php echo e(route('agents.destroy', $agent)); ?>" method="POST" onsubmit="return confirm('Are you sure you want to delete this agent?');" style="display: inline-block;">
                                                <?php echo csrf_field(); ?>
                                                <?php echo method_field('DELETE'); ?>
                                                <button type="submit" class="btn btn-outline-danger btn-sm">Delete</button>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                <tr>
                                    <td class="text-muted text-center" colspan="4">No agents added yet.</td>
                                </tr>
                            <?php endif; ?>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH F:\christopher\currencychangerui\resources\views/agents/index.blade.php ENDPATH**/ ?>