/******/ (() => { // webpackBootstrap
var __webpack_exports__ = {};
/*!***************************!*\
  !*** ./assets/auction.js ***!
  \***************************/
/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
window.reloadAuction_old = function () {
  $(document).ajaxStart(function () {
    $(".loader").remove();
  });
  var aukcia = $("#auction_increase_auction").val();
  var param = [aukcia];
  $.ajax({
    url: generateRoute('auction_item_increase', param),
    type: 'POST',
    async: false,
    success: function success(data) {
      $('#auction-item-price').html(data);
    }
  });
};

window.reloadAuction = function (timer) {
  $(document).ajaxStart(function () {
    $(".loader").remove();
  });
  var aukcia = $("#auction_increase_auction").val();
  var param = [aukcia]; //console.log(generateRoute('auction_item_increase_json', param));

  $.ajax({
    url: generateRoute('auction_item_increase_json', param),
    type: 'POST',
    async: false,
    success: function success(data) {
      if (parseInt(data['increase_count']) > 0) {
        $(".ai-sellnow-text").remove();
      }

      if (data['price_actual'] != 'undefined' && data['price_actual'] != null) {
        data['price_actual'] = data['price_actual'].replace("\\", "");

        if ($(".ai-price").html() != data['price_actual']) {
          $(".ai-price").animate({
            'background-color': "red"
          }, 200);
          $(".ai-price").animate({
            'background-color': "white"
          }, 600);
        }

        $(".ai-price").html(data['price_actual']);
        $(".min_inc_json").html(data['price_increase']);
        $(".auction-kurz").html(data['eur_price']);
        $("#auction_text_alert").html(data['increase_alert']);
        $(".observe-ico").html(data['observe_ico']);
        $(".observe-ico").attr('title', data['observe_title']);
        $(".btn-observe").html(data['btn_observe']);
        $("#endAuctionDatetime").html(data['end_auction']);
        $("#auction_increase_price_after").removeAttr('placeholder');
        $("#auction_increase_price_after").attr('placeholder', 'min.: ' + data['price_increase'] + " " + data['currency']);

        if (data['my_observe'] == 1) {
          $(".observe-ico").removeClass('observe-yes');
          $(".observe-ico").addClass('observe-yes');
        }

        var rmincbt = $("#remove-my-last-increase").length; //console.log(rmincbt+"aaa");

        if (data['last_increase']['iam'] == 'no') {
          $("#remove-my-last-increase").remove();
          $("#iamFirst").css('display', 'none');
          $("#iamNotFirst").css('display', 'block');
        } else {
          var btTxt = $("#iamFirst").attr('btncrt');
          $("#iamFirst").css('display', 'block');
          $("#iamNotFirst").css('display', 'none');

          if (rmincbt == 0) {
            $("#myDetail").append('<a href="#" class="btn btn-danger" style="font-size: 0.9em;" id="remove-my-last-increase">' + btTxt + '<a/><br>');
            $("#remove-my-last-increase").on('click', function () {
              removeMyInc(timer, 'remove_my_last_inc287');
            });
          }
        } //if($("#auction_increase_price_after").is(":focus")){}else{$("#auction_increase_price_after").val(data['price_increase']);}

      }

      if (data['time'] == 'undefined' || data['time'] == null) {
        data['time'] = 20000;
      }

      console.log(data['time']);

      if (data['time'] > 0) {
        var timer = setTimeout(function (e) {
          reloadAuction();
        }, data['time']);
      }

      if (data['end'] == 'end' || data['time'] <= 0) {
        location.reload();
      }
    }
  });
};

window.removeMyInc = function (timer, page) {
  if (page == "remove_my_last_inc287") {
    var mess = $("#mess_rmLstInc").html();
  } else {
    var mess = $("#mess_rmMxInc").html();
  }

  alertify.confirm('', mess, function (e) {
    var param = [$("#auction_increase_auction").val()];
    $.ajax({
      url: generateRoute($("#special").html() + page, param),
      type: 'POST',
      async: false,
      success: function success(data) {
        $('#auction-item-price').html(data);
      }
    });
    clearTimeout(timer);
  }, function () {
    $(".ajs-buttons .btn-success").css("display", 'inline-block');
  }).set('labels', {
    ok: $("#prekl").attr("ano"),
    cancel: $("#prekl").attr("nie")
  });
};
/******/ })()
;