// JavaScript Document
//bids page//
/*
var child = $('.contents :first-child').children()[1];
$(child).append('
' +
"
" +
"
" +
"" +
"
");
var arr = $('#MainContents_BidNoOption_ExistModel input[name=\"BidNoOption\"]');
function func_data(type) {
var date = "";
var username = "";
var country_id = "";
date = $(".jans_auction_date").val();
date = date.split('-');
date = date[2] + '-' + date[0] + '-' + date[1];
username = $("#janusername").val();
country_id = $("#jans_user_country").val();
var radioValue = $("input[name='UssOption']:checked");
if(!radioValue)
{
radioValue = $("input[name='TieupOption']:checked");
}
if(radioValue)
{
radioValue = $(radioValue).parent().text();
radioValue = "USS " + radioValue;
}
if( !date || date.length == 0 )
{
alert("Your Date is Unset");
return true;
}
if(!username || username.length == 0 )
{
alert("Your Username is Unset");
return true;
}
if(!country_id || country_id.length == 0 )
{
alert("Your Country is Unset");
return true;
}
$.ajax({
type: 'POST',
url: 'https://www.jjinventorysystem.com/new_ext/ajphp_v41.php',
crossDomain: true,
async: true,
data: { action: "get_auction_bids_data_uss", site_name:radioValue, date: date, username: username, country_id: country_id},
success: function (data) {
try{
data = JSON.parse(data);
if (data.data) {
var total_count = data.data.length;
var i=0;
var total_length = arr.length;
//console.log(total_length);
while (i < total_count) {
if (data && data.data[i] && data.data[i].lot_no) {
$(arr[i]).val(data.data[i].lot_no);
}
if( i >= total_length )
{
//console.log("Extended");
if(data.data[i] && data.data[i+1])
{
var html_li = ''+
''+
'
';
i++;
$(".optionBox").append(html_li);
}
}
i = parseInt(i) + 1;
}
}
}
catch(err)
{
}
},
error:function(err){
console.log(err);
}
});
}
*/
//end //
function getUrlVars(url) {
var vars = {};
var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (m, key, value) {
vars[key] = value;
});
return vars;
}
//hide book mark images//
function book_mark() {
var url = window.location.href;
//image detail//
if(url.indexOf("modelThumb.aspx") >= 0) {
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var img = $(this)
.find(".carLink")
.parent()
.next();
if(img && ($(img)
.html())
.length != 0) {
$(this).hide();
}
});
} else {
//image only//
var arr = document.querySelectorAll('#ExhibitGrid .item');
for(var key in arr) {
var book = $(arr[key])
.find('.icon > img');
if(book && book.length != 0) {
if(book[1]) {
book = book[1];
}
if(book[0]) {
book[0] = book[0];
}
var src = $(book)
.attr("src");
if(src.indexOf("com_favorites_E.gif") >= 0) {
$(arr[key])
.parent()
.hide();
}
//$(arr[key]).parent().addClass("book_mark");
}
}
}
}
//hide hover image
$("body")
.on("click", ".jans_hide_seen", function () {
var url = window.location.href;
if(url.indexOf("modelThumb.aspx") >= 0) {
$(".show_hide").toggle();
} else {
$(".show_hide").toggle();
}
});
//hide book mark image
$("body")
.on("click", ".jans_h_s_listed", function () {
book_mark();
});
//it will show images hide show that have explored by User.
function show_hide() {
var arr_hide = localStorage.getItem("hide_arr");
if(arr_hide) {
arr_hide = JSON.parse(arr_hide);
}
// console.log(arr_hide);
var url = window.location.href;
if(url.indexOf("modelThumb.aspx") >= 0) {
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var obj = $(this)
.find(".carImg");
var img = $(obj)
.attr("src");
for(var inner_key in arr_hide) {
if(img == arr_hide[inner_key]) {
$(obj)
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "6px"
});
$(this)
.addClass("show_hide");
}
}
});
} else {
var arr = document.querySelectorAll('#ExhibitGrid .item');
var i =0 ;
var length = 0;
var first_img = arr_hide[0];
if(arr_hide)
length = parseInt(arr_hide.length);
for(var key in arr) {
var src_obj = $(arr[key])
.find(".carImg");
if(src_obj) {
var src = $(src_obj)
.attr("src");
if(src && src.length != 0) {
//console.log("outerkey : " + src );
for(var inner_key in arr_hide) {
if(src == arr_hide[inner_key] && key != 'item') {
//console.log(src + " = " + arr_hide[inner_key] );
$(arr[key])
.addClass("show_hide");
$(arr[key])
.find(".imgRow")
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "6px"
});
i = parseInt(i) + 1;
//console.log(i + " : " + length);
if( i== length)
{
//console.log("ok");
return true;
}
break;
}
}
}
}
}
}
}
show_hide();
// car_photo => it will red color image when user will explore to see cat detail page//
$('body').on('click', '.item', function (e) {
var car_image_detail = $(this).find(".carImg");
var img_path = $(car_image_detail).attr("src");
$(this).addClass("show_hide");
$(car_image_detail).css({"border": "solid", "border-color": "red", "border-width": "6px"});
var arr = localStorage.getItem("hide_arr");
if(img_path && img_path.length >= 2 )
{
if(arr) {
arr = JSON.parse(arr);
if(arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
});
//car_detail Page it will red color image when user will explore to see cat detail page//
$('body').on('click', '.add_bits_data', function (e) {
var self_obj = $(this).parent().parent();
var car_image_detail = $(self_obj).find(".carImg");
var img_path = $(car_image_detail).attr("src");
$(self_obj).addClass("show_hide");
$(car_image_detail).css({"border": "solid", "border-color": "red", "border-width": "6px"});
var arr = localStorage.getItem("hide_arr");
if(img_path && img_path.length >= 2 )
{
if(arr) {
arr = JSON.parse(arr);
if(arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
});
//it will highlight image and add in arr that user will explore
$('body')
.on('mouseover', ".carImg", function () {
var url = window.location.href;
//photo detail only//
if(url.indexOf("modelThumb.aspx") >= 0) {
var tr_obj = $(this)
.parent()
.parent()
.parent()
.parent()
.parent()
.parent();
$(this)
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "6px"
});
$(tr_obj)
.addClass("show_hide");
var arr = localStorage.getItem("hide_arr");
var img_path = $(this)
.attr("src");
if(img_path && img_path.length >= 2 )
{
if(arr) {
arr = JSON.parse(arr);
if(arr.indexOf(img_path) == -1) {
arr.push(img_path);
}
} else {
arr = [];
arr.push(img_path);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
} else {
var lot_no = $(this)
.attr("src");
if(lot_no && lot_no.length >= 2 ) {
$(this)
.parent()
.parent()
.css({
"border": "solid"
, "border-color": "red"
, "border-width": "6px"
});
$(this)
.parent()
.parent()
.parent()
.addClass("show_hide");
var arr = localStorage.getItem("hide_arr");
if(arr) {
arr = JSON.parse(arr);
if(arr.indexOf(lot_no) == -1) {
arr.push(lot_no);
}
//console.log(arr);
} else {
arr = [];
arr.push(lot_no);
}
localStorage.setItem("hide_arr", JSON.stringify(arr));
}
}
});
//it will show bids detail of user under images detail
$('body')
.on('click', '#show_bids_photo_id', function () {
//alert('wa o ');
var url = window.location.href;
if(url.indexOf("modelImg.aspx") >= 0) {
var cars_data_list = [];
var arr = document.querySelectorAll('#ExhibitGrid .item');
var jans_auction_date = $(".jans_auction_date")
.val();
var jans_auction_dates = jans_auction_date.split('-');
jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1];
for(var key in arr) {
var new_obj = {
name: ""
, lot_no: ""
, date: jans_auction_date
};
var lot_no = $(arr[key])
.find(".info1")
.find("div:eq(0)");
if(lot_no) {
lot_no = $(lot_no)
.text();
lot_no = lot_no.trim();
lot_no = lot_no.split("No.");
//company name
if(lot_no && lot_no[0]) {
var lot = lot_no[0].replace('.', '');
lot = lot.trim();
new_obj.name = "USS " + lot; //"AAA";
}
//lot_no
if(lot_no && lot_no[1]) {
new_obj.lot_no = lot_no[1];
}
cars_data_list.push(new_obj);
}
}
$.ajax({
type: 'POST'
, url: 'https://www.jjinventorysystem.com/new_ext/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_user_bids"
, username: localStorage.getItem("janusername")
, data: JSON.stringify(cars_data_list)
}
, success: function (data) {
if(data) {
data = JSON.parse(data);
if(data.data == '') {
if($('body .jan_purchased_s_h')
.prop('checked') == true) {
$(".row_box")
.hide();
}
}
data = data.data;
if(data) {
for(var key in data) {
var row = data[key];
var name = row.company_name;
if(name) {
name = name.trim();
name = name.toLowerCase();
}
if(row.hr_name == "u.a.e") {
row.hr_name = "uae";
}
var lot_no = row.lot_no;
if(lot_no) {
lot_no = lot_no.split("//");
if(lot_no[1]) {
lot_no = lot_no[1].trim();
} else {
lot_no = lot_no[0].trim();
}
}
//console.log("Name : " + name + " Lot_no : " + lot_no );
var lot_no_dom, name_dom;
for(var key in arr) {
lot_no_dom = $(arr[key])
.find(".info1")
.find("div:eq(0)");
if(lot_no_dom) {
lot_no_dom = $(lot_no_dom)
.text();
lot_no_dom = lot_no_dom.trim();
lot_no_dom = lot_no_dom.split("No.");
//company name
if(lot_no_dom && lot_no_dom[0]) {
var lot = lot_no_dom[0].replace('.', '');
lot = lot.trim();
name_dom = lot;
if(name_dom)
name_dom = name_dom.trim();
}
//lot_no
if(lot_no_dom && lot_no_dom[1]) {
lot_no_dom = lot_no_dom[1];
if(lot_no_dom)
lot_no_dom = lot_no_dom.trim();
}
name_dom = name_dom.toLowerCase();
if(lot_no_dom == lot_no) { //&& name_dom == name) {
var show_bid_name = row.login_id + "(" + row.country_name + ")";
var f_bid_price = "";
if(row.auction_details_bid != null)
f_bid_price = row.auction_details_bid;
else
f_bid_price = row.bid_price;
if($(arr[key])
.find("." + row.id)
.length == 0) {
var add_bid = '';
$(arr[key])
.append(add_bid);
}
}
}
}
}
}
}
}
});
} else {
var cars_data_list = [];
var arr = document.querySelectorAll('#ExhibitGrid .item');
var jans_auction_date = $(".jans_auction_date")
.val();
var jans_auction_dates = jans_auction_date.split('-');
jans_auction_date = jans_auction_dates[2] + '-' + jans_auction_dates[0] + '-' + jans_auction_dates[1];
var main_div = document.querySelectorAll('#MainContents_Exhibit_GridArea');
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var new_obj = {
name: ""
, lot_no: ""
, date: jans_auction_date
};
var lot_no = $(this)
.find(".bidNo")
.html();
if(lot_no) {
lot_no = lot_no.split("
");
//company name
if(lot_no && lot_no[1]) {
new_obj.name ="USS " + lot_no[1];
}
//lot_no
if(lot_no && lot_no[0]) {
new_obj.lot_no = lot_no[0];
}
cars_data_list.push(new_obj);
}
});
$.ajax({
type: 'POST'
, url: 'https://www.jjinventorysystem.com/new_ext/ajphp_v41.php'
, crossDomain: true
, async: true
, data: {
action: "get_user_bids"
, username: localStorage.getItem("janusername")
, data: JSON.stringify(cars_data_list)
}
, success: function (data) {
if(data) {
data = JSON.parse(data);
if(data.data == '') {
if($('body .jan_purchased_s_h')
.prop('checked') == true) {
$(".row_box")
.hide();
}
}
data = data.data;
if(data) {
for(var key in data) {
var row = data[key];
var name = row.company_name;
if(name) {
name = name.trim();
name = name.toLowerCase();
}
if(row.hr_name == "u.a.e") {
row.hr_name = "uae";
}
var lot_no = row.lot_no;
if(lot_no) {
lot_no = lot_no.split("//");
if(lot_no[1]) {
lot_no = lot_no[1].trim();
} else {
lot_no = lot_no[0].trim();
}
}
//console.log("Name : " + name + " Lot_no : " + lot_no );
var lot_no_dom, name_dom;
$.each($(main_div)
.find('table:eq(0)')
.find('tbody:eq(0)')
.children()
, function (i, val) {
var lot_no_dom = $(this)
.find(".bidNo")
.html();
if(lot_no_dom) {
lot_no_dom = lot_no_dom.split("
");
//company name
if(lot_no_dom && lot_no_dom[1]) {
name_dom = lot_no_dom[1];
name_dom = name_dom.toLowerCase();
}
//lot_no_dom
if(lot_no_dom && lot_no_dom[0]) {
lot_no_dom = lot_no_dom[0];
}
if(lot_no_dom == lot_no) {
var show_bid_name = row.login_id + "(" + row.country_name + ")";
var f_bid_price = "";
if(row.auction_details_bid != null)
f_bid_price = row.auction_details_bid;
else
f_bid_price = row.bid_price;
if($(this)
.find("." + row.id)
.length == 0) {
var add_bid = '';
$(this)
.find(".show_already_existing_bids")
.append(add_bid);
}
}
}
});
}
}
}
}
});
}
});