<?php $this->layout('main', ['title' => __('Mount Points'), 'manual' => true]) ?>

<div class="card">
    <div class="card-header ch-alt">
        <h2><?=__('Mount Points') ?></h2>

        <a class="btn bgm-blue btn-float" role="button" title="<?=__('Add %s', __('Mount Point')) ?>" href="<?=$router->fromHere('stations:mounts:add') ?>">
            <span class="sr-only"><?=__('Add %s', __('Mount Point')) ?></span>
            <i class="zmdi zmdi-plus"></i>
        </a>
    </div>
    <div class="card-body card-padding p-b-0">
        <p><?=__('Mount points are how listeners connect and listen to your station. Each mount point can be a different audio format or quality. Using mount points, you can set up a high-quality stream for broadband listeners and a mobile stream for phone users.') ?></p>
    </div>
    <div class="table-responsive">
        <table class="table table-striped">
            <colgroup>
                <col width="25%">
                <col width="45%">
                <col width="30%">
            </colgroup>
            <thead>
            <tr>
                <th><?=__('Actions') ?></th>
                <th><?=__('Mount Point') ?></th>
                <th><?=__('AutoDJ') ?></th>
            </tr>
            </thead>
            <tbody>
            <?php foreach($mounts as $row): ?>
                <?php /** @var App\Entity\StationMount $row */ ?>
                <tr class="vertical-align-middle">
                    <td>
                        <a class="btn btn-sm btn-primary" href="<?=$router->named('stations:mounts:edit', ['station' => $station->getId(), 'id' => $row->getId()]) ?>"><?=__('Edit') ?></a>
                        <a class="btn btn-sm btn-danger" href="<?=$router->named('stations:mounts:delete', ['station' => $station->getId(), 'id' => $row->getId(), 'csrf' => $csrf]) ?>"><?=__('Delete') ?></a>
                    </td>
                    <td>
                    <?php if ($frontend_type === 'remote'): ?>
                        <big><a href="<?=$this->e($row->getRemoteUrl()) ?>" target="_blank"><?=$this->e($row->getRemoteUrl()) ?></a> # <?=$row->getRemoteMount() ?></big>
                    <?php else: ?>
                        <big><a href="<?=$this->e($frontend->getUrlForMount($row->getName())) ?>" target="_blank"><?=$this->e($row->getName()) ?></a></big>
                    <?php endif; ?>
                    <?php if ($row->getIsDefault()): ?>
                        <br><span class="label label-success"><?=__('Default Mount') ?></span>
                    <?php endif; ?>
                    </td>
                    <td>
                    <?php if ($row->getEnableAutodj()): ?>
                        <?=__('Enabled') ?> - <?=(int)$row->getAutodjBitrate() ?>kbps <?=strtoupper($this->e($row->getAutodjFormat())) ?>
                    <?php else: ?>
                        <?=__('Disabled') ?>
                    <?php endif; ?>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
</div>
