'left': $("header nav").outerWidth() + 20,
position: "absolute"
}).append(select);
- $("#wescosalesselect").on('change', function () {
+ $(document).on('change', "#wescosalesselect", function () {
$(".wescosaleswindow").each(function () {
setWescoSalesPanel($(this).data('ref'), null, true);
});
var w = '';
w += '<a href="#" class="close"></a>';
w += '<h2>' + r.title + '</h2>';
- w += '<h3>' + rref.substr(0, 3) + ' ' + rref.substr(3, 3) + ' ' + rref.substr(6) + '</h3>';
+ if (rref.length == 9) {
+ w += '<h3>' + rref.substr(0, 3) + ' ' + rref.substr(3, 3) + ' ' + rref.substr(6) + '</h3>';
+ } else if (rref.length == 5) {
+ w += '<h3>' + rref.substr(0, 2) + ' ' + rref.substr(2) + '</h3>';
+ }
w += '<hr />';
if (!updateOnly) {
$('body').append('<div id="' + id + '" class="wescosaleswindow" data-ref="' + ref + '"></div>');
}
+
+ var seenNotFigure = false;
+
w += '<table>';
+ w += '<tr><th></th><th>Qté</th><th>CA</th></tr>';
for (var i in r.countries[activeCountry]) {
var d = r.countries[activeCountry][i];
if (d[1] === null) {
continue;
}
- w += '<tr>';
- w += '<td class="d">' + d[0] + '</td>';
- w += '<td class="v">' + d[1] + '</td>';
+
+ if (d[2] == null) {
+ var cl = '';
+ if (!seenNotFigure) {
+ w += '<tr class="hr"><td colspan="3"><hr /></td></tr>';
+ seenNotFigure = true;
+ }
+ w += '<tr>';
+ w += '<td class="d">' + d[0] + '</td>';
+ w += '<td class="v" colspan="2">' + d[1] + '</td>';
+ } else {
+ w += '<tr>';
+ w += '<td class="d">' + d[0] + '</td>';
+ w += '<td class="v">' + d[1] + '</td>';
+ w += '<td class="c">' + d[2] + '</td>';
+ }
w + '</tr>';
}
w += '<table>';
$('#' + id).html(w);
- var x = e.pageX - 150;
- var y = e.pageY - $("#" + id).outerHeight() / 2;
- $("#" + id).css({left: x, top: y}).data({x: x, y: y});
+ if (e != null) {
+ var x = e.pageX - 150;
+ var y = e.pageY - $("#" + id).outerHeight() / 2;
+ $("#" + id).css({left: x, top: y}).data({x: x, y: y});
+ }
setInteractPanel(ref, updateOnly);
}
}
function getWescoRef(ref) {
- ref = ref.toString().substr(4);
+ ref = ref.toString().substr(ref.toString().length - 5);
if (wsref[ref] === undefined) {
var res = {countries: {}, del: ''};
for (var country in DATAS.basketReferences) {
-
var sheet = DATAS.basketReferences[country];
var line0 = sheet[0];
var l = line0.length;
continue;
}
- d.push([line0[i], line[i]]);
+ var ca = null;
+ var hasCA = false;
+ if (line0[i + 1] != undefined && line0[i + 1].toString().indexOf('CA ' + line0[i]) != -1) {
+ ca = Math.round(parseFloat(line[i + 1])).toString();
+ hasCA = true;
+ }
+ d.push([line0[i], line[i], ca]);
+
if (String(line0[i]).toLocaleLowerCase().indexOf('supp') >= 0 && line[i] !== null && String(line[i]) != '') {
res.del = line[i];
}
if (String(line0[i]).toLocaleLowerCase().indexOf('export') >= 0 && line[i] !== null && String(line[i]) != '') {
res.export = line[i];
}
+ if (hasCA) {
+ i++;
+ }
}
res.countries[country] = d;
res.title = line[1];