
<?php $__env->startSection('title','Lokasi Konser'); ?>

<?php $__env->startSection('content'); ?>

<div class="hero">

    <h1>📍 Lokasi Konser</h1>

    <p>
        Kelola venue dan lokasi event konser
    </p>

</div>

<div class="d-flex justify-content-between align-items-center mb-4">

    <div>
        <h2>🏟 Data Lokasi</h2>

        <p class="text-secondary">
            Semua lokasi yang digunakan oleh event
        </p>
    </div>

    <div>
        <a href="<?php echo e(route('lokasi.create')); ?>"
           class="btn btn-neon">

            + Tambah Lokasi

        </a>
    </div>

</div>

<div class="card-dark mb-3">
    <div class="card-body">
        <form method="GET" action="<?php echo e(route('lokasi.index')); ?>">
            <div class="d-flex gap-2 align-items-center flex-wrap">
                <input name="search" type="text" class="form-control-dark" placeholder="Cari lokasi atau alamat..." value="<?php echo e(request('search')); ?>" style="min-width:240px">
                <select name="perpage" class="form-control-dark" style="width:auto">
                    <option value="6" <?php echo e(request('perpage', 12) == 6 ? 'selected' : ''); ?>>6</option>
                    <option value="12" <?php echo e(request('perpage', 12) == 12 ? 'selected' : ''); ?>>12</option>
                    <option value="24" <?php echo e(request('perpage') == 24 ? 'selected' : ''); ?>>24</option>
                </select>
                <div class="ms-auto">
                    <button class="btn-primary-glow">Cari</button>
                    <a href="<?php echo e(route('lokasi.index')); ?>" class="btn btn-outline-light">Reset</a>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="row">

<?php $__empty_1 = true; $__currentLoopData = $lokasis; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $lokasi): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>

<?php

$totalEvent = $lokasi->events->count();

$totalTiket = 0;

$totalPendapatan = 0;

foreach($lokasi->events as $event){

    foreach($event->tikets as $tiket){

        $totalTiket +=
        $tiket->transaksis->sum('jumlah');

        $totalPendapatan +=
        $tiket->transaksis->sum('total_harga');
    }
}

?>

<div class="col-md-6 mb-4">

<div class="card-neon">

<h3>

<?php echo e($lokasi->nama_lokasi); ?>


</h3>

<p>

<strong>Alamat :</strong><br>

<?php echo e($lokasi->alamat); ?>


</p>

<p>

<strong>Kapasitas :</strong>

<?php echo e(number_format($lokasi->kapasitas)); ?> Orang

</p>

<hr>

<p>

🎫 Tiket Terjual :
<strong>

<?php echo e($totalTiket); ?>


</strong>

</p>

<p>

🎵 Total Event :
<strong>

<?php echo e($totalEvent); ?>


</strong>

</p>

<p>

💰 Pendapatan :
<strong>

Rp <?php echo e(number_format($totalPendapatan,0,',','.')); ?>


</strong>

</p>

<div class="d-flex gap-2">

<a href="<?php echo e(route('lokasi.show',$lokasi->id)); ?>"
   class="btn btn-info">

Detail

</a>

<a href="<?php echo e(route('lokasi.edit',$lokasi->id)); ?>"
   class="btn btn-warning">

Edit

</a>

<form action="<?php echo e(route('lokasi.destroy',$lokasi->id)); ?>"
      method="POST">

    <?php echo csrf_field(); ?>
    <?php echo method_field('DELETE'); ?>

    <button
        class="btn btn-danger"
        onclick="return confirm('Hapus lokasi?')">

        Hapus

    </button>

</form>

</div>

</div>

</div>

<?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>

<div class="col-12">

<div class="alert alert-warning">

Belum ada data lokasi.

</div>

</div>

<?php endif; ?>

</div>

<div class="d-flex justify-content-center mt-4"><?php echo e($lokasis->appends(request()->except('page'))->links()); ?></div>

<br>

<div class="card-neon">

<h3>

📊 Statistik Lokasi

</h3>

<br>

<div class="row">

<div class="col-md-3">

<div class="card bg-dark p-3">

<h5>Total Lokasi</h5>

<h1>

<?php echo e($lokasis->total()); ?>


</h1>

</div>

</div>

<div class="col-md-3">

<div class="card bg-dark p-3">

<h5>Total Event</h5>

<h1>

<?php echo e(\App\Models\Event::count()); ?>


</h1>

</div>

</div>

<div class="col-md-3">

<div class="card bg-dark p-3">

<h5>Tiket Terjual</h5>

<h1>

<?php echo e(\App\Models\Transaksi::sum('jumlah')); ?>


</h1>

</div>

</div>

<div class="col-md-3">

<div class="card bg-dark p-3">

<h5>Pendapatan</h5>

<h1>

Rp <?php echo e(number_format(\App\Models\Transaksi::sum('total_harga'),0,',','.')); ?>


</h1>

</div>

</div>

</div>

</div>

<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.app', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH D:\tugas pa asur\konser-ticket\resources\views/lokasi/index.blade.php ENDPATH**/ ?>