";
for (var a = 0; a < obj.length; a++) {
if (obj[a].model_name === strValue && cleanName(obj[a].display_name.trim()) === cleanName(strText_2)) {
txtTable += "
" + obj[a].reparacion + "
$" + currency_comma(currency(obj[a].precio)) + "
";
}
}
objTable.innerHTML = txtTable;
} */
// function ddChange() {
// var e = document.getElementById("ddSamsungProduct");
// var strValue = e.options[e.selectedIndex].value;
// var strText = e.options[e.selectedIndex].text;
// var strText_2 = e.options[e.selectedIndex].getAttribute("data-name");
// document.getElementById("samsungTagInvisible").setAttribute('data-omni', 'mx:micrositio:centro-servicio:20180108:producto:' + strText);
// document.getElementById("samsungTagInvisible").setAttribute('data-omni', 'mx:micrositio:centro-servicio:20180108:producto:' + strText);
// document.getElementById("samsungTagInvisible").click();
// var objTable = document.getElementById('tableSamsungProduct');
// var txtTable = "
Modelo
Descripción Modelo
Tipo de reparación
Precio Reparación
";
// for (var a = 0; a < obj.length; a++) {
// if (obj[a].model_name === strValue && cleanName(obj[a].display_name.trim()) === cleanName(strText_2)) {
// txtTable += "
" + obj[a].reparacion + "
" + obj[a].description +"
" + obj[a].ub_repair + "
$" + currency_comma(currency(obj[a].precio)) + "*" + "
";
// }
// }
// objTable.innerHTML = txtTable;
// }
function ddChange() {
var e = document.getElementById("ddSamsungProduct");
var strValue = e.options[e.selectedIndex].value;
var strText = e.options[e.selectedIndex].text;
var strText_2 = e.options[e.selectedIndex].getAttribute("data-name");
document.getElementById("samsungTagInvisible").setAttribute('data-omni', 'mx:micrositio:centro-servicio:20180108:producto:' + strText);
document.getElementById("samsungTagInvisible").setAttribute('data-omni', 'mx:micrositio:centro-servicio:20180108:producto:' + strText);
document.getElementById("samsungTagInvisible").click();
var objTable = document.getElementById('tableSamsungProduct');
var txtTable = "
Modelo
Descripción Modelo
Tipo de reparación
Precio Reparación
";
for (var a = 0; a < obj.length; a++) {
if (obj[a].model_name === strValue && cleanName(obj[a].display_name.trim()) === cleanName(strText_2)) {
txtTable += "
" + obj[a].model_name + "
" + obj[a].display_name +"
" + obj[a].reparacion + "
$" + currency_comma(currency(obj[a].precio)) + "*" + "
";
}
}
objTable.innerHTML = txtTable;
}
function cleanName($str) {
$txt = $str.toString().replace('+', 'plus');
return $txt.replace(/[\W_]+/g, '_').toLowerCase()
}
function currency(n) {
n = parseFloat(n);
return isNaN(n) ? false : n.toFixed(2);
}
function currency_comma(amount) {
var delimiter = ",";
var i = Math.round(parseFloat(amount));
var minus = '';
if (i < 0) {
minus = '-';
}
i = Math.abs(i);
var n = new String(i);
var a = [];
while (n.length > 3) {
var nn = n.substr(n.length - 3);
a.unshift(nn);
n = n.substr(0, n.length - 3);
}
if (n.length > 0) {
a.unshift(n);
}
n = a.join(delimiter);
amount = n;
amount = minus + amount;
return amount;
}
$(function() {
$("#bannerSpecial").slick({
dots: true,
arrows: false,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 5000,
});
$(document).on("click", "[data-center]", function(e) {
e.preventDefault();
$("body").addClass("ovhCDS");
var dc = $(this).attr("data-center");
$("body").append('
×' + centrosServicio[dc]["name"] + '
' + centrosServicio[dc]["address"] + '
' + centrosServicio[dc]["map"] + '
')
});
$(document).on("click", "#wrapCDS, #closeModalCDE", function(e) {
e.preventDefault();
if (e.target !== this) {
return;
}
$("body").removeClass("ovhCDS");
$("#wrapCDS").fadeOut(450, function() {
$("#wrapCDS").delay(450).remove();
})
});
$(document).on("click", "[data-product]", function(e) {
e.preventDefault();
$("[data-product]").removeClass("active");
var service = $(this).attr("data-product");
$(this).addClass("active");
var sc = $("#selectServiceCenter");
sc.find("a").hide();
sc.find("a").each(function(i, v) {
var centers = $(this).attr('data-service');
var dataCenter = $(this).attr('data-center');
var isVisible = false;
centers = centers.split(',');
$.each(centers, function(i, v) {
if (v === service) {
isVisible = true;
}
});
if (isVisible) {
$(this).show();
}
});
$("html, body").animate({
scrollTop: ($('#selectServiceCenter').offset().top - 100)
}, 1000);
});
$.each(obj, function(i, v) {
$(".hideImages").append('
)%20+%20'.jpg?v=2;%24ORIGIN_JPG%24)
');
});
var options = {
data: autocompleteArray,
list: {
maxNumberOfElements: 10,
match: {
enabled: true
},
onSelectItemEvent: function() {
var value = $("#searcher").getSelectedItemData();
var spplt = value.split("(");
var model = spplt[1].split(")");
tmpName = spplt[0];
$("#nameModelTmp").text(tmpName);
var img_single = $(".wrapImage").find("img");
img_single.attr('src', urlImage + cleanName(model[0].toLowerCase()) + ".jpg?v=3;$ORIGIN_JPG$");
img_single.on('error', function() {
$(this).attr("src", "https://images.samsung.com/is/image/samsung/assets/co/microsite/centro_de_servicio_samsung/devices/nodisponible.jpg?$ORIGIN_JPG$");
});
var nameOpt = tmpName.trim();
console.log(cleanName(nameOpt) + ' - ' + model[0]);
$('#ddSamsungProduct').find('option[data-name=' + cleanName(nameOpt) + '][value="' + model[0] + '"]').prop('selected', true);
$('#ddSamsungProduct').trigger('change');
}
},
};
ddSamsungProduct();
document.getElementById("ddSamsungProduct").onchange = function() {
ddChange()
};
$("#searcher").easyAutocomplete(options);
$("#ddSamsungProduct").hide();
});
");
for (var m = 0, n = l.length; n > m && h < c[i].maxListSize; m += 1) e = $("
"),
function() {
var a = m,
b = h,
f = c[i].getValue(l[a]);
e.find(" > div").on("click", function() {
t.val(f).trigger("change"), w = b, j(b), o.get("list").onClickEvent(), o.get("list").onChooseEvent()
}).mouseover(function() {
w = b, j(b), o.get("list").onMouseOverEvent()
}).mouseout(function() {
o.get("list").onMouseOutEvent()
}).html(q.build(g(f, d), l[a]))
}(), f.append(e), v.push(l[m]), h += 1
}
}
a.append(f), o.get("list").onLoadEvent()
})
}(), t.after(a)
}
function e() {
t.next("." + n.getValue("CONTAINER_CLASS")).remove()
}
function g(a, b) {
return o.get("highlightPhrase") && "" !== b ? i(a, b) : a
}
function h(a) {
return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&")
}
function i(a, b) {
var c = h(b);
return (a + "").replace(new RegExp("(" + c + ")", "gi"), "
$1")
}
t.parent().hasClass(n.getValue("WRAPPER_CSS_CLASS")) && (e(), c()), a(), d(), u = $("#" + f()), o.get("placeholder") && t.attr("placeholder", o.get("placeholder"))
}
function f() {
var a = t.attr("id");
return a = n.getValue("CONTAINER_ID") + a
}
function g() {
function a() {
s("autocompleteOff", !0) && n(), b(), c(), d(), e(), f(), g()
}
function b() {
t.focusout(function() {
var a, b = t.val();
o.get("list").match.caseSensitive || (b = b.toLowerCase());
for (var c = 0, d = v.length; d > c; c += 1)
if (a = o.get("getValue")(v[c]), o.get("list").match.caseSensitive || (a = a.toLowerCase()), a === b) return w = c, void j(w)
})
}
function c() {
t.off("keyup").keyup(function(a) {
function b(a) {
function b() {
var a = {},
b = o.get("ajaxSettings") || {};
for (var c in b) a[c] = b[c];
return a
}
function c(a, b) {
return o.get("matchResponseProperty") !== !1 ? "string" == typeof o.get("matchResponseProperty") ? b[o.get("matchResponseProperty")] === a : "function" == typeof o.get("matchResponseProperty") ? o.get("matchResponseProperty")(b) === a : !0 : !0
}
if (!(a.length < o.get("minCharNumber"))) {
if ("list-required" !== o.get("data")) {
var d = o.get("data"),
e = r.init(d);
e = r.updateCategories(e, d), e = r.processData(e, a), k(e, a), t.parent().find("li").length > 0 ? h() : i()
}
var f = b();
void 0 !== f.url && "" !== f.url || (f.url = o.get("url")), void 0 !== f.dataType && "" !== f.dataType || (f.dataType = o.get("dataType")), void 0 !== f.url && "list-required" !== f.url && (f.url = f.url(a), f.data = o.get("preparePostData")(f.data, a), $.ajax(f).done(function(b) {
var d = r.init(b);
d = r.updateCategories(d, b), d = r.convertXml(d), c(a, b) && (d = r.processData(d, a), k(d, a)), r.checkIfDataExists(d) && t.parent().find("li").length > 0 ? h() : i(), o.get("ajaxCallback")()
}).fail(function() {
p.warning("Fail to load response data")
}).always(function() {}))
}
}
switch (a.keyCode) {
case 27:
i(), l();
break;
case 38:
a.preventDefault(), v.length > 0 && w > 0 && (w -= 1, t.val(o.get("getValue")(v[w])), j(w));
break;
case 40:
a.preventDefault(), v.length > 0 && w < v.length - 1 && (w += 1, t.val(o.get("getValue")(v[w])), j(w));
break;
default:
if (a.keyCode > 40 || 8 === a.keyCode) {
var c = t.val();
o.get("list").hideOnEmptyPhrase !== !0 || 8 !== a.keyCode || "" !== c ? o.get("requestDelay") > 0 ? (void 0 !== m && clearTimeout(m), m = setTimeout(function() {
b(c)
}, o.get("requestDelay"))) : b(c) : i()
}
}
})
}
function d() {
t.on("keydown", function(a) {
a = a || window.event;
var b = a.keyCode;
return 38 === b ? (suppressKeypress = !0, !1) : void 0
}).keydown(function(a) {
13 === a.keyCode && w > -1 && (t.val(o.get("getValue")(v[w])), o.get("list").onKeyEnterEvent(), o.get("list").onChooseEvent(), w = -1, i(), a.preventDefault())
})
}
function e() {
t.off("keypress")
}
function f() {
t.focus(function() {
"" !== t.val() && v.length > 0 && (w = -1, h())
})
}
function g() {
t.blur(function() {
setTimeout(function() {
w = -1, i()
}, 250)
})
}
function n() {
t.attr("autocomplete", "off")
}
a()
}
function h() {
u.trigger("show.eac")
}
function i() {
u.trigger("hide.eac")
}
function j(a) {
u.trigger("selectElement.eac", a)
}
function k(a, b) {
u.trigger("loadElements.eac", [a, b])
}
function l() {
t.trigger("blur")
}
var m, n = new a.Constans,
o = new a.Configuration(c),
p = new a.Logger,
q = new a.Template(c.template),
r = new a.ListBuilderService(o, a.proccess),
s = o.equals,
t = b,
u = "",
v = [],
w = -1;
a.consts = n, this.getConstants = function() {
return n
}, this.getConfiguration = function() {
return o
}, this.getContainer = function() {
return u
}, this.getSelectedItemIndex = function() {
return w
}, this.getItems = function() {
return v
}, this.getItemData = function(a) {
return v.length < a || void 0 === v[a] ? -1 : v[a]
}, this.getSelectedItemData = function() {
return this.getItemData(w)
}, this.build = function() {
e()
}, this.init = function() {
d()
}
}, a.eacHandles = [], a.getHandle = function(b) {
return a.eacHandles[b]
}, a.inputHasId = function(a) {
return void 0 !== $(a).attr("id") && $(a).attr("id").length > 0
}, a.assignRandomId = function(b) {
var c = "";
do c = "eac-" + Math.floor(1e4 * Math.random()); while (0 !== $("#" + c).length);
elementId = a.consts.getValue("CONTAINER_ID") + c, $(b).attr("id", c)
}, a.setHandle = function(b, c) {
a.eacHandles[c] = b
}, a
}(EasyAutocomplete || {});
! function(a) {
a.fn.easyAutocomplete = function(b) {
return this.each(function() {
var c = a(this),
d = new EasyAutocomplete.main(c, b);
EasyAutocomplete.inputHasId(c) || EasyAutocomplete.assignRandomId(c), d.init(), EasyAutocomplete.setHandle(d, c.attr("id"))
})
}, a.fn.getSelectedItemIndex = function() {
var b = a(this).attr("id");
return void 0 !== b ? EasyAutocomplete.getHandle(b).getSelectedItemIndex() : -1
}, a.fn.getItems = function() {
var b = a(this).attr("id");
return void 0 !== b ? EasyAutocomplete.getHandle(b).getItems() : -1
}, a.fn.getItemData = function(b) {
var c = a(this).attr("id");
return void 0 !== c && b > -1 ? EasyAutocomplete.getHandle(c).getItemData(b) : -1
}, a.fn.getSelectedItemData = function() {
var b = a(this).attr("id");
return void 0 !== b ? EasyAutocomplete.getHandle(b).getSelectedItemData() : -1
}
}(jQuery);
});