{*
* 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
*}

{if isset($message) && $message}
	{assign var="ticket_of_manager" value=isset($message.id_employee) && $message.id_employee || isset($message.is_staff) && $message.is_staff}
	<div class="ets_hd_message{if $ticket_of_manager} staff{else} customer{/if}" data-uiq="{$message.unique|escape:'html':'UTF-8'}" data-id="{$message.id_ets_hd_ticket_message|intval}">
        <div class="ets_hd_wrap">
			{if (!isset($sendmail) || !$sendmail) && isset($message.show_profile) && $message.show_profile}
				<div class="ets_hd_profile">
					{if isset($message.yourself) && $message.yourself}
					<a class="edit" href="{$message.yourself nofilter}" target="_blank">
						{/if}
						{if isset($message.avatar) && trim($message.avatar) !== '' && (!isset($sendmail) || !$sendmail)}
							<span class="avatar_img">
								<i class="icon_edit_hover ets_svg_fill_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="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>
								<img class="avatar" src="{$message.avatar nofilter}" />
							</span>
						{else}
							<svg class="w_14 h_14" width="14" height="14" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"><path d="M1536 1399q0 109-62.5 187t-150.5 78h-854q-88 0-150.5-78t-62.5-187q0-85 8.5-160.5t31.5-152 58.5-131 94-89 134.5-34.5q131 128 313 128t313-128q76 0 134.5 34.5t94 89 58.5 131 31.5 152 8.5 160.5zm-256-887q0 159-112.5 271.5t-271.5 112.5-271.5-112.5-112.5-271.5 112.5-271.5 271.5-112.5 271.5 112.5 112.5 271.5z"/></svg>
						{/if}
						<span class="username">{$message.username|escape:'html':'UTF-8'}</span>
						{if isset($message.yourself) && $message.yourself}
					</a>
					{/if}
				</div>
			{/if}
			<div class="ets_hd_message_wrap">
				<p class="message">{if isset($message.message)}{$message.message|nl2br nofilter}{/if}
					<br />
				{if isset($message.attachment) && $message.attachment|trim !== ''}
					{if isset($message.attachment_name)}
                        {if isset($message.file_deleted) && $message.file_deleted}
                            {$message.attachment_name|escape:'html':'UTF-8'} (<span class="text-red">{l s='File deleted' mod='ets_helpdesk'}</span>)
                        {else}
                            <a class="ets_hd_file_mes" href="{$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"></path></svg>
        						</span>
        						{$message.attachment_name|escape:'html':'UTF-8'}</a>
        					<span class="file_size">{$message.file_size|escape:'html':'UTF-8'}</span>
                        {/if}
                    {else}
                        {$message.attachment|escape:'html':'UTF-8'}
                    {/if}
				{/if}
				</p>

				{if isset($message.signature) && $message.signature|trim !== ''}
					<span class="ets_hd_signature">{$message.signature|escape:'html':'UTF-8'}</span>
				{/if}
				{if isset($message.display_date) && (!isset($sendmail) || !$sendmail)}
					<span class="message_date">{$message.display_date nofilter}</span>
				{/if}
			</div>
		</div>
		{if isset($message.mark_as_replied) && !$message.mark_as_replied && !$ticket_of_manager && isset($is_staff) && $is_staff}
			{assign var="concat" value="{if $currentIndex|strpos:'?' > 0}&{else}?{/if}"}
			<a class="ets_hd_mark_as_replied" href="{$currentIndex|cat:$concat nofilter}id_ets_hd_ticket={$message.id_ets_hd_ticket|intval}&id_ets_hd_ticket_message={$message.id_ets_hd_ticket_message|intval}&action=markAsReplied&mark_as_replied=1">{l s='Mark as replied' mod='ets_helpdesk'}</a>
		{/if}

	</div>
{/if}