<?php
$cd = $_view["frontendData"];
$post = $_view["post"];
/** @var \lim\_shared\models\wpPost $post */
?>

<div class="main-container">
    <section>
        
        <div class="article-wrapper header">
            <?php if ($cd["company"] ?? null) { ?>
                <div class="article-company"> <b><?= $cd["company"]; ?></b> </div>
            <?php } ?>
            <?php if ($cd["categories"] ?? null) { ?>
                <?= $_con->getRenderedView("magazine/categories.partial", $cd["categories"]); ?>
            <?php } ?>
            <h1 class="headline hero space-mb-sm space-mt-sm"><span class="underline pink"><?= $cd["title"];?></span></h1>
            <?php if (!empty($cd["subline"])) { ?>
            <p class="txt-big space-mb-md"><?= $cd["subline"]; ?></p>
            <?php } ?>
            <div class="row g-3">
                <div class="col">
                    <div class="row g-3 pt-3">
                        <div class="col-auto"><b><?= $cd["dateCreatedFull"]; ?></b></div>
                        <?php if (!empty($cd["author"])) { ?>
                            <div class="col-auto">
                                <div class="vertical-spacer lightgray h-100"></div>
                            </div>
                            <div class="col-auto"><b><?= $cd["author"]; ?></b></div>
                        <?php } ?>
                    </div>
                </div>
                <?php if ($cd["companyLink"] ?? null) { ?>
                <div class="col-auto ms-auto pt-1">
                    <a href="<?= $cd["companyLink"]; ?>" class="btn md d-none d-lg-inline-block btn-secondary ico left"><span class="icon"></span>zum Firmenprofil</a>
                    <a href="<?= $cd["companyLink"]; ?>" class="btn md d-inline-block d-lg-none btn-secondary round"><span class="icon"></span></a>
                </div>
                <?php } ?>
            </div>
        </div>
        <div class="article-wrapper picture space-py-sm">
            <div class="article-picture ar-442-295 mobile-w-100" data-lazybg="<?= $_view["post"]->getImageLink("header", 1135, 0, 80);?>"> </div>
            <?php if ($cd["imageCopyrights"]["header"] ?? null) { ?>
            <p class="txt-small opa-05"><?= $cd["imageCopyrights"]["header"]; ?></p>
            <?php } ?>
        </div>
        <div class="article-wrapper">
            <?= $cd["content"]; ?>
            <?php if ($cd["companyLink"] ?? null) { ?>
            <a href="<?= $cd["companyLink"]; ?>" class="btn md btn-secondary ico left mt-4"><span class="icon"></span>zum Firmenprofil</a>
            <?php } ?>
        </div>
    </section>
    <?php
    $images = $post->getImages("slider");
    if ($images) { ?>
    <section>
        <div class="slider-expand">
            <div class="slider-container"> 
                <?php foreach ($images as $image) { ?>
                <div class="col-xl-3 col-lg-6">
                    <img src="<?= $post->getImagesLink($image, "slider", height: 480); ?>" class="img-fluid" loading="lazy">
                    <?php if ($cd["imageCopyrights"][$image] ?? null) { ?>
                       <p class="txt-small opa-05"> <?= $cd["imageCopyrights"][$image]; ?></p>
                    <?php } ?>
                </div>
                <?php } ?>       
            </div>
        </div>
    </section>
    <?php } ?>
    <?php if (!empty($_view["articles"])) { ?>
    <section>
        <div class="row space-mb-md">
            <div class="col">
                <h1 class="headline medium">Mehr aus dem Magazin</h1>
            </div>
            <div class="col-auto d-none d-lg-block">
                <a href="<?= $_con->getLink(["magazine", "overview"]); ?>" class="btn md btn-secondary ico right mb-2">zur Artikelübersicht<span class="icon"></span></a>
            </div>
        </div>
        <div class="row g-c">
            <?php foreach ($_view["articles"] as $row) { ?>
                <div class="col-xl-4 col-lg-6">
                    <?= $_con->getRenderedView("magazine/articleCard.partial", $row); ?>
                </div>
            <?php } ?>
        </div>
    </section>
    <?php } ?>
</div>
<!---END MAINCONTENT--->

<?= $_con->getRenderedView("magazine/ctaMagazine.partial"); ?>