{"id":7941,"date":"2025-08-05T17:22:59","date_gmt":"2025-08-05T20:22:59","guid":{"rendered":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/?p=7941"},"modified":"2025-08-09T14:40:54","modified_gmt":"2025-08-09T17:40:54","slug":"toros-angus-lote-02","status":"publish","type":"post","link":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/toros-angus-lote-02\/","title":{"rendered":"Toros Angus Lote 02"},"content":{"rendered":"\r\n<div class=\"vicino-auction-container\" data-lot-id=\"7941\">\r\n    <h2 class=\"vicino-auction-title\">Toros Angus Lote 02<\/h2>\r\n\r\n    <div class=\"vicino-auction-details\">\r\n                    <div class=\"vicino-auction-status vicino-auction-inactive\">\r\n                <span class=\"status-icon\">\ud83c\udfc1<\/span> Subasta Finalizada            <\/div>\r\n        \r\n        <!-- Auction Time Information -->\r\n        <div class=\"vicino-auction-time-info\">\r\n            \r\n            <div class=\"vicino-auction-dates\">\r\n                \r\n                <div class=\"vicino-auction-start-date\">\r\n                    <span class=\"label\">Fecha de Inicio:<\/span>\r\n                    <span class=\"date\">agosto 11, 2025 10:00 am<\/span>\r\n                <\/div>\r\n\r\n                <div class=\"vicino-auction-end-date\">\r\n                    <span class=\"label\">Fecha de Finalizaci\u00f3n:<\/span>\r\n                    <span class=\"date\" id=\"vicino-end-date\" data-end=\"2025-08-14 00:00:00\">\r\n                        agosto 13, 2025 9:00 pm                    <\/span>\r\n                                    <\/div>\r\n            <\/div>\r\n\r\n                    <\/div>\r\n\r\n        <div class=\"vicino-auction-price-info\">\r\n            <div class=\"vicino-auction-starting-price\">\r\n                <span class=\"label\">Precio Inicial:<\/span>\r\n                <span class=\"price\">7.000.000<\/span>\r\n            <\/div>\r\n\r\n            <div class=\"vicino-auction-current-bid\">\r\n                <span class=\"label\">Preoferta Actual:<\/span>\r\n                <span class=\"price\">8.500.000<\/span>\r\n            <\/div>\r\n        <\/div>\r\n\r\n        <!-- Bid History Table -->\r\n        <div class=\"vicino-auction-bid-history\">\r\n            <h3>Historial de Preofertas<\/h3>\r\n                            <div class=\"vicino-bid-history-table-container\">\r\n                    <table class=\"vicino-bid-history-table\">\r\n                        <thead>\r\n                            <tr>\r\n                                <th>Usuario<\/th>\r\n                                <th>Monto de Preoferta<\/th>\r\n                                <th>Fecha<\/th>\r\n                            <\/tr>\r\n                        <\/thead>\r\n                        <tbody>\r\n                                                        <tr>\r\n                                <td>angu<\/td>\r\n                                <td class=\"bid-amount\">8.500.000<\/td>\r\n                                <td>agosto 13, 2025 7:13 am<\/td>\r\n                            <\/tr>\r\n                                                        <tr>\r\n                                <td>alejandro-arbelbide<\/td>\r\n                                <td class=\"bid-amount\">8.000.000<\/td>\r\n                                <td>agosto 13, 2025 12:23 am<\/td>\r\n                            <\/tr>\r\n                                                        <tr>\r\n                                <td>angu<\/td>\r\n                                <td class=\"bid-amount\">7.500.000<\/td>\r\n                                <td>agosto 12, 2025 8:49 pm<\/td>\r\n                            <\/tr>\r\n                                                        <tr>\r\n                                <td>angu<\/td>\r\n                                <td class=\"bid-amount\">7.000.000<\/td>\r\n                                <td>agosto 11, 2025 8:26 pm<\/td>\r\n                            <\/tr>\r\n                                                    <\/tbody>\r\n                    <\/table>\r\n                <\/div>\r\n                    <\/div>\r\n\r\n            <\/div>\r\n<\/div>\r\n\r\n<script>\r\njQuery(document).ready(function($) {\r\n    \/\/ Format number with thousand separators\r\n    function formatNumber(num) {\r\n        return num.toString().replace(\/\\B(?=(\\d{3})+(?!\\d))\/g, \".\");\r\n    }\r\n\r\n    \/\/ Parse formatted number back to raw number\r\n    function parseFormattedNumber(str) {\r\n        return parseInt(str.replace(\/\\.\/g, ''));\r\n    }\r\n\r\n    \/\/ Initialize with minimum value\r\n    var minBid = parseInt($('#bid_amount').data('min'));\r\n    $('#bid_amount').val(formatNumber(minBid));\r\n    $('#bid_amount_raw').val(minBid);\r\n\r\n    \/\/ Format the input when user types\r\n    $('#bid_amount').on('input', function() {\r\n        var rawValue = parseFormattedNumber($(this).val());\r\n        if (!isNaN(rawValue)) {\r\n            $('#bid_amount_raw').val(rawValue);\r\n            $(this).val(formatNumber(rawValue));\r\n        }\r\n    });\r\n\r\n    \/\/ Unified countdown timer functionality\r\n    function updateCountdown() {\r\n        $('.countdown-timer').each(function() {\r\n            var $timer = $(this);\r\n            var $countdown = $timer.closest('#vicino-countdown');\r\n            var endDateStr = $countdown.length > 0 ? $countdown.data('end') : $timer.data('end');\r\n\r\n            if (!endDateStr) {\r\n                $timer.html('Error: No end date set');\r\n                return;\r\n            }\r\n\r\n            try {\r\n                \/\/ Parse end date string stored in UTC - browser will convert to local timezone automatically\r\n                var endDate = new Date(endDateStr + 'Z'); \/\/ Treat stored date as UTC, browser handles timezone conversion\r\n                var now = new Date();\r\n\r\n                \/\/ Calculate time difference in milliseconds\r\n                var diff = endDate.getTime() - now.getTime();\r\n\r\n                if (diff <= 0) {\r\n                    $timer.html('Subasta finalizada');\r\n                    \/\/ Reload the page only once when the auction ends\r\n                    var lotId = $('.vicino-auction-container').data('lot-id') || 'default';\r\n                    var reloadKey = 'auctionEndReloaded_' + lotId;\r\n\r\n                    if (!sessionStorage.getItem(reloadKey)) {\r\n                        console.log('Auction ended, reloading page...');\r\n                        sessionStorage.setItem(reloadKey, 'true');\r\n                        setTimeout(function() {\r\n                            location.reload();\r\n                        }, 2000); \/\/ Wait 2 seconds then reload\r\n                    }\r\n                    return;\r\n                }\r\n\r\n                \/\/ Calculate time components\r\n                var days = Math.floor(diff \/ (1000 * 60 * 60 * 24));\r\n                var hours = Math.floor((diff % (1000 * 60 * 60 * 24)) \/ (1000 * 60 * 60));\r\n                var minutes = Math.floor((diff % (1000 * 60 * 60)) \/ (1000 * 60));\r\n                var seconds = Math.floor((diff % (1000 * 60)) \/ 1000);\r\n\r\n                \/\/ Format time string\r\n                var timeString = '';\r\n                if (days > 0) timeString += days + ' d\u00edas ';\r\n                timeString += hours.toString().padStart(2, '0') + ':' +\r\n                             minutes.toString().padStart(2, '0') + ':' +\r\n                             seconds.toString().padStart(2, '0');\r\n\r\n                $timer.html(timeString);\r\n\r\n                \/\/ Highlight countdown if less than 5 minutes remaining\r\n                if ($countdown.length > 0 && diff <= 5 * 60 * 1000) {\r\n                    $countdown.addClass('vicino-countdown-ending');\r\n                }\r\n            } catch (e) {\r\n                console.error('Error in countdown calculation:', e);\r\n                $timer.html('Error en el c\u00e1lculo del tiempo');\r\n            }\r\n        });\r\n    }\r\n\r\n    \/\/ Update countdown every second if there are any timers and the auction is not completed\/expired\r\n    var auctionStatus = 'completed';\r\n    if ($('.countdown-timer').length > 0 && auctionStatus !== 'completed' && auctionStatus !== 'expired') {\r\n        updateCountdown();\r\n        setInterval(updateCountdown, 1000);\r\n    }\r\n\r\n    \/\/ Handle form submission\r\n    $('#vicino-place-bid-form').on('submit', function(e) {\r\n        e.preventDefault();\r\n\r\n        var $form = $(this);\r\n        var $message = $('.vicino-bid-message');\r\n        var rawBidAmount = parseFormattedNumber($form.find('input[name=\"bid_amount\"]').val());\r\n\r\n        \/\/ Validate minimum bid\r\n        if (rawBidAmount < minBid) {\r\n            $message.html('<span class=\"error\">Tu Preoferta debe ser al menos ' + formatNumber(minBid) + '<\/span>');\r\n            return;\r\n        }\r\n\r\n        $message.html('<span class=\"loading\">Procesando tu Preoferta...<\/span>');\r\n\r\n        $.ajax({\r\n            url: vicino_auction_public.ajax_url,\r\n            type: 'POST',\r\n            data: {\r\n                action: 'vicino_auction_place_bid',\r\n                lot_id: $form.find('input[name=\"lot_id\"]').val(),\r\n                bid_amount: rawBidAmount,\r\n                nonce: vicino_auction_public.nonce\r\n            },\r\n            success: function(response) {\r\n                if (response.success) {\r\n                    $message.html('<span class=\"success\">' + response.data.message + '<\/span>');\r\n\r\n                    \/\/ Update the current bid display\r\n                    $('.vicino-auction-current-bid .price').text(formatNumber(rawBidAmount));\r\n\r\n                    \/\/ Update the minimum bid amount\r\n                    var increment = parseInt($('#bid_amount').data('increment'));\r\n                    minBid = rawBidAmount + increment;\r\n                    $('#bid_amount').data('min', minBid);\r\n                    $('#bid_amount').val(formatNumber(minBid));\r\n                    $('#bid_amount_raw').val(minBid);\r\n\r\n                    \/\/ Update the has-bids attribute to indicate there are now bids\r\n                    $('#bid_amount').data('has-bids', '1');\r\n\r\n                    \/\/ Update the minimum bid message\r\n                    $('.min-bid-info').text('Preoferta m\u00ednima: ' + formatNumber(minBid) + ' (preoferta actual + ' + increment + ' de incremento)')\r\n\r\n                    \/\/ If the auction end time was extended\r\n                    if (response.data.new_end_date) {\r\n                        \/\/ Update the end date display\r\n                        var formattedDate = new Date(response.data.new_end_date.replace(\/-\/g, '\/'));\r\n                        var dateOptions = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };\r\n                        var formattedDateStr = formattedDate.toLocaleDateString('es-ES', dateOptions);\r\n\r\n                        $('#vicino-end-date').text(formattedDateStr);\r\n                        $('#vicino-end-date').data('end', response.data.new_end_date);\r\n                        $('#vicino-countdown').data('end', response.data.new_end_date);\r\n\r\n                        \/\/ Add the time extended indicator if not already present\r\n                        if ($('.vicino-time-extended').length === 0) {\r\n                            $('#vicino-end-date').after('<span class=\"vicino-time-extended\">(Tiempo Extendido)<\/span>');\r\n                        }\r\n                    }\r\n\r\n                    \/\/ Reload the page to show updated bid history\r\n                    setTimeout(function() {\r\n                        location.reload();\r\n                    }, 2000);\r\n                } else {\r\n                    $message.html('<span class=\"error\">' + response.data + '<\/span>');\r\n                }\r\n            },\r\n            error: function() {\r\n                $message.html('<span class=\"error\">Ocurri\u00f3 un error. Por favor, int\u00e9ntalo de nuevo.<\/span>');\r\n            }\r\n        });\r\n    });\r\n});\r\n<\/script>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"\r\n<div class=\"vicino-auction-status-badge vicino-status-finished\">\r\n    <span class=\"status-icon\">\ud83c\udfc1<\/span>\r\n    <span class=\"status-text\">SUBASTA FINALIZADA<\/span>\r\n<\/div>\n","protected":false},"author":497,"featured_media":8448,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[178],"tags":[],"class_list":["post-7941","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-toros-angus-p"],"_links":{"self":[{"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/posts\/7941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/users\/497"}],"replies":[{"embeddable":true,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/comments?post=7941"}],"version-history":[{"count":2,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/posts\/7941\/revisions"}],"predecessor-version":[{"id":8027,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/posts\/7941\/revisions\/8027"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/media\/8448"}],"wp:attachment":[{"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/media?parent=7941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/categories?post=7941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/catalogolastranqueras.com.ar\/remate2025\/wp-json\/wp\/v2\/tags?post=7941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}