<?php $__env->startSection('title', __('Editar recinto')); ?>

<?php $__env->startSection('content'); ?>
    <div class="d-sm-flex align-items-start justify-content-between rt-flex-gap-3 mb-4">
        <div>
            <nav aria-label="breadcrumb" class="mb-1">
                <ol class="breadcrumb bg-transparent p-0 mb-0" style="font-size:.82rem">
                    <li class="breadcrumb-item"><a href="<?php echo e(route('dashboard.venues.index')); ?>"><?php echo e(__('Recintos')); ?></a></li>
                    <li class="breadcrumb-item active"><?php echo e(__('Editar')); ?></li>
                </ol>
            </nav>
            <h1 class="h3 mb-0 text-gray-800 font-weight-bold"><?php echo e($venue->name); ?></h1>
            <p class="small text-muted mb-0">
                <?php echo e(__('Slug:')); ?> <code><?php echo e($venue->slug); ?></code>
                <?php if($venue->catalog_review_status === \App\Enums\CatalogReviewStatus::PendingReview): ?>
                    <span class="badge badge-warning ml-2"><?php echo e(__('En revisión')); ?></span>
                <?php else: ?>
                    <span class="badge badge-success ml-2"><?php echo e(__('Aprobada')); ?></span>
                <?php endif; ?>
            </p>
        </div>
        <div class="d-flex rt-flex-gap-2 flex-shrink-0">
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('delete', $venue)): ?>
                <?php if($venue->events_count === 0): ?>
                    <form action="<?php echo e(route('dashboard.venues.destroy', $venue)); ?>" method="post" class="d-inline"
                          onsubmit="return confirm(<?php echo json_encode(__('¿Eliminar este recinto?'), 15, 512) ?>);">
                        <?php echo csrf_field(); ?>
                        <?php echo method_field('DELETE'); ?>
                        <button type="submit" class="btn btn-sm btn-outline-danger"><?php echo e(__('Eliminar')); ?></button>
                    </form>
                <?php endif; ?>
            <?php endif; ?>
            <a href="<?php echo e(route('dashboard.venues.index')); ?>" class="btn btn-sm btn-outline-secondary"><?php echo e(__('Listado')); ?></a>
        </div>
    </div>

    <div class="card shadow-sm border-0">
        <div class="card-body">
            <form id="rt-venue-form" method="post" action="<?php echo e(route('dashboard.venues.update', $venue)); ?>" data-google-maps-key="<?php echo e(e($googleMapsKey)); ?>" data-google-maps-map-id="<?php echo e(e($googleMapsMapId ?? '')); ?>">
                <?php echo csrf_field(); ?>
                <?php echo method_field('PUT'); ?>
                <?php echo $__env->make('dashboard.venues._form', ['venue' => $venue, 'timezones' => $timezones, 'googleMapsKey' => $googleMapsKey], array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?>
                <button type="submit" class="btn rt-btn-cherry"><?php echo e(__('Guardar cambios')); ?></button>
            </form>
        </div>
    </div>
<?php $__env->stopSection(); ?>

<?php $__env->startPush('head'); ?>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/css/tom-select.bootstrap4.min.css">
<?php $__env->stopPush(); ?>

<?php $__env->startPush('scripts'); ?>
    <script src="https://cdn.jsdelivr.net/npm/tom-select@2.3.1/dist/js/tom-select.complete.min.js"></script>
    <script src="<?php echo e(asset('js/dashboard-venue-page-map.js')); ?>?v=4"></script>
    <script>
        document.addEventListener('DOMContentLoaded', function () {
            var tz = document.getElementById('timezone');
            if (tz && window.TomSelect) {
                new TomSelect(tz, { maxOptions: null, allowEmptyOption: false });
            }
            var country = document.getElementById('country');
            if (country && window.TomSelect) {
                new TomSelect(country, {
                    allowEmptyOption: true,
                    maxOptions: null,
                    placeholder: <?php echo json_encode(__('Buscar país o código ISO…'), 15, 512) ?>,
                });
            }
            var form = document.getElementById('rt-venue-form');
            var key = form && form.getAttribute('data-google-maps-key');
            if (key && window.rtVenuePageMapInit) {
                window.rtVenuePageMapInit({
                    apiKey: key,
                    mapId: form.getAttribute('data-google-maps-map-id') || '',
                });
            }
        });
    </script>
<?php $__env->stopPush(); ?>

<?php echo $__env->make('layouts.dashboard', array_diff_key(get_defined_vars(), ['__data' => 1, '__path' => 1]))->render(); ?><?php /**PATH /var/www/html/resources/views/dashboard/venues/edit.blade.php ENDPATH**/ ?>