$(function(){
$('.contentWrapper').show();
$('.contentLoader').hide();
var url = location.href;
setInterval(function(){
if(url.indexOf('orderManagement') > -1){
var $orderNumbers = $(".orderNumber");
var styleClass = "";
var prevClass = "";
var $prevItem = "";
var $item = "";
$orderNumbers.first().parents('tr').addClass('red');
for(var i = 1, ii = $orderNumbers.length; i < ii; i++){
$prevItem = $orderNumbers.eq(i-1).parents('tr');
prevClass = $prevItem.attr('class');
$item = $orderNumbers.eq(i);
if($item.text() != $orderNumbers.eq(i-1).text()){
styleClass = $prevItem.hasClass('red') ? 'green' : 'red';
}
$item.parents('tr').addClass(styleClass);
}
}
}, 500);
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
$('#menuContainer').find('.menuItem').bind('click', function() {});
}
var $sellerAnalyticsIcon = $("#searchResultPanel").find(".ui-icon-seller-analytics");
$sellerAnalyticsIcon.live({
mouseenter: function(e){
var $this = $(this);
$this.attr("data-mouseover", "on");
var showTooltip = function (viewCount) {
$this.parent().find(".tooltipContainer").remove();
$this.attr("data-viewcount", viewCount);
var tooltipMarkup = '
';
if($this.attr("data-mouseover") == "on"){
$(tooltipMarkup).insertAfter($this).show();
$this.removeClass("disable");
}
};
var viewCount = $this.attr("data-viewcount");
if((viewCount || viewCount === "0") && !$this.hasClass("disable")){
showTooltip(0);
}
else {
$this.addClass("disable");
$.ajax({
url: "/selleroffice/app/analytics/productViewCount?productId=" + $this.data("productid"),
method: "get",
global: false,
dataType: "json",
success: function(response){
showTooltip(response.viewCount);
}
})
}
},
mouseleave: function(){
var $this = $(this);
$this.parent().find(".tooltipContainer").remove();
$this.attr("data-mouseover", "off");
}
});
$('#header .myNotificationsHolder:not(.disabled)').bind('click', function(){
$.ajax({
url: "/selleroffice/app/notifications/ajax",
success : function(result){
$('.myNotificationsHolder .notices').empty().removeClass('hidden');
$('.myNotificationsHolder .notices').html(result);
}
});
});
$('#header .notices').mouseleave(function(){
$(this).addClass('hidden')
});
$(document).on('click', '#readAllNot', function(){
$.ajax({
url: "/selleroffice/app/notifications/markAllAsRead",
success : function(result){
$('.notices').empty().removeClass('hidden');
$('.notices').html(result);
}
});
});
$(document).on('click', '.notList li.notItem', function(){
var dataId = $(this).data('id');
$.ajax({
url: "/selleroffice/app/notifications/markAsRead-" + dataId,
dataType : 'json',
success : function(result){
if(result['url']){
window.location.href = result['url'];
}
}
});
})
$('.sppPanelTable .closeBtn').click(function(){
$('.sppPanelTable').fadeOut(500)
});
});
$(document).ready(function() {
$("#printAgreementAndIssuanceButton").click(function() {
$('#agreementAndIssuanceContent').printElement({heading:true, pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css'], printBodyOptions:
{
styleToAdd:' overflow:hidden;'
}
});
});
$("#printCommissionContractButton").click(function() {
$('#commissionContractContent').printElement({heading:true, pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css'], printBodyOptions:
{
styleToAdd:' overflow:hidden;'
}
});
});
$("#printStudioReservationContractButton").click(function() {
$('#studioReservationContractContent').printElement({heading:true, pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css'], printBodyOptions:
{
styleToAdd:' overflow:hidden;'
}
});
});
});
function printElemOrderDetail(){
$("#printOrderDetailButton").click(function() {
$('#singleOrderOutputPanel').printElement({pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css'] , printBodyOptions:
{
styleToAdd:' overflow:hidden;'
}
});
});
}
function printElemBillingDetail(){
$("#printBillingDetailButton").click(function() {
$('#billingDetailContent').printElement({pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css']
});
});
}
function printElemOrderBillingDetail(){
$("#printOrderBillingDetailButton").click(function() {
$('#orderBillingDetailContent').printElement({pageTitle: '',
overrideElementCSS: ['/selleroffice/javax.faces.resource/theme.css.xhtml?ln=primefaces-aristo',
'/selleroffice/javax.faces.resource/layout.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/theme.css.xhtml?ln=css',
'/selleroffice/javax.faces.resource/primefaces.css.xhtml?ln=primefaces',
'/selleroffice/javax.faces.resource/print.css.xhtml?ln=css'] , printBodyOptions:
{
styleToAdd:' overflow:hidden;'
}
});
});
}