{extends file=$smarty.const.SMARTY_LAYOUT_CONTENT_LIST_TABLE_CURRENT_DATA}

{block name="listing-td-content-description"}
	{$rowFields['description']}

	{if $rowFields['idCategory']}
		<div><i>({taskCategoryLabel ref=$rowFields['idCategory']})</i></div>
	{/if}
{/block}

{block name="listing-td-content-idDepartment"}
	{departmentLabel ref=$rowFields['idDepartment']}

	{if $rowFields['idOffice']}
		<div>({officeLabel ref=$rowFields['idOffice']})</div>
	{/if}
{/block}

{block name="listing-td-content-idResponsibleUser"}
	{userLabel ref=$rowFields['idResponsibleUser']}
{/block}

{block name="listing-td-content-idAssignorUser"}
	{userLabel ref=$rowFields['idAssignorUser']}
{/block}

{block name="listing-td-content-status"}
	<b>{$_LANG['tasks']['statusName'][$rowFields['status']]}
	{if $rowFields['statusReason']}
	: {$_LANG['tasks']['reasonForStatus'][$rowFields['status']][$rowFields['statusReason']]}
	{/if}
	</b>
	{if $rowFields['free']}
		<span class="red italic">[{$_LANG['TaskManagement']['Tasks']['index']['listing']['free']}]</span>
	{/if}
	<div>({$_LANG['tasks']['priorities'][$rowFields['priority']]})</div>
{/block}

{block name="listing-td-content-deadline"}
	{if $rowFields['deadline']<$smarty.const.TIMESTAMP && $rowFields['status']!='finished'}
		<div class="bold red">
	{else}
		<div class="bold green">
	{/if}
	{$rowFields['deadline']|dateTimeFormat:'dateWithHM'}
	</div>

	{if $rowFields['estimatedFinishTime']}
		<div class="italic">
			{$rowFields['estimatedFinishTime']|dateTimeFormat:'dateWithHM'}
			{if $rowFields['estimatedDuration']}
				{if $rowFields['estimatedDuration']>86400}
					{$estimatedDurationUnit="days"}
					{$estimatedDuration=round($rowFields['estimatedDuration']/86400)}
				{elseif $rowFields['estimatedDuration']>3600}
					{$estimatedDurationUnit="hours"}
					{$estimatedDuration=round($rowFields['estimatedDuration']/3600)}
				{else}
					{$estimatedDurationUnit="minutes"}
					{$estimatedDuration=round($rowFields['estimatedDuration']/60)}
				{/if}
				[{$estimatedDuration} {$_LANG['TaskManagement']['Tasks']['taskHistory']['durationUnits'][$estimatedDurationUnit]}]
			{/if}
		</div>
	{/if}
{/block}

{block name="listing-td-content-pivot"}
	{if $rowFields['pivot']}
		{$_LANG['tasks']['pivotsArr'][$rowFields['pivot']]}
		{if $rowFields['pivot']=='order'}
			{orderLabel ref=$rowFields['idPivot']}
		{elseif $rowFields['pivot']=='service'}
			{serviceLabel ref=$rowFields['idPivot']}
		{elseif $rowFields['pivot']=='invoice'}
			{invoiceLabel ref=$rowFields['idPivot']}
		{else}
			#{$rowFields['idPivot']}
		{/if}
	{/if}

	{if $rowFields['idOperationType']}
		<div><i>({taskOperationTypeLabel ref=$rowFields['idOperationType']})</i></div>
	{/if}
{/block}

{block name="listing-td-content-addTime" append}
	<div>[{taskLabel ref=$rowFields['id']}]</div>
{/block}