update ant_support_form

This commit is contained in:
Marion Muszynski 2016-02-25 12:24:15 +01:00
parent 09ee75be23
commit af731eae69
3 changed files with 624 additions and 605 deletions

View File

@ -351,9 +351,9 @@ class AdminCustomerThreads extends AdminTab
(!empty($message['id_order']) AND empty($message['employee_name'])) (!empty($message['id_order']) AND empty($message['employee_name']))
? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />' ? '<b>'.$this->l('Order #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($message['id_order']).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_order']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: '' : ''
).( ).( // Override Antadis
(!empty($message['id_product']) AND empty($message['employee_name'])) (!empty($message['id_product']) AND empty($message['employee_name']))
? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminOrders&id_order='.(int)($id_order_product).'&vieworder&token='.Tools::getAdminToken('AdminOrders'.(int)(Tab::getIdFromClassName('AdminOrders')).(int)($cookie->id_employee)).'" title="'.$this->l('View order').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />' ? '<b>'.$this->l('Product #').'</b> <a href="index.php?tab=AdminCatalog&id_product='.(int)($message['id_product']).'&updateproduct&token='.Tools::getAdminToken('AdminCatalog'.(int)(Tab::getIdFromClassName('AdminCatalog')).(int)($cookie->id_employee)).'" title="'.$this->l('View product').'">'.(int)($message['id_product']).' <img src="../img/admin/search.gif" alt="'.$this->l('view').'" /></a><br />'
: '' : ''
).'<br /> ).'<br />
<form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post"> <form action="'.Tools::htmlentitiesutf8($_SERVER['REQUEST_URI']).'" method="post">
@ -546,6 +546,11 @@ class AdminCustomerThreads extends AdminTab
echo '</div>'; echo '</div>';
echo '<div style="float:left;margin-top:10px">';
foreach ($messages AS $message)
echo $this->displayMsg($message);
echo '</div><div class="clear">&nbsp;</div>';
if ($thread->id_customer) if ($thread->id_customer)
{ {
$customer = new Customer($thread->id_customer); $customer = new Customer($thread->id_customer);
@ -619,13 +624,9 @@ class AdminCustomerThreads extends AdminTab
</tr>'; </tr>';
echo '</table></div>'; echo '</table></div>';
} }
echo '</div>'; echo '</div><div class="clear">&nbsp;</div>';
} }
echo '<div style="float:left;margin-top:10px">';
foreach ($messages AS $message)
echo $this->displayMsg($message);
echo '</div><div class="clear">&nbsp;</div>';
} }
private function displayButton($content) private function displayButton($content)

View File

@ -27,18 +27,23 @@ if ($cookie->isLogged()) {
$date = explode(' ', $order->date_add); $date = explode(' ', $order->date_add);
$orders[$row['id_order']] = Tools::displayDate($date[0], $cookie->id_lang); $orders[$row['id_order']] = Tools::displayDate($date[0], $cookie->id_lang);
$tmp = $order->getProducts(); $tmp = $order->getProducts();
foreach ($tmp as $key => $val) foreach ($tmp as $key => $val) {
$products[$val['product_id']] = $val['product_name']; //$products[$val['product_id']] = $val['product_name'];
$products[$row['id_order']] = array(
'id' => $val['product_id'],
'name' => $val['product_name']
);
}
} }
$orderList = ''; $orderList = '';
foreach ($orders as $key => $val) { foreach ($orders as $key => $val) {
$orderList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >'.$key.' -- '.$val.'</option>'; $orderList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_order')) == $key ? 'selected' : '').' >'.$val.' -- '.$key.'</option>';
} }
$orderedProductList = ''; $orderedProductList = '';
foreach ($products as $key => $val) { foreach ($products as $key => $val) {
$orderedProductList .= '<option value="'.$key.'" '.((int)(Tools::getValue('id_product')) == $key ? 'selected' : '').' >'.$val.'</option>'; $orderedProductList .= '<option value="'.$val['id'].'" data-order="'.$key.'" '.((int)(Tools::getValue('id_product')) == $val['id'] ? 'selected' : '').' >'.$val['name'].'</option>';
} }
$smarty->assign('orderList', $orderList); $smarty->assign('orderList', $orderList);
$smarty->assign('orderedProductList', $orderedProductList); $smarty->assign('orderedProductList', $orderedProductList);
@ -283,5 +288,3 @@ require_once(dirname(__FILE__).'/../../header.php');
echo Module::display(dirname(__FILE__), 'support.tpl'); echo Module::display(dirname(__FILE__), 'support.tpl');
require_once(dirname(__FILE__).'/../../footer.php'); require_once(dirname(__FILE__).'/../../footer.php');

View File

@ -34,7 +34,7 @@
{if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)} {if !isset($customerThread.id_order) && isset($isLogged) && $isLogged == 1 && !empty($orderList)}
<p class="text"> <p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label> <label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
<select name="id_order" ><option value="0">{l s='-- Choose --' mod='ant_support_form'}</option>{$orderList}</select> <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)} {elseif !isset($customerThread.id_order) && !isset($isLogged)}
<p class="text"> <p class="text">
<label for="id_order">{l s='Order ID' mod='ant_support_form'}</label> <label for="id_order">{l s='Order ID' mod='ant_support_form'}</label>
@ -53,7 +53,7 @@
{if !isset($customerThread.id_product) && !empty($orderedProductList)} {if !isset($customerThread.id_product) && !empty($orderedProductList)}
<p class="text"> <p class="text">
<label for="id_product">{l s='Product' mod='ant_support_form'}</label> <label for="id_product">{l s='Product' mod='ant_support_form'}</label>
<select name="id_product" style="width:300px;"><option value="0">{l s='-- Choose --'}</option>{$orderedProductList}</select> <select name="id_product" id='id_product' style="width:300px;"><option value="0">{l s='-- Choose --'}</option>{$orderedProductList}</select>
</p> </p>
{elseif $customerThread.id_product > 0} {elseif $customerThread.id_product > 0}
<p class="text"> <p class="text">
@ -86,13 +86,13 @@
</select> </select>
</p> </p>
{/if} {/if}
{*{if $fileupload == 1} {if $fileupload == 1}
<p class="text"> <p class="text">
<label for="fileUpload">{l s='Attach File' mod='ant_support_form'}</label> <label for="fileUpload">{l s='Attach File' mod='ant_support_form'}</label>
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" /> <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
<input type="file" name="fileUpload" id="fileUpload" /> <input type="file" name="fileUpload" id="fileUpload" />
</p> </p>
{/if}*} {/if}
{if isset($reasons) && !empty($reasons)} {if isset($reasons) && !empty($reasons)}
<p class="select"> <p class="select">
<label for="id_reason">{l s='Reason' mod='ant_support_form'}</label> <label for="id_reason">{l s='Reason' mod='ant_support_form'}</label>
@ -137,6 +137,21 @@
} }
}); });
}); });
if ($('select#id_product').length>0) {
$('#id_product option[data-order!="'+ $("option:selected", $('#id_order')).val()+'"]').each(function(index, el) {
$(this).hide();
});
$('#id_order').change(function() {
$('#id_product option[value!="0"]').each(function(index, el) {
if ($(this).data('order') != $("option:selected", $('#id_order')).val()) {
$(this).hide();
} else {
$(this).show();
}
});
});
}
}); });
</script> </script>
{/literal} {/literal}