From d54e377c1d001f45a2e041b962c6f39bed203164 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 1 Mar 2018 16:41:27 +0100 Subject: [PATCH] wait #1966 @3 --- js/libs/fluidbook/special/wescosales.js | 54 ++++++++++++++++++++----- style/special/wescosales.less | 24 ++++++++++- 2 files changed, 66 insertions(+), 12 deletions(-) diff --git a/js/libs/fluidbook/special/wescosales.js b/js/libs/fluidbook/special/wescosales.js index 8037af5f..2c6b7f9f 100644 --- a/js/libs/fluidbook/special/wescosales.js +++ b/js/libs/fluidbook/special/wescosales.js @@ -17,7 +17,7 @@ function initWescoNav() { '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); }); @@ -59,27 +59,50 @@ function setWescoSalesPanel(ref, e, updateOnly) { var w = ''; w += ''; w += '

' + r.title + '

'; - w += '

' + rref.substr(0, 3) + ' ' + rref.substr(3, 3) + ' ' + rref.substr(6) + '

'; + if (rref.length == 9) { + w += '

' + rref.substr(0, 3) + ' ' + rref.substr(3, 3) + ' ' + rref.substr(6) + '

'; + } else if (rref.length == 5) { + w += '

' + rref.substr(0, 2) + ' ' + rref.substr(2) + '

'; + } w += '
'; if (!updateOnly) { $('body').append('
'); } + + var seenNotFigure = false; + w += ''; + w += ''; for (var i in r.countries[activeCountry]) { var d = r.countries[activeCountry][i]; if (d[1] === null) { continue; } - w += ''; - w += ''; - w += ''; + + if (d[2] == null) { + var cl = ''; + if (!seenNotFigure) { + w += ''; + seenNotFigure = true; + } + w += ''; + w += ''; + w += ''; + } else { + w += ''; + w += ''; + w += ''; + w += ''; + } w + ''; } w += '
QtéCA
' + d[0] + '' + d[1] + '

' + d[0] + '' + d[1] + '
' + d[0] + '' + d[1] + '' + d[2] + '
'; $('#' + 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); } @@ -157,11 +180,10 @@ function wescoLinksReady() { } 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; @@ -179,13 +201,23 @@ function getWescoRef(ref) { 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]; diff --git a/style/special/wescosales.less b/style/special/wescosales.less index 40771a97..43075b25 100644 --- a/style/special/wescosales.less +++ b/style/special/wescosales.less @@ -75,13 +75,35 @@ table { width: 100%; font-size: 13px; + border-collapse: collapse; + tr.hr td { + height: 15px; + hr{ + bottom: 0; + height: 1px; + background: #fff; + width: 100%; + } + } td { - margin: 2px 0; + margin: 0px 0; + } + th { + text-align: right; + padding: 0 15px; } .v { text-align: right; white-space: nowrap; width: 1px; + padding: 0 15px; + } + .c { + text-align: right; + white-space: nowrap; + width: 1px; + border-left: 1px solid #fff; + padding: 0 15px; } } } -- 2.39.5