{* Hide Inactive Services - status dropdown - toggle inactive statuses *}

{if $type == "status-dropdown"}
    {assign var="hiddeStatus" value=false scope=parent}
    {assign var="statusCounter" value=0}      
    {if is_array($RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus']) && ($status.statusClass|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'] || $status.statusClass|replace:"-":" "|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'])}
        {foreach key=num item=service from=$tickets}
            {if $service.statusClass == $status.statusClass}
                {assign var="hiddeStatus" value=true scope=parent}
            {/if}
        {/foreach}
        {if $statusCounter == 0}{assign var="hiddeStatus" value=true scope=parent}{/if}
    {/if}
{/if}

{* Hide Inactive Services - switcher - toggle inactive services *}
{if $type == "switcher"}
    {assign var="serviceCounter" value=0}
    {foreach key=num item=service from=$tickets}
        {if is_array($RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus']) && ($service.statusClass|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'] || $service.statusClass|replace:"-":" "|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'])}
            {assign var="serviceCounter" value=$serviceCounter+1}
        {/if}
    {/foreach}
    <label class="d-flex" data-inactive-services>
        <span data-inactive-services-text="hide" {if !$hideInactiveServices['inactiveTickets']}class="hidden"{/if}>{$rslang->trans('hide_incactive_tickets.tickets.hide')|replace:"%s":$serviceCounter}</span>
        <span data-inactive-services-text="hidden"{if $hideInactiveServices['inactiveTickets']}class="hidden"{/if}>{if $serviceCounter == 1}{$rslang->trans('hide_incactive_tickets.tickets.hidden')|replace:"%s":$serviceCounter}{else}{$rslang->trans('hide_incactive_tickets.tickets.hidden_plural')|replace:"%s":$serviceCounter}{/if}</span>
        <div class="switch switch--sm">
            <input class="switch__checkbox" tabindex="0" type="checkbox" name="hideInactiveTickets" value="1" {if !$hideInactiveServices['inactiveTickets']}checked{/if} data-inactive-services-checkbox data-toggle="tooltip" title="Hide Inactive Tickets" aria-label="Hide Inactive Tickets">
            <span class="switch__container"><span class="switch__handle"></span></span>
        </div>
    </label>  
{/if}  



{* Hide Inactive Services - Table Cell Additional text for filtering *}
{if $type == "table-cell"}
    {assign var="hiddeStatus" value=false}
    {if is_array($RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus']) && ($ticket['statusClass']|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'] || $ticket['statusClass']|replace:"-":" "|capitalize|in_array:$RSThemes['pages'][$templatefile]['config']['hideInactiveTicketsStatus'])}
        {assign var="hiddeStatus" value=true}
    {/if}    
    {if !$hiddeStatus}<span class="hidden">lagomshowservice</span>{/if}
{/if}