193 lines
11 KiB
Smarty
193 lines
11 KiB
Smarty
<link media="all" type="text/css" rel="stylesheet" href="{$base_dir_ssl}modules/ant_support_form/support.css">
|
|
|
|
{capture name=path}{l s='Contact' mod='ant_support_form'}{/capture}
|
|
{include file="$tpl_dir./breadcrumb.tpl"}
|
|
|
|
<h1>{l s='Customer Service' mod='ant_support_form'} - {if isset($customerThread) && $customerThread}{l s='Your reply' mod='ant_support_form'}{elseif isset($subject)}{$subject}{else}{l s='Contact us' mod='ant_support_form'}{/if}</h1>
|
|
|
|
{if isset($confirmation)}
|
|
<p class="success">{l s='Your message has been successfully sent to our team.' mod='ant_support_form'}</p>
|
|
<p class="footer_links">
|
|
<a href="{$base_dir}" class="button">{l s='Home' mod='ant_support_form'}</a>
|
|
</p>
|
|
{elseif isset($alreadySent)}
|
|
<p class="notification">{l s='Your message has already been sent.' mod='ant_support_form'}</p>
|
|
<p class="footer_links">
|
|
<a href="{$base_dir}" class="button">{l s='Home' mod='ant_support_form'}</a>
|
|
</p>
|
|
{else}
|
|
<p class="bold">{l s='For questions about an order or for more information about our products' mod='ant_support_form'}.</p>
|
|
{include file="$tpl_dir./errors.tpl"}
|
|
<form action="{$request_uri|escape:'htmlall':'UTF-8'}" method="post" class="std" enctype="multipart/form-data">
|
|
<fieldset>
|
|
<div class="content">
|
|
<p class="text">
|
|
<label for="email">{l s='E-mail address' mod='ant_support_form'}</label>
|
|
{if isset($customerThread.email)}
|
|
<input type="text" id="email" name="from" value="{$customerThread.email}" readonly="readonly" />
|
|
{else}
|
|
<input type="text" id="email" name="from" value="{$email}" />
|
|
{/if}
|
|
</p>
|
|
{if !$PS_CATALOG_MODE}
|
|
{if (!isset($customerThread.id_order) || $customerThread.id_order > 0) && (isset($allow_order) && $allow_order)}
|
|
{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)}
|
|
<p class="text">
|
|
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
|
|
<select name="id_order" id="id_order"><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select>
|
|
{elseif !isset($customerThread.id_order) && !isset($isLogged)}
|
|
<p class="text">
|
|
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
|
|
<input type="text" name="id_order" id="id_order" value="{if isset($customerThread.id_order) && $customerThread.id_order > 0}{$customerThread.id_order|intval}{else}{if isset($smarty.post.id_order)}{$smarty.post.id_order|intval}{/if}{/if}" />
|
|
{elseif $customerThread.id_order > 0}
|
|
<p class="text">
|
|
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
|
|
<input type="text" name="id_order" id="id_order" value="{$customerThread.id_order|intval}" readonly="readonly" />
|
|
{else}
|
|
<p class="text error cant-submit">
|
|
{l s='You don\'t have any order' mod='ant_support_form'} - <a href="{$base_dir}" class="button">{l s='Home' mod='ant_support_form'}</a>
|
|
{/if}
|
|
</p>
|
|
{/if}
|
|
{if isset($isLogged) && $isLogged && isset($allow_product) && $allow_product}
|
|
{if !isset($customerThread.id_product)}
|
|
<div id="products_part" class="text" style="display:none;">
|
|
<label for="id_products">{l s='Product' mod='ant_support_form'}</label>
|
|
<div id="products">
|
|
|
|
</div>
|
|
</div>
|
|
{literal}<script>
|
|
$(function() {
|
|
if ($('#id_order').val()!= 0) {
|
|
var id_order = $('#id_order').val();
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: '{/literal}{$base_dir_ssl}{literal}modules/ant_support_form/ajax_support.php',
|
|
dataType: 'json',
|
|
data: {
|
|
id_order : id_order,
|
|
token : static_token
|
|
},
|
|
success: function(jsonData) {
|
|
$("#products_part").hide();
|
|
$("#products").empty();
|
|
if(jsonData.error == "false") {
|
|
$("#products").append(jsonData.result);
|
|
$("#products_part").show();
|
|
}
|
|
},
|
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
|
});
|
|
}
|
|
|
|
$('#id_order').change(function() {
|
|
var id_order = $(this).val();
|
|
$.ajax({
|
|
type: 'GET',
|
|
url: '{/literal}{$base_dir_ssl}{literal}modules/ant_support_form/ajax_support.php',
|
|
dataType: 'json',
|
|
data: {
|
|
id_order : id_order,
|
|
token : static_token
|
|
},
|
|
success: function(jsonData) {
|
|
$("#products_part").hide();
|
|
$("#products").empty();
|
|
if(jsonData.error == "false") {
|
|
$("#products").append(jsonData.result);
|
|
$("#products_part").show();
|
|
}
|
|
},
|
|
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to get order products \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
|
|
});
|
|
});
|
|
});
|
|
</script>{/literal}
|
|
{elseif $customerThread.id_product > 0}
|
|
<p class="text">
|
|
<label for="id_product">{l s='Product' mod='ant_support_form'}</label>
|
|
<input type="text" name="id_products[]" id="id_product" value="{$customerThread.id_product|intval}" readonly="readonly" />
|
|
</p>
|
|
{else}
|
|
<p class="text error cant-submit">
|
|
{l s='You have not yet ordered products from us' mod='ant_support_form'} - <a href="{$base_dir}" class="button">{l s='Home' mod='ant_support_form'}</a>
|
|
</p>
|
|
{/if}
|
|
{/if}
|
|
{/if}
|
|
<p class="select" style="display: none;">
|
|
<label for="id_contact">{l s='Subject Heading' mod='ant_support_form'}</label>
|
|
{if isset($customerThread.id_contact)}
|
|
{foreach from=$contacts item=contact}
|
|
{if $contact.id_contact == $customerThread.id_contact}
|
|
<input type="text" id="contact_name" name="contact_name" value="{$contact.name|escape:'htmlall':'UTF-8'}" readonly="readonly" />
|
|
<input type="hidden" name="id_contact" value="{$contact.id_contact}" />
|
|
{/if}
|
|
{/foreach}
|
|
</p>
|
|
{else}
|
|
<select id="id_contact" name="id_contact" onchange="showElemFromSelect('id_contact', 'desc_contact')">
|
|
<option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>
|
|
{foreach from=$contacts item=contact}
|
|
<option value="{$contact.id_contact|intval}" {if isset($smarty.post.id_contact) && $smarty.post.id_contact == $contact.id_contact}selected="selected"{/if}>{$contact.name|escape:'htmlall':'UTF-8'}</option>
|
|
{/foreach}
|
|
</select>
|
|
</p>
|
|
{/if}
|
|
{*{if $fileupload == 1}
|
|
<p class="text">
|
|
<label for="fileUpload">{l s='Attach File' mod='ant_support_form'}</label>
|
|
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
|
|
<input type="file" name="fileUpload" id="fileUpload" />
|
|
</p>
|
|
{/if}*}
|
|
{if isset($reasons) && !empty($reasons)}
|
|
<p class="select">
|
|
<label for="id_reason">{l s='Reason' mod='ant_support_form'}</label>
|
|
<select id="id_reason" name="id_reason">
|
|
<option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>
|
|
{foreach from=$reasons item=reason}
|
|
{if $reason->visible}
|
|
<option data-contact="{$reason->id_contact}" value="{$reason->id_reason}" {if isset($smarty.post.id_reason) && $smarty.post.id_reason == $reason->id_reason}selected="selected"{/if}>{$reason->title[$cookie->id_lang]}</option>
|
|
{/if}
|
|
{/foreach}
|
|
</select>
|
|
</p>
|
|
{elseif isset($id_reason)}
|
|
<input type="hidden" name='id_reason' value="{$id_reason}">
|
|
{/if}
|
|
<p class="textarea">
|
|
<label for="message">{l s='Message' mod='ant_support_form'}</label>
|
|
<textarea id="message" name="message">{if isset($message)}{$message|escape:'htmlall':'UTF-8'|stripslashes}{/if}</textarea>
|
|
</p>
|
|
<p class="submit">
|
|
<input type="submit" name="submitMessage" id="submitMessage" value="{l s='Send' mod='ant_support_form'}" class="button_large" onclick="$(this).hide();" />
|
|
</p>
|
|
</div>
|
|
</fieldset>
|
|
</form>
|
|
|
|
{literal}
|
|
<script>
|
|
$(function() {
|
|
if($('.cant-submit').length>0) {
|
|
$('#submitMessage').hide();
|
|
}
|
|
$('#id_reason option[data-contact!="'+ $("option:selected", $('#id_contact')).val()+'"]').each(function(index, el) {
|
|
$(this).hide();
|
|
});
|
|
$('#id_contact').change(function() {
|
|
$('#id_reason option[value!="0"]').each(function(index, el) {
|
|
if ($(this).data('contact') != $("option:selected", $('#id_contact')).val()) {
|
|
$(this).hide();
|
|
} else {
|
|
$(this).show();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
{/literal}
|
|
{/if}
|