{*
* 2007-2022 ETS-Soft
*
* NOTICE OF LICENSE
*
* This file is not open source! Each license that you purchased is only available for 1 wesite only.
* If you want to use this file on more websites (or projects), you need to purchase additional licenses.
* You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs, please contact us for extra customization service at an affordable price
*
*  @author ETS-Soft <etssoft.jsc@gmail.com>
*  @copyright  2007-2022 ETS-Soft
*  @license    Valid for 1 website (or project) for each purchase of license
*  International Registered Trademark & Property of ETS-Soft
*}
<tr class="ets-hd-no-replied{if $is_staff && isset($ticket.staff_read) && !$ticket.staff_read || !$is_staff && isset($ticket.read) && !$ticket.read} ets-hd-no-read-ticket{/if} ets-hd-ticket-{$ticket.id_ets_hd_ticket|intval}">
	{if $has_bulk_actions && isset($back_office) && $back_office}
		<td class="row-selector text-center">
			<input type="checkbox" name="{$table|escape:'html':'UTF-8'}_groupBox[]" value="{$ticket.id_ets_hd_ticket|intval}" class="noborder">
		</td>
	{/if}
    {foreach from=$fields_list item='field'}
		<td{if isset($field.class) && $field.class} class="{$field.class|escape:'html':'UTF-8'}"{/if}>
            {if isset($ticket[$field.name]) && trim($ticket[$field.name]) !== ''}
                {if isset($field.product_display) && $field.product_display && isset($ticket.product_image) && isset($ticket.product_link)}
					<a href="{$ticket.product_link nofilter}" title="{$ticket.product|escape:'html':'UTF-8'}" target="_blank">
						<img src="{$ticket.product_image nofilter}" width="50px" />
                    </a>
				{elseif isset($field.customer_display) && $field.customer_display}
					{if isset($ticket.customer_link) && isset($ticket.customer_link)}
						<a class="ets_hd_display_customer" href="{$ticket.customer_link nofilter}">
					{/if}
						{$ticket.customer nofilter}
					{if isset($ticket.customer_link) && isset($ticket.customer_link)}
						</a>
					{/if}
					{if isset($ticket.customer_country) && $ticket.customer_country|trim !==''}
						<span>({$ticket.customer_country|escape:'html':'UTF-8'})</span>
					{/if}
					{if isset($ticket.customer_email2) && $ticket.customer_email2|trim !==''}
						<br><span>{$ticket.customer_email2|escape:'html':'UTF-8'}</span>
					{/if}
				{elseif $field.type == 'select' || $field.type == 'radio'}
                    {if isset($field.list) && is_array($field.list) && $field.list|count > 0}
                        {foreach from=$field.list item='list'}
                            {if $ticket[$field.name] == $list.id}
                                <span class="{$field.name|escape:'html':'UTF-8'}_{$list.id|lower|escape:'html':'UTF-8'}">{if isset($list.icon) && $list.icon}{$list.icon nofilter}{else}{$list.name|escape:'html':'UTF-8'}{/if}</span>
                            {/if}
                        {foreachelse}--{/foreach}
                    {/if}
                {elseif $field.type == 'file'}
					{assign var="filename" value=$field.name|cat:'_link_download'}
					{assign var="has_link_download" value=isset($ticket[$filename]) && $ticket[$filename]|trim !== ''}
					{if $has_link_download}
						<a href="{$ticket[$filename] nofilter}">
					{/if}
							{$ticket[$field.name]|escape:'html':'UTF-8'}
					{if $has_link_download}
						</a>
					{/if}
                {elseif isset($field.truncate) && $field.truncate > 0}
                    {$ticket[$field.name]|truncate:"{$field.truncate}":'...'|escape:'html':'UTF-8'}
                    {if $field.name=='last_message'}
                        {if isset($ticket.last_message_attachment_name) && $ticket.last_message_attachment_name}
                        </br>
                        {if isset($ticket.file_deleted) && $ticket.file_deleted}
                            {$ticket.last_message_attachment_name|escape:'html':'UTF-8'} (<span class="text-red">{l s='File deleted' mod='ets_helpdesk'}</span>)
                        {else}
                            <a class="link_file" href="{$ticket.last_message_attachment nofilter}">
    							<span class="icon_svg">
    								<svg width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M768 384v-128h-128v128h128zm128 128v-128h-128v128h128zm-128 128v-128h-128v128h128zm128 128v-128h-128v128h128zm700-388q28 28 48 76t20 88v1152q0 40-28 68t-68 28h-1344q-40 0-68-28t-28-68v-1600q0-40 28-68t68-28h896q40 0 88 20t76 48zm-444-244v376h376q-10-29-22-41l-313-313q-12-12-41-22zm384 1528v-1024h-416q-40 0-68-28t-28-68v-416h-128v128h-128v-128h-512v1536h1280zm-627-721l107 349q8 27 8 52 0 83-72.5 137.5t-183.5 54.5-183.5-54.5-72.5-137.5q0-25 8-52 21-63 120-396v-128h128v128h79q22 0 39 13t23 34zm-141 465q53 0 90.5-19t37.5-45-37.5-45-90.5-19-90.5 19-37.5 45 37.5 45 90.5 19z"/></svg>
    							</span>
    							{$ticket.last_message_attachment_name|escape:'html':'UTF-8'}
    						</a>
                        {/if}
                        {elseif isset($ticket.attachment) && $ticket.attachment}
                            </br>
                            {$ticket.attachment|escape:'html':'UTF-8'}
                        {/if}
                    {/if}
                {elseif $field.type == 'checkbox'}
					<span class="ets_hd_display_field_checkbox">
						{$ticket[$field.name]|regex_replace:'/^(.+?)\n?$/m':'<span>$1</span>' nofilter}
					</span>
				{elseif $field.type == 'textarea'}
					<div class="td_content">
                    	{$ticket[$field.name]|truncate:"100":'...' nofilter}
					</div>
				{else}
					{$ticket[$field.name]|truncate:"100":'...' nofilter}
                {/if}
            {else}--{/if}
		</td>
    {/foreach}
    {assign var="concat" value="{if $ticket.link|strpos:'?' > 0}&{else}?{/if}"}
	<td class="text-right">
		<div class="btn-group-action">
			{if isset($ticket.order_link) && $ticket.order_link|trim !== ''}
				<a title="{l s='View orders' mod='ets_helpdesk'}" class="ets_hd_view_orders pull-left{if isset($ticket.has_product_expried) && $ticket.has_product_expried} expried{/if}" href="{$ticket.order_link nofilter}">
					<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M704 1536q0 52-38 90t-90 38-90-38-38-90 38-90 90-38 90 38 38 90zm896 0q0 52-38 90t-90 38-90-38-38-90 38-90 90-38 90 38 38 90zm128-1088v512q0 24-16.5 42.5t-40.5 21.5l-1044 122q13 60 13 70 0 16-24 64h920q26 0 45 19t19 45-19 45-45 19h-1024q-26 0-45-19t-19-45q0-11 8-31.5t16-36 21.5-40 15.5-29.5l-177-823h-204q-26 0-45-19t-19-45 19-45 45-19h256q16 0 28.5 6.5t19.5 15.5 13 24.5 8 26 5.5 29.5 4.5 26h1201q26 0 45 19t19 45z"/></svg>
                    {if isset($ticket.has_product_expried) && $ticket.has_product_expried}
                        <span class="count_cart">{$ticket.has_product_expried|intval}</span>
                    {/if}
				</a>
			{/if}
			<div class="btn-group pull-right{if isset($ticket.is_granted) && $ticket.is_granted && ($back_office || $ticket.status !='closed' && $ticket.status != 'canceled')} has_dropdown{else} no_dropdown{/if}">
				<a class="ets_hd_view_ticket btn btn-default" data-ticket="{$ticket.status|escape:'html':'UTF-8'}" href="{$ticket.link nofilter}">
					<i class="ets_svg_fill_gray ets_svg_fill_hover_white lh_16">
						<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1664 960q-152-236-381-353 61 104 61 225 0 185-131.5 316.5t-316.5 131.5-316.5-131.5-131.5-316.5q0-121 61-225-229 117-381 353 133 205 333.5 326.5t434.5 121.5 434.5-121.5 333.5-326.5zm-720-384q0-20-14-34t-34-14q-125 0-214.5 89.5t-89.5 214.5q0 20 14 34t34 14 34-14 14-34q0-86 61-147t147-61q20 0 34-14t14-34zm848 384q0 34-20 69-140 230-376.5 368.5t-499.5 138.5-499.5-139-376.5-368q-20-35-20-69t20-69q140-229 376.5-368t499.5-139 499.5 139 376.5 368q20 35 20 69z"/></svg>
					</i>
					{l s='View' mod='ets_helpdesk'}
				</a>
				{assign value=isset($ticket.is_granted) && $ticket.is_granted && ($is_staff || $back_office || $ticket.status !='closed' && $ticket.status != 'canceled')  var="has_dropdown_show"}
                {if $has_dropdown_show}
					<button class="btn btn-default dropdown-toggle"
					        data-toggle="dropdown"><i class="ets_icon">
							<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1408 704q0 26-19 45l-448 448q-19 19-45 19t-45-19l-448-448q-19-19-19-45t19-45 45-19h896q26 0 45 19t19 45z"/></svg>
						</i>
					</button>
					<ul class="dropdown-menu dropdown_list_ticket">
						{if $is_staff || !$back_office && $ticket.status !='closed' && $ticket.status != 'canceled'}
							<li>
								<a class="ets_hd_edit_ticket edit" href="{$ticket.link|cat:$concat|cat:'edit_ticket=1' nofilter}">
									<i class="ets_svg_fill_gray lh_16">
										<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M491 1536l91-91-235-235-91 91v107h128v128h107zm523-928q0-22-22-22-10 0-17 7l-542 542q-7 7-7 17 0 22 22 22 10 0 17-7l542-542q7-7 7-17zm-54-192l416 416-832 832h-416v-416zm683 96q0 53-37 90l-166 166-416-416 166-165q36-38 90-38 53 0 91 38l235 234q37 39 37 91z"/></svg>
									</i> {l s='Edit' mod='ets_helpdesk'}
								</a>
							</li>
						{/if}
						{if $is_staff}
							<li class="divider"></li>
							<li{if $ticket.status == 'open'} style="display: none;"{/if}>
								<a class="ets_hd_status_ticket open" href="{$ticket.link|cat:$concat|cat:'status=open' nofilter}">
									<i class="ets_icon">
										<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1792 1120q0 166-127 451-3 7-10.5 24t-13.5 30-13 22q-12 17-28 17-15 0-23.5-10t-8.5-25q0-9 2.5-26.5t2.5-23.5q5-68 5-123 0-101-17.5-181t-48.5-138.5-80-101-105.5-69.5-133-42.5-154-21.5-175.5-6h-224v256q0 26-19 45t-45 19-45-19l-512-512q-19-19-19-45t19-45l512-512q19-19 45-19t45 19 19 45v256h224q713 0 875 403 53 134 53 333z"/></svg>
									</i> {l s='Reopen' mod='ets_helpdesk'}
								</a>
							</li>

							<li{if $ticket.status == 'closed'} style="display: none;"{/if}>
								<a class="ets_hd_status_ticket closed" href="{$ticket.link|cat:$concat|cat:'status=closed' nofilter}"><i class="ets_icon">
										<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M555 1335l78-141q-87-63-136-159t-49-203q0-121 61-225-229 117-381 353 167 258 427 375zm389-759q0-20-14-34t-34-14q-125 0-214.5 89.5t-89.5 214.5q0 20 14 34t34 14 34-14 14-34q0-86 61-147t147-61q20 0 34-14t14-34zm363-191q0 7-1 9-106 189-316 567t-315 566l-49 89q-10 16-28 16-12 0-134-70-16-10-16-28 0-12 44-87-143-65-263.5-173t-208.5-245q-20-31-20-69t20-69q153-235 380-371t496-136q89 0 180 17l54-97q10-16 28-16 5 0 18 6t31 15.5 33 18.5 31.5 18.5 19.5 11.5q16 10 16 27zm37 447q0 139-79 253.5t-209 164.5l280-502q8 45 8 84zm448 128q0 35-20 69-39 64-109 145-150 172-347.5 267t-419.5 95l74-132q212-18 392.5-137t301.5-307q-115-179-282-294l63-112q95 64 182.5 153t144.5 184q20 34 20 69z"/></svg>
									</i> {l s='Closed' mod='ets_helpdesk'}</a>
							</li>
							<li class="divider"></li>
							<li>
								<a class="ets_hd_status_ticket canceled" href="{$ticket.link|cat:$concat|cat:'status=canceled' nofilter}"><i class="ets_icon">
										<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1490 1322q0 40-28 68l-136 136q-28 28-68 28t-68-28l-294-294-294 294q-28 28-68 28t-68-28l-136-136q-28-28-28-68t28-68l294-294-294-294q-28-28-28-68t28-68l136-136q28-28 68-28t68 28l294 294 294-294q28-28 68-28t68 28l136 136q28 28 28 68t-28 68l-294 294 294 294q28 28 28 68z"/></svg>
									</i> {l s='Canceled' mod='ets_helpdesk'}</a>
							</li>
							<li class="divider"></li>
							<li>
								<a class="ets_hd_delete_ticket delete" onclick="confirm({l s='Do you want delete it?' mod='ets_helpdesk'});" href="{$ticket.link|cat:$concat|cat:'delete_ticket=1' nofilter}"><i class="ets_icon">
										<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M704 736v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm256 0v576q0 14-9 23t-23 9h-64q-14 0-23-9t-9-23v-576q0-14 9-23t23-9h64q14 0 23 9t9 23zm128 724v-948h-896v948q0 22 7 40.5t14.5 27 10.5 8.5h832q3 0 10.5-8.5t14.5-27 7-40.5zm-672-1076h448l-48-117q-7-9-17-11h-317q-10 2-17 11zm928 32v64q0 14-9 23t-23 9h-96v948q0 83-47 143.5t-113 60.5h-832q-66 0-113-58.5t-47-141.5v-952h-96q-14 0-23-9t-9-23v-64q0-14 9-23t23-9h309l70-167q15-37 54-63t79-26h320q40 0 79 26t54 63l70 167h309q14 0 23 9t9 23z"/></svg>
									</i> {l s='Delete' mod='ets_helpdesk'}</a>
							</li>
						{/if}
					</ul>
                {/if}
			</div>
		</div>
	</td>
</tr>