(function() {
grunticon(["styles/icons/data.svg.css", "styles/icons/data.png.css", "styles/icons/fallback.css"]), $(function() {
var e, t, a, n, i, r, s, o, c, l, u, d, p, h, f, v, g, m, k, b, w, D, y, x, z;
return $("#promo-carousel").carousel({
interval: 8e3
}), e = $("#to-top-button"), $(document).on("scroll", function() {
var t;
t = $(this).scrollTop(), t > 600 ? e.fadeIn() : e.fadeOut()
}), $("#to-top-button").on("click", function() {
return $("body, html").animate({
scrollTop: 0
})
}), $("select").selectpicker(), $(".collapse-toggle-title").on("click", function(e) {
return e.preventDefault(), $(this).closest(".collapse-toggle").toggleClass("opened")
}), o = $("#purchase-form"), $("#advanced-search-button").on("click", function(e) {
return e.preventDefault(), o.toggleClass("advanced-search-opened")
}), $("#clear-purchase-filter-button").on("click", function(e) {
e.preventDefault(), o.find('input:text, input[type="search"], select, textarea').val(""), o.find("input:radio, input:checkbox").removeAttr("checked").removeAttr("selected"), $("select").selectpicker("refresh"), s.datepicker("update");
$("#purchase-form").submit();
}), $(".input-datepicker").datepicker({
format: "dd.mm.yy",
weekStart: 1,
language: "lv"
}), s = $("#purchase-datepicker"), s.datepicker({
format: "dd.mm.yy",
weekStart: 1,
language: "lv"
}).on("changeDate", function(e) {
return null != e.date ? s.addClass("daterange-set") : s.removeClass("daterange-set")
}), $("#clear-daterange").on("click", function(e) {
return s.find("input").datepicker("clearDates")
}), t = $(".daterange-filter-options").find("button"), t.on("click", function(e) {
var t, a, n, i, r, o, c, l;
switch (e.preventDefault(), r = $(this).data("range"), c = new Date, c.setHours(0, 0, 0, 0), r) {
case "today":
o = c, a = c;
break;
case "yesterday":
t = new Date, t.setHours(0, 0, 0, 0), l = new Date(t.setDate(t.getDate() - 1)), o = l, a = l;
break;
case "week":
t = new Date, t.setHours(0, 0, 0, 0), n = new Date(t.setDate(t.getDate() - (t.getDay()==0 ? 7 : t.getDay()) + 1)), i = new Date(t.setDate(t.getDate() - t.getDay() + 7)), o = n, a = i;
break;
case "month":
t = new Date, n = new Date(t.getFullYear(), t.getMonth(), 1), i = new Date(), o = n, a = i
}
s.find("#start").datepicker("setDate", o);
s.find("#end").datepicker("setDate", a);
$("#purchase-form").submit();
}), k = new Bloodhound({
datumTokenizer: function(e) {
return Bloodhound.tokenizers.whitespace(e.label)
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: "/en/iepirkums/ajax/cpvs/%QUERY",
wildcard: "%QUERY"
}
}), $("#cpv-code").tokenfield({
typeahead: {
limit: 500,
autoselect: !0,
highlight: !0,
minLength: 3,
hint: !1,
multiselect: !0,
source: k.ttAdapter(),
display: "label",
templates: {
suggestion: function(e) {
return '
' + e.label + '' + e.value + "
"
}
}
}
}), indbl = new Bloodhound({
datumTokenizer: function(e) {
return Bloodhound.tokenizers.whitespace(e.label)
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: "/en/iepirkums/ajax/indsel/%QUERY",
wildcard: "%QUERY"
}
}), $("#industry-sel").tokenfield({
typeahead: {
limit: 10000,
autoselect: !0,
highlight: !0,
minLength: 0,
hint: !1,
multiselect: !0,
source: indbl.ttAdapter(),
display: "label",
templates: {
suggestion: function(e) {
return ''
}
}
},
showAutocompleteOnFocus: true
}).on('tokenfield:createtoken', function (e) {
$("#search_").focus();
}), $("#nozare-sel .tokenfield").hide(),
izpdbl = new Bloodhound({
datumTokenizer: function(e) {
return Bloodhound.tokenizers.whitespace(e.label)
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: "/en/izpardosanas/ajax/indsel/%QUERY",
wildcard: "%QUERY"
}
}), $("#izp-industry-sel").tokenfield({
typeahead: {
limit: 10000,
autoselect: !0,
highlight: !0,
minLength: 0,
hint: !1,
multiselect: !0,
source: izpdbl.ttAdapter(),
display: "label",
templates: {
suggestion: function(e) {
return ''
}
}
},
showAutocompleteOnFocus: true
}).on('tokenfield:createtoken', function (e) {
$("#search_").focus();
}), $("#nozare-sel .tokenfield").hide(),
regbl = new Bloodhound({
datumTokenizer: function(e) {
return Bloodhound.tokenizers.whitespace(e.label)
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: "/en/iepirkums/ajax/regsel/%QUERY",
wildcard: "%QUERY"
}
}), $("#region-sel").tokenfield({
typeahead: {
limit: 10000,
autoselect: !0,
highlight: !0,
minLength: 0,
hint: !1,
multiselect: !0,
source: regbl.ttAdapter(),
display: "label",
templates: {
suggestion: function(e) {
return ''
}
}
},
showAutocompleteOnFocus: true
}).on('tokenfield:createtoken', function (e) {
$("#search_").focus();
}),
sabl = new Bloodhound({
datumTokenizer: function(e) {
return Bloodhound.tokenizers.whitespace(e.label)
},
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: "/en/izsludinat/ajax/get_templ/%QUERY",
wildcard: "%QUERY"
}
}), $("#template-autocomplete").tokenfield({
typeahead: {
limit: 500,
autoselect: true,
highlight: true,
minLength: 3,
hint: false,
createTokensOnBlur: true,
source: sabl.ttAdapter(),
display: "label",
templates: {
suggestion: function(e) {
return ''
}
}
},
}).on('tokenfield:createtoken', function (e) {
document.location.href='/en/izsludinat/apraksti/'+e.attrs.value;
}),
d = $("#purchases-table"), $(".btn-sort").on("click", function(e) {
var t, a;
return e.preventDefault(), t = $(this).attr("sort-by"), a = $(this).attr("sort-direction"), a = a=="down"?"up":"down", o.find('input[name="sortBy"]').val(t), o.find('input[name="sortDirection"]').val(a), o.submit()
}), $("#extended-view-button").on("click", function(e) {
return e.preventDefault(), d.toggleClass("table-extended-view")
}), $(".purchase-item-favorite-checkbox").on("click", function() {
if (getCookie("infoModalTempStar")=="") {$('#infoModalTempStar').modal();}
const e = {
id: $(this).val(),
favorite: this.checked
};
const kondors_id = $(this).data('kondors');
// kondors set on
if (kondors_id && kondors_id!='' && this.checked) {
$.ajax(`https://api2.iepirkumi.lv/iepirkumi/${kondors_id}/favorite`,{
contentType:'application/json',type:'GET',
error:function(err){alert("Iepirkumu neizdevās pievienot interesējošiem!");},
headers: {"authorization": getCookie("templateid")}
})
// kondors set off
} else if (kondors_id && kondors_id!='') {
document.location.href = `https://mani.iepirkumi.lv/en/piegadatajs/iepirkums/${kondors_id}?neinterese=1&backto=referer`
}
// parastais
else {
return e, $.post("/en/iepirkums/ajax/set_favorite", e,function(data){if (data=='ERROR'){$("#"+e.id).click();} })
}
}), $("#toggle-all-purchases").on("change", function() {
var e;
return e = $(".purchase-item-select-checkbox"), this.checked ? e.prop("checked", !0) : e.prop("checked", !1)
}), a = $(".purchases-favorites-action-list").find("a.clickable"), a.on("click", function(e) {
var t, a, n;
e.preventDefault();
if ($(".purchase-item-select-checkbox:checked").length==0) {$('#onetimeErrorModal').modal('show'); return;}
smod=$(this).data('tempmod');
if (getCookie(smod)=="") {$("#"+smod).modal('show');}
t = d.find(".purchase-item-select-checkbox:checked").serialize(), n = $(this).attr("href"), a = $(this).attr("target") || "_self", window.open(n + "?" + t, a)
}), l = $("#purchases-nav"), l.length && (u = l.find("a"), u.on("click", function(e) {
var t;
return e.preventDefault(), t = $(this).data("page"), o.find('input[name="page"]').val(t), o.submit()
}), y = function(e) {
var t, a;
switch (t = parseInt(o.find('input[name="page"]').val()), e) {
case "back":
a = t - 1;
break;
case "forward":
a = t + 1
}
return o.find('input[name="page"]').val(a), o.submit()
}, $(document).keydown(function(e) {
e.altKey && 37 === e.keyCode && (e.preventDefault(), y("back")), e.altKey && 39 === e.keyCode && (e.preventDefault(), y("forward"))
})), w = void 0, $("#purchase-comment").on("keyup", function() {
var e;
void 0 !== w && clearTimeout(w), w && clearTimeout(w), e = {
purchase_id: $(this).data("purchase"),
comment: $(this).val()
}, w = setTimeout(function() {
w = void 0, $.post("/en/iepirkums/ajax/set_comment", e)
}, 2e3)
}), $("#template-toggle").on("change", function(e) {
if ($("#input_veidne_id").val()=='0')
{
$("#veidne_tpl").html(tpl_content);
$("#input_veidne_id").val($("#input_veidne_tpl").val());
}
else
{
tpl_content = $("#veidne_tpl").html();
$("#veidne_tpl").empty();
$("#input_veidne_id").val('0');
}
}), c = $(".purchases-user-table"), $("#user-purchases-toggle").on("click", function() {
return c.toggle()
}), $("#fileupload").fineUploader({
sizeLimit: 10240,
debug: true,
form: {
autoUpload: 1,
interceptSubmit: !1,
endpoint: 'https://faili.iepirkumi.lv/requests/upload'
},
session: {
endpoint: '/en/izsludinat/ajax/uploadedfiles'
},
request: {
endpoint: 'https://faili.iepirkumi.lv/requests/upload'
},
retry: {
enableAuto: true
},
callbacks: {
onError: function(id, name, errorReason, xhrOrXdr) {
$("#fileupload li.qq-file-id-"+id+" span.error").remove();
$("#fileupload li.qq-file-id-"+id+" button").remove();
$("#fileupload li.qq-file-id-"+id).append('Error: '+errorReason+'');
},
onComplete: function(id, name, errorReason, xhrOrXdr){
$("#purchase-create-form").prepend('');
},
onCancel: function(id,name){
$('#file_'+this.getUuid(id)).remove();
}
},
text: {
defaultResponseError: 'An unknown upload error occurred.'
}
}), $("#fileupload_offers").fineUploader({
sizeLimit: 10240,
debug: true,
form: {
autoUpload: 1,
interceptSubmit: !1,
endpoint: 'https://faili.iepirkumi.lv/offer/upload'
},
session: {
endpoint: '/en/izpardosanas/ajax/uploadedfiles'
},
request: {
endpoint: 'https://faili.iepirkumi.lv/offer/upload'
},
retry: {
enableAuto: true
},
callbacks: {
onError: function(id, name, errorReason, xhrOrXdr) {
$("#fileupload_offers li.qq-file-id-"+id+" span.error").remove();
$("#fileupload_offers li.qq-file-id-"+id+" button").remove();
$("#fileupload_offers li.qq-file-id-"+id).append('Error: '+errorReason+'');
},
onComplete: function(id, name, errorReason, xhrOrXdr){
$("#purchase-create-form").prepend('');
},
onCancel: function(id,name){
$('#file_'+this.getUuid(id)).remove();
}
},
text: {
defaultResponseError: 'An unknown upload error occurred.'
}
}), $(window).load(function() {})
})
}).call(this);
function disable_alerts(modalid) {var d = new Date();d.setTime(d.getTime() + (93*24*60*60*1000));var expires = "expires="+ d.toUTCString();document.cookie = modalid+"=disable; expires="+expires+"; path=/";}
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i = 0; i