{if isset($RSThemes['pages'][$templatefile]) && file_exists($RSThemes['pages'][$templatefile]['fullPath'])}
    {include file=$RSThemes['pages'][$templatefile]['fullPath']}
{else}
    {if !isset($RSThemes['pages'][$templatefile]['config']['hideKnowledgebaseSearchbar']) || $RSThemes['pages'][$templatefile]['config']['hideKnowledgebaseSearchbar'] != '1'}
        <div class="section">
            <div class="section-header">
                <h2 class="section-title">{$rslang->trans('support.need_help')}</h2>
            </div>
            <div class="section-body">
                <div class="search-box search-box-{$searchBoxStyle}">
                    <div role="form" data-knowledgebase-search data-ajax-url="{$WEB_ROOT}/templates/{$template}">
                    <div class="search-group search-group-lg">
                            <div class="search-field">
                                <input 
                                    class="form-control" 
                                    type="text" 
                                    name="search" 
                                    placeholder="{$LANG.howcanwehelp}" 
                                    data-knowledgebase-search-input
                                />
                                <div class="search-field-icon"><i class="lm lm-search" aria-hidden="true"></i></div>
                                <div class="search-field-loader loader hidden" data-knowledgebase-search-loader>                     
                                    {include file="$template/includes/common/loader.tpl" classes="spinner-sm"}
                                </div>
                                <div class="search-field-results list-group" data-knowledgebase-search-results data-lang-nodata="{$LANG.knowledgebasenoarticles}" data-lang-nodata-desc="{$rslang->trans('support.kb_search_sidebar.no_data_desc')}" data-btn-clear-lang="{$rslang->trans('generals.clear_filters')}"></div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    {/if}
    <div class="section">
        <div class="section-header">
            <h2 class="section-title">{$rslang->trans('support.choose_support_department')}</h2>
        </div>
        <div class="section-body">
            {if $departments}
                <div class="list-group">
                    {foreach from=$departments key=num item=department}
                        <a tabindex="0" class="list-group-item has-icon" href="{$smarty.server.PHP_SELF}?step=2&amp;deptid={$department.id}">
                            {if is_array($graphics['department']) && $graphics['department'][$department.id]->enabled && $graphics['department'][$department.id]->getJson()->condensed->type}
                                {assign var=graphic value=$graphics['department'][$department.id]->getJson()->condensed->graphic}
                                {assign var=graphicType value=$graphics['department'][$department.id]->getJson()->condensed->type}
                                {if $graphicType == "icon"}
                                    <span class="list-group-item-icon department-graphic">
                                        {include file="$template/assets/svg-icon/{$graphic}"}
                                    </span>
                                {else if $graphicType == "media"}
                                    <span class="list-group-item-icon department-graphic">
                                        <img src="{$WEB_ROOT}/templates/{$template}/assets/img/page-manager/{$graphic}" alt="{$department.name}">
                                    </span>
                                {else if $graphicType == "font-icon"}
                                    <i class="list-group-item-icon {$graphic}"></i>
                                {/if}
                            {else}
                                <i class="list-group-item-icon lm lm-envelope"></i>
                            {/if}
                            <div class="list-group-item-body {if $supportHours}list-group-support-hours{/if}">
                                <div class="list-group-item-heading">
                                    {$department.name} 
                                        {* If active supporthours in department  *}
                                        {if $supportHours && file_exists("templates/$template/includes/support-hours/departments-hours.tpl")}
                                            <div class="support-time-box d-flex">
                                                {include file="{$template}/includes/support-hours/departments-hours.tpl"}
                                            </div>
                                        {/if}
                                        
                                        {* 
                                            -- Start of integration code --
                                            - Integration code for: Premium Support Tickets For WHMCS from ModulesGarden
                                            - Module URL: https://www.modulesgarden.com/products/whmcs/premium-support-tickets
                                        *}

                                        {if $PremiumSupportTickets.$num}  
                                            {if $PremiumSupportTickets.$num.canCreate}
                                                <span class="label label-success m-l-1x">{$PremiumSupportTickets.$num.message}</span>
                                            {else}
                                                <span class="label label-danger m-l-1x">{$PremiumSupportTickets.$num.message}</span>
                                            {/if}
                                        {/if}
                                        {* -- End of integration code -- *}
                                </div>

                                {if $department.description}
                                    <p class="list-group-item-text">{$department.description}</p>
                                {/if}
                                {*
                                    -- Start of integration code --
                                    - Integration code for: Premium Support Tickets For WHMCS from ModulesGarden
                                    - Module URL: https://www.modulesgarden.com/products/whmcs/premium-support-tickets
                                *}
                                {if $PremiumSupportTickets.$num}                      
                                    {if $PremiumSupportTickets.$num.canCreate}
                                        <p class="list-group-item-text">
                                            {$PremiumSupportTickets.$num.havePointsMsg} {$PremiumSupportTickets.$num.havePoints}
                                        </p>
                                    {else}
                                        <p class="list-group-item-text">
                                            {$PremiumSupportTickets.$num.requiredPointsMsg} {$PremiumSupportTickets.$num.requiredPoints} <br />
                                            {$PremiumSupportTickets.$num.havePointsMsg} {$PremiumSupportTickets.$num.havePoints} <br />
                                        </p>
                                    {/if}
                                {/if}
                                {* -- End of integration code -- *}
                            </div>
                        </a>    
                    {/foreach}
                </div>
            {else}
                <div class="message message-no-data">
                    <div class="message-image">
                        {include file="$template/includes/common/svg-icon.tpl" icon="ticket"}
                    </div>
                    <h6 class="message-title">{$LANG.nosupportdepartments}</h6>
                </div>
            {/if}
        </div>
    </div>
{/if}
