<?php $attributes ??= new \Illuminate\View\ComponentAttributeBag;

$__newAttributes = [];
$__propNames = \Illuminate\View\ComponentAttributeBag::extractPropNames(([
    'linha',
    'itinerario',
    'corLinha' => '#21409a',
]));

foreach ($attributes->all() as $__key => $__value) {
    if (in_array($__key, $__propNames)) {
        $$__key = $$__key ?? $__value;
    } else {
        $__newAttributes[$__key] = $__value;
    }
}

$attributes = new \Illuminate\View\ComponentAttributeBag($__newAttributes);

unset($__propNames);
unset($__newAttributes);

foreach (array_filter(([
    'linha',
    'itinerario',
    'corLinha' => '#21409a',
]), 'is_string', ARRAY_FILTER_USE_KEY) as $__key => $__value) {
    $$__key = $$__key ?? $__value;
}

$__defined_vars = get_defined_vars();

foreach ($attributes->all() as $__key => $__value) {
    if (array_key_exists($__key, $__defined_vars)) unset($$__key);
}

unset($__defined_vars, $__key, $__value); ?>

<?php
    $sentidos = $itinerario['sentidos'] ?? [];
    $routeId = $itinerario['route_id'] ?? null;
?>

<article class="ma-itinerario mt-4" id="ma-itinerario-detalhe"
    data-linha-codigo="<?php echo e($linha->codigo); ?>"
    data-route-id="<?php echo e($routeId); ?>">

    <header class="ma-itinerario__header">
        <div class="ma-itinerario__line-badge" style="background-color: <?php echo e($corLinha); ?>">
            <?php echo e($linha->codigo); ?>

        </div>
        <div>
            <h2 class="ma-itinerario__line-title"><?php echo e($linha->nome_completo ?? $linha->nome); ?></h2>
            <p class="ma-itinerario__line-subtitle mb-0"><?php echo e(__('Informações e trajeto da linha')); ?></p>
        </div>
        <button type="button" class="btn btn-outline-primary btn-sm ma-itinerario__fav-btn ms-auto"
            id="ma-itinerario-favoritar"
            title="<?php echo e(__('Adicionar aos favoritos')); ?>"
            aria-label="<?php echo e(__('Adicionar aos favoritos')); ?>">
            <i class="fa-regular fa-star" aria-hidden="true"></i>
        </button>
    </header>

    <div class="ma-itinerario__body">
        <section class="ma-itinerario__section" aria-labelledby="ma-sobre-title">
            <h3 id="ma-sobre-title" class="ma-itinerario__section-title">
                <i class="fa-solid fa-circle-info me-1" aria-hidden="true"></i>
                <?php echo e(__('Sobre a linha')); ?>

            </h3>
            <dl class="row ma-itinerario__meta mb-0">
                <dt class="col-sm-4"><?php echo e(__('Tipo de linha')); ?></dt>
                <dd class="col-sm-8"><?php echo e(__('Convencional')); ?></dd>

                <dt class="col-sm-4"><?php echo e(__('Dias de operação')); ?></dt>
                <dd class="col-sm-8"><?php echo e(__('Todos os dias')); ?></dd>

                <?php if($linha->tarifa): ?>
                    <dt class="col-sm-4"><?php echo e(__('Tarifa')); ?></dt>
                    <dd class="col-sm-8">R$ <?php echo e(number_format((float) $linha->tarifa, 2, ',', '.')); ?></dd>
                <?php endif; ?>

                <?php if($linha->tarifa_cidadao): ?>
                    <dt class="col-sm-4"><?php echo e(__('Tarifa Passageiro Cidadão')); ?></dt>
                    <dd class="col-sm-8">R$ <?php echo e(number_format((float) $linha->tarifa_cidadao, 2, ',', '.')); ?></dd>
                <?php endif; ?>
            </dl>
        </section>

        <section class="ma-itinerario__section" aria-labelledby="ma-itinerario-title">
            <h3 id="ma-itinerario-title" class="ma-itinerario__section-title">
                <i class="fa-solid fa-route me-1" aria-hidden="true"></i>
                <?php echo e(__('Itinerário')); ?>

            </h3>

            <?php if(empty($sentidos)): ?>
                <p class="text-muted mb-0"><?php echo e(__('Itinerário indisponível para esta linha no momento.')); ?></p>
            <?php else: ?>
                <?php $__currentLoopData = $sentidos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $sentido): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <div class="ma-itinerario__sentido-block">
                        <?php if(count($sentidos) > 1): ?>
                            <h4 class="ma-itinerario__sentido-label"><?php echo e($sentido['label']); ?></h4>
                        <?php endif; ?>
                        <ol class="ma-itinerario__stops-list">
                            <?php $__currentLoopData = $sentido['paradas']; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $paradaIdx => $parada): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <li class="<?php echo \Illuminate\Support\Arr::toCssClasses([
                                    'ma-itinerario__stop',
                                    'ma-itinerario__stop--first' => $paradaIdx === 0,
                                    'ma-itinerario__stop--last' => $paradaIdx === count($sentido['paradas']) - 1,
                                ]); ?>">
                                    <span class="ma-itinerario__stop-marker" aria-hidden="true"></span>
                                    <span class="ma-itinerario__stop-name"><?php echo e($parada['nome']); ?></span>
                                </li>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                        </ol>
                    </div>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            <?php endif; ?>
        </section>

        <div class="d-flex flex-wrap gap-2 ma-itinerario__actions">
            <a href="<?php echo e(route('mobiangra.horarios', ['linha' => $linha->codigo])); ?>" class="btn btn-outline-primary btn-sm">
                <i class="fa-solid fa-clock me-1" aria-hidden="true"></i><?php echo e(__('Ver horários')); ?>

            </a>
            <a href="<?php echo e(route('mobiangra.mapa')); ?>" class="btn btn-primary btn-sm">
                <i class="fa-solid fa-map-location-dot me-1" aria-hidden="true"></i><?php echo e(__('Ver trajeto completo no mapa')); ?>

            </a>
        </div>
    </div>

    <div class="ma-itinerario__save-card mt-4">
        <div>
            <strong><?php echo e(__('Salve esta linha')); ?></strong>
            <p class="mb-0 small text-muted"><?php echo e(__('Adicione aos favoritos para acessar rapidamente no mapa.')); ?></p>
        </div>
        <button type="button" class="btn btn-primary btn-sm" id="ma-itinerario-favoritar-card">
            <i class="fa-regular fa-star me-1" aria-hidden="true"></i><?php echo e(__('Adicionar aos favoritos')); ?>

        </button>
    </div>
</article>
<?php /**PATH /var/www/html/portal/resources/views/components/mobiangra/itinerario-linha.blade.php ENDPATH**/ ?>