Current bid and time status does not automatically update - You must refresh your page frequently to stay updated
Review your bid and press the Confirm Your Bid button below. Important: By confirming your bid, you are agreeing to purchase the item listed below if you are the winning bidder.
You haven't placed any bids.
');
} else {
$('.ButtonContainer').prepend('');
}
$('.btnSaveWatchedItems').click(function () {
SaveWatchedItems();
return false;
});
$('.btnPlaceBids').click(function () {
if ($('#ItemListingGrid input[name="NextBidBox"]').filter(function () { return this.value > 0; }).length < 1) {
$("#NoBidsPlacedDialog").dialog('open');
return false;
}
$('#ConfirmBidsBidList').empty();
$('#ItemListingGrid input[name="NextBidBox"]').filter(function () { return this.value > 0; }).each(function () {
var BP = parseFloat($(this).attr('BuyersPremium')) * .01;
var bid = parseFloat($(this).val());
var nextBid = parseFloat($(this).attr('NextBidAmount'));
var bidWithBP = (bid * BP) + bid;
var itemLine = '
';
itemLine = itemLine + '
' + $(this).attr('Description') + ' (' + $(this).attr('Itemcode') + ')' + '
';
itemLine = itemLine + '
';
itemLine = itemLine + 'Your Maximum Bid: ' + '' + CurrencyFormat(bid) + '';
itemLine = itemLine + ' (' + CurrencyFormat(bidWithBP) + " including Buyer's Premium" + ')';
itemLine = itemLine + '
';
if (bid < nextBid) {
itemLine = itemLine + '
';
itemLine = itemLine + 'Your bid did not meet the minimum next bid for this item (' + '' + CurrencyFormat(nextBid) + '' + ').';
itemLine = itemLine + '
';
itemLine = itemLine + 'This bid will not be placed.';
itemLine = itemLine + '
';
}
itemLine = itemLine + '
';
$('#ConfirmBidsBidList').append(itemLine);
});
$("#ConfirmBids").dialog('open');
return false;
});
}
});
function LoadItemDataNow() {
var t = 267;
$.ajax({
type: 'POST',
url: '/Auction/CategoryItemListJson',
contentType: "application/json",
data: JSON.stringify({ Id: t}),
error: function (result) { },
success: function (result) {
_rowSet = result;
DisplayItemListingGrid();
}
});
}
function DescriptionCompareAsc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = a.Description;
var bPrefix = b.Description;
if (aPrefix > bPrefix) {
return 1;
}
if (bPrefix > aPrefix) {
return -1;
}
}
function DescriptionCompareDesc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = a.Description;
var bPrefix = b.Description;
if (aPrefix > bPrefix) {
return -1;
}
if (bPrefix > aPrefix) {
return 1;
}
}
function NumberBidCompareAsc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = parseInt(a.NumberOfBids);
var bPrefix = parseInt(b.NumberOfBids);
if (aPrefix > bPrefix) {
return 1;
}
if (bPrefix > aPrefix) {
return -1;
}
}
function NumberBidCompareDesc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = parseInt(a.NumberOfBids);
var bPrefix = parseInt(b.NumberOfBids);
if (aPrefix > bPrefix) {
return -1;
}
if (bPrefix > aPrefix) {
return 1;
}
}
function ValueCodeCompareAsc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = a.ValueCode;
var bPrefix = b.ValueCode;
if (aPrefix > bPrefix) {
return 1;
}
if (bPrefix > aPrefix) {
return -1;
}
}
function ValueCodeCompareDesc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = a.ValueCode;
var bPrefix = b.ValueCode;
if (aPrefix > bPrefix) {
return -1;
}
if (bPrefix > aPrefix) {
return 1;
}
}
function ItemCodeCompareAsc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = parseInt(a.ItemcodePrefix);
var bPrefix = parseInt(b.ItemcodePrefix);
if (aPrefix > bPrefix) {
return 1;
}
if (bPrefix > aPrefix) {
return -1;
}
if (a.Itemcode > b.Itemcode) {
return 1;
}
if (b.Itemcode > a.Itemcode) {
return -1;
}
}
function ItemCodeCompareDesc(a, b) {
if (!a.IsBiddingActive && b.IsBiddingActive) {
return 1;
}
else if (a.IsBiddingActive && !b.IsBiddingActive) {
return -1;
}
var aPrefix = parseInt(a.ItemcodePrefix);
var bPrefix = parseInt(b.ItemcodePrefix);
if (aPrefix > bPrefix) {
return -1;
}
if (bPrefix > aPrefix) {
return 1;
}
if (a.Itemcode > b.Itemcode) {
return -1;
}
if (b.Itemcode > a.Itemcode) {
return 1;
}
}
function WinningBidCompareAsc(a, b) {
var field = "CurrentWinningBid";
return BaseItemCompareAsc(a, b, field);
}
function WinningBidCompareDesc(a, b) {
var field = "CurrentWinningBid";
return BaseItemCompareDesc(a, b, field);
}
function TimeLeftCompareAsc(a, b) {
var field = "TimeLeft";
return BaseItemCompareAsc(a, b, field);
}
function TimeLeftCompareDesc(a, b) {
var field = "TimeLeft";
return BaseItemCompareDesc(a, b, field);
}
function BaseItemCompareAsc(a, b, field) {
if (a.IsBiddingActive && !b.IsBiddingActive) { return -1; }
if (!a.IsBiddingActive && b.IsBiddingActive) { return 1; }
if (b[field] == null) return 1;
if (a[field] < b[field]) return -1;
if (a[field] > b[field]) return 1;
if (field == "Itemcode") return 0;
return ItemCodeCompareAsc(a, b);
}
function BaseItemCompareDesc(a, b, field) {
if (a.IsBiddingActive && !b.IsBiddingActive) { return -1; }
if (!a.IsBiddingActive && b.IsBiddingActive) { return 1; }
if (a[field] == null) return 1;
if (a[field] > b[field]) return -1;
if (a[field] < b[field]) return 1;
if (field == "Itemcode") return 0;
return ItemCodeCompareDesc(a, b);
}
function DisplayItemListingGrid(itemsPerPage) {
if (_fromTopList == 'Y') {
$('#ItemListingGrid').DiamondGridView({
rowOrientation: 'auto',
disableColumnHeadersInVerticalView: false,
columns: _columnsItemListing,
rows: _rowSet,
rowsPerPage: 100,
showPager: false,
pagerPosition: 'both',
startingSortCol: 'CurrentWinningBid',
startingSortDir: 'desc',
mobileStartingSortCol: 'CurrentWinningBid',
mobileStartingSortDir: 'desc',
renderCompleteCallback: ItemListingGridRenderComplete,
enableBrowserPageHistory: true
});
} else {
$('#ItemListingGrid').DiamondGridView({
rowOrientation: 'auto',
disableColumnHeadersInVerticalView: false,
columns: _columnsItemListing,
rows: _rowSet,
rowsPerPage: itemsPerPage,
showPager: true,
pagerPosition: 'both',
//startingSortCol: _fromRankable == 'Y' ? 'Rank' : 'Itemcode',
startingSortCol: 'ItemcodeFull',
startingSortDir: 'asc',
mobileStartingSortCol: 'ItemcodeFull',
mobileStartingSortDir: 'asc',
renderCompleteCallback: ItemListingGridRenderComplete,
enableBrowserPageHistory: true
});
}
}
function ItemListingGridRenderComplete() {
if (_rowSet.length < 1) {
$('#ItemListingGrid tbody').empty().append('
No items to show. |
');
}
if ('N' == 'Y' && !_gridEventsMapped) {
_gridEventsMapped = true;
$('select.dgv-rowPageOptionSelect').change(function() {
SaveItemsPerPagePreferences($('select.dgv-rowPageOptionSelect').val());
_itemListingRowsToDisplay = $('select.dgv-rowPageOptionSelect').val();
});
}
if ('N' == 'Y') {
$('#ItemListingGrid tfoot .FooterButtonRow').remove();
$('#ItemListingGrid thead .HeaderButtonRow').remove();
}
ReToolTip();
SetUrl();
}
function NumOfValidBids() {
var totalValid = 0;
$('#ItemListingGrid input[name="NextBidBox"]').filter(function () { return this.value > 0; }).each(function () {
var bid = parseFloat($(this).val());
var nextBid = parseFloat($(this).attr('NextBidAmount'));
if (bid >= nextBid) { totalValid += 1; }
});
return totalValid;
}
function SaveWatchedItems() {
var savedItems = new Array();
$('#ItemListingGrid input[name="WatchItems"]:checked').each(function () { savedItems.push($(this).val()); });
if (savedItems.length > 0) {
$.ajax({
type: 'POST',
url: '/Account/SaveWatchedItems',
data: JSON.stringify({ items: savedItems }),
contentType: "application/json",
error: function (result) {
NotifyError("Error saving watched items.");
},
success: function (result) {
if (result == "Failure") {
} else {
$('#ItemListingGrid input[name="WatchItems"]').attr('checked', false);
NotifySuccess("Watched Items Saved.");
}
}
});
}
}
function SavePlacedBids() {
var bids = new Array();
$('#ItemListingGrid input[name="NextBidBox"]').filter(function () { return this.value > 0; }).each(function () { bids.push({ AuctionItemId: $(this).attr('auctionitemid'), BidAmount: $(this).val() }); });
if (bids.length > 0) {
$.ajax({
type: 'POST',
url: '/Auction/SaveBids',
data: JSON.stringify({ Results: bids }),
contentType: "application/json",
error: function (result) {
NotifyError("Error saving bids.");
},
success: function (result) {
//console.log(result);
if (result == "Failure") {
NotifyError("Not All Bids Were Executed. Please Check My Bids Page.");
} else {
var allSuccess = true;
$('#ItemListingGrid input[name="NextBidBox"]').val('');
var scrollToId = "";
// Adjust the grids data model
for (rs = 0; rs < _rowSet.length; rs++) { // Go over the current rowset
for (br = 0; br < result.Results.length; br++) { // Go over the bid results
if (_rowSet[rs].Id == result.Results[br].LineModel.Id) {
_rowSet[rs].NextBidAmount = result.Results[br].LineModel.NextBidAmount;
_rowSet[rs].CurrentWinningBid = result.Results[br].LineModel.CurrentWinningBid;
_rowSet[rs].HasBid = result.Results[br].LineModel.HasBid;
_rowSet[rs].IsWinningBidder = result.Results[br].LineModel.IsWinningBidder;
if (!result.Results[br].LineModel.IsWinningBidder) {
if (scrollToId == "") {
scrollToId = result.Results[br].LineModel.Itemcode + "";
}
allSuccess = false;
}
}
}
}
$("#ItemListingGrid").DiamondGridView('refreshData', _rowSet);
var resultContent = FormatBidResults(result.Results);
if (allSuccess) {
NotifySuccess("Bids Successfully Placed", resultContent);
}
else {
if (scrollToId != "") {
var scrollToItem = null;
$(".GridListing_ItemNumberColumn").each(function () {
if ($(this).text() == scrollToId) {
scrollToItem = $(this);
}
});
if (scrollToItem != null) {
$('html, body').animate({
scrollTop: scrollToItem.offset().top
}, 1000);
}
}
NotifyWarning("Bids Submitted", resultContent);
}
}
LoadItemDataNow();
}
});
}
}
function FormatBidResults(rows) {
var winningResultSet = $("
You are now the winning bidder for these items:
");
var losingResultSet = $("
You have been outbid on these items:
");
var couldNotPlaecResultSet = $("
The follow bids could not be placed:
");
var hasWinningItems = false;
var hasLosingItems = false;
var hasCouldNotPlaceItems = false;
for (var i = 0; i < rows.length; i++) {
console.log(rows[i])
if (rows[i].LineModel.IsWinningBidder) {
hasWinningItems = true;
winningResultSet.append($("
").append(rows[i].LineModel.DescriptionSafe));
}
else if (!rows[i].Successful) {
hasCouldNotPlaceItems = true;
couldNotPlaecResultSet.append($("
").append(rows[i].LineModel.DescriptionSafe));
}
else {
hasLosingItems = true;
losingResultSet.append($("
").append(rows[i].LineModel.DescriptionSafe));
}
}
var resultSet = $("
");
if (hasWinningItems) {
resultSet.append(winningResultSet);
}
if (hasLosingItems) {
resultSet.append(losingResultSet);
}
if (hasCouldNotPlaceItems) {
resultSet.append(couldNotPlaecResultSet);
}
return resultSet.html();
}
function CurrentBidFormatter(row, cell, value, tableRow) {
if (row.IsBiddingActive == false) {
data = CurrencyFormatter(row, cell, row.CurrentWinningBidWithBP);
} else {
data = CurrencyFormatter(row, cell, value);
}
if (row.IsWinningBidder) {
data = data + '
';
if (row.IsBiddingActive) { data = data + '[Winning]'; }
else { data = data + '[Won]'; }
data = data + '
';
$(tableRow).addClass('WinningRow');
} else if (row.HasBid) {
data = data + '
[Outbid]
';
$(tableRow).addClass('OutbidRow');
data = data + '
';
}
return data;
}
function IsLastBidFormatter(row, cell, value) {
//console.log(row);
if (row.IsWinningBidder) {
return "You are winning";
} else {
return null;
}
}
function DescriptionFormatter(row, cell, value) {
var data = '';
data = data + '