{if isset($footerprimaryNavbarHtmlCache)}
    {$footerprimaryNavbarHtmlCache}
{else}
    {if isset($rsFooter.primary) && $rsFooter.primary}
        {assign var="footerColCount" value=count($rsFooter.primary)}
        {if $footerColCount == 1}
            {assign var="footerPrimaryCol" value="12" scope=parent}
        {elseif $footerColCount == 2}
            {assign var="footerPrimaryCol" value="6" scope=parent}
        {elseif $footerColCount == 3}
            {assign var="footerPrimaryCol" value="4" scope=parent}
        {elseif $footerColCount >= 4 }
            {assign var="footerPrimaryCol" value="3" scope=parent}
        {/if}
        <div class="footer-site-map">
            <div class="row">
                {foreach from=$rsFooter.primary item=$footerLink}
                    <div class="footer-col {$footerLink.custom_classes} col-md-{$footerPrimaryCol}">
                        {if $footerLink.children && $footerLink.children|count > 0}
                            <h3 class="footer-title collapsed" data-toggle="collapse" data-target="#footer-nav-{$footerLink@index}" aria-expanded="false" aria-controls="footer-nav-{$footerLink@index}">
                                {if isset($footerLink.icon) && $footerLink.icon}
                                    <i class="{$footerLink.icon}"></i>
                                {elseif isset($footerLink.predefined_icon) && $footerLink.predefined_icon}
                                    <span>{$footerLink.predefined_icon}</span>
                                {elseif isset($footerLink.media) && $footerLink.media}
                                    {$footerLink.media}
                                {/if}
                                {if $footerLink.name && $footerLink.style != "icon"}{$footerLink.name}{/if}
                                <i class="footer-icon">
                                    <svg width="18" height="11" viewBox="0 0 18 11" fill="none" xmlns="http://www.w3.org/2000/svg">
                                        <path d="M9.21 10.01H8.79C8.66 10.01 8.53 9.96 8.44 9.86L0.14 1.57C0.04 1.48 0 1.34 0 1.22C0 1.1 0.05 0.97 0.15 0.87L0.86 0.16C1.06 -0.0400002 1.37 -0.0400002 1.57 0.16L9 7.6L16.43 0.15C16.63 -0.05 16.94 -0.05 17.14 0.15L17.85 0.86C18.05 1.06 18.05 1.37 17.85 1.57L9.56 9.86C9.47 9.95 9.34 10.01 9.21 10.01Z" fill="#B9BDC5"/>
                                    </svg>
                                </i>
                            </h3>
                            <ul class="footer-nav collapse" id="footer-nav-{$footerLink@index}">
                                {foreach from=$footerLink.children item=$footerChild}
                                    <li>
                                        <a tabindex="0" href="{$footerChild.url}" class="nav-link {$footerChild.custom_classes}" {if isset($footerChild.target_blank) && $footerChild.target_blank}target="_blank"{/if} {if isset($footerChild.rel) && $footerChild.rel}rel="{$footerChild.rel}"{/if} {if (isset($footerChild.name) && $footerChild.name) && $footerChild.style == "icon"}aria-label="{$footerChild.name}"{/if}>
                                            {if isset($footerChild.icon) && $footerChild.icon}
                                                <i class="{$footerChild.icon}"></i>
                                            {elseif isset($footerChild.predefined_icon) && $footerChild.predefined_icon}
                                                {$footerChild.predefined_icon}
                                            {elseif isset($footerChild.media) && $footerChild.media}
                                                {$footerChild.media}
                                            {/if}
                                            {if isset($footerChild.name) && $footerChild.name && $footerChild.style != "icon"}<span>{$footerChild.name}</span>{/if}
                                        </a>
                                    </li>
                                {/foreach}
                            </ul>
                        {else}
                            <a tabindex="0" class="footer-title {$footerLink.custom_classes}" href="{$footerLink.url}" {if isset($footerLink.target_blank) && $footerLink.target_blank}target="_blank"{/if} {if isset($footerLink.rel) && $footerLink.rel}rel="{$footerLink.rel}"{/if}>
                                {if $footerLink.icon}
                                    <i class="{$footerLink.icon}"></i>
                                {elseif $footerLink.predefined_icon}
                                    {$footerLink.predefined_icon}
                                {elseif isset($footerLink.media) && $footerLink.media}
                                    {$footerLink.media}
                                {/if}
                                {if $footerLink.name}<span>{$footerLink.name}</span>{/if}
                            </a>
                        {/if}
                    </div>
                {/foreach}
            </div>
        </div>
    {/if}
{/if}