/* Cell Title */
{ldelim} 
    data: null,
    name: "tid",
    "render": function(data, row){ldelim}
        {if isset($ticketSensitiveData)}
            {assign var=shieldIcon value="{include file="$template/core/extensions/SensitiveDataManager/assets/svg-icon/shield.svg"}"|escape:'javascript'}
            var ticketSensitiveData = {json_encode($ticketSensitiveData)};
        {/if}
        var text = ``;
        var collapseButton = '<button tabindex="0" type="button" class="btn-table-collapse"></button>';
        {if isset($ticketSensitiveData)}
            if (ticketSensitiveData.hasOwnProperty(data.id) && ticketSensitiveData[data.id] == 1) {
                text += `<i class="ml-2" data-html="true" data-toggle="tooltip" data-original-title="{$rslang->trans('sensitive_data.tooltip')}">{$shieldIcon}</i>`;
            }
        {/if}
        var departmentGraphic = '';
        if (data.graphics && data.graphics.condensed) {
            var innerGraphic = '';
            if (data.graphics.condensed.type == "media"){ 
                innerGraphic = '<img src="{$WEB_ROOT}/templates/{$template}/assets/img/page-manager/'+data.graphics.condensed.graphic+'">';
            } else if (data.graphics.condensed.type == "tpl"){
                innerGraphic = data.graphics.condensed.graphic;
            } else if (data.graphics.condensed.type == "font-icon"){ 
                innerGraphic = '<div class="graphic-item-bg"><i class="'+data.graphics.condensed.graphic+'"></i></div>';
            }
            departmentGraphic = '<div class="graphic-item graphic-item-sm">'+innerGraphic+'</div>';
        }
        text += `<div class="d-flex gap-base align-items-center">` + departmentGraphic + `<div> ` + collapseButton + ` <div class="text-primary p-md font-weight-medium d-flex align-items-center">
                        <span>#` + data.tid + `</span>`;
        {if isset($ticketSensitiveData)}
            if (ticketSensitiveData.hasOwnProperty(data.id) && ticketSensitiveData[data.id] == 1) {
                text += `<i class="ml-2" data-html="true" data-toggle="tooltip" data-original-title="{$rslang->trans('sensitive_data.tooltip')}">{$shieldIcon}</i>`;
            }
        {/if}
        text += `</div><span class="p-sm">` + data.title + `</span></div></div>`;
        return text;
    {rdelim}
{rdelim},

/* Cell Department */
{ldelim}
    data: null,
    name: "department",
    "render": function (data, row){        
        var text = '',
            collapseButton = '<button tabindex="0" type="button" class="btn-table-collapse"></button>',
            department = data.department;
        text = collapseButton + '<div class="d-flex gap-sm"><span>' + department + '</span></div>';
        return text;
    }
{rdelim},


/* Cell Status */
{ldelim}
    data: null,
    name: "status",
    className: "text-nowrap",
    "render": function(data, row){ldelim}
        {if $RSThemes.addonSettings.show_status_icon == 'displayed' && in_array($templatefile, $iconsPages)}
            var icon = data.status.statusIcon;
                icon = icon.replace('{ldelim}$statusColor{rdelim}',data.status.statusColor)
            var text = `<span class="status status-`+data.status.cssFriendly+` {if $RSThemes.addonSettings.show_status_icon == 'displayed'}dot-hidden{/if}" style="--status-color:`+data.status.statusColor+`">
                {if $RSThemes.addonSettings.show_status_icon == 'displayed'}
                    <span class="status-icon" data-status-icon="`+data.status.cssFriendly+`">
                        `+icon+`
                    </span>
                {/if}
                `+data.status.statusText+`</span>
            `;
        {else}
            var text = `<span class="status" style="--status-color:`+data.status.statusColor+`">`+data.status.statusText+`</span>`;
        {/if}    
        return text;
    {rdelim}
{rdelim},

/* Cell Last Reply */
{ldelim} 
    data: null,
    name: "lastreply",
    "render": function(data, row){ldelim}
        {if isset($RSThemes['pages'][$templatefile]) && $RSThemes['pages'][$templatefile]['config']['dateAgo'] == "1"}
            var text = '<span data-html="true" data-toggle="tooltip" data-original-title="' + data.normalisedlastreply + '">' + data.lastreplyago + '</span>';
        {else}
            var text = data.normalisedlastreply;
        {/if}
    return text;
    {rdelim}
{rdelim}
{if isset($RSThemes['pages'][$templatefile]) && $RSThemes['pages'][$templatefile]['config']['showManageButton'] == "1"}
,
/* Cell Actions */
{ldelim} 
    data: null,
    name: "actions",
    className: "cell-action",
    "render": function (data, row){ldelim}
        text = `<a tabindex="0" href="viewticket.php?tid=`+data.tid+`&c=`+data.c+`" class="btn btn-default btn-sm btn-manage">{$_LANG['manage']}</a>`;
        return text;
    {rdelim}
{rdelim}
{/if}