{config_load file="lang" section='support'}
{if isset($user_actions_allowed)}
<div id="result_datas" style="display:none">
    <h1>{#support_action_result#}</h1>

    <p id="close_ok" style="display:none;" class="success">{#result_support_close_ok#}</p>
    <p id="reply_is_ok" style="display:none;" class="success">{#result_support_reply_ok#}</p>
    <p id="err_req_message_missing" style="display:none;" class="error">{#error_message_missing#}</p>
    <p id="err_req_message" style="display:none;" class="error">{#error_message_format#}</p>
    <p id="err_ticket_id" style="display:none;" class="error">{#error_ticket_id_not_valid#}</p>
    <p id="err_database_update" style="display:none;" class="error">{#error_database_query#}</p>
</div>
{/if}
<div id="details_table">
    <h1>{#support_show#}</h1>
    <table style="width: 720px;">
        <tr>
            <td>{#ticket_date_legend#}</td>
            <td>{$ticket->open_date}</td>
        </tr>
        <tr>
            <td>{#ticket_hosting_legend#}</td>
            <td>
            {if !isset($ticket->hosting_name)}
            {#no_hosting_associated#}
            {else}
            {$ticket->hosting_name}
            {/if}
            </td>
        </tr>
        <tr>
            <td>{#ticket_subject_legend#}</td>
            <td>{$ticket->subject}</td>
        </tr>
        <tr>
            <td>{#ticket_status_legend#}</td>
            {if $ticket->status == 'asked'}<td>{#ticket_status_asked_full#}</td>
            {elseif $ticket->status == 'replied'}<td>{#ticket_status_replied_full#}</td>
            {elseif $ticket->status == 'closed_by_user'}<td>{#ticket_status_closed_user_full#}</td>
            {elseif $ticket->status == 'closed_by_support'}<td>{#ticket_status_closed_support_full#}</td>
            {elseif $ticket->status == 'auto_closed'}<td>{#ticket_status_auto_closed_full#}</td>
            {/if}
        </tr>
        {if isset($user_actions_allowed)}
        <tr>
            <td>{#ticket_avail_actions#}</td>
            <td>
                <input type="button" id="btn_reply" name="btn_reply" style="width: 45%" value="{#mnu_reply_ticket#}" onclick="$('#form_user_reply_container').slideDown('slow'); $('#details_table').slideUp('slow');" />
                <input type="button" id="btn_close" name="btn_close" style="width: 45%" value="{#mnu_close_ticket#}" onclick="$('#form_user_close_container').slideDown('slow'); $('#details_table').slideUp('slow');" />
            </td>
        </tr>
        {/if}
    </table>
</div>
    {if isset($user_actions_allowed)}
        <div id="form_user_reply_container" style="display:none;">
            <h1>{#mnu_reply_ticket#}</h1>
            <form id="form_user_reply" name="form_user_reply" action="">
                <table>
                    <tr>
                        <td id="form_msg" name="form_msg" title="{#ticket_msg_title#}" style="vertical-align:top;">{#ticket_reply_legend#} :</td>
                        <td>
                            <textarea class="textarea" name="req_message" id="req_message"></textarea>
                            <input type="hidden" name="reply_ticket_id" id="reply_ticket_id" value="{$ticket->id}" />
                        </td>
                    </tr>
                    <tr>
                        <td><input type="button" name="btn_reply_cancel" id="btn_reply_cancel" value="{#button_cancel_legend#}" onclick="$('#form_user_reply_container').slideUp('slow'); $('#details_table').slideDown('slow');" /></td>
                        <td><input type="button" name="btn_reply_valid" id="btn_reply_valid" value="{#button_reply_legend#}" onclick="validateForm('form_user_reply');" /></td>
                    </tr>
                </table>
            </form>
        </div>
        <div id="form_user_close_container" style="display:none;">
            <h1>{#mnu_close_ticket#}</h1>
            <p>{#support_close_intro#}</p>
            <form id="form_user_close" name="form_user_close" action="">
                <input type="hidden" name="close_ticket_id" id="close_ticket_id" value="{$ticket->id}" />
                <input type="button" name="btn_close_cancel" id="btn_close_cancel" style="width: 45%" value="{#button_cancel_legend#}" onclick="$('#form_user_close_container').slideUp('slow'); $('#details_table').slideDown('slow');" /> &nbsp;
                <input type="button" name="btn_close_valid" id="btn_close_valid" style="width: 45%" value="{#mnu_close_ticket#}" onclick="validateForm('form_user_close');" />
            </form>
        </div>
    {/if}
<p>{#support_show_intro#}</p>
    <table style="width: 720px;">
		<thead>
			<tr>
				<th>Auteur / Date</th>
				<th>Message</th>
			</tr>
		</thead>
		<tbody id="tbl_user_ticket_details">
			<tr><td></td><td></td></tr>
		</tbody>
    </table>
	<p class="pageslinks" id="tbl_user_ticket_details_pg_links"></p>
	{literal}<script type="text/javascript">
		$(document).ready(function () { getPage('tbl_user_ticket_details',1,{/literal}{$pages_count},0, '{$ticket->id}'{literal}); });
	</script>{/literal}
