// Fix notifications

This commit is contained in:
Jerome Nadaud
2013-10-10 11:02:33 +02:00
parent 79b0a571c0
commit 067c78f868
3 changed files with 17 additions and 32 deletions
+6 -6
View File
@@ -120,8 +120,8 @@
<ul id="header_notifs_icon_wrapper">
{if {$show_new_orders} == 1}
<li id="orders_notif" class="dropdown" >
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">
<li id="orders_notif" class="dropdown" data-type="order">
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
<i class="icon-shopping-cart"></i>
<span id="orders_notif_number_wrapper" class="notifs_badge">
<span id="orders_notif_value">0</span>
@@ -150,8 +150,8 @@
</li>
{/if}
{if {$show_new_customers} == 1}
<li id="customers_notif" class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">
<li id="customers_notif" class="dropdown" data-type="customer">
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
<i class="icon-user"></i>
<span id="customers_notif_number_wrapper" class="notifs_badge">
<span id="customers_notif_value">0</span>
@@ -180,8 +180,8 @@
</li>
{/if}
{if {$show_new_messages} == 1}
<li id="customer_messages_notif" class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown">
<li id="customer_messages_notif" class="dropdown" data-type="customer_message">
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
<i class="icon-envelope"></i>
<span id="customer_messages_notif_number_wrapper" class="notifs_badge">
<span id="customer_messages_notif_value" >0</span>
+1 -1
View File
@@ -1503,7 +1503,7 @@ class AdminControllerCore extends Controller
/* Hooks are volontary out the initialize array (need those variables already assigned) */
$bo_color = empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color;
$this->context->smarty->assign(array(
'autorefresh_notifications' => Configuration::get('PS_ADMIN_REFRESH_NOTIFICATION'),
'autorefresh_notifications' => Configuration::get('PS_ADMINREFRESH_NOTIFICATION'),
'help_box' => Configuration::get('PS_HELPBOX'),
'round_mode' => Configuration::get('PS_PRICE_ROUND_MODE'),
'brightness' => Tools::getBrightness($bo_color) < 128 ? 'white' : '#383838',
+10 -25
View File
@@ -10,36 +10,21 @@ $(document).ready(function()
var wrapper_id = "";
var type = new Array();
$(".notifs").live("click", function(){
// Add class "open_notifs" to the clicked notification, remove the class from other notificationqs
$('.notifs').removeClass('open_notifs');
$(this).addClass('open_notifs');
wrapper_id = $(this).attr("id");
type = wrapper_id.split("s_notif")
$(".notifs").click(function(){
var wrapper_id = $(this).parent().attr("id");
$.post("ajax.php",
{
"updateElementEmployee" : "1", "updateElementEmployeeType" : type[0]
"updateElementEmployee" : "1",
"updateElementEmployeeType" : $(this).parent().attr('data-type')
}, function(data) {
if(data)
{
if(!$("#" + wrapper_id + "_wrapper").is(":visible"))
{
$(".notifs_wrapper").hide();
$("#" + wrapper_id + "_number_wrapper").hide();
$("#" + wrapper_id + "_wrapper").show();
}else
{
$("#" + wrapper_id + "_wrapper").hide();
}
$("#" + wrapper_id + "_value").html(0);
$("#" + wrapper_id + "_number_wrapper").hide();
}
});
});
$("#main").click(function(){
$(".notifs_wrapper").hide();
$('.notifs').removeClass('open_notifs');
});
// call it once immediately, then use setTimeout if refresh is activated
getPush(autorefresh_notifications);
@@ -66,7 +51,7 @@ function getPush(refresh)
html += "<small class='text-muted'>1 minute ago</small>";
html += "</span></a>";
});
if (json.order.total)
if (parseInt(json.order.total) > 0)
{
//$("#list_orders_notif").prev("p").hide();
$("#list_orders_notif").empty().append(html);
@@ -88,7 +73,7 @@ function getPush(refresh)
html += "<small class='text-muted'>1 minute ago</small>";
html += "</span></a>";
});
if (json.customer.total)
if (parseInt(json.customer.total) > 0)
{
//$("#list_customers_notif").prev("p").hide();
$("#list_customers_notif").empty().append(html);
@@ -111,7 +96,7 @@ function getPush(refresh)
html += "</span></a>";
});
if (json.customer_message.total)
if (parseInt(json.customer_message.total) > 0)
{
// $("#list_customer_messages_notif").prev("p").hide();
$("#list_customer_messages_notif").empty().append(html);