From d72f2419468132cb955d8d9a3fa4fe933edac22b Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 23 Mar 2020 08:24:57 +0100 Subject: [PATCH 01/53] first commit --- .DS_Store | Bin 0 -> 8196 bytes back/.DS_Store | Bin 0 -> 6148 bytes back/methods/.DS_Store | Bin 0 -> 6148 bytes back/methods/collection/collectionGet.js | 22 +++++ back/methods/collection/collectionNew.js | 120 +++++++++++++++++++++++ back/methods/collection/getSectors.js | 20 ++++ back/model-config.json | 3 + back/models/collection.js | 5 + back/models/collection.json | 12 +++ loopback/.DS_Store | Bin 0 -> 6148 bytes 10 files changed, 182 insertions(+) create mode 100644 .DS_Store create mode 100644 back/.DS_Store create mode 100644 back/methods/.DS_Store create mode 100644 back/methods/collection/collectionGet.js create mode 100644 back/methods/collection/collectionNew.js create mode 100644 back/methods/collection/getSectors.js create mode 100644 back/models/collection.js create mode 100644 back/models/collection.json create mode 100644 loopback/.DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..f0821349b2196b034eb2201ebee8f9ea8fe4d886 GIT binary patch literal 8196 zcmeHM(M}UV6ukq*ZVLz)6L@o9OniU_F(Ss8)B+C}F~%BwPy=1Mmddi*bXzLcn!flC z>L2(ieu2N>yC0zE&Mb9yy9J+&kr^^`XLrw;nLTr7rgtGCQEFGO6D<&th0Jz#5=Bbl z=bVSqSajzKtN@?rfLv-)ooeI{q0J4WfKk9GU=%P47zO?X1#o6_vPPWy>ZvJ>0!D#z zsQ~W}HZt2{Wc$j>tpkM&0bnz@Efea910=_eY%#KZWhE7Ds^~#PR1t+3LecTuW;kpy zvVCP0orI#3hYG7IpJM(DCihyPV>%=+ z-lzDGU}k`;@mLeM9|>Ik1UGtAW0eFa3(gURQh{o!ZXY$>X2_umvWxdG=&IrBHHGo< z5o@QjGm?$jisPhGI&KUz<0LSwiH^z0*$Y!O(Q%hz9np5P$Y($ls<>nXglg5MMu^r#+m@DDLppn5l|_HoP^)BG1|tU zpS1SjM+w$_jL65TVjmArxbYcbm13-Ecz_FZi_o23V| zMeDRl52;L>@i9u}^qwqe5#X;e!V_7)Q}IqGY()FYSEu3C!`AZhH!(JznYfU(th|+< z&c7`02c2@O(rSmLO7l5iJ*u?!ov8jK2)seP;ykUpot@ds>w({@)P1)p$@QuW$ctxn zzZ!H(LEEo}vYoPeU|BgUw==uY?cQEnU9?wLS9^h9_x=->4w8s|fzXV)9+aO^8xrQI-1NP`uQ3rhi)|{vQetPqBqwBM2hwGmg4;0K zrJd7w(uH*1944lMC3=9e2KJJiF20s-i#Gju&%CjV@0u%3C0ZE8u9_p2rt>_j?ajyiZ3XE3reom{YnkfMC}cPeE5mWv!9NU9w*h5N dF|vJSaR=$Ie+b}T73TbppS9-vm%ezOieD3RXrcfB literal 0 HcmV?d00001 diff --git a/back/.DS_Store b/back/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a15d86adb3a8380cd195bb108ab8ed68193beb99 GIT binary patch literal 6148 zcmeHK%}(1u5S~raViT!yB@R^T!BP*sa0n_PJz9bEgw(1=pbKp%n^;oh0u4JxEPf=D$Z&3@zgTl=%M>jePO9Y(7F4ggrFgf$z7zX-)i zXQXC4ghKU@5J3@+ii0qn$!5o6WPsk?0(^rQN*KT&?@xvpxegD~q$pdhD^aUAo;+Q! z?8TLn~(>*@#Bv~X!T{+C6Lgkz0%Ki|P1MFkH^1?I4sBPJOXL&qs zciJoN+S}G-#T|D#EwtaPPbRiyy?FiZ#r>{A86pH#mh~XxyRX z(9g3}X8RbKR!y@RnE_^i8JI%`%u;4G=kVV7mYD%&;C>mP^}$6Y^bA%S)zX0j{XSB> zK}do&oh1legPy@kBSuh!E=AO(!W=P#E=Rv>@;rl;MqLg<&5V7_%)*>dgqj`wu1W{t zY2=X^UYk#_~#pYErZX-K6$X3on{wI>1 zw77l|o#lw#->~4-6Ie$Dr~nn90#tws3>C;WJ)I4cjHv(>paM|9z7Hj_Cia2;>A>P6 z0I)&Y4YAJ>z+wqtP3!}afoV{ILDd{FH0a2etgDHAV9-VVWIQKN)|^n(Pe;CZxo8dK zN(HFEqXLuI&aMBi;7{iNM-q2bfC~I81+-bNmkYd7_SVtMS+6bd4cuyOa5KbC!Q$;0 j=m!pwp3eI*>mDrVEV { + Self.remoteMethodCtx('collectionGet', { + description: 'Get pending collections from a worker', + accessType: 'WRITE', + returns: { + type: 'Object', + root: true + }, + http: { + path: `/collectionGet`, + verb: 'POST' + } + }); + + Self.collectionGet = async ctx => { + const userId = ctx.req.accessToken.userId; + const query = `CALL vn.collection_get(?)`; + const [result] = await Self.rawSql(query, [userId]); + + return result; + }; +}; diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/collectionNew.js new file mode 100644 index 0000000000..59830a08bd --- /dev/null +++ b/back/methods/collection/collectionNew.js @@ -0,0 +1,120 @@ +module.exports = Self => { + Self.remoteMethodCtx('collectionNew', { + description: 'Make a new collection of tickets', + accessType: 'WRITE', + accepts: [{ + arg: 'collectionFk', + type: 'Number', + required: false, + description: 'The collection id' + }, { + arg: 'sectorFk', + type: 'Number', + required: true, + description: 'The sector of worker' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/collectionNew`, + verb: 'POST' + } + }); + + Self.collectionNew = async(ctx, collectionFk, sectorFk) => { + let query = ''; + + if (!collectionFk) { + const userId = ctx.req.accessToken.userId; + query = `CALL vn.collection_newBeta(?,?)`; + const [result] = await Self.rawSql(query, [sectorFk, userId]); + if (result.length == 0) + throw new Error(`No collections for today`); + + collectionFk = result[0].vCollectionFk; + } + + query = `CALL vn.collectionTicket_get(?)`; + const [tickets] = await Self.rawSql(query, [collectionFk]); + + query = `CALL vn.collectionSale_get(?)`; + const [sales] = await Self.rawSql(query, [collectionFk]); + + query = `CALL vn.collectionPlacement_get(?)`; + const [placements] = await Self.rawSql(query, [collectionFk]); + + return makeCollection(tickets, sales, placements); + }; + + /** + * Returns a collection json + * @param {*} tickets - Request tickets + * @param {*} sales - Request sales + * @param {*} placements - Request placements + * @return {Object} Collection JSON + */ + async function makeCollection(tickets, sales, placements) { + let collection = []; + + for (let i = 0; i < tickets.length; i++) { + let ticket = {}; + ticket['ticketFk'] = tickets[i]['ticketFk']; + ticket['level'] = tickets[i]['level']; + ticket['agencyName'] = tickets[i]['agencyName']; + ticket['warehouseFk'] = tickets[i]['warehouseFk']; + ticket['salesPersonFk'] = tickets[i]['salesPersonFk']; + + let ticketSales = []; + + for (let x = 0; x < sales.length; x++) { + if (sales[x]['ticketFk'] == ticket['ticketFk']) { + let sale = {}; + + sale['ticketFk'] = sales[x]['ticketFk']; + sale['saleFk'] = sales[x]['saleFk']; + sale['itemFk'] = sales[x]['itemFk']; + sale['quantity'] = sales[x]['quantity']; + sale['longName'] = sales[x]['longName']; + sale['size'] = sales[x]['size']; + sale['color'] = sales[x]['color']; + sale['discount'] = sales[x]['discount']; + sale['price'] = sales[x]['price']; + sale['stems'] = sales[x]['stems']; + sale['category'] = sales[x]['category']; + sale['origin'] = sales[x]['origin']; + sale['clientFk'] = sales[x]['clientFk']; + sale['productor'] = sales[x]['productor']; + sale['reserved'] = sales[x]['reserved']; + sale['isPreviousPrepared'] = sales[x]['isPreviousPrepared']; + sale['isPrepared'] = sales[x]['isPrepared']; + sale['isControlled'] = sales[x]['isControlled']; + + let salePlacements = []; + + for (let z = 0; z < placements.length; z++) { + if (placements[z]['saleFk'] == sale['saleFk']) { + let placement = {}; + placement['saleFk'] = placements[z]['saleFk']; + placement['itemFk'] = placements[z]['itemFk']; + placement['placement'] = placements[z]['placement']; + placement['shelving'] = placements[z]['shelving']; + placement['created'] = placements[z]['created']; + placement['visible'] = placements[z]['visible']; + placement['order'] = placements[z]['order']; + placement['grouping'] = placements[z]['grouping']; + salePlacements.push(placement); + } + } + sale['placements'] = salePlacements; + ticketSales.push(sale); + } + } + ticket['sales'] = ticketSales; + collection.push(ticket); + } + + return collection; + } +}; diff --git a/back/methods/collection/getSectors.js b/back/methods/collection/getSectors.js new file mode 100644 index 0000000000..c5da7ec13f --- /dev/null +++ b/back/methods/collection/getSectors.js @@ -0,0 +1,20 @@ +module.exports = Self => { + Self.remoteMethodCtx('getSectors', { + description: 'Get all sectors', + accessType: 'WRITE', + returns: { + type: 'Object', + root: true + }, + http: { + path: `/getSectors`, + verb: 'POST' + } + }); + + Self.getSectors = async ctx => { + const query = `CALL vn.sector_get()`; + const [result] = await Self.rawSql(query, []); + return result; + }; +}; diff --git a/back/model-config.json b/back/model-config.json index 50603be3ff..872f2239ec 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -14,6 +14,9 @@ "Container": { "dataSource": "storage" }, + "Collection": { + "dataSource": "vn" + }, "Chat": { "dataSource": "vn" }, diff --git a/back/models/collection.js b/back/models/collection.js new file mode 100644 index 0000000000..2802425a5e --- /dev/null +++ b/back/models/collection.js @@ -0,0 +1,5 @@ +module.exports = Self => { + require('../methods/collection/collectionGet')(Self); + require('../methods/collection/collectionNew')(Self); + require('../methods/collection/getSectors')(Self); +}; diff --git a/back/models/collection.json b/back/models/collection.json new file mode 100644 index 0000000000..3e428ef609 --- /dev/null +++ b/back/models/collection.json @@ -0,0 +1,12 @@ +{ + "name": "Collection", + "base": "VnModel", + "acls": [{ + "property": "validations", + "accessType": "EXECUTE", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + }] +} + \ No newline at end of file diff --git a/loopback/.DS_Store b/loopback/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5eff1eaf067fb52e1e272e187642d76f154ecfcf GIT binary patch literal 6148 zcmeHK!EVz)5S>j;>I4uuAhkzdkT^tDT0|&9NNGq9Js=^B-~gz#W2-fFy;1Bmf)L~j z9|3>Br|<=Q2p<4%b{AA9z<~oo(M~k;c4udHz0cWQFA<6UB-$ow5s?dJbeb@~5N>B( zlA7^wqfmWF$_`RF3{x2{MO%kuz%uZ^F~DoLPD7G(hF^94@}_VPdh?qS_2_j<5jCU$ z7++ZH9Q$b@_6m&6Y8V~S~uUQxb0hS*rhYtUobr#%|bL*N#kE2@qp-Y;a-(Qiy+ zI%m5O`}I$;;WQta-Rg5VN|U_kbiRn%nsceX?z&C4dA0e{Kao?v2#QJG55~{A_9!S$ zLQ{SsW%{!mgin)rdf2-DKxRddWbs%fCsB-$7tfL`lGDDNWKpjA@pXgiHr&QxYjZZc zyW4GhJKgTQ?ag*~ZnwQVom=yH!`-;CegEL-?Dd=3+xfc>m=Hu@%T;pC;1BqSLWPiX zf1ITadRG>~3=87S7I{coA>lrLH>U0w3@*&K~!rV}V z8Xf(6Dx5@5qqUX+%RrTZHC=7-`M>}B`+qgb)+_^-ft6xFI0Jvs$CS+3x->aHYdz=@ ql!fC;jVcAk9LK7_NAV_93EDg^0DA^YjqpJ1hk&BN8q2^xW#Buj-=0PQ literal 0 HcmV?d00001 From a4f14e5fdad7db702f337535edf2dc63525ae9b9 Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 23 Mar 2020 10:36:10 +0100 Subject: [PATCH 02/53] collection update sale --- .../collection/collectionUpdateSale.js | 42 +++++++++++++++++++ back/models/collection.js | 1 + 2 files changed, 43 insertions(+) create mode 100644 back/methods/collection/collectionUpdateSale.js diff --git a/back/methods/collection/collectionUpdateSale.js b/back/methods/collection/collectionUpdateSale.js new file mode 100644 index 0000000000..4e8775755f --- /dev/null +++ b/back/methods/collection/collectionUpdateSale.js @@ -0,0 +1,42 @@ +module.exports = Self => { + Self.remoteMethodCtx('collectionUpdateSale', { + description: 'Update sale of a collection', + accessType: 'WRITE', + accepts: [{ + arg: 'sale', + type: 'Number', + required: true, + description: 'The sale id' + }, { + arg: 'originalQuantity', + type: 'Number', + required: true, + description: 'The quantity to sale' + }, { + arg: 'ticketFk', + type: 'Number', + required: true, + description: 'The ticket id' + }, { + arg: 'stateFk', + type: 'Number', + required: true, + description: 'The state id' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/collectionUpdateSale`, + verb: 'POST' + } + }); + + Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => { + const userId = ctx.req.accessToken.userId; + + query = `vn.collection_updateSale(?,?,?,?,?)`; + return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]); + }; +}; diff --git a/back/models/collection.js b/back/models/collection.js index 2802425a5e..9f944d72f6 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -2,4 +2,5 @@ module.exports = Self => { require('../methods/collection/collectionGet')(Self); require('../methods/collection/collectionNew')(Self); require('../methods/collection/getSectors')(Self); + require('../methods/collection/collectionUpdateSale')(Self); }; From c7a5d94ed0ebc51bee2ce89f291168ec3f3a2f12 Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 23 Mar 2020 13:26:45 +0100 Subject: [PATCH 03/53] faults --- back/methods/collection/collectionFaults.js | 35 +++++++++++++++++++++ back/methods/collection/collectionNew.js | 3 ++ back/models/collection.js | 1 + 3 files changed, 39 insertions(+) create mode 100644 back/methods/collection/collectionFaults.js diff --git a/back/methods/collection/collectionFaults.js b/back/methods/collection/collectionFaults.js new file mode 100644 index 0000000000..b39e9f2d22 --- /dev/null +++ b/back/methods/collection/collectionFaults.js @@ -0,0 +1,35 @@ +module.exports = Self => { + Self.remoteMethodCtx('collectionFaults', { + description: 'Update sale of a collection', + accessType: 'WRITE', + accepts: [{ + arg: 'shelvingFk', + type: 'Number', + required: true, + description: 'The sale id' + }, { + arg: 'quantity', + type: 'Number', + required: true, + description: 'The quantity to sale' + }, { + arg: 'itemFk', + type: 'Number', + required: true, + description: 'The ticket id' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/collectionFaults`, + verb: 'POST' + } + }); + + Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => { + query = `vn.collection_faults(?,?,?)`; + return await Self.rawSql(query, [shelvingFk, quantity, itemFk]); + }; +}; diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/collectionNew.js index 59830a08bd..6e248f6408 100644 --- a/back/methods/collection/collectionNew.js +++ b/back/methods/collection/collectionNew.js @@ -45,6 +45,9 @@ module.exports = Self => { query = `CALL vn.collectionPlacement_get(?)`; const [placements] = await Self.rawSql(query, [collectionFk]); + query = `CALL vn.collectionSticker_print(?,?)`; + // await Self.rawSql(query, [collectionFk, sectorFk]); + return makeCollection(tickets, sales, placements); }; diff --git a/back/models/collection.js b/back/models/collection.js index 9f944d72f6..aad0b4196f 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -3,4 +3,5 @@ module.exports = Self => { require('../methods/collection/collectionNew')(Self); require('../methods/collection/getSectors')(Self); require('../methods/collection/collectionUpdateSale')(Self); + require('../methods/collection/collectionFaults')(Self); }; From 52f97e1decd0e6408f9b14dcb28fb271a8c65fdf Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 23 Mar 2020 15:22:48 +0100 Subject: [PATCH 04/53] sacadores --- back/methods/collection/collectionFaults.js | 6 +++--- back/methods/collection/collectionNew.js | 17 +++++++++++------ back/methods/collection/collectionUpdateSale.js | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/back/methods/collection/collectionFaults.js b/back/methods/collection/collectionFaults.js index b39e9f2d22..ac51865750 100644 --- a/back/methods/collection/collectionFaults.js +++ b/back/methods/collection/collectionFaults.js @@ -4,9 +4,9 @@ module.exports = Self => { accessType: 'WRITE', accepts: [{ arg: 'shelvingFk', - type: 'Number', + type: 'String', required: true, - description: 'The sale id' + description: 'The shalving id' }, { arg: 'quantity', type: 'Number', @@ -29,7 +29,7 @@ module.exports = Self => { }); Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => { - query = `vn.collection_faults(?,?,?)`; + query = `CALL vn.collection_faults(?,?,?)`; return await Self.rawSql(query, [shelvingFk, quantity, itemFk]); }; }; diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/collectionNew.js index 6e248f6408..9a3020bf8e 100644 --- a/back/methods/collection/collectionNew.js +++ b/back/methods/collection/collectionNew.js @@ -12,6 +12,11 @@ module.exports = Self => { type: 'Number', required: true, description: 'The sector of worker' + }, { + arg: 'vWagons', + type: 'Number', + required: true, + description: 'The number of wagons' }], returns: { type: 'Object', @@ -23,13 +28,13 @@ module.exports = Self => { } }); - Self.collectionNew = async(ctx, collectionFk, sectorFk) => { + Self.collectionNew = async(ctx, collectionFk, sectorFk, vWagons) => { let query = ''; if (!collectionFk) { const userId = ctx.req.accessToken.userId; - query = `CALL vn.collection_newBeta(?,?)`; - const [result] = await Self.rawSql(query, [sectorFk, userId]); + query = `CALL vn.collectionTrain_newBeta(?,?,?)`; + const [result] = await Self.rawSql(query, [sectorFk, vWagons, userId]); if (result.length == 0) throw new Error(`No collections for today`); @@ -48,7 +53,7 @@ module.exports = Self => { query = `CALL vn.collectionSticker_print(?,?)`; // await Self.rawSql(query, [collectionFk, sectorFk]); - return makeCollection(tickets, sales, placements); + return makeCollection(tickets, sales, placements, collectionFk); }; /** @@ -58,7 +63,7 @@ module.exports = Self => { * @param {*} placements - Request placements * @return {Object} Collection JSON */ - async function makeCollection(tickets, sales, placements) { + async function makeCollection(tickets, sales, placements, collectionFk) { let collection = []; for (let i = 0; i < tickets.length; i++) { @@ -74,7 +79,7 @@ module.exports = Self => { for (let x = 0; x < sales.length; x++) { if (sales[x]['ticketFk'] == ticket['ticketFk']) { let sale = {}; - + sale['collectionFk'] = collectionFk; sale['ticketFk'] = sales[x]['ticketFk']; sale['saleFk'] = sales[x]['saleFk']; sale['itemFk'] = sales[x]['itemFk']; diff --git a/back/methods/collection/collectionUpdateSale.js b/back/methods/collection/collectionUpdateSale.js index 4e8775755f..7204dad222 100644 --- a/back/methods/collection/collectionUpdateSale.js +++ b/back/methods/collection/collectionUpdateSale.js @@ -36,7 +36,7 @@ module.exports = Self => { Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => { const userId = ctx.req.accessToken.userId; - query = `vn.collection_updateSale(?,?,?,?,?)`; + query = `CALL vn.collection_updateSale(?,?,?,?,?)`; return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]); }; }; From b9c6f76c47432cfc26d203c9b2a4d752b636df41 Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 23 Mar 2020 15:34:13 +0100 Subject: [PATCH 05/53] print --- back/methods/collection/collectionNew.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/collectionNew.js index 9a3020bf8e..d22a0b7fe2 100644 --- a/back/methods/collection/collectionNew.js +++ b/back/methods/collection/collectionNew.js @@ -51,7 +51,7 @@ module.exports = Self => { const [placements] = await Self.rawSql(query, [collectionFk]); query = `CALL vn.collectionSticker_print(?,?)`; - // await Self.rawSql(query, [collectionFk, sectorFk]); + await Self.rawSql(query, [collectionFk, sectorFk]); return makeCollection(tickets, sales, placements, collectionFk); }; @@ -61,6 +61,7 @@ module.exports = Self => { * @param {*} tickets - Request tickets * @param {*} sales - Request sales * @param {*} placements - Request placements + * @param {*} collectionFk - Request placements * @return {Object} Collection JSON */ async function makeCollection(tickets, sales, placements, collectionFk) { From 0561f193136a88996b1ee07c1f8de875b39817b2 Mon Sep 17 00:00:00 2001 From: jgallego Date: Tue, 24 Mar 2020 17:34:23 +0100 Subject: [PATCH 06/53] version 1 --- back/methods/dms/checkRole.js | 12 ++++++++ back/methods/dms/downloadFile.js | 30 ++++--------------- back/methods/dms/getFile.js | 29 ++++++++++++++++++ back/methods/dms/specs/downloadFile.spec.js | 2 +- .../10161-postValentineDay/00-borrame.sql | 4 +++ .../worker/back/methods/worker-dms/filter.js | 0 modules/worker/back/models/worker-dms.js | 1 + modules/worker/back/models/worker-dms.json | 3 ++ modules/worker/front/dms/index/index.html | 2 +- modules/worker/front/routes.json | 2 +- modules/worker/front/search-panel/index.html | 2 +- 11 files changed, 58 insertions(+), 29 deletions(-) create mode 100644 back/methods/dms/checkRole.js create mode 100644 back/methods/dms/getFile.js create mode 100644 db/changes/10161-postValentineDay/00-borrame.sql create mode 100644 modules/worker/back/methods/worker-dms/filter.js diff --git a/back/methods/dms/checkRole.js b/back/methods/dms/checkRole.js new file mode 100644 index 0000000000..b8beed3cb7 --- /dev/null +++ b/back/methods/dms/checkRole.js @@ -0,0 +1,12 @@ +const UserError = require('vn-loopback/util/user-error'); + +checkRole = async function(ctx, id) { + const models = Self.app.models; + const dms = await Self.findById(id); + + const hasReadRole = await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); + if (!hasReadRole) + throw new UserError(`You don't have enough privileges`); + + return true; +}; diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js index f3096aabb4..6f0d379aa1 100644 --- a/back/methods/dms/downloadFile.js +++ b/back/methods/dms/downloadFile.js @@ -1,4 +1,6 @@ -const UserError = require('vn-loopback/util/user-error'); + +const checkRole = require('./checkRole'); +const getfile = require('./getfile'); module.exports = Self => { Self.remoteMethodCtx('downloadFile', { @@ -34,29 +36,7 @@ module.exports = Self => { }); Self.downloadFile = async function(ctx, id) { - const storageConnector = Self.app.dataSources.storage.connector; - const models = Self.app.models; - const dms = await Self.findById(id); - - const hasReadRole = await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); - if (!hasReadRole) - throw new UserError(`You don't have enough privileges`); - - const pathHash = storageConnector.getPathHash(dms.id); - try { - await models.Container.getFile(pathHash, dms.file); - } catch (e) { - if (e.code != 'ENOENT') - throw e; - - const error = new UserError(`File doesn't exists`); - error.statusCode = 404; - - throw error; - } - - const stream = models.Container.downloadStream(pathHash, dms.file); - - return [stream, dms.contentType, `filename="${dms.file}"`]; + await checkRole(ctx, id); + return await getfile(ctx, id); }; }; diff --git a/back/methods/dms/getFile.js b/back/methods/dms/getFile.js new file mode 100644 index 0000000000..5c1000b69d --- /dev/null +++ b/back/methods/dms/getFile.js @@ -0,0 +1,29 @@ +const UserError = require('vn-loopback/util/user-error'); + +getFile = async function(ctx, id) { + const storageConnector = Self.app.dataSources.storage.connector; + const models = Self.app.models; + const dms = await Self.findById(id); + + const hasReadRole = await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); + if (!hasReadRole) + + throw new UserError(`You don't have enough privileges`); + + const pathHash = storageConnector.getPathHash(dms.id); + try { + await models.Container.getFile(pathHash, dms.file); + } catch (e) { + if (e.code != 'ENOENT') + throw e; + + const error = new UserError(`File doesn't exists`); + error.statusCode = 404; + + throw error; + } + + const stream = models.Container.downloadStream(pathHash, dms.file); + + return [stream, dms.contentType, `filename="${dms.file}"`]; +}; diff --git a/back/methods/dms/specs/downloadFile.spec.js b/back/methods/dms/specs/downloadFile.spec.js index 99820ed389..43969fc1f0 100644 --- a/back/methods/dms/specs/downloadFile.spec.js +++ b/back/methods/dms/specs/downloadFile.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -describe('dms downloadFile()', () => { +fdescribe('dms downloadFile()', () => { let dmsId = 1; it('should return a response for an employee with text content-type', async() => { diff --git a/db/changes/10161-postValentineDay/00-borrame.sql b/db/changes/10161-postValentineDay/00-borrame.sql new file mode 100644 index 0000000000..22d1f5dec2 --- /dev/null +++ b/db/changes/10161-postValentineDay/00-borrame.sql @@ -0,0 +1,4 @@ +ALTER TABLE `vn`.`workerDocument` +ADD COLUMN `isReadableByWorker` TINYINT(1) NOT NULL DEFAULT 0 AFTER `document`; + +UPDATE `vn`.`workerDocument` SET `isReadableByWorker` = '1' WHERE (`id` = '1'); diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/modules/worker/back/models/worker-dms.js b/modules/worker/back/models/worker-dms.js index 4504b4ed42..c81ec1560e 100644 --- a/modules/worker/back/models/worker-dms.js +++ b/modules/worker/back/models/worker-dms.js @@ -1,4 +1,5 @@ module.exports = Self => { require('../methods/worker-dms/removeFile')(Self); require('../methods/worker-dms/allowedContentTypes')(Self); + // require('../methods/worker-dms/filter')(Self); }; diff --git a/modules/worker/back/models/worker-dms.json b/modules/worker/back/models/worker-dms.json index 56cad65a64..80634cfcc2 100644 --- a/modules/worker/back/models/worker-dms.json +++ b/modules/worker/back/models/worker-dms.json @@ -29,6 +29,9 @@ "mysql": { "columnName": "worker" } + }, + "isReadableByWorker": { + "type": "Boolean" } }, "relations": { diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index 697d3d5aa1..e90d5640e5 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -1,6 +1,6 @@ From 0bd09492d10f1b9fe79e025b207d13be351812b0 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 25 Mar 2020 20:44:59 +0100 Subject: [PATCH 07/53] #2026 Implemented & tests passed --- e2e/helpers/extensions.js | 75 +++++++++++++------- e2e/helpers/selectors.js | 7 +- e2e/paths/01-login/01_login.spec.js | 50 ++++++++----- e2e/paths/02-client/01_create_client.spec.js | 7 +- e2e/paths/05-ticket/11_diary.spec.js | 60 ++++------------ front/core/services/auth.js | 7 +- gulpfile.js | 7 ++ modules/item/front/descriptor/style.scss | 1 + 8 files changed, 115 insertions(+), 99 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 2484728f46..36fbd2c384 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -65,15 +65,6 @@ let actions = { }, doLogin: async function(userName, password = 'nightmare') { - await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true}); - await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`); - await this.write(`vn-login vn-textfield[ng-model="$ctrl.user"]`, userName); - await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.password"]`); - await this.write(`vn-login vn-textfield[ng-model="$ctrl.password"]`, password); - await this.waitToClick('vn-login button[type=submit]'); - }, - - login: async function(userName) { let state = await this.getState(); if (state != 'login') { @@ -91,6 +82,16 @@ let actions = { } await this.waitForState('login'); + + await this.waitForSelector(`vn-login vn-textfield[ng-model="$ctrl.user"]`, {visible: true}); + await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.user"]`); + await this.write(`vn-login vn-textfield[ng-model="$ctrl.user"]`, userName); + await this.clearInput(`vn-login vn-textfield[ng-model="$ctrl.password"]`); + await this.write(`vn-login vn-textfield[ng-model="$ctrl.password"]`, password); + await this.waitToClick('vn-login button[type=submit]'); + }, + + login: async function(userName) { await this.doLogin(userName); await this.waitForState('home'); }, @@ -114,10 +115,11 @@ let actions = { }, gotoState: async function(state, params) { - return await this.evaluate((state, params) => { + await this.evaluate((state, params) => { let $state = angular.element(document.body).injector().get('$state'); return $state.go(state, params); }, state, params); + await this.waitForSpinnerLoad(); }, waitForState: async function(state) { @@ -125,7 +127,7 @@ let actions = { let $state = angular.element(document.body).injector().get('$state'); return !$state.transition && $state.is(state); }, {}, state); - await this.waitForSpinnerLoad(state); + await this.waitForSpinnerLoad(); }, waitForTransition: async function() { @@ -181,6 +183,12 @@ let actions = { }, selector, property); }, + getClassName: async function(selector) { + const element = await this.$(selector); + const handle = await element.getProperty('className'); + return await handle.jsonValue(); + }, + waitPropertyLength: async function(selector, property, minLength) { await this.waitForFunction((selector, property, minLength) => { const element = document.querySelector(selector); @@ -339,24 +347,42 @@ let actions = { await this.waitFor(300); await this.evaluate(() => { - let hideButton = document.querySelector('#shapes .shown button'); + let hideButton = document + .querySelector('vn-snackbar .shape.shown button'); if (hideButton) - return document.querySelector('#shapes .shown button').click(); + return hideButton.click(); }); - await this.waitFor('#shapes > .shape', {hidden: true}); + await this.waitFor('vn-snackbar .shape.shown', {hidden: true}); + }, + + waitForSnackbar: async function() { + const selector = 'vn-snackbar .shape.shown'; + await this.waitForSelector(selector); + + let message = await this.evaluate(selector => { + const shape = document.querySelector(selector); + const message = { + text: shape.querySelector('.text').innerText + }; + + const types = ['error', 'success']; + for (let type of types) { + if (shape.classList.contains(type)) { + message.type = type; + break; + } + } + + return message; + }, selector); + + await this.hideSnackbar(); + return message; }, waitForLastSnackbar: async function() { - const selector = 'vn-snackbar .shown .text'; - - await this.waitForSelector(selector); - let snackBarText = await this.evaluate(selector => { - const shape = document.querySelector(selector); - - return shape.innerText; - }, selector); - await this.hideSnackbar(); - return snackBarText; + const message = await this.waitForSnackbar(); + return message.text; }, pickDate: async function(selector, date) { @@ -438,7 +464,6 @@ let actions = { .includes(searchValue.toLowerCase()); }, {}, builtSelector, searchValue); - await this.waitForMutation('.vn-drop-down', 'childList'); await this.waitFor('.vn-drop-down', {hidden: true}); }, diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 5469c09df3..f9b2a0113e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -2,6 +2,8 @@ export default { globalItems: { applicationsMenuButton: '#apps', + userMenuButton: '#user', + logoutButton: '#logout', applicationsMenuVisible: '.modules-menu', clientsButton: '.modules-menu > li[ui-sref="client.index"]', itemsButton: '.modules-menu > li[ui-sref="item.index"]', @@ -10,7 +12,6 @@ export default { claimsButton: '.modules-menu > li[ui-sref="claim.index"]', returnToModuleIndexButton: 'a[ui-sref="order.index"]', homeButton: 'vn-topbar > div.side.start > a', - userMenuButton: '#user', userLocalWarehouse: '.user-popover vn-autocomplete[ng-model="$ctrl.localWarehouseFk"]', userLocalBank: '.user-popover vn-autocomplete[ng-model="$ctrl.localBankFk"]', userLocalCompany: '.user-popover vn-autocomplete[ng-model="$ctrl.localCompanyFk"]', @@ -338,8 +339,8 @@ export default { }, itemDiary: { secondTicketId: 'vn-item-diary vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > span', + fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance > span', firstBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(1) > vn-td.balance', - fourthBalance: 'vn-item-diary vn-tbody > vn-tr:nth-child(4) > vn-td.balance', warehouse: 'vn-item-diary vn-autocomplete[ng-model="$ctrl.warehouseFk"]', }, itemLog: { @@ -352,7 +353,7 @@ export default { route: 'vn-ticket-summary vn-label-value[label="Route"] > section > span > span', total: 'vn-ticket-summary vn-one.taxes > p:nth-child(3) > strong', sale: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr', - firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table > div > vn-tbody > vn-tr > vn-td:nth-child(2) > span', + firstSaleItemId: 'vn-ticket-summary [name="sales"] vn-table vn-tbody > :nth-child(1) > vn-td:nth-child(2) > span', firstSaleDescriptorImage: '.vn-popover.shown vn-item-descriptor img', itemDescriptorPopover: '.vn-popover.shown vn-item-descriptor', itemDescriptorPopoverItemDiaryButton: 'vn-item-descriptor a[href="#!/item/2/diary?warehouseFk=5&ticketFk=20"]', diff --git a/e2e/paths/01-login/01_login.spec.js b/e2e/paths/01-login/01_login.spec.js index 6b101b00bf..ed507df4e2 100644 --- a/e2e/paths/01-login/01_login.spec.js +++ b/e2e/paths/01-login/01_login.spec.js @@ -1,3 +1,4 @@ +import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; describe('Login path', async() => { @@ -13,41 +14,54 @@ describe('Login path', async() => { }); describe('Bad login', async() => { - it('should receive an error when the username is incorrect', async() => { - await page.doLogin('badUser', ''); - const result = await page.waitForLastSnackbar(); + it('should receive an error when the password is invalid', async() => { + await page.doLogin('employee', 'badPassword'); + const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(result.length).toBeGreaterThan(0); + expect(message.type).toBe('error'); + expect(state).toBe('login'); + }); + + it('should receive an error when the username is invalid', async() => { + await page.doLogin('badUser', ''); + const message = await page.waitForSnackbar(); + const state = await page.getState(); + + expect(message.type).toBe('error'); expect(state).toBe('login'); }); it('should receive an error when the username is blank', async() => { await page.doLogin('', ''); - const result = await page.waitForLastSnackbar(); + const message = await page.waitForSnackbar(); const state = await page.getState(); - expect(result.length).toBeGreaterThan(0); - expect(state).toBe('login'); - }); - - it('should receive an error when the password is incorrect', async() => { - await page.doLogin('employee', 'badPassword'); - const result = await page.waitForLastSnackbar(); - const state = await page.getState(); - - expect(result.length).toBeGreaterThan(0); + expect(message.type).toBe('error'); expect(state).toBe('login'); }); }); describe('Successful login', async() => { - it('should log in', async() => { - await page.doLogin('employee', 'nightmare'); - await page.waitForNavigation(); + it('should log in and go to home state', async() => { + await page.doLogin('employee'); + await page.waitFor('vn-home'); const state = await page.getState(); expect(state).toBe('home'); }); }); + + describe('Logout', async() => { + it('should logout and return to login state', async() => { + await page.doLogin('employee'); + + await page.waitToClick(selectors.globalItems.userMenuButton); + await page.waitToClick(selectors.globalItems.logoutButton); + await page.waitFor('vn-login'); + const state = await page.getState(); + + expect(state).toBe('login'); + }); + }); }); diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 0b8c96c167..79c50fe11b 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -1,9 +1,10 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client create path', async() => { +describe('Client create path', () => { let browser; let page; + beforeAll(async() => { browser = await getBrowser(); page = browser.page; @@ -92,9 +93,9 @@ describe('Client create path', async() => { await page.clearInput(selectors.createClientView.postcode); await page.write(selectors.createClientView.postcode, '46000'); await page.waitToClick(selectors.createClientView.createButton); - const result = await page.waitForLastSnackbar(); + const message = await page.waitForSnackbar(); - expect(result).toEqual('Data saved!'); + expect(message.type).toEqual('success'); }); it('should click on the Clients button of the top bar menu', async() => { diff --git a/e2e/paths/05-ticket/11_diary.spec.js b/e2e/paths/05-ticket/11_diary.spec.js index 5e900fd25e..71c2fa881b 100644 --- a/e2e/paths/05-ticket/11_diary.spec.js +++ b/e2e/paths/05-ticket/11_diary.spec.js @@ -1,66 +1,30 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -// #2026 Fallo en relocate de descriptor popover -xdescribe('Ticket diary path', () => { - let browser; +describe('Ticket diary path', () => { let page; beforeAll(async() => { - browser = await getBrowser(); - page = browser.page; + page = (await getBrowser()).page; await page.loginAndModule('employee', 'ticket'); }); afterAll(async() => { - await browser.close(); + await page.browser().close(); }); - it('should search for a specific ticket', async() => { - await page.write(selectors.ticketsIndex.topbarSearch, '1'); - await page.waitToClick(selectors.ticketsIndex.searchButton); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 1); - const result = await page.countElement(selectors.ticketsIndex.searchResult); - - expect(result).toEqual(1); - }); - - it(`should click on the search result to access to the ticket summary`, async() => { - await page.waitForTextInElement(selectors.ticketsIndex.searchResult, 'Bat cave'); - await page.waitToClick(selectors.ticketsIndex.searchResult); - let url = await page.expectURL('/summary'); // use waitForState instead - - expect(url).toBe(true); - }); - - it(`should navigate to the item diary from the 1st sale item id descriptor popover`, async() => { + it(`should navigate to item diary from ticket sale and check the lines`, async() => { + await page.accessToSearchResult('1'); await page.waitToClick(selectors.ticketSummary.firstSaleItemId); - await page.waitForTransitionEnd('.vn-popover'); await page.waitToClick(selectors.ticketSummary.popoverDiaryButton); - let url = await page.expectURL('/diary'); // use waitForState instead + await page.waitForState('item.card.diary'); - expect(url).toBe(true); - }); + const secondIdClass = await page.getClassName(selectors.itemDiary.secondTicketId); + const fourthBalanceClass = await page.getClassName(selectors.itemDiary.fourthBalance); + const firstBalanceClass = await page.getClassName(selectors.itemDiary.firstBalance); - it(`should check the second line id is marked as message`, async() => { - const result = await page - .waitToGetProperty(selectors.itemDiary.secondTicketId, 'className'); - - expect(result).toContain('message'); - }); - - it(`should check the third line balance is marked as message`, async() => { - const result = await page - .waitToGetProperty(`${selectors.itemDiary.fourthBalance} > span`, 'className'); - - expect(result).toContain('message'); - }); - - it(`should change to the warehouse two and check there are sales marked as negative balance`, async() => { - await page.autocompleteSearch(selectors.itemDiary.warehouse, 'Warehouse Two'); - const result = await page - .waitToGetProperty(selectors.itemDiary.firstBalance, 'className'); - - expect(result).toContain('balance'); + expect(secondIdClass).toContain('message'); + expect(fourthBalanceClass).toContain('message'); + expect(firstBalanceClass).toContain('balance'); }); }); diff --git a/front/core/services/auth.js b/front/core/services/auth.js index f59c4c0dd4..a1dcfa3953 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -45,8 +45,11 @@ export default class Auth { } login(user, password, remember) { - if (!user) - return this.$q.reject(new UserError('Please enter your username')); + if (!user) { + let err = new UserError('Please enter your username'); + err.code = 'EmptyLogin'; + return this.$q.reject(err); + } let params = { user, diff --git a/gulpfile.js b/gulpfile.js index eb421ba9bb..3d9adfded4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -181,6 +181,13 @@ function e2eSingleRun() { return gulp.src(specFiles).pipe(jasmine({ errorOnFail: false, timeout: 30000, + config: { + random: false, + // TODO: Waiting for this option to be implemented + // https://github.com/jasmine/jasmine/issues/1533 + stopSpecOnExpectationFailure: false + + }, reporter: [ new SpecReporter({ spec: { diff --git a/modules/item/front/descriptor/style.scss b/modules/item/front/descriptor/style.scss index c4847bead5..336bfdf53c 100644 --- a/modules/item/front/descriptor/style.scss +++ b/modules/item/front/descriptor/style.scss @@ -3,6 +3,7 @@ vn-item-descriptor { display: block; img[ng-src] { + min-height: 16em; height: 100%; width: 100%; display: block; From 7d6a33d79a525a38935db22f1c32bfdc87a1f27d Mon Sep 17 00:00:00 2001 From: Ainki Date: Thu, 26 Mar 2020 13:12:59 +0100 Subject: [PATCH 08/53] change some names an methods --- back/methods/collection/collectionFaults.js | 4 +- .../collection/collectionUpdateSale.js | 42 --------- .../{collectionGet.js => getCollection.js} | 10 +-- back/methods/collection/getSectors.js | 4 +- .../{collectionNew.js => newCollection.js} | 10 ++- .../collection/updateCollectionSale.js | 89 +++++++++++++++++++ back/models/collection.js | 6 +- 7 files changed, 108 insertions(+), 57 deletions(-) delete mode 100644 back/methods/collection/collectionUpdateSale.js rename back/methods/collection/{collectionGet.js => getCollection.js} (69%) rename back/methods/collection/{collectionNew.js => newCollection.js} (93%) create mode 100644 back/methods/collection/updateCollectionSale.js diff --git a/back/methods/collection/collectionFaults.js b/back/methods/collection/collectionFaults.js index ac51865750..395c7e581e 100644 --- a/back/methods/collection/collectionFaults.js +++ b/back/methods/collection/collectionFaults.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('collectionFaults', { + Self.remoteMethod('collectionFaults', { description: 'Update sale of a collection', accessType: 'WRITE', accepts: [{ @@ -28,7 +28,7 @@ module.exports = Self => { } }); - Self.collectionFaults = async(ctx, shelvingFk, quantity, itemFk) => { + Self.collectionFaults = async(shelvingFk, quantity, itemFk) => { query = `CALL vn.collection_faults(?,?,?)`; return await Self.rawSql(query, [shelvingFk, quantity, itemFk]); }; diff --git a/back/methods/collection/collectionUpdateSale.js b/back/methods/collection/collectionUpdateSale.js deleted file mode 100644 index 7204dad222..0000000000 --- a/back/methods/collection/collectionUpdateSale.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = Self => { - Self.remoteMethodCtx('collectionUpdateSale', { - description: 'Update sale of a collection', - accessType: 'WRITE', - accepts: [{ - arg: 'sale', - type: 'Number', - required: true, - description: 'The sale id' - }, { - arg: 'originalQuantity', - type: 'Number', - required: true, - description: 'The quantity to sale' - }, { - arg: 'ticketFk', - type: 'Number', - required: true, - description: 'The ticket id' - }, { - arg: 'stateFk', - type: 'Number', - required: true, - description: 'The state id' - }], - returns: { - type: 'Object', - root: true - }, - http: { - path: `/collectionUpdateSale`, - verb: 'POST' - } - }); - - Self.collectionUpdateSale = async(ctx, sale, originalQuantity, ticketFk, stateFk) => { - const userId = ctx.req.accessToken.userId; - - query = `CALL vn.collection_updateSale(?,?,?,?,?)`; - return await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]); - }; -}; diff --git a/back/methods/collection/collectionGet.js b/back/methods/collection/getCollection.js similarity index 69% rename from back/methods/collection/collectionGet.js rename to back/methods/collection/getCollection.js index ff98c55d53..caf9cc5210 100644 --- a/back/methods/collection/collectionGet.js +++ b/back/methods/collection/getCollection.js @@ -1,18 +1,18 @@ module.exports = Self => { - Self.remoteMethodCtx('collectionGet', { + Self.remoteMethodCtx('getCollection', { description: 'Get pending collections from a worker', - accessType: 'WRITE', + accessType: 'READ', returns: { type: 'Object', root: true }, http: { - path: `/collectionGet`, - verb: 'POST' + path: `/getCollection`, + verb: 'GET' } }); - Self.collectionGet = async ctx => { + Self.getCollection = async ctx => { const userId = ctx.req.accessToken.userId; const query = `CALL vn.collection_get(?)`; const [result] = await Self.rawSql(query, [userId]); diff --git a/back/methods/collection/getSectors.js b/back/methods/collection/getSectors.js index c5da7ec13f..d844e50979 100644 --- a/back/methods/collection/getSectors.js +++ b/back/methods/collection/getSectors.js @@ -1,14 +1,14 @@ module.exports = Self => { Self.remoteMethodCtx('getSectors', { description: 'Get all sectors', - accessType: 'WRITE', + accessType: 'READ', returns: { type: 'Object', root: true }, http: { path: `/getSectors`, - verb: 'POST' + verb: 'GET' } }); diff --git a/back/methods/collection/collectionNew.js b/back/methods/collection/newCollection.js similarity index 93% rename from back/methods/collection/collectionNew.js rename to back/methods/collection/newCollection.js index d22a0b7fe2..31e419b674 100644 --- a/back/methods/collection/collectionNew.js +++ b/back/methods/collection/newCollection.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('collectionNew', { + Self.remoteMethodCtx('newCollection', { description: 'Make a new collection of tickets', accessType: 'WRITE', accepts: [{ @@ -23,12 +23,12 @@ module.exports = Self => { root: true }, http: { - path: `/collectionNew`, + path: `/newCollection`, verb: 'POST' } }); - Self.collectionNew = async(ctx, collectionFk, sectorFk, vWagons) => { + Self.newCollection = async(ctx, collectionFk, sectorFk, vWagons) => { let query = ''; if (!collectionFk) { @@ -85,6 +85,10 @@ module.exports = Self => { sale['saleFk'] = sales[x]['saleFk']; sale['itemFk'] = sales[x]['itemFk']; sale['quantity'] = sales[x]['quantity']; + if (sales[x]['quantityPicked'] != null) + sale['quantityPicked'] = sales[x]['quantityPicked']; + else + sale['quantityPicked'] = 0; sale['longName'] = sales[x]['longName']; sale['size'] = sales[x]['size']; sale['color'] = sales[x]['color']; diff --git a/back/methods/collection/updateCollectionSale.js b/back/methods/collection/updateCollectionSale.js new file mode 100644 index 0000000000..01575c9727 --- /dev/null +++ b/back/methods/collection/updateCollectionSale.js @@ -0,0 +1,89 @@ +module.exports = Self => { + Self.remoteMethodCtx('updateCollectionSale', { + description: 'Update sale of a collection', + accessType: 'WRITE', + accepts: [{ + arg: 'sale', + type: 'Number', + required: true, + description: 'The sale id' + }, { + arg: 'originalQuantity', + type: 'Number', + required: true, + description: 'The quantity to sale' + }, + { + arg: 'quantity', + type: 'Number', + required: true, + description: 'The quantity to picked' + }, + { + arg: 'quantityPicked', + type: 'Number', + required: true, + description: 'The quantity to picked' + }, { + arg: 'ticketFk', + type: 'Number', + required: true, + description: 'The ticket id' + }, { + arg: 'stateFk', + type: 'Number', + required: true, + description: 'The state id' + }, { + arg: 'isNicho', + type: 'Boolean', + required: true, + description: 'Determine if sale is picked from nicho or not' + }, { + arg: 'shelvingFk', + type: 'String', + required: false, + description: 'The shelving id' + }, { + arg: 'itemFk', + type: 'Number', + required: true, + description: 'The item id' + }, { + arg: 'sectorFk', + type: 'Number', + required: true, + description: 'The sector id' + }], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/updateCollectionSale`, + verb: 'POST' + } + }); + + Self.updateCollectionSale = async(ctx, sale, originalQuantity, quantity, quantityPicked, ticketFk, stateFk, isNicho, shelvingFk, itemFk, sectorFk) => { + const userId = ctx.req.accessToken.userId; + + if (originalQuantity == quantity) { + query = `CALL vn.collection_updateSale(?,?,?,?,?)`; + await Self.rawSql(query, [sale, originalQuantity, userId, stateFk, ticketFk]); + } + + if (!isNicho) { + query = `CALL vn.collection_faults(?,?,?)`; + await Self.rawSql(query, [shelvingFk, quantityPicked, itemFk]); + } else { + query = `CALL vn.sector_getWarehouse(?)`; + const [result] = await Self.rawSql(query, [sectorFk]); + + query = `CALL vn.itemPlacementSave(?,?,?)`; + await Self.rawSql(query, [shelvingFk, quantityPicked, result[0]['warehouseFk']]); + } + query = `CALL vn.sale_updateOriginalQuantity(?,?)`; + return await Self.rawSql(query, [sale, quantity]); + }; +}; diff --git a/back/models/collection.js b/back/models/collection.js index aad0b4196f..d3670d56b5 100644 --- a/back/models/collection.js +++ b/back/models/collection.js @@ -1,7 +1,7 @@ module.exports = Self => { - require('../methods/collection/collectionGet')(Self); - require('../methods/collection/collectionNew')(Self); + require('../methods/collection/getCollection')(Self); + require('../methods/collection/newCollection')(Self); require('../methods/collection/getSectors')(Self); - require('../methods/collection/collectionUpdateSale')(Self); + require('../methods/collection/updateCollectionSale')(Self); require('../methods/collection/collectionFaults')(Self); }; From 3f1039f6d7a68a5e62a7a3f909bf86050d5dfdd5 Mon Sep 17 00:00:00 2001 From: Ainki Date: Thu, 26 Mar 2020 19:10:09 +0100 Subject: [PATCH 09/53] spec --- back/methods/collection/getSectors.js | 6 +++--- back/methods/collection/spec/collectionFauls.spec.js | 8 ++++++++ back/methods/collection/spec/getCollection.spec.js | 10 ++++++++++ back/methods/collection/spec/getSectors.spec.js | 9 +++++++++ back/methods/collection/spec/newCollection.spec.js | 10 ++++++++++ .../collection/spec/updateCollectionSale.spec.js | 7 +++++++ 6 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 back/methods/collection/spec/collectionFauls.spec.js create mode 100644 back/methods/collection/spec/getCollection.spec.js create mode 100644 back/methods/collection/spec/getSectors.spec.js create mode 100644 back/methods/collection/spec/newCollection.spec.js create mode 100644 back/methods/collection/spec/updateCollectionSale.spec.js diff --git a/back/methods/collection/getSectors.js b/back/methods/collection/getSectors.js index d844e50979..12ad0dc068 100644 --- a/back/methods/collection/getSectors.js +++ b/back/methods/collection/getSectors.js @@ -1,5 +1,5 @@ module.exports = Self => { - Self.remoteMethodCtx('getSectors', { + Self.remoteMethod('getSectors', { description: 'Get all sectors', accessType: 'READ', returns: { @@ -12,9 +12,9 @@ module.exports = Self => { } }); - Self.getSectors = async ctx => { + Self.getSectors = async() => { const query = `CALL vn.sector_get()`; - const [result] = await Self.rawSql(query, []); + const [result] = await Self.rawSql(query); return result; }; }; diff --git a/back/methods/collection/spec/collectionFauls.spec.js b/back/methods/collection/spec/collectionFauls.spec.js new file mode 100644 index 0000000000..0df234bfd3 --- /dev/null +++ b/back/methods/collection/spec/collectionFauls.spec.js @@ -0,0 +1,8 @@ + +describe('collectionFaults()', () => { + it('return shelving afected', async() => { + let val = 2; + + expect(val).toBeGreaterThan(1); + }); +}); diff --git a/back/methods/collection/spec/getCollection.spec.js b/back/methods/collection/spec/getCollection.spec.js new file mode 100644 index 0000000000..b8a92285f3 --- /dev/null +++ b/back/methods/collection/spec/getCollection.spec.js @@ -0,0 +1,10 @@ +const app = require('vn-loopback/server/server'); + +describe('getCollection()', () => { + it('return list of collection', async() => { + let ctx = {req: {accessToken: {userId: 1}}}; + let response = await app.models.Collection.getCollection(ctx); + + expect(response.length).toEqual(0); + }); +}); diff --git a/back/methods/collection/spec/getSectors.spec.js b/back/methods/collection/spec/getSectors.spec.js new file mode 100644 index 0000000000..4ba288c015 --- /dev/null +++ b/back/methods/collection/spec/getSectors.spec.js @@ -0,0 +1,9 @@ +const app = require('vn-loopback/server/server'); + +describe('getSectors()', () => { + it('return list of sectors', async() => { + let response = await app.models.Collection.getSectors(); + + expect(response.length).toBeGreaterThan(0); + }); +}); diff --git a/back/methods/collection/spec/newCollection.spec.js b/back/methods/collection/spec/newCollection.spec.js new file mode 100644 index 0000000000..4bf3f79453 --- /dev/null +++ b/back/methods/collection/spec/newCollection.spec.js @@ -0,0 +1,10 @@ +const app = require('vn-loopback/server/server'); + +describe('newCollection()', () => { + it('return a new collection', async() => { + let ctx = {req: {accessToken: {userId: 1}}}; + let response = await app.models.Collection.newCollection(ctx, 500, 1, 1); + + expect(response.length).toBeGreaterThan(0); + }); +}); diff --git a/back/methods/collection/spec/updateCollectionSale.spec.js b/back/methods/collection/spec/updateCollectionSale.spec.js new file mode 100644 index 0000000000..bd4d0fb783 --- /dev/null +++ b/back/methods/collection/spec/updateCollectionSale.spec.js @@ -0,0 +1,7 @@ +describe('updateCollectionSale()', () => { + it('return a collection updated', async() => { + let val = 2; + + expect(val).toBeGreaterThan(1); + }); +}); From 42f3bfb86dec4f0451ef37ae13e0dd6c5a0469c4 Mon Sep 17 00:00:00 2001 From: Ainki Date: Mon, 30 Mar 2020 14:28:29 +0200 Subject: [PATCH 10/53] test, fitxures and changes --- .../collection/spec/collectionFauls.spec.js | 7 +- .../collection/spec/getCollection.spec.js | 5 +- .../collection/spec/getSectors.spec.js | 2 + .../collection/spec/newCollection.spec.js | 5 +- .../spec/updateCollectionSale.spec.js | 13 +- .../00-collectionPlacement_get.sql | 108 + .../00-collection_faults.sql | 39 + .../00-collection_updateSale.sql | 42 + .../00-coolerPathDetail.sql | 13 + .../00-sale_updateOriginalQuantity.sql | 15 + .../00-sector_getWarehouse.sql | 14 + db/dump/fixtures.sql | 25 +- db/dump/structure.sql | 2076 ++++++++--------- 13 files changed, 1314 insertions(+), 1050 deletions(-) create mode 100644 db/changes/10162-postValentineDay/00-collectionPlacement_get.sql create mode 100644 db/changes/10162-postValentineDay/00-collection_faults.sql create mode 100644 db/changes/10162-postValentineDay/00-collection_updateSale.sql create mode 100644 db/changes/10162-postValentineDay/00-coolerPathDetail.sql create mode 100644 db/changes/10162-postValentineDay/00-sale_updateOriginalQuantity.sql create mode 100644 db/changes/10162-postValentineDay/00-sector_getWarehouse.sql diff --git a/back/methods/collection/spec/collectionFauls.spec.js b/back/methods/collection/spec/collectionFauls.spec.js index 0df234bfd3..210dcdf63b 100644 --- a/back/methods/collection/spec/collectionFauls.spec.js +++ b/back/methods/collection/spec/collectionFauls.spec.js @@ -1,8 +1,9 @@ - +const app = require('vn-loopback/server/server'); describe('collectionFaults()', () => { it('return shelving afected', async() => { - let val = 2; + let response = await app.models.Collection.collectionFaults('UXN', 0, 1); - expect(val).toBeGreaterThan(1); + expect(response.length).toBeGreaterThan(0); + expect(response[0][0].shelvingFk).toEqual('UXN'); }); }); diff --git a/back/methods/collection/spec/getCollection.spec.js b/back/methods/collection/spec/getCollection.spec.js index b8a92285f3..44c7af62f7 100644 --- a/back/methods/collection/spec/getCollection.spec.js +++ b/back/methods/collection/spec/getCollection.spec.js @@ -2,9 +2,10 @@ const app = require('vn-loopback/server/server'); describe('getCollection()', () => { it('return list of collection', async() => { - let ctx = {req: {accessToken: {userId: 1}}}; + let ctx = {req: {accessToken: {userId: 106}}}; let response = await app.models.Collection.getCollection(ctx); - expect(response.length).toEqual(0); + expect(response.length).toBeGreaterThan(0); + expect(response[0].collectionFk).toEqual(1); }); }); diff --git a/back/methods/collection/spec/getSectors.spec.js b/back/methods/collection/spec/getSectors.spec.js index 4ba288c015..d453220a04 100644 --- a/back/methods/collection/spec/getSectors.spec.js +++ b/back/methods/collection/spec/getSectors.spec.js @@ -5,5 +5,7 @@ describe('getSectors()', () => { let response = await app.models.Collection.getSectors(); expect(response.length).toBeGreaterThan(0); + expect(response[0].id).toEqual(1); + expect(response[0].description).toEqual('First sector'); }); }); diff --git a/back/methods/collection/spec/newCollection.spec.js b/back/methods/collection/spec/newCollection.spec.js index 4bf3f79453..bd574db0f4 100644 --- a/back/methods/collection/spec/newCollection.spec.js +++ b/back/methods/collection/spec/newCollection.spec.js @@ -2,9 +2,10 @@ const app = require('vn-loopback/server/server'); describe('newCollection()', () => { it('return a new collection', async() => { - let ctx = {req: {accessToken: {userId: 1}}}; - let response = await app.models.Collection.newCollection(ctx, 500, 1, 1); + let ctx = {req: {accessToken: {userId: 106}}}; + let response = await app.models.Collection.newCollection(ctx, 1, 1, 1); expect(response.length).toBeGreaterThan(0); + expect(response[0].ticketFk).toEqual(1); }); }); diff --git a/back/methods/collection/spec/updateCollectionSale.spec.js b/back/methods/collection/spec/updateCollectionSale.spec.js index bd4d0fb783..4695f6eec5 100644 --- a/back/methods/collection/spec/updateCollectionSale.spec.js +++ b/back/methods/collection/spec/updateCollectionSale.spec.js @@ -1,7 +1,12 @@ -describe('updateCollectionSale()', () => { - it('return a collection updated', async() => { - let val = 2; +const app = require('vn-loopback/server/server'); - expect(val).toBeGreaterThan(1); +describe('updateCollectionSale()', () => { + it('return a new collection', async() => { + let ctx = {req: {accessToken: {userId: 106}}}; + let response = await app.models.Collection.updateCollectionSale(ctx, 1, 5, 5, 5, 1, 4, false, 'UXN', 1, 1); + + expect(response.length).toBeGreaterThan(0); + expect(response[0][0].id).toEqual(1); + expect(response[0][0].quantity).toEqual(5); }); }); diff --git a/db/changes/10162-postValentineDay/00-collectionPlacement_get.sql b/db/changes/10162-postValentineDay/00-collectionPlacement_get.sql new file mode 100644 index 0000000000..d89f6a801b --- /dev/null +++ b/db/changes/10162-postValentineDay/00-collectionPlacement_get.sql @@ -0,0 +1,108 @@ +DROP procedure IF EXISTS `vn`.`collectionPlacement_get`; + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`collectionPlacement_get`(vCollectionFk INT) +BEGIN + + DECLARE vCalcFk INT; + DECLARE vWarehouseFk INT; + DECLARE vWarehouseAliasFk INT; + + SELECT t.warehouseFk, w.aliasFk + INTO vWarehouseFk, vWarehouseAliasFk + FROM vn.ticket t + JOIN vn.ticketCollection tc ON tc.ticketFk = t.id + JOIN vn.warehouse w ON w.id = t.warehouseFk + WHERE tc.collectionFk = vCollectionFk + LIMIT 1; + + CALL cache.visible_refresh(vCalcFk,FALSE,vWarehouseFk); + + DROP TEMPORARY TABLE IF EXISTS tmp.parked; + CREATE TEMPORARY TABLE tmp.parked + ENGINE MEMORY + SELECT s.itemFk, 0 as quantity + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + WHERE tc.collectionFk = vCollectionFk; + + UPDATE tmp.parked pk + JOIN ( SELECT itemFk, sum(visible) as visible + FROM vn.itemShelvingStock iss + JOIN vn.warehouse w ON w.id = iss.warehouseFk + WHERE w.aliasFk = vWarehouseAliasFk + GROUP BY iss.itemFk ) iss ON iss.itemFk = pk.itemFk + SET pk.quantity = iss.visible; + + DROP TEMPORARY TABLE IF EXISTS tmp.`grouping`; + CREATE TEMPORARY TABLE tmp.`grouping` + ENGINE MEMORY + SELECT itemFk, `grouping` + FROM ( + SELECT itemFk, + CASE groupingMode + WHEN 0 THEN 1 + WHEN 2 THEN packing + ELSE `grouping` + END AS `grouping` + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + WHERE tr.warehouseInFk = vWarehouseFk + AND landed BETWEEN (SELECT inventoried FROM vn.config LIMIT 1) AND CURDATE() + AND b.isIgnored = FALSE + ORDER BY tr.landed DESC + ) sub + GROUP BY sub.itemFk ; + + DROP TEMPORARY TABLE IF EXISTS tmp.grouping2; + CREATE TEMPORARY TABLE tmp.grouping2 + ENGINE MEMORY + SELECT * FROM tmp.`grouping`; + + + SELECT s.id as saleFk, s.itemFk, + p.code COLLATE utf8_general_ci as placement , + sh.code COLLATE utf8_general_ci as shelving, + ish.created, + ish.visible, + 0 as `order`, + IF(sc.isPreviousPreparedByPacking, ish.packing, g.`grouping`) as `grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemShelving ish ON ish.itemFk = s.itemFk + JOIN vn.shelving sh ON sh.code = ish.shelvingFk + JOIN vn.parking p ON p.id = sh.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + JOIN vn.warehouse w ON w.id = sc.warehouseFk + JOIN tmp.`grouping` g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND w.aliasFk = vWarehouseAliasFk + AND ish.visible > 0 + UNION ALL + SELECT s.id as saleFk, s.itemFk, + ip.code COLLATE utf8_general_ci as placement, + '' COLLATE latin1_general_ci as shelving, + modificationDate as created, + v.visible - p.quantity as visible, + 0 as `order`, + g.`grouping` + FROM vn.ticketCollection tc + JOIN vn.sale s ON s.ticketFk = tc.ticketFk + JOIN vn.itemPlacement ip ON ip.itemFk = s.itemFk AND ip.warehouseFk = vWarehouseFk + JOIN tmp.parked p ON p.itemFk = s.itemFk + JOIN cache.visible v ON v.item_id = s.itemFk AND v.calc_id = vCalcFk + LEFT JOIN tmp.grouping2 g ON g.itemFk = s.itemFk + WHERE tc.collectionFk = vCollectionFk + AND v.visible - p.quantity > 0; + + DROP TEMPORARY TABLE + tmp.parked, + tmp.`grouping`, + tmp.grouping2; +END + + +$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10162-postValentineDay/00-collection_faults.sql b/db/changes/10162-postValentineDay/00-collection_faults.sql new file mode 100644 index 0000000000..5faa42ca44 --- /dev/null +++ b/db/changes/10162-postValentineDay/00-collection_faults.sql @@ -0,0 +1,39 @@ +DROP procedure IF EXISTS `vn`.`collection_faults`; + +DELIMITER $$ + +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`collection_faults`( + vShelvingFk VARCHAR(10), + vQuantity INT, + vItemFk INT) +BEGIN + DECLARE vQuantityTotal INT DEFAULT 0; + DECLARE vshelve VARCHAR(2); + DECLARE vdeep INT(11); + DECLARE vpriority INT(11); + DECLARE vgrouping SMALLINT(5); + DECLARE vpacking INT(11); + DECLARE vpackagingFk VARCHAR(10); + DECLARE vlevel VARCHAR(45); + DECLARE vuserFk INT(10); + + + SELECT SUM(quantity),shelve,deep,priority,`grouping`,packing,packagingFk,`level`,userFk + INTO vQuantityTotal,vshelve,vdeep,vpriority,vgrouping,vpacking,vpackagingFk,vlevel,vuserFk + FROM vn.itemShelving + WHERE shelvingFk = vShelvingFk COLLATE utf8mb4_unicode_ci AND itemFk = vItemFk + GROUP BY itemFk; + + SELECT vQuantityTotal - vQuantity INTO vQuantityTotal; + + DELETE FROM vn.itemShelving WHERE shelvingFk = vShelvingFk COLLATE utf8mb4_unicode_ci AND itemFk = vItemFk; + + INSERT INTO vn.itemShelving (itemFk, shelvingFk,shelve,deep,quantity,visible,available,priority,`grouping`,packing,packagingFk,`level`,userFk ) + VALUES (vItemFk,vShelvingFk,vshelve,vdeep,vQuantityTotal,vQuantityTotal,vQuantityTotal,vpriority,vgrouping,vpacking,vpackagingFk,vlevel,vuserFk ); + + SELECT * FROM vn.itemShelving + WHERE shelvingFk = vShelvingFk COLLATE utf8mb4_unicode_ci AND itemFk = vItemFk; + +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10162-postValentineDay/00-collection_updateSale.sql b/db/changes/10162-postValentineDay/00-collection_updateSale.sql new file mode 100644 index 0000000000..cce8f4ff56 --- /dev/null +++ b/db/changes/10162-postValentineDay/00-collection_updateSale.sql @@ -0,0 +1,42 @@ +DROP procedure IF EXISTS `vn`.`collection_updateSale`; + + +DELIMITER $$ +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`collection_updateSale`( + vSaleFk INT, + vOriginalQuantity INT, + vWorkerFk INT, + vStateFk INT, + vTicketFk INT) +BEGIN + + DECLARE vNumPrepared INT; + DECLARE vNumTotal INT; + + REPLACE INTO vn.saleTracking(saleFk,isChecked, originalQuantity, workerFk, actionFk,stateFk) + VALUES(vSaleFk,1,vOriginalQuantity,vWorkerFk,vStateFk,vStateFk); + + UPDATE vn.sale SET isPicked = 1 + WHERE id = vSaleFk; + + SELECT COUNT(s.id) INTO vNumPrepared + FROM vn.sale s + WHERE s.ticketFk = vTicketFk AND s.isPicked = 1; + + SELECT COUNT(s.id) INTO vNumTotal + FROM vn.sale s + WHERE s.ticketFk = vTicketFk; + + IF vNumPrepared = vNumTotal THEN + + INSERT INTO vncontrol.inter + SET state_id = vStateFk, Id_Ticket = vTicketFk, Id_Trabajador = vWorkerFk; + + CALL vn.collection_update(vTicketFk); + + END IF; + + +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10162-postValentineDay/00-coolerPathDetail.sql b/db/changes/10162-postValentineDay/00-coolerPathDetail.sql new file mode 100644 index 0000000000..7d30065445 --- /dev/null +++ b/db/changes/10162-postValentineDay/00-coolerPathDetail.sql @@ -0,0 +1,13 @@ +/*DROP view IF EXISTS `vn`.`coolerPathDetail`; + +CREATE + ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `vn`.`coolerPathDetail` AS + SELECT + `c`.`cooler_path_detail_id` AS `id`, + `c`.`cooler_path_id` AS `coolerPathFk`, + `c`.`pasillo` AS `hallway` + FROM + `vn2008`.`cooler_path_detail` `c`*/ \ No newline at end of file diff --git a/db/changes/10162-postValentineDay/00-sale_updateOriginalQuantity.sql b/db/changes/10162-postValentineDay/00-sale_updateOriginalQuantity.sql new file mode 100644 index 0000000000..debdd3ac2f --- /dev/null +++ b/db/changes/10162-postValentineDay/00-sale_updateOriginalQuantity.sql @@ -0,0 +1,15 @@ +DROP procedure IF EXISTS `vn`.`sale_updateOriginalQuantity`; + +DELIMITER $$ + +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sale_updateOriginalQuantity`(vSale INT, vQuantity INT) +proc: BEGIN + +UPDATE vn.sale SET originalQuantity = vQuantity +WHERE id = vSale; + +SELECT * FROM vn.sale WHERE id = vSale; + +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/changes/10162-postValentineDay/00-sector_getWarehouse.sql b/db/changes/10162-postValentineDay/00-sector_getWarehouse.sql new file mode 100644 index 0000000000..90611b5592 --- /dev/null +++ b/db/changes/10162-postValentineDay/00-sector_getWarehouse.sql @@ -0,0 +1,14 @@ +DROP procedure IF EXISTS `vn`.`sector_getWarehouse`; + +DELIMITER $$ + +CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`sector_getWarehouse`(vSectorFk INT) +BEGIN + + SELECT s.warehouseFk + FROM vn.sector s + WHERE s.id = vSectorFk; + +END$$ + +DELIMITER ; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7b2fd1cae5..fbe33159af 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -21,7 +21,7 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo (1.30, 167.00, 138000, 71); INSERT INTO `vn`.`chatConfig` (`host`, `api`) - VALUES + VALUES ('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1'); INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`) @@ -954,6 +954,29 @@ INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`) (3, 1, 3, 'A3'), (4, 2, 1, 'A4'); + +INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`) + VALUES + (1, 106, 5), + (2, 106, 14); + +INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`) + VALUES + ('100', '01', 1, '100-01', 1); + +INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `priority`, `userFk`) + VALUES + ('UXN', 1, 1, 106); + +INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `deep`, `quantity`, `visible`, `available`, `grouping`, `packing`, `level`, `userFk`) + VALUES + (1, 'UXN', 'A', 2, 12, 12, 12, 12, 12, 1, 106); + +INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `level`) + VALUES + (1, 1, 1); + + INSERT INTO `edi`.`genus`(`genus_id`, `latin_genus_name`, `entry_date`, `expiry_date`, `change_date_time`) VALUES (1, 'Abelia' , CURDATE(), NULL, CURDATE()), diff --git a/db/dump/structure.sql b/db/dump/structure.sql index 8e783c8337..2a1a168d7c 100644 --- a/db/dump/structure.sql +++ b/db/dump/structure.sql @@ -4055,16 +4055,16 @@ BEGIN * La tabla mana_spellers es una caché * */ - - UPDATE mana_spellers me - JOIN - (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual - FROM bs.vendedores - WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE()) - GROUP BY Id_Trabajador - ) lastYearSales USING(Id_Trabajador) - SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ; - + + UPDATE mana_spellers me + JOIN + (SELECT Id_Trabajador, FLOOR(SUM(importe)/12) as pesoCarteraMensual + FROM bs.vendedores + WHERE año * 100 + mes >= (YEAR(CURDATE()) -1) * 100 + MONTH(CURDATE()) + GROUP BY Id_Trabajador + ) lastYearSales USING(Id_Trabajador) + SET me.prices_modifier_rate = GREATEST(me.minRate,LEAST(me.maxRate,ROUND(- me.used/lastYearSales.pesoCarteraMensual,3))) ; + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6703,9 +6703,9 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cacheCalc_clean`() -BEGIN - DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW()); - DELETE FROM cache_calc WHERE expires < vCleanTime; +BEGIN + DECLARE vCleanTime DATETIME DEFAULT TIMESTAMPADD(MINUTE, -5, NOW()); + DELETE FROM cache_calc WHERE expires < vCleanTime; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6723,27 +6723,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_end`(IN `v_calc` INT) -BEGIN - DECLARE v_cache_name VARCHAR(255); - DECLARE v_params VARCHAR(255); - - -- Libera el bloqueo y actualiza la fecha de ultimo refresco. - - UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id - SET - cc.last_refresh = NOW(), - cc.expires = ADDTIME(NOW(), c.lifetime), - cc.connection_id = NULL - WHERE cc.id = v_calc; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +BEGIN + DECLARE v_cache_name VARCHAR(255); + DECLARE v_params VARCHAR(255); + + -- Libera el bloqueo y actualiza la fecha de ultimo refresco. + + UPDATE cache_calc cc JOIN cache c ON c.id = cc.cache_id + SET + cc.last_refresh = NOW(), + cc.expires = ADDTIME(NOW(), c.lifetime), + cc.connection_id = NULL + WHERE cc.id = v_calc; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6761,88 +6761,88 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_start`(OUT `v_calc` INT, INOUT `v_refresh` INT, IN `v_cache_name` VARCHAR(50), IN `v_params` VARCHAR(100)) -proc: BEGIN - DECLARE v_valid BOOL; - DECLARE v_lock_id VARCHAR(100); - DECLARE v_cache_id INT; - DECLARE v_expires DATETIME; - DECLARE v_clean_time DATETIME; - - DECLARE EXIT HANDLER FOR SQLEXCEPTION - BEGIN - IF v_lock_id IS NOT NULL THEN - DO RELEASE_LOCK(v_lock_id); - END IF; - - RESIGNAL; - END; - - SET v_params = IFNULL(v_params, ''); - - -- Si el servidor se ha reiniciado invalida todos los calculos. - - SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; - - IF !v_valid - THEN - DELETE FROM cache_calc; - INSERT INTO cache_valid (valid) VALUES (TRUE); - END IF; - - -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. - - SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); - - IF !GET_LOCK(v_lock_id, 30) - THEN - SET v_calc = NULL; - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Comprueba si el calculo solicitado existe y esta actualizado. - - SELECT c.id, ca.id, ca.expires - INTO v_cache_id, v_calc, v_expires - FROM cache c - LEFT JOIN cache_calc ca - ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' - WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; - - -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. - - IF !v_refresh AND NOW() < v_expires - THEN - DO RELEASE_LOCK(v_lock_id); - SET v_refresh = FALSE; - LEAVE proc; - END IF; - - -- Si el calculo no existe le crea una entrada en la tabla de calculos. - - IF v_calc IS NULL - THEN - INSERT INTO cache_calc SET - cache_id = v_cache_id, - cacheName = v_cache_name, - params = v_params, - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID(); - - SET v_calc = LAST_INSERT_ID(); - ELSE - UPDATE cache_calc - SET - last_refresh = NULL, - expires = NULL, - connection_id = CONNECTION_ID() - WHERE id = v_calc; - END IF; - - -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. - - SET v_refresh = TRUE; +proc: BEGIN + DECLARE v_valid BOOL; + DECLARE v_lock_id VARCHAR(100); + DECLARE v_cache_id INT; + DECLARE v_expires DATETIME; + DECLARE v_clean_time DATETIME; + + DECLARE EXIT HANDLER FOR SQLEXCEPTION + BEGIN + IF v_lock_id IS NOT NULL THEN + DO RELEASE_LOCK(v_lock_id); + END IF; + + RESIGNAL; + END; + + SET v_params = IFNULL(v_params, ''); + + -- Si el servidor se ha reiniciado invalida todos los calculos. + + SELECT COUNT(*) > 0 INTO v_valid FROM cache_valid; + + IF !v_valid + THEN + DELETE FROM cache_calc; + INSERT INTO cache_valid (valid) VALUES (TRUE); + END IF; + + -- Obtiene un bloqueo exclusivo para que no haya problemas de concurrencia. + + SET v_lock_id = CONCAT_WS('/', v_cache_name, v_params); + + IF !GET_LOCK(v_lock_id, 30) + THEN + SET v_calc = NULL; + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Comprueba si el calculo solicitado existe y esta actualizado. + + SELECT c.id, ca.id, ca.expires + INTO v_cache_id, v_calc, v_expires + FROM cache c + LEFT JOIN cache_calc ca + ON ca.cache_id = c.id AND ca.params = v_params COLLATE 'utf8_general_ci' + WHERE c.name = v_cache_name COLLATE 'utf8_general_ci'; + + -- Si existe una calculo valido libera el bloqueo y devuelve su identificador. + + IF !v_refresh AND NOW() < v_expires + THEN + DO RELEASE_LOCK(v_lock_id); + SET v_refresh = FALSE; + LEAVE proc; + END IF; + + -- Si el calculo no existe le crea una entrada en la tabla de calculos. + + IF v_calc IS NULL + THEN + INSERT INTO cache_calc SET + cache_id = v_cache_id, + cacheName = v_cache_name, + params = v_params, + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID(); + + SET v_calc = LAST_INSERT_ID(); + ELSE + UPDATE cache_calc + SET + last_refresh = NULL, + expires = NULL, + connection_id = CONNECTION_ID() + WHERE id = v_calc; + END IF; + + -- Si se debe recalcular mantiene el bloqueo y devuelve su identificador. + + SET v_refresh = TRUE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6860,24 +6860,24 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_calc_unlock`(IN `v_calc` INT) -proc: BEGIN - DECLARE v_cache_name VARCHAR(50); - DECLARE v_params VARCHAR(100); - - IF v_calc IS NULL THEN - LEAVE proc; - END IF; - - SELECT c.name, ca.params INTO v_cache_name, v_params - FROM cache c - JOIN cache_calc ca ON c.id = ca.cache_id - WHERE ca.id = v_calc; - - DELETE FROM cache_calc WHERE id = v_calc; - - IF v_cache_name IS NOT NULL THEN - DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); - END IF; +proc: BEGIN + DECLARE v_cache_name VARCHAR(50); + DECLARE v_params VARCHAR(100); + + IF v_calc IS NULL THEN + LEAVE proc; + END IF; + + SELECT c.name, ca.params INTO v_cache_name, v_params + FROM cache c + JOIN cache_calc ca ON c.id = ca.cache_id + WHERE ca.id = v_calc; + + DELETE FROM cache_calc WHERE id = v_calc; + + IF v_cache_name IS NOT NULL THEN + DO RELEASE_LOCK(CONCAT_WS('/', v_cache_name, IFNULL(v_params, ''))); + END IF; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6896,9 +6896,9 @@ DELIMITER ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `cache_clean`() NO SQL -BEGIN - CALL available_clean; - CALL visible_clean; +BEGIN + CALL available_clean; + CALL visible_clean; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -6916,13 +6916,13 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean`() -BEGIN - - DECLARE vDateShort DATETIME; - - SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); - - DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; +BEGIN + + DECLARE vDateShort DATETIME; + + SET vDateShort = TIMESTAMPADD(MONTH, -1, CURDATE()); + + DELETE FROM cache.departure_limit WHERE Fecha < vDateShort; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8386,158 +8386,158 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `ekt_load`(IN `vSelf` INT) -BEGIN - DECLARE vRef INT; - DECLARE vBuy INT; - DECLARE vItem INT; - DECLARE vQty INT; - DECLARE vPackage INT; - DECLARE vIsLot BOOLEAN; - DECLARE vForceToPacking INT DEFAULT 2; - - -- Carga los datos necesarios del EKT - - SELECT ref, qty, package INTO vRef, vQty, vPackage - FROM ekt e - LEFT JOIN item i ON e.ref = i.id - WHERE e.id = vSelf; - - -- Inserta el cubo si no existe - - IF vPackage = 800 - THEN - SET vPackage = 800 + vQty; - - INSERT IGNORE INTO vn2008.Cubos SET - Id_Cubo = vPackage, - x = 7200 / vQty, - y = 1; - ELSE - INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) - SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) - FROM bucket WHERE bucket_id = vPackage; - - IF ROW_COUNT() > 0 - THEN - INSERT INTO vn2008.mail SET - `subject` = 'Cubo añadido', - `text` = CONCAT('Se ha añadido el cubo: ', vPackage), - `to` = 'ekt@verdnatura.es'; - END IF; - END IF; - - -- Intenta obtener el artículo en base a los atributos holandeses - - INSERT IGNORE INTO item_track SET - item_id = vRef; - - SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem - FROM vn2008.buy_edi e - JOIN item_track t ON t.item_id = e.ref - LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref - LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id - JOIN vn2008.config cfg - WHERE e.id = vSelf - AND l.id != vSelf - AND c.Id_Article != cfg.generic_item - AND IF(t.s1, l.s1 = e.s1, TRUE) - AND IF(t.s2, l.s2 = e.s2, TRUE) - AND IF(t.s3, l.s3 = e.s3, TRUE) - AND IF(t.s4, l.s4 = e.s4, TRUE) - AND IF(t.s5, l.s5 = e.s5, TRUE) - AND IF(t.s6, l.s6 = e.s6, TRUE) - AND IF(t.kop, l.kop = e.kop, TRUE) - AND IF(t.pac, l.pac = e.pac, TRUE) - AND IF(t.cat, l.cat = e.cat, TRUE) - AND IF(t.ori, l.ori = e.ori, TRUE) - AND IF(t.pro, l.pro = e.pro, TRUE) - AND IF(t.sub, l.sub = e.sub, TRUE) - AND IF(t.package, l.package = e.package, TRUE) - AND c.Id_Article < 170000 - ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; - - -- Determina si el articulo se vende por lotes - - IF vItem - THEN - SELECT COUNT(*) > 0 INTO vIsLot - FROM vn2008.Articles a - LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id - WHERE a.Id_Article = vItem - AND t.`transaction`; - - -- Si el articulo se vende por lotes se inserta un nuevo artículo - - IF vIsLot - THEN - INSERT INTO vn2008.Articles ( - Article - ,Medida - ,Categoria - ,Id_Origen - ,iva_group_id - ,Foto - ,Color - ,Codintrastat - ,tipo_id - ,Tallos - ) - SELECT - i.`name` - ,IFNULL(e.s1, e.pac) - ,e.cat - ,IFNULL(o.id, 17) - ,IFNULL(a.iva_group_id, 1) - ,a.Foto - ,a.Color - ,a.Codintrastat - ,IFNULL(a.tipo_id, 10) - ,IF(a.tipo_id = 15, 0, 1) - FROM vn2008.buy_edi e - LEFT JOIN item i ON i.id = e.ref - LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori - LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem - WHERE e.id = vSelf; - - SET vItem = LAST_INSERT_ID(); - END IF; - END IF; - - -- Inserta la compra asociada al EKT - - INSERT INTO vn2008.Compres - ( - Id_Entrada - ,buy_edi_id - ,Costefijo - ,Id_Article - ,`grouping` - ,caja - ,Packing - ,Cantidad - ,Productor - ,Etiquetas - ,Id_Cubo - ) - SELECT - cfg.edi_entry - ,vSelf - ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri - ,IFNULL(vItem, cfg.generic_item) - ,IFNULL(c.`grouping`, e.pac) - ,vForceToPacking - ,@pac := e.pac / @t - ,@pac * e.qty - ,s.company_name - ,e.qty - ,IFNULL(c.Id_Cubo, e.package) - FROM vn2008.buy_edi e - LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy - LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article - LEFT JOIN supplier s ON e.pro = s.supplier_id - JOIN vn2008.config cfg - WHERE e.id = vSelf - LIMIT 1; +BEGIN + DECLARE vRef INT; + DECLARE vBuy INT; + DECLARE vItem INT; + DECLARE vQty INT; + DECLARE vPackage INT; + DECLARE vIsLot BOOLEAN; + DECLARE vForceToPacking INT DEFAULT 2; + + -- Carga los datos necesarios del EKT + + SELECT ref, qty, package INTO vRef, vQty, vPackage + FROM ekt e + LEFT JOIN item i ON e.ref = i.id + WHERE e.id = vSelf; + + -- Inserta el cubo si no existe + + IF vPackage = 800 + THEN + SET vPackage = 800 + vQty; + + INSERT IGNORE INTO vn2008.Cubos SET + Id_Cubo = vPackage, + x = 7200 / vQty, + y = 1; + ELSE + INSERT IGNORE INTO vn2008.Cubos (Id_Cubo, X, Y, Z) + SELECT bucket_id, ROUND(x_size/10), ROUND(y_size/10), ROUND(z_size/10) + FROM bucket WHERE bucket_id = vPackage; + + IF ROW_COUNT() > 0 + THEN + INSERT INTO vn2008.mail SET + `subject` = 'Cubo añadido', + `text` = CONCAT('Se ha añadido el cubo: ', vPackage), + `to` = 'ekt@verdnatura.es'; + END IF; + END IF; + + -- Intenta obtener el artículo en base a los atributos holandeses + + INSERT IGNORE INTO item_track SET + item_id = vRef; + + SELECT c.Id_Compra, c.Id_Article INTO vBuy, vItem + FROM vn2008.buy_edi e + JOIN item_track t ON t.item_id = e.ref + LEFT JOIN vn2008.buy_edi l ON l.ref = e.ref + LEFT JOIN vn2008.Compres c ON c.buy_edi_id = l.id + JOIN vn2008.config cfg + WHERE e.id = vSelf + AND l.id != vSelf + AND c.Id_Article != cfg.generic_item + AND IF(t.s1, l.s1 = e.s1, TRUE) + AND IF(t.s2, l.s2 = e.s2, TRUE) + AND IF(t.s3, l.s3 = e.s3, TRUE) + AND IF(t.s4, l.s4 = e.s4, TRUE) + AND IF(t.s5, l.s5 = e.s5, TRUE) + AND IF(t.s6, l.s6 = e.s6, TRUE) + AND IF(t.kop, l.kop = e.kop, TRUE) + AND IF(t.pac, l.pac = e.pac, TRUE) + AND IF(t.cat, l.cat = e.cat, TRUE) + AND IF(t.ori, l.ori = e.ori, TRUE) + AND IF(t.pro, l.pro = e.pro, TRUE) + AND IF(t.sub, l.sub = e.sub, TRUE) + AND IF(t.package, l.package = e.package, TRUE) + AND c.Id_Article < 170000 + ORDER BY l.now DESC, c.Id_Compra ASC LIMIT 1; + + -- Determina si el articulo se vende por lotes + + IF vItem + THEN + SELECT COUNT(*) > 0 INTO vIsLot + FROM vn2008.Articles a + LEFT JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id + WHERE a.Id_Article = vItem + AND t.`transaction`; + + -- Si el articulo se vende por lotes se inserta un nuevo artículo + + IF vIsLot + THEN + INSERT INTO vn2008.Articles ( + Article + ,Medida + ,Categoria + ,Id_Origen + ,iva_group_id + ,Foto + ,Color + ,Codintrastat + ,tipo_id + ,Tallos + ) + SELECT + i.`name` + ,IFNULL(e.s1, e.pac) + ,e.cat + ,IFNULL(o.id, 17) + ,IFNULL(a.iva_group_id, 1) + ,a.Foto + ,a.Color + ,a.Codintrastat + ,IFNULL(a.tipo_id, 10) + ,IF(a.tipo_id = 15, 0, 1) + FROM vn2008.buy_edi e + LEFT JOIN item i ON i.id = e.ref + LEFT JOIN vn2008.Origen o ON o.Abreviatura = e.ori + LEFT JOIN vn2008.Articles a ON a.Id_Article = vItem + WHERE e.id = vSelf; + + SET vItem = LAST_INSERT_ID(); + END IF; + END IF; + + -- Inserta la compra asociada al EKT + + INSERT INTO vn2008.Compres + ( + Id_Entrada + ,buy_edi_id + ,Costefijo + ,Id_Article + ,`grouping` + ,caja + ,Packing + ,Cantidad + ,Productor + ,Etiquetas + ,Id_Cubo + ) + SELECT + cfg.edi_entry + ,vSelf + ,(@t := IF(a.Tallos, a.Tallos, 1)) * e.pri + ,IFNULL(vItem, cfg.generic_item) + ,IFNULL(c.`grouping`, e.pac) + ,vForceToPacking + ,@pac := e.pac / @t + ,@pac * e.qty + ,s.company_name + ,e.qty + ,IFNULL(c.Id_Cubo, e.package) + FROM vn2008.buy_edi e + LEFT JOIN vn2008.Compres c ON c.Id_Compra = vBuy + LEFT JOIN vn2008.Articles a ON a.Id_Article = c.Id_Article + LEFT JOIN supplier s ON e.pro = s.supplier_id + JOIN vn2008.config cfg + WHERE e.id = vSelf + LIMIT 1; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -8587,154 +8587,154 @@ CREATE DEFINER=`root`@`%` PROCEDURE `exchange_new`( IN `vAuction` SMALLINT, IN `vPackage` INT, IN `vPutOrderFk` INT) -BEGIN +BEGIN /** * Adds a new exchange, generates it's barcode and * inserts/updates the transaction. When the referenced * transaction exists as provisional, updates it with - * the new values. - */ - DECLARE vEkt INT; - DECLARE vRewriteKop INT DEFAULT NULL; - DECLARE vBarcode CHAR(15) DEFAULT NULL; - DECLARE vIsDuplicated BOOL; + * the new values. + */ + DECLARE vEkt INT; + DECLARE vRewriteKop INT DEFAULT NULL; + DECLARE vBarcode CHAR(15) DEFAULT NULL; + DECLARE vIsDuplicated BOOL; DECLARE vUpdateExistent BOOL DEFAULT FALSE; - DECLARE duplicateKey CONDITION FOR 1062; - - DECLARE CONTINUE HANDLER FOR duplicateKey - SET vIsDuplicated = TRUE; - - -- Generates the barcode - - IF vAgj != 0 AND vAgj IS NOT NULL - THEN - SET vBarcode = CONCAT( - LPAD(vAuction, 2, 0), - LPAD(IFNULL(vClock, 99), 2, 0), - LPAD(DAYOFYEAR(vDate), 3, 0), - IF(vClock IS NULL OR vClock = 99, - LPAD(vAgj, 7, 0), - CONCAT(LPAD(vAgj, 5, 0), '01') - ), - '0' - ); - END IF; - - -- Rewrites the kop parameter - - IF vKop IS NULL THEN - SELECT defaultKop INTO vKop FROM exchangeConfig; - END IF; - - SELECT e.kop INTO vRewriteKop - FROM mailSender e - JOIN mail m ON m.senderFk = e.id - WHERE m.id = vMailFk; - - SET vKop = IFNULL(vRewriteKop, vKop); - - -- Inserts the new transaction + DECLARE duplicateKey CONDITION FOR 1062; - SET vIsDuplicated = FALSE; - INSERT INTO ekt SET - barcode = IFNULL(vBarcode, barcode) - ,deliveryNumber = vDeliveryNumber - ,entryYear = YEAR(vDate) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = vPutOrderFk; - - -- If it exists duplicado updates it - - IF NOT vIsDuplicated - THEN - SET vEkt = LAST_INSERT_ID(); - CALL ekt_load (vEkt); - - ELSEIF vDeliveryNumber != 0 - AND vDeliveryNumber IS NOT NULL - THEN - SELECT id INTO vEkt - FROM ekt - WHERE deliveryNumber = vDeliveryNumber; - - SELECT COUNT(*) = 0 INTO vUpdateExistent - FROM ekt t - JOIN `exchange` b ON b.ektFk = t.id - JOIN exchangeConfig c - WHERE t.deliveryNumber = vDeliveryNumber - AND t.entryYear = YEAR(vDate) - AND b.typeFk != c.presaleFk; - END IF; - - IF vUpdateExistent - THEN - UPDATE ekt SET - barcode = IFNULL(vBarcode, barcode) - ,fec = vDate - ,hor = vHour - ,ref = vRef - ,item = vItem - ,agj = vAgj - ,cat = vCat - ,pac = vPac - ,sub = vSub - ,kop = vKop - ,ptd = vPtd - ,pro = vPro - ,ori = vOrigin - ,ptj = vPtj - ,qty = vQuantiy - ,pri = vPrice - ,klo = vClock - ,s1 = vS1 - ,s2 = vS2 - ,s3 = vS3 - ,s4 = vS4 - ,s5 = vS5 - ,s6 = vS6 - ,k1 = vK1 - ,k2 = vK2 - ,k3 = vP1 - ,k4 = vP2 - ,auction = vAuction - ,package = vPackage - ,putOrderFk = vPutOrderFk - WHERE id = vEkt; - END IF; - - -- Registers the exchange - - INSERT INTO `exchange` SET - mailFk = vMailFk - ,typeFk = vType - ,ektFk = vEkt; + DECLARE CONTINUE HANDLER FOR duplicateKey + SET vIsDuplicated = TRUE; + + -- Generates the barcode + + IF vAgj != 0 AND vAgj IS NOT NULL + THEN + SET vBarcode = CONCAT( + LPAD(vAuction, 2, 0), + LPAD(IFNULL(vClock, 99), 2, 0), + LPAD(DAYOFYEAR(vDate), 3, 0), + IF(vClock IS NULL OR vClock = 99, + LPAD(vAgj, 7, 0), + CONCAT(LPAD(vAgj, 5, 0), '01') + ), + '0' + ); + END IF; + + -- Rewrites the kop parameter + + IF vKop IS NULL THEN + SELECT defaultKop INTO vKop FROM exchangeConfig; + END IF; + + SELECT e.kop INTO vRewriteKop + FROM mailSender e + JOIN mail m ON m.senderFk = e.id + WHERE m.id = vMailFk; + + SET vKop = IFNULL(vRewriteKop, vKop); + + -- Inserts the new transaction + + SET vIsDuplicated = FALSE; + INSERT INTO ekt SET + barcode = IFNULL(vBarcode, barcode) + ,deliveryNumber = vDeliveryNumber + ,entryYear = YEAR(vDate) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k1 = vK1 + ,k2 = vK2 + ,k3 = vP1 + ,k4 = vP2 + ,auction = vAuction + ,package = vPackage + ,putOrderFk = vPutOrderFk; + + -- If it exists duplicado updates it + + IF NOT vIsDuplicated + THEN + SET vEkt = LAST_INSERT_ID(); + CALL ekt_load (vEkt); + + ELSEIF vDeliveryNumber != 0 + AND vDeliveryNumber IS NOT NULL + THEN + SELECT id INTO vEkt + FROM ekt + WHERE deliveryNumber = vDeliveryNumber; + + SELECT COUNT(*) = 0 INTO vUpdateExistent + FROM ekt t + JOIN `exchange` b ON b.ektFk = t.id + JOIN exchangeConfig c + WHERE t.deliveryNumber = vDeliveryNumber + AND t.entryYear = YEAR(vDate) + AND b.typeFk != c.presaleFk; + END IF; + + IF vUpdateExistent + THEN + UPDATE ekt SET + barcode = IFNULL(vBarcode, barcode) + ,fec = vDate + ,hor = vHour + ,ref = vRef + ,item = vItem + ,agj = vAgj + ,cat = vCat + ,pac = vPac + ,sub = vSub + ,kop = vKop + ,ptd = vPtd + ,pro = vPro + ,ori = vOrigin + ,ptj = vPtj + ,qty = vQuantiy + ,pri = vPrice + ,klo = vClock + ,s1 = vS1 + ,s2 = vS2 + ,s3 = vS3 + ,s4 = vS4 + ,s5 = vS5 + ,s6 = vS6 + ,k1 = vK1 + ,k2 = vK2 + ,k3 = vP1 + ,k4 = vP2 + ,auction = vAuction + ,package = vPackage + ,putOrderFk = vPutOrderFk + WHERE id = vEkt; + END IF; + + -- Registers the exchange + + INSERT INTO `exchange` SET + mailFk = vMailFk + ,typeFk = vType + ,ektFk = vEkt; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -10810,30 +10810,30 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `item_listAllocation`(IN `vWh` TINYINT, IN `vDate` DATE, IN `vType` INT, IN `vPrefix` VARCHAR(255), IN `vUseIds` BOOLEAN) -BEGIN -/** - * Lists visible items and it's box sizes of the specified - * type at specified date. - * - * @param vWh The warehouse id - * @param vDate The visible date - * @param vType The type id - * @param vPrefix The article prefix to filter or %NULL for all - * @param vUseIds Whether to order the result by item id - * @select List of visible items with it's box sizes - */ - CALL item_getVisible(vWh, vDate, vType, vPrefix); - - IF vUseIds - THEN - SELECT * FROM tmp.itemVisible - ORDER BY Id_Article; - ELSE - SELECT * FROM tmp.itemVisible - ORDER BY Article, packing; - END IF; - - DROP TEMPORARY TABLE tmp.itemVisible; +BEGIN +/** + * Lists visible items and it's box sizes of the specified + * type at specified date. + * + * @param vWh The warehouse id + * @param vDate The visible date + * @param vType The type id + * @param vPrefix The article prefix to filter or %NULL for all + * @param vUseIds Whether to order the result by item id + * @select List of visible items with it's box sizes + */ + CALL item_getVisible(vWh, vDate, vType, vPrefix); + + IF vUseIds + THEN + SELECT * FROM tmp.itemVisible + ORDER BY Id_Article; + ELSE + SELECT * FROM tmp.itemVisible + ORDER BY Article, packing; + END IF; + + DROP TEMPORARY TABLE tmp.itemVisible; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16189,8 +16189,8 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `log_add_beta`(IN `vTableName` VARCHAR(255), IN `vNewId` VARCHAR(255), IN `vOldId` VARCHAR(255)) -proc: BEGIN - -- XXX: Disabled while testing +proc: BEGIN + -- XXX: Disabled while testing DECLARE vLanded DATE; DECLARE vWarehouseFk INT; DECLARE vBuyerFk INT; @@ -16198,20 +16198,20 @@ proc: BEGIN DECLARE vItemFk INT; DECLARE vItemName VARCHAR(50); - -- LEAVE proc; + -- LEAVE proc; - IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vOldId, - operation = 'delete'; - END IF; - - IF vNewId IS NOT NULL THEN - INSERT IGNORE INTO `log` SET - tableName = vTableName, - tableId = vNewId, - operation = 'insert'; + IF vOldId IS NOT NULL AND !(vOldId <=> vNewId) THEN + INSERT IGNORE INTO `log` SET + tableName = vTableName, + tableId = vOldId, + operation = 'delete'; + END IF; + + IF vNewId IS NOT NULL THEN + INSERT IGNORE INTO `log` SET + tableName = vTableName, + tableId = vNewId, + operation = 'insert'; END IF; IF vTableName = 'buy' THEN @@ -16241,7 +16241,7 @@ proc: BEGIN END IF; END IF; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -16509,29 +16509,29 @@ CREATE DEFINER=`root`@`%` PROCEDURE `log_refreshSale`( BEGIN DROP TEMPORARY TABLE IF EXISTS tValues; CREATE TEMPORARY TABLE tValues - ENGINE = MEMORY - SELECT - m.id saleFk, - m.ticketFk, - m.itemFk, - t.warehouseFk, - t.shipped, + ENGINE = MEMORY + SELECT + m.id saleFk, + m.ticketFk, + m.itemFk, + t.warehouseFk, + t.shipped, ABS(m.quantity) quantity, m.created, TIMESTAMPADD(DAY, tp.life, t.shipped) expired, m.quantity < 0 isIn, - m.isPicked OR s.alertLevel > 1 isPicked - FROM vn.sale m - JOIN vn.ticket t ON t.id = m.ticketFk + m.isPicked OR s.alertLevel > 1 isPicked + FROM vn.sale m + JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticketFk = t.id JOIN vn.item i ON i.id = m.itemFk - JOIN vn.itemType tp ON tp.id = i.typeFk + JOIN vn.itemType tp ON tp.id = i.typeFk WHERE ( - vTableId IS NULL - OR (vTableName = 'ticket' AND t.id = vTableId) - OR (vTableName = 'sale' AND m.id = vTableId) - ) - AND t.shipped >= vn.getInventoryDate() + vTableId IS NULL + OR (vTableName = 'ticket' AND t.id = vTableId) + OR (vTableName = 'sale' AND m.id = vTableId) + ) + AND t.shipped >= vn.getInventoryDate() AND m.quantity != 0; REPLACE INTO inbound ( @@ -16564,7 +16564,7 @@ BEGIN FROM tValues WHERE !isIn; - DROP TEMPORARY TABLE tValues; + DROP TEMPORARY TABLE tValues; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -29495,90 +29495,90 @@ DELIMITER ;; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ;; /*!50003 SET @saved_time_zone = @@time_zone */ ;; /*!50003 SET time_zone = 'SYSTEM' */ ;; -/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN - - DECLARE vCurrentCount INT; - DECLARE vCheckSum INT; - DECLARE vIsAlreadyNotified BOOLEAN; - DECLARE vTableQueue TEXT; - DECLARE vLineQueue TEXT; - DECLARE vDone BOOL DEFAULT FALSE; - DECLARE vCur CURSOR FOR - SELECT CONCAT(' - ', IFNULL(pq.id, ''), ' - ', IFNULL(p.path, ''),' - ', IFNULL(i.Informe, ''),' - ', IFNULL(e.Estado, ''),' - ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' - ', IFNULL(pq.`error`, ''),' - ') - FROM vn.printingQueue pq - LEFT JOIN vn.worker w ON w.id = pq.worker - LEFT JOIN vn.printer p ON p.id = pq.printer - LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report - JOIN vn2008.Estados e ON e.Id_Estado = pq.state - LIMIT 30; - - DECLARE CONTINUE HANDLER FOR NOT FOUND - SET vDone = TRUE; - - SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum - FROM vn.printingQueue WHERE state = 1; - - SELECT isAlreadyNotified INTO vIsAlreadyNotified - FROM printingQueueCheck; - - IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND - (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND - vIsAlreadyNotified = FALSE AND vCurrentCount > 0 - THEN - - SELECT ' - - - - - - - - ' INTO vTableQueue; - - OPEN vCur; - - l: LOOP - - SET vDone = FALSE; - - FETCH vCur INTO vLineQueue; - - IF vDone THEN - LEAVE l; - END IF; - - SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; - - END LOOP; - - CLOSE vCur; - - INSERT INTO vn2008.mail (`to`, subject, text) - VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es', - 'servidor de impresion parado', - CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
')); - - UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; - END IF; - - IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND - vIsAlreadyNotified = TRUE - THEN - UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; - END IF; - - UPDATE printingQueueCheck - SET lastCount = vCurrentCount, - lastCheckSum = vCheckSum; - +/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`%`*/ /*!50106 EVENT `printQueue_check` ON SCHEDULE EVERY 10 MINUTE STARTS '2019-11-08 00:00:00' ON COMPLETION PRESERVE ENABLE COMMENT 'Notifica en caso de que el servidor de impresión este parado' DO BEGIN + + DECLARE vCurrentCount INT; + DECLARE vCheckSum INT; + DECLARE vIsAlreadyNotified BOOLEAN; + DECLARE vTableQueue TEXT; + DECLARE vLineQueue TEXT; + DECLARE vDone BOOL DEFAULT FALSE; + DECLARE vCur CURSOR FOR + SELECT CONCAT(' + ', IFNULL(pq.id, ''), ' + ', IFNULL(p.path, ''),' + ', IFNULL(i.Informe, ''),' + ', IFNULL(e.Estado, ''),' + ', IFNULL(w.firstname, ''), " ", IFNULL(w.lastName, ''),' + ', IFNULL(pq.`error`, ''),' + ') + FROM vn.printingQueue pq + LEFT JOIN vn.worker w ON w.id = pq.worker + LEFT JOIN vn.printer p ON p.id = pq.printer + LEFT JOIN vn2008.Informes i ON i.Id_Informe = pq.report + JOIN vn2008.Estados e ON e.Id_Estado = pq.state + LIMIT 30; + + DECLARE CONTINUE HANDLER FOR NOT FOUND + SET vDone = TRUE; + + SELECT COUNT(*), IFNULL(SUM(id),0) INTO vCurrentCount, vCheckSum + FROM vn.printingQueue WHERE state = 1; + + SELECT isAlreadyNotified INTO vIsAlreadyNotified + FROM printingQueueCheck; + + IF (SELECT lastCount FROM printingQueueCheck) = vCurrentCount AND + (SELECT lastCheckSum FROM printingQueueCheck) = vCheckSum AND + vIsAlreadyNotified = FALSE AND vCurrentCount > 0 + THEN + + SELECT ' + + + + + + + + ' INTO vTableQueue; + + OPEN vCur; + + l: LOOP + + SET vDone = FALSE; + + FETCH vCur INTO vLineQueue; + + IF vDone THEN + LEAVE l; + END IF; + + SELECT CONCAT(vTableQueue, vLineQueue) INTO vTableQueue; + + END LOOP; + + CLOSE vCur; + + INSERT INTO vn2008.mail (`to`, subject, text) + VALUES ('cau@verdnatura.es, sysadmin@verdnatura.es', + 'servidor de impresion parado', + CONCAT('Hay ', vCurrentCount, ' lineas bloqueadas', vTableQueue, '
Id ColaRuta ImpresoraInformeEstadoTrabajadorError
')); + + UPDATE printingQueueCheck SET isAlreadyNotified = TRUE; + END IF; + + IF (SELECT lastCount FROM printingQueueCheck) > vCurrentCount AND + vIsAlreadyNotified = TRUE + THEN + UPDATE printingQueueCheck SET isAlreadyNotified = FALSE; + END IF; + + UPDATE printingQueueCheck + SET lastCount = vCurrentCount, + lastCheckSum = vCheckSum; + END */ ;; /*!50003 SET time_zone = @saved_time_zone */ ;; /*!50003 SET sql_mode = @saved_sql_mode */ ;; @@ -35117,27 +35117,27 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clean__`() -BEGIN - DECLARE vDateShort DATETIME; - DECLARE oneYearAgo DATE; - DECLARE twoYearsAgo DATE; - DECLARE fourYearsAgo DATE; - - SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); - SET oneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); - SET twoYearsAgo = TIMESTAMPADD(YEAR,-2,CURDATE()); - SET fourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); - - DELETE FROM vn.message WHERE sendDate < vDateShort; - DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; - DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; - DELETE FROM vn.workerTimeControl WHERE timed < fourYearsAgo; - DELETE FROM vn.itemShelving WHERE created < CURDATE() AND visible = 0; - DELETE FROM vn.ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); - CALL shelving_clean; - +BEGIN + DECLARE vDateShort DATETIME; + DECLARE oneYearAgo DATE; + DECLARE twoYearsAgo DATE; + DECLARE fourYearsAgo DATE; + + SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE()); + SET oneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE()); + SET twoYearsAgo = TIMESTAMPADD(YEAR,-2,CURDATE()); + SET fourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE()); + + DELETE FROM vn.message WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; + DELETE FROM vn.messageInbox WHERE sendDate < vDateShort; + DELETE FROM vn.workerTimeControl WHERE timed < fourYearsAgo; + DELETE FROM vn.itemShelving WHERE created < CURDATE() AND visible = 0; + DELETE FROM vn.ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE()); + CALL shelving_clean; + CALL vn.ticketPackagingRecovery; - + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -35980,54 +35980,54 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `clientRemoveWorker__`() -BEGIN - DECLARE done BOOL DEFAULT FALSE; - DECLARE vClientFk INT; - - DECLARE rs CURSOR FOR - SELECT c.clientFk - FROM tmp.clientGetDebt c - LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk - WHERE IFNULL(r.risk,0) = 0; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; - CREATE TEMPORARY TABLE tmp.clientGetDebt - SELECT cd.id as clientFk - FROM bs.clientDied cd - LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id - JOIN vn.client c ON c.id = cd.id - JOIN vn.province p ON p.id = c.provinceFk - JOIN vn.country co ON co.id = p.countryFk - WHERE cd.Aviso = 'TERCER AVISO' - AND cp.clientFk IS NULL - AND co.country NOT IN ('Portugal','Francia','España exento') - AND c.salesPersonFk IS NOT NULL; - - CALL vn.clientGetDebt(curdate()); - - DROP TEMPORARY TABLE IF EXISTS tmp.contador; - CREATE TEMPORARY TABLE tmp.contador (id INT) - ENGINE = MEMORY; - - OPEN rs; - FETCH rs INTO vClientFk; - - WHILE NOT done DO - INSERT INTO tmp.contador SET id = vClientFk; - CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); +BEGIN + DECLARE done BOOL DEFAULT FALSE; + DECLARE vClientFk INT; + + DECLARE rs CURSOR FOR + SELECT c.clientFk + FROM tmp.clientGetDebt c + LEFT JOIN tmp.risk r ON r.clientFk = c.clientFk + WHERE IFNULL(r.risk,0) = 0; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + DROP TEMPORARY TABLE IF EXISTS tmp.clientGetDebt; + CREATE TEMPORARY TABLE tmp.clientGetDebt + SELECT cd.id as clientFk + FROM bs.clientDied cd + LEFT JOIN vn.clientProtected cp ON cp.clientFk = cd.id + JOIN vn.client c ON c.id = cd.id + JOIN vn.province p ON p.id = c.provinceFk + JOIN vn.country co ON co.id = p.countryFk + WHERE cd.Aviso = 'TERCER AVISO' + AND cp.clientFk IS NULL + AND co.country NOT IN ('Portugal','Francia','España exento') + AND c.salesPersonFk IS NOT NULL; + + CALL vn.clientGetDebt(curdate()); + + DROP TEMPORARY TABLE IF EXISTS tmp.contador; + CREATE TEMPORARY TABLE tmp.contador (id INT) + ENGINE = MEMORY; + + OPEN rs; + FETCH rs INTO vClientFk; + + WHILE NOT done DO + INSERT INTO tmp.contador SET id = vClientFk; + CALL vn.clientGreugeSpray(vClientFk, TRUE, '',TRUE); UPDATE vn.client SET salesPersonFk = NULL WHERE id = vClientFk; INSERT INTO vn.clientLog (originFk, userFk, `action`, description) VALUES (vClientFk, account.userGetId(), 'update', CONCAT('Se ha desasignado el cliente por que no ha comprado en 3 meses')); - + REPLACE bs.clientNewBorn(clientFk, shipped) - VALUES(vClientFk, CURDATE()); - FETCH rs INTO vClientFk; - END WHILE; - - CLOSE rs; + VALUES(vClientFk, CURDATE()); + FETCH rs INTO vClientFk; + END WHILE; + + CLOSE rs; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -38951,216 +38951,216 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `entryConverter`(IN `vEntry` INT) -BEGIN - - DECLARE vWarehouseIn INT; - DECLARE vWarehouseOut INT; - DECLARE vTravel INT; - - DECLARE done BOOL DEFAULT FALSE; - - DECLARE vId_Entrada INT; - DECLARE vId_Article INT; - DECLARE vEtiquetas INT; - DECLARE vId_Cubo VARCHAR(10); - DECLARE vPacking INT; - DECLARE vGrouping INT; - DECLARE vCantidad INT; - DECLARE vCostefijo DECIMAL(10,3); - DECLARE vPortefijo DECIMAL(10,3); - DECLARE vEmbalajefijo DECIMAL(10); - DECLARE vComisionfija DECIMAL(10,3); - DECLARE vCaja INT; - DECLARE vNicho VARCHAR(5); - DECLARE vTarifa1 DECIMAL(10,2); - DECLARE vTarifa2 DECIMAL(10,2); - DECLARE vTarifa3 DECIMAL(10,2); - DECLARE vPVP DECIMAL(10,2); - DECLARE vCompra INT; - - DECLARE rs CURSOR FOR - SELECT - b.Id_Entrada, - b.Id_Article, - b.Etiquetas, - b.Id_Cubo, - b.Packing, - b.`grouping`, - b.Cantidad, - b.Costefijo, - b.Portefijo, - b.Embalajefijo, - b.Comisionfija, - b.caja, - b.Nicho, - b.Tarifa1, - b.Tarifa2, - b.Tarifa3, - b.PVP - FROM vn2008.Compres b - JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article - WHERE Id_Entrada = vEntry; - - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; - - SELECT warehouseInFk, warehouseOutFk, tr.id - INTO vWarehouseIn, vWarehouseOut, vTravel - FROM travel tr - JOIN entry e ON e.travelFk = tr.id - WHERE e.id = vEntry; - - UPDATE travel - SET warehouseInFk = vWarehouseOut, - warehouseOutFk = vWarehouseIn - WHERE id = vTravel; - - UPDATE vn2008.Compres c - LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article - SET Etiquetas = 0, Cantidad = 0 - WHERE c.Id_Entrada = vEntry - AND ic.espItemFk IS NULL; - - OPEN rs; - - DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - WHILE NOT done DO - - -- Primero la linea original con las cantidades invertidas - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - VALUES - ( - vId_Entrada, - vId_Article, - - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP); - - -- Ahora la linea nueva, con el item genérico - INSERT INTO vn2008.Compres - ( - Id_Entrada, - Id_Article, - Etiquetas, - Id_Cubo, - Packing, - `grouping`, - Cantidad, - Costefijo, - Portefijo, - Embalajefijo, - Comisionfija, - caja, - Nicho, - Tarifa1, - Tarifa2, - Tarifa3, - PVP - ) - SELECT - vId_Entrada, - genItemFk as Id_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP - FROM itemConversor - WHERE espItemFk = vId_Article; - - SELECT LAST_INSERT_ID() - INTO vCompra; - - REPLACE vn2008.Compres_mark(Id_Compra,`comment`) - SELECT vCompra, vId_Article; - - - FETCH rs INTO - vId_Entrada, - vId_Article, - vEtiquetas, - vId_Cubo, - vPacking, - vGrouping, - vCantidad, - vCostefijo, - vPortefijo, - vEmbalajefijo, - vComisionfija, - vCaja, - vNicho, - vTarifa1, - vTarifa2, - vTarifa3, - vPVP; - - END WHILE; - - - CLOSE rs; - - - +BEGIN + + DECLARE vWarehouseIn INT; + DECLARE vWarehouseOut INT; + DECLARE vTravel INT; + + DECLARE done BOOL DEFAULT FALSE; + + DECLARE vId_Entrada INT; + DECLARE vId_Article INT; + DECLARE vEtiquetas INT; + DECLARE vId_Cubo VARCHAR(10); + DECLARE vPacking INT; + DECLARE vGrouping INT; + DECLARE vCantidad INT; + DECLARE vCostefijo DECIMAL(10,3); + DECLARE vPortefijo DECIMAL(10,3); + DECLARE vEmbalajefijo DECIMAL(10); + DECLARE vComisionfija DECIMAL(10,3); + DECLARE vCaja INT; + DECLARE vNicho VARCHAR(5); + DECLARE vTarifa1 DECIMAL(10,2); + DECLARE vTarifa2 DECIMAL(10,2); + DECLARE vTarifa3 DECIMAL(10,2); + DECLARE vPVP DECIMAL(10,2); + DECLARE vCompra INT; + + DECLARE rs CURSOR FOR + SELECT + b.Id_Entrada, + b.Id_Article, + b.Etiquetas, + b.Id_Cubo, + b.Packing, + b.`grouping`, + b.Cantidad, + b.Costefijo, + b.Portefijo, + b.Embalajefijo, + b.Comisionfija, + b.caja, + b.Nicho, + b.Tarifa1, + b.Tarifa2, + b.Tarifa3, + b.PVP + FROM vn2008.Compres b + JOIN vn.itemConversor ic ON ic.espItemFk = b.Id_Article + WHERE Id_Entrada = vEntry; + + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = TRUE; + + SELECT warehouseInFk, warehouseOutFk, tr.id + INTO vWarehouseIn, vWarehouseOut, vTravel + FROM travel tr + JOIN entry e ON e.travelFk = tr.id + WHERE e.id = vEntry; + + UPDATE travel + SET warehouseInFk = vWarehouseOut, + warehouseOutFk = vWarehouseIn + WHERE id = vTravel; + + UPDATE vn2008.Compres c + LEFT JOIN vn.itemConversor ic ON ic.espItemFk = c.Id_Article + SET Etiquetas = 0, Cantidad = 0 + WHERE c.Id_Entrada = vEntry + AND ic.espItemFk IS NULL; + + OPEN rs; + + DELETE FROM vn2008.Compres WHERE Id_Entrada = vEntry; + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + WHILE NOT done DO + + -- Primero la linea original con las cantidades invertidas + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + VALUES + ( + vId_Entrada, + vId_Article, + - vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + - vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP); + + -- Ahora la linea nueva, con el item genérico + INSERT INTO vn2008.Compres + ( + Id_Entrada, + Id_Article, + Etiquetas, + Id_Cubo, + Packing, + `grouping`, + Cantidad, + Costefijo, + Portefijo, + Embalajefijo, + Comisionfija, + caja, + Nicho, + Tarifa1, + Tarifa2, + Tarifa3, + PVP + ) + SELECT + vId_Entrada, + genItemFk as Id_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP + FROM itemConversor + WHERE espItemFk = vId_Article; + + SELECT LAST_INSERT_ID() + INTO vCompra; + + REPLACE vn2008.Compres_mark(Id_Compra,`comment`) + SELECT vCompra, vId_Article; + + + FETCH rs INTO + vId_Entrada, + vId_Article, + vEtiquetas, + vId_Cubo, + vPacking, + vGrouping, + vCantidad, + vCostefijo, + vPortefijo, + vEmbalajefijo, + vComisionfija, + vCaja, + vNicho, + vTarifa1, + vTarifa2, + vTarifa3, + vPVP; + + END WHILE; + + + CLOSE rs; + + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -39222,62 +39222,62 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `entryPrepare`(IN `idE` BIGINT) -BEGIN - SELECT - b.quantity / b.packing AS Paquetes, - b.packing AS `Grouping`, - barcode, - 'ASEGURADO' AS asegurado, - ic.name, - ic.order, - s.name AS Consignatario, - e.supplierFk AS Id_Cliente, - e.isOrdered, - e.isConfirmed, - 10 AS Calidad, - LPAD(IFNULL(cpd.id, ip.code), - 5, - '0') AS path, - b.entryFk AS Id_Ticket, - t.landed AS Fecha, - b.itemFk, - b.quantity, - i.name AS Concepte, - i.size, - i.inkFk, - i.category, - o.code AS Origen, - 0 AS Bultos, - wIn.`name` AS Tipo, - 0 AS OK, - 0 AS Reservado, - i.stems, - b.id AS Id_Movimiento, - ip.code, - 'PEDIDO ASEGURADO' AS MSG, - 0 AS Seguro, - i.image, - pr.name AS producer - FROM vn.buy b - JOIN vn.entry e ON b.entryFk = e.id - JOIN vn.travel t ON t.id = e.travelFk - JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk - JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk - JOIN vn.item i ON i.id = b.itemFk - JOIN vn.itemType it ON it.id =i.typeFk - JOIN vn.itemCategory ic ON ic.id = it.categoryFk - JOIN vn.packaging pkg ON pkg.id = b.packageFk - LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk - LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk - LEFT JOIN vn.origin o ON o.id = i.originFk - LEFT JOIN vn.supplier s ON s.id = e.supplierFk - LEFT JOIN vn.producer pr on pr.id = i.producerFk - LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway - WHERE - NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid - AND e.id = 158772 - AND i.typeFk IS NOT NULL - AND ic.merchandise IS NOT FALSE; +BEGIN + SELECT + b.quantity / b.packing AS Paquetes, + b.packing AS `Grouping`, + barcode, + 'ASEGURADO' AS asegurado, + ic.name, + ic.order, + s.name AS Consignatario, + e.supplierFk AS Id_Cliente, + e.isOrdered, + e.isConfirmed, + 10 AS Calidad, + LPAD(IFNULL(cpd.id, ip.code), + 5, + '0') AS path, + b.entryFk AS Id_Ticket, + t.landed AS Fecha, + b.itemFk, + b.quantity, + i.name AS Concepte, + i.size, + i.inkFk, + i.category, + o.code AS Origen, + 0 AS Bultos, + wIn.`name` AS Tipo, + 0 AS OK, + 0 AS Reservado, + i.stems, + b.id AS Id_Movimiento, + ip.code, + 'PEDIDO ASEGURADO' AS MSG, + 0 AS Seguro, + i.image, + pr.name AS producer + FROM vn.buy b + JOIN vn.entry e ON b.entryFk = e.id + JOIN vn.travel t ON t.id = e.travelFk + JOIN vn.warehouse wIn ON wIn.id = t.warehouseInFk + JOIN vn.warehouse wOut ON wOut.id = t.warehouseOutFk + JOIN vn.item i ON i.id = b.itemFk + JOIN vn.itemType it ON it.id =i.typeFk + JOIN vn.itemCategory ic ON ic.id = it.categoryFk + JOIN vn.packaging pkg ON pkg.id = b.packageFk + LEFT JOIN vn.itemPlacement ip ON i.id = ip.itemFk AND ip.warehouseFk = wIn.id AND ip.warehouseFk = t.warehouseOutFk + LEFT JOIN (SELECT itemFk, code AS barcode FROM vn.itemBarcode GROUP BY itemFk) ib ON ib.itemFk = b.itemFk + LEFT JOIN vn.origin o ON o.id = i.originFk + LEFT JOIN vn.supplier s ON s.id = e.supplierFk + LEFT JOIN vn.producer pr on pr.id = i.producerFk + LEFT JOIN vn.coolerPathDetail cpd ON LEFT(ip.code, 3) = cpd.hallway + WHERE + NOT wIn.isFeedStock AND NOT e.isInventory AND NOT e.isRaid + AND e.id = 158772 + AND i.typeFk IS NOT NULL + AND ic.merchandise IS NOT FALSE; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -43012,38 +43012,38 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `itemLastEntries`(IN `vItem` INT, IN `vDays` DATE) -BEGIN - SELECT - w.id AS warehouseFk, - w.name AS warehouse, - tr.landed, - b.entryFk, - b.isIgnored, - b.price2, - b.price3, - b.stickers, - b.packing, - b.`grouping`, - b.groupingMode, - i.stems, - b.quantity, - b.buyingValue, - b.packageFk , - s.id AS supplierFk, - s.name AS supplier - FROM itemType it - RIGHT JOIN (entry e - LEFT JOIN supplier s ON s.id = e.supplierFk - RIGHT JOIN buy b ON b.entryFk = e.id - LEFT JOIN item i ON i.id = b.itemFk - LEFT JOIN ink ON ink.id = i.inkFk - LEFT JOIN travel tr ON tr.id = e.travelFk - LEFT JOIN warehouse w ON w.id = tr.warehouseInFk - LEFT JOIN origin o ON o.id = i.originFk - ) ON it.id = i.typeFk - LEFT JOIN edi.ekt ek ON b.ektFk = ek.id - WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY) - ORDER BY tr.landed DESC , b.id DESC; +BEGIN + SELECT + w.id AS warehouseFk, + w.name AS warehouse, + tr.landed, + b.entryFk, + b.isIgnored, + b.price2, + b.price3, + b.stickers, + b.packing, + b.`grouping`, + b.groupingMode, + i.stems, + b.quantity, + b.buyingValue, + b.packageFk , + s.id AS supplierFk, + s.name AS supplier + FROM itemType it + RIGHT JOIN (entry e + LEFT JOIN supplier s ON s.id = e.supplierFk + RIGHT JOIN buy b ON b.entryFk = e.id + LEFT JOIN item i ON i.id = b.itemFk + LEFT JOIN ink ON ink.id = i.inkFk + LEFT JOIN travel tr ON tr.id = e.travelFk + LEFT JOIN warehouse w ON w.id = tr.warehouseInFk + LEFT JOIN origin o ON o.id = i.originFk + ) ON it.id = i.typeFk + LEFT JOIN edi.ekt ek ON b.ektFk = ek.id + WHERE b.itemFk = vItem And tr.shipped BETWEEN vDays AND DATE_ADD(CURDATE(), INTERVAl + 10 DAY) + ORDER BY tr.landed DESC , b.id DESC; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47362,77 +47362,77 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `saleItemShelvingMake`(IN `vTicketFk` INT, IN `vSectorFk` INT) -BEGIN - - SET @rest:= CAST(0 AS DECIMAL(10,0)); - SET @saleFk := CAST(0 AS DECIMAL(10,0)); - SET @reserved := CAST(0 AS DECIMAL(10,0)); - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN sale s ON s.id = sis.saleFk - SET ish.visible = sis.quantity + ish.visible, - ish.available = sis.quantity + ish.visible - WHERE s.ticketFk = vTicketFk; - - DELETE sis.* - FROM saleItemShelving sis - JOIN sale s ON s.id = sis.saleFk - WHERE s.ticketFk = vTicketFk; - - INSERT INTO saleItemShelving( saleFk, - itemShelvingFk, - quantity, - ubication) - SELECT saleFk, - itemShelvingFk, - CAST(Reserved as DECIMAL(10,0)) as Reserved, - ubication - FROM - (SELECT saleFk, - itemShelvingFk, - ubication, - @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, - @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, - @rest := @rest - @reserved, - @saleFk := saleFk - FROM - ( SELECT s.id as saleFk, - ish.created, - ish.id as itemShelvingFk, - ish.available, - s.quantity, - ish.packing, - CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication - FROM vn.sale s - JOIN vn.ticket t ON t.id = s.ticketFk - JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk - JOIN vn.parking p ON p.sectorFk = sc.id - JOIN vn.shelving sh ON sh.parkingFk = p.id - JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk - WHERE t.id = vTicketFk - AND sc.id = vSectorFk - AND s.quantity MOD ish.packing = 0 - AND s.quantity >= ish.packing - ORDER BY s.id, - sh.priority DESC, - ish.packing DESC, - ish.created - ) sub - ) sub2 - WHERE Reserved > 0; - - UPDATE vn.itemShelving ish - JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id - JOIN vn.sale s ON s.id = sis.saleFk - SET ish.available = ish.visible - sis.quantity, - ish.visible = ish.visible - sis.quantity - WHERE s.ticketFk = vTicketFk - AND s.isPicked = FALSE; - - CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); - - +BEGIN + + SET @rest:= CAST(0 AS DECIMAL(10,0)); + SET @saleFk := CAST(0 AS DECIMAL(10,0)); + SET @reserved := CAST(0 AS DECIMAL(10,0)); + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN sale s ON s.id = sis.saleFk + SET ish.visible = sis.quantity + ish.visible, + ish.available = sis.quantity + ish.visible + WHERE s.ticketFk = vTicketFk; + + DELETE sis.* + FROM saleItemShelving sis + JOIN sale s ON s.id = sis.saleFk + WHERE s.ticketFk = vTicketFk; + + INSERT INTO saleItemShelving( saleFk, + itemShelvingFk, + quantity, + ubication) + SELECT saleFk, + itemShelvingFk, + CAST(Reserved as DECIMAL(10,0)) as Reserved, + ubication + FROM + (SELECT saleFk, + itemShelvingFk, + ubication, + @rest := IF(@saleFk = saleFk, @rest, quantity) as Falta, + @reserved := IF(available < @rest, available, IF(@rest < packing,0,@rest)) as Reserved, + @rest := @rest - @reserved, + @saleFk := saleFk + FROM + ( SELECT s.id as saleFk, + ish.created, + ish.id as itemShelvingFk, + ish.available, + s.quantity, + ish.packing, + CONCAT(p.`column`, '-',p.`row`,': ', sh.code ) as ubication + FROM vn.sale s + JOIN vn.ticket t ON t.id = s.ticketFk + JOIN vn.sector sc ON sc.warehouseFk = t.warehouseFk + JOIN vn.parking p ON p.sectorFk = sc.id + JOIN vn.shelving sh ON sh.parkingFk = p.id + JOIN vn.itemShelving ish ON ish.shelvingFk = sh.code AND ish.itemFk = s.itemFk + WHERE t.id = vTicketFk + AND sc.id = vSectorFk + AND s.quantity MOD ish.packing = 0 + AND s.quantity >= ish.packing + ORDER BY s.id, + sh.priority DESC, + ish.packing DESC, + ish.created + ) sub + ) sub2 + WHERE Reserved > 0; + + UPDATE vn.itemShelving ish + JOIN vn.saleItemShelving sis ON sis.itemShelvingFk = ish.id + JOIN vn.sale s ON s.id = sis.saleFk + SET ish.available = ish.visible - sis.quantity, + ish.visible = ish.visible - sis.quantity + WHERE s.ticketFk = vTicketFk + AND s.isPicked = FALSE; + + CALL vn.saleItemShelvingIsPicked(vTicketFk, TRUE); + + END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; @@ -47925,33 +47925,33 @@ DELIMITER ; /*!50003 SET sql_mode = 'NO_ENGINE_SUBSTITUTION' */ ; DELIMITER ;; CREATE DEFINER=`root`@`%` PROCEDURE `scanTreeCreate`() -BEGIN - CALL nestTree( - 'vn2008', - 'scan', - 'vn2008', - 'scanTree' - ); - - UPDATE vn2008.scanTree st - JOIN ( - SELECT sl.scan_id, - MAX(sl.odbc_date) lastScanned, - COUNT(DISTINCT t.routeFk) routeCount, - MIN(t.routeFk) mod 1000 as minRoute, - MAX(t.routeFk) mod 1000 as maxRoute, - COUNT(sl.scan_line_id) as scanned - FROM vn2008.scan_line sl - JOIN expedition e ON e.id = sl.`code` - JOIN ticket t ON t.id = e.ticketFk - WHERE t.routeFk - GROUP BY sl.scan_id - ) rs ON rs.scan_id = st.id - SET st.lastScanned = rs.lastScanned, - st.routeCount = rs.routeCount, - st.minRoute = rs.minRoute, - st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL), - st.scanned = rs.scanned; +BEGIN + CALL nestTree( + 'vn2008', + 'scan', + 'vn2008', + 'scanTree' + ); + + UPDATE vn2008.scanTree st + JOIN ( + SELECT sl.scan_id, + MAX(sl.odbc_date) lastScanned, + COUNT(DISTINCT t.routeFk) routeCount, + MIN(t.routeFk) mod 1000 as minRoute, + MAX(t.routeFk) mod 1000 as maxRoute, + COUNT(sl.scan_line_id) as scanned + FROM vn2008.scan_line sl + JOIN expedition e ON e.id = sl.`code` + JOIN ticket t ON t.id = e.ticketFk + WHERE t.routeFk + GROUP BY sl.scan_id + ) rs ON rs.scan_id = st.id + SET st.lastScanned = rs.lastScanned, + st.routeCount = rs.routeCount, + st.minRoute = rs.minRoute, + st.maxRoute = IF(rs.minRoute != rs.maxRoute, rs.maxRoute,NULL), + st.scanned = rs.scanned; END ;; DELIMITER ; /*!50003 SET sql_mode = @saved_sql_mode */ ; From dfb9d32c2aa9b0047a86d25b6efc5c30a3b366a1 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 30 Mar 2020 17:30:03 +0200 Subject: [PATCH 11/53] Client & ticket E2E fixes --- e2e/helpers/extensions.js | 5 ++ e2e/helpers/selectors.js | 7 +- e2e/paths/02-client/14_balance.spec.js | 10 +-- e2e/paths/05-ticket/13_services.spec.js | 2 - .../09-invoice-out/02_descriptor.spec.js | 2 +- front/core/components/confirm/confirm.js | 5 +- front/core/components/dialog/index.js | 21 +++++ front/salix/components/layout/style.scss | 11 +++ front/salix/styles/misc.scss | 5 -- .../client/front/balance/create/index.html | 25 +++--- modules/client/front/balance/create/index.js | 43 ++++----- .../client/front/balance/create/style.scss | 3 - modules/client/front/balance/index/index.html | 58 ++++++------ modules/client/front/balance/index/index.js | 7 -- modules/client/front/balance/index/style.scss | 10 --- modules/ticket/front/card/index.js | 4 +- modules/ticket/front/descriptor/index.html | 20 ++--- modules/ticket/front/descriptor/index.js | 89 ++++++++++--------- modules/ticket/front/descriptor/index.spec.js | 3 +- modules/ticket/front/services/index.html | 16 ++-- modules/ticket/front/services/index.js | 42 ++++----- modules/ticket/front/services/index.spec.js | 37 ++++---- 22 files changed, 202 insertions(+), 223 deletions(-) delete mode 100644 modules/client/front/balance/create/style.scss delete mode 100644 modules/client/front/balance/index/style.scss diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 2484728f46..93914d2ff7 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -228,6 +228,11 @@ let actions = { await this.waitForTextInField(selector, text); }, + overwrite: async function(selector, text) { + await this.clearInput(selector); + await this.write(selector, text); + }, + waitToClick: async function(selector) { await this.waitForSelector(selector); await this.waitForFunction(checkVisibility, {}, selector); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 826f5b6ec8..9d6992be00 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -178,12 +178,11 @@ export default { }, clientBalance: { - balanceButton: 'vn-left-menu a[ui-sref="client.card.balance.index"]', company: 'vn-client-balance-index vn-autocomplete[ng-model="$ctrl.companyId"]', newPaymentButton: `vn-float-button`, newPaymentBank: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', newPaymentAmount: '.vn-dialog.shown vn-input-number[ng-model="$ctrl.receipt.amountPaid"]', - saveButton: '.vn-dialog.shown vn-button[label="Save"]', + saveButton: '.vn-dialog.shown [response="accept"]', firstBalanceLine: 'vn-client-balance-index vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(8)' }, @@ -545,8 +544,8 @@ export default { firstPrice: 'vn-ticket-service vn-horizontal:nth-child(1) vn-input-number[ng-model="service.price"]', firstVatType: 'vn-ticket-service vn-autocomplete[label="Tax class"]', fistDeleteServiceButton: 'vn-ticket-service form vn-horizontal:nth-child(1) vn-icon-button[icon="delete"]', - newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="$ctrl.newServiceType.name"]', - newServiceTypeExpense: '.vn-dialog.shown vn-autocomplete[ng-model="$ctrl.newServiceType.expenseFk"]', + newServiceTypeName: '.vn-dialog.shown vn-textfield[ng-model="newServiceType.name"]', + newServiceTypeExpense: '.vn-dialog.shown vn-autocomplete[ng-model="newServiceType.expenseFk"]', serviceLine: 'vn-ticket-service > form > vn-card > vn-one:nth-child(2) > vn-horizontal', saveServiceButton: 'button[type=submit]', saveServiceTypeButton: '.vn-dialog.shown tpl-buttons > button' diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 87dc84a8ea..15486b72c0 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -67,9 +67,7 @@ describe('Client balance path', () => { it('should create a new payment that sets the balance to positive value', async() => { await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( - await page.clearInput(selectors.clientBalance.newPaymentAmount); - await page.write(selectors.clientBalance.newPaymentAmount, '100'); + await page.overwrite(selectors.clientBalance.newPaymentAmount, '100'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -85,10 +83,7 @@ describe('Client balance path', () => { it('should create a new payment that sets the balance back to the original negative value', async() => { await page.waitToClick(selectors.clientBalance.newPaymentButton); - await page.waitFor(3000); // didn't manage to make this dynamic to allow clearInput to find the icon clear... :( - await page.waitForSelector('.vn-dialog.vn-popup.shown', {visible: true}); - await page.clearInput(selectors.clientBalance.newPaymentAmount); - await page.write(selectors.clientBalance.newPaymentAmount, '-150'); + await page.overwrite(selectors.clientBalance.newPaymentAmount, '-150'); await page.waitToClick(selectors.clientBalance.saveButton); let result = await page.waitForLastSnackbar(); @@ -113,7 +108,6 @@ describe('Client balance path', () => { it('should now search for the user Petter Parker', async() => { await page.accessToSearchResult('Petter Parker'); - await page.waitToClick(selectors.clientBalance.balanceButton); await page.waitForState('client.card.balance.index'); }); diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 1a32ea9448..170841fda5 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -81,7 +81,6 @@ describe('Ticket services path', () => { await page.autocompleteSearch(selectors.ticketService.newServiceTypeExpense, 'Retencion'); await page.waitToClick(selectors.ticketService.saveServiceTypeButton); await page.write(selectors.ticketService.firstPrice, '999'); - await page.waitFor(1000); // time needed for the button to be clickable await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); @@ -120,7 +119,6 @@ describe('Ticket services path', () => { it('should delete the service', async() => { await page.waitToClick(selectors.ticketService.fistDeleteServiceButton); await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0); - await page.waitFor(1000); // without this wait it fails to click the save button await page.waitToClick(selectors.ticketService.saveServiceButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index ceb2175e2d..5b0bee67e1 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -describe('InvoiceOut descriptor path', () => { +fdescribe('InvoiceOut descriptor path', () => { let browser; let page; diff --git a/front/core/components/confirm/confirm.js b/front/core/components/confirm/confirm.js index f187a3cb41..c0a1cc0c55 100644 --- a/front/core/components/confirm/confirm.js +++ b/front/core/components/confirm/confirm.js @@ -6,10 +6,7 @@ import './style.scss'; export default class Confirm extends Dialog { constructor($element, $, $transclude) { super($element, $, $transclude); - - let $template = angular.element(template); - this.fillSlot('body', $template.find('tpl-body')); - this.fillSlot('buttons', $template.find('tpl-buttons')); + this.fillSlots(template); } } diff --git a/front/core/components/dialog/index.js b/front/core/components/dialog/index.js index 7a7cb5f9fd..dfc1e5d3ad 100644 --- a/front/core/components/dialog/index.js +++ b/front/core/components/dialog/index.js @@ -21,6 +21,17 @@ export default class Dialog extends Popup { this.fillDefaultSlot(template); } + /** + * Fills the dialog slots, it is intended to be used by child classes. + * + * @param {String} template The HTML template string + */ + fillSlots(template) { + let $template = angular.element(template); + this.fillSlot('body', $template.find('tpl-body')); + this.fillSlot('buttons', $template.find('tpl-buttons')); + } + /** * Shows the dialog and optionally registers a handler for the response. * @@ -68,7 +79,17 @@ export default class Dialog extends Popup { respond(response) { if (!this.shown) return this.$q.resolve(); + return this.responseHandler(response); + } + /** + * The default response handler, it can be overriden by child classes to + * add custom logic. + * + * @param {String} response The response code + * @return {Boolean} The response handler return + */ + responseHandler(response) { let handlerArgs = { $response: response, $data: this.data diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 1a483ab961..b775ab4c03 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -79,6 +79,9 @@ vn-layout { & > .main-view { padding-right: $menu-width; } + [fixed-bottom-right] { + right: 4em + $menu-width; + } } & > .main-view { padding-top: $topbar-height; @@ -89,6 +92,11 @@ vn-layout { padding: $spacing-md; box-sizing: border-box } + [fixed-bottom-right] { + position: fixed; + bottom: 2em; + right: 2em; + } &.ng-enter { vn-side-menu { opacity: 0; @@ -124,6 +132,9 @@ vn-layout { & > .main-view { padding-right: 0; } + [fixed-bottom-right] { + right: 2em; + } } ui-view > * { padding-left: 0; diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index 1f2d799815..b2f28032e6 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -73,11 +73,6 @@ vn-bg-title { padding: $spacing-lg; max-width: 1000px; } -html [fixed-bottom-right] { - position: fixed; - bottom: 2em; - right: 2em; -} .list > vn-none { min-width: 60px; } diff --git a/modules/client/front/balance/create/index.html b/modules/client/front/balance/create/index.html index 36f45653fe..07c4de531b 100644 --- a/modules/client/front/balance/create/index.html +++ b/modules/client/front/balance/create/index.html @@ -1,11 +1,6 @@ - +
- - -
New payment
-
+
New payment
- -
- - - -
- \ No newline at end of file + + + + +
\ No newline at end of file diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 1a7d8b97bb..c39536746e 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -1,10 +1,12 @@ import ngModule from '../../module'; -import Section from 'salix/components/section'; -import './style.scss'; +import Dialog from 'core/components/dialog'; +import template from './index.html'; + +class Controller extends Dialog { + constructor($element, $, $transclude) { + super($element, $, $transclude); + this.fillSlots(template); -class Controller extends Section { - constructor($element, $) { - super($element, $); this.receipt = { payed: new Date(), clientFk: this.$params.id, @@ -51,46 +53,35 @@ class Controller extends Section { } getAmountPaid() { - let filter = { + const filter = { where: { clientFk: this.$params.id, companyFk: this.receipt.companyFk } }; - let query = `ClientRisks?filter=${JSON.stringify(filter)}`; - this.$http.get(query).then(res => { + this.$http.get(`ClientRisks`, {filter}).then(res => { this.receipt.amountPaid = (res.data.length && res.data[0].amount) || null; }); } - show() { - this.$.dialog.show(); - } + responseHandler(response) { + if (response !== 'accept') + return super.responseHandler(response); - hide() { - this.$.dialog.hide(); - } - - save() { - let query = `receipts`; - this.$http.post(query, this.receipt).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); - this.hide(); - if (this.onResponse) - this.onResponse(); - }); + return this.$http.post(`Receipts`, this.receipt) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) + .then(() => super.responseHandler(response)); } } -ngModule.component('vnClientBalanceCreate', { - template: require('./index.html'), +ngModule.vnComponent('vnClientBalanceCreate', { controller: Controller, + transclude: true, bindings: { payed: '
+ +
+ + +
+
Total by company
+ + +
+
+
- - - - - - - - -
-
Total by company
- - - - -
-
-
-
@@ -117,10 +113,12 @@ vn-tooltip="New payment" vn-bind="+" fixed-bottom-right - ng-click="$ctrl.openCreateDialog()"> + ng-click="balanceCreate.show()"> + vn-id="balance-create" + on-accept="$ctrl.getData()" + company-fk="$ctrl.companyId"> this.getData(); - this.$.balanceCreateDialog.show(); - } - showWorkerDescriptor(event, workerFk) { if (event.defaultPrevented) return; diff --git a/modules/client/front/balance/index/style.scss b/modules/client/front/balance/index/style.scss deleted file mode 100644 index 74d3bc09b3..0000000000 --- a/modules/client/front/balance/index/style.scss +++ /dev/null @@ -1,10 +0,0 @@ - -@import "./variables"; - -vn-client-balance-index { - .totalBox { - border: $border-thin-light; - text-align: left; - float: right - } -} \ No newline at end of file diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index 3872259a92..8dce23aa7b 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -57,13 +57,13 @@ class Controller extends ModuleCard { ], }; - this.$http.get(`Tickets/${this.$params.id}`, {filter}) + return this.$http.get(`Tickets/${this.$params.id}`, {filter}) .then(res => this.onData(res.data)); } onData(data) { this.ticket = data; - this.$http.get(`Clients/${data.client.id}/getDebt`) + return this.$http.get(`Clients/${data.client.id}/getDebt`) .then(res => this.ticket.client.debt = res.data.debt); } } diff --git a/modules/ticket/front/descriptor/index.html b/modules/ticket/front/descriptor/index.html index f47f3d6efa..2ea87839b8 100644 --- a/modules/ticket/front/descriptor/index.html +++ b/modules/ticket/front/descriptor/index.html @@ -153,20 +153,14 @@ + on-accept="$ctrl.changeShipped()"> -
-
- Change shipped hour -
- - -
+
Change shipped hour
+ +
diff --git a/modules/ticket/front/descriptor/index.js b/modules/ticket/front/descriptor/index.js index d60e2ce670..28fdfe3a22 100644 --- a/modules/ticket/front/descriptor/index.js +++ b/modules/ticket/front/descriptor/index.js @@ -9,38 +9,45 @@ class Controller extends Component { this.moreOptions = [ { name: 'Add turn', - acl: 'buyer', - callback: this.showAddTurnDialog - }, - {name: 'Show Delivery Note', callback: this.showDeliveryNote}, - {name: 'Send Delivery Note', callback: this.confirmDeliveryNote}, - {name: 'Delete ticket', callback: this.showDeleteTicketDialog}, - {name: 'Change shipped hour', callback: this.showChangeShipped}, - {name: 'SMS Pending payment', callback: this.sendPaymentSms}, - {name: 'SMS Minimum import', callback: this.sendImportSms}, - { + callback: this.showAddTurnDialog, + acl: 'buyer' + }, { + name: 'Show Delivery Note', + callback: this.showDeliveryNote + }, { + name: 'Send Delivery Note', + callback: this.confirmDeliveryNote + }, { + name: 'Delete ticket', + callback: this.showDeleteTicketDialog + }, { + name: 'Change shipped hour', + callback: this.showChangeShipped + }, { + name: 'SMS Pending payment', + callback: this.sendPaymentSms + }, { + name: 'SMS Minimum import', + callback: this.sendImportSms + }, { name: 'Add stowaway', callback: this.showAddStowaway, show: () => this.canShowStowaway - }, - { + }, { name: 'Delete stowaway', callback: this.showDeleteStowaway, show: () => this.shouldShowDeleteStowaway() - }, - { + }, { name: 'Make invoice', - acl: 'invoicing', callback: this.showMakeInvoiceDialog, - show: () => !this.hasInvoice() - }, - { + show: () => !this.hasInvoice(), + acl: 'invoicing' + }, { name: 'Regenerate invoice', - acl: 'invoicing', callback: this.showRegenerateInvoiceDialog, - show: () => this.hasInvoice() - }, - { + show: () => this.hasInvoice(), + acl: 'invoicing' + }, { name: 'Recalculate components', callback: this.comfirmRecalculateComponents, show: () => this.isEditable @@ -98,22 +105,20 @@ class Controller extends Component { showChangeShipped() { if (!this.isEditable) { - this.vnApp.showError(this.$translate.instant(`This ticket can't be modified`)); + this.vnApp.showError(this.$t(`This ticket can't be modified`)); return; } + this.newShipped = this.ticket.shipped; this.$.changeShippedDialog.show(); } - changeShipped(response) { - if (response === 'accept') { - let data = {shipped: this.newShipped}; - let query = `Tickets/${this.ticket.id}/updateEditableTicket`; - this.$http.post(query, data).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Shipped hour updated')); - this.cardReload(); - }); - } + changeShipped() { + let data = {shipped: this.newShipped}; + let query = `Tickets/${this.ticket.id}/updateEditableTicket`; + this.$http.post(query, data) + .then(() => this.cardReload()) + .then(() => this.vnApp.showSuccess(this.$t('Shipped hour updated'))); } isTicketModule() { @@ -161,13 +166,13 @@ class Controller extends Component { let params = {ticketFk: this.ticket.id, weekDay: day}; this.$http.patch(`TicketWeeklies`, params).then(() => { this.$.addTurn.hide(); - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); }); } showDeleteTicketDialog() { if (!this.isEditable) { - this.vnApp.showError(this.$translate.instant('This ticket cant be deleted')); + this.vnApp.showError(this.$t('This ticket cant be deleted')); return; } @@ -179,7 +184,7 @@ class Controller extends Component { const query = `Tickets/${this.ticket.id}/setDeleted`; this.$http.post(query).then(() => { this.$state.go('ticket.index'); - this.vnApp.showSuccess(this.$translate.instant('Ticket deleted')); + this.vnApp.showSuccess(this.$t('Ticket deleted')); }); } } @@ -213,7 +218,7 @@ class Controller extends Component { deleteStowaway() { const query = `Tickets/${this.ticket.id}/deleteStowaway`; this.$http.post(query).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); this.cardReload(); }); } @@ -236,7 +241,7 @@ class Controller extends Component { ticketId: this.ticket.id }; this.$http.get(`email/delivery-note`, {params}).then( - () => this.vnApp.showMessage(this.$translate.instant('Notification sent!')) + () => this.vnApp.showMessage(this.$t('Notification sent!')) ); } @@ -245,13 +250,13 @@ class Controller extends Component { ticketId: this.ticket.id, created: this.ticket.created }; - const message = this.$params.message || this.$translate.instant('Minimum is needed', params); + const message = this.$params.message || this.$t('Minimum is needed', params); this.newSMS = {message}; this.showSMSDialog(); } sendPaymentSms() { - const message = this.$params.message || this.$translate.instant('Make a payment'); + const message = this.$params.message || this.$t('Make a payment'); this.newSMS = {message}; this.showSMSDialog(); } @@ -284,7 +289,7 @@ class Controller extends Component { if (response === 'accept') { const query = `Tickets/${this.ticket.id}/makeInvoice`; this.$http.post(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('Ticket invoiced')); + this.vnApp.showSuccess(this.$t('Ticket invoiced')); this.$state.reload(); }); } @@ -308,7 +313,7 @@ class Controller extends Component { const invoiceId = this.ticket.invoiceOut.id; const query = `InvoiceOuts/${invoiceId}/regenerate`; this.$http.post(query).then(() => { - const snackbarMessage = this.$translate.instant( + const snackbarMessage = this.$t( `Invoice sent for a regeneration, will be available in a few minutes`); this.vnApp.showSuccess(snackbarMessage); }); @@ -341,7 +346,7 @@ class Controller extends Component { recalculateComponents() { const query = `Tickets/${this.ticket.id}/recalculateComponents`; this.$http.post(query).then(res => { - this.vnApp.showSuccess(this.$translate.instant('Data saved!')); + this.vnApp.showSuccess(this.$t('Data saved!')); }); } } diff --git a/modules/ticket/front/descriptor/index.spec.js b/modules/ticket/front/descriptor/index.spec.js index 3f4b876828..4f43ac0104 100644 --- a/modules/ticket/front/descriptor/index.spec.js +++ b/modules/ticket/front/descriptor/index.spec.js @@ -157,8 +157,7 @@ describe('Ticket Component vnTicketDescriptor', () => { jest.spyOn(controller.vnApp, 'showSuccess'); jest.spyOn(controller, 'cardReload'); - $httpBackend.when('POST', 'Tickets/12/updateEditableTicket').respond(); - $httpBackend.expect('POST', 'Tickets/12/updateEditableTicket').respond(); + $httpBackend.expectRoute('POST', 'Tickets/:id/updateEditableTicket').respond(); controller.changeShipped('accept'); $httpBackend.flush(); diff --git a/modules/ticket/front/services/index.html b/modules/ticket/front/services/index.html index 419110eacb..57146661cc 100644 --- a/modules/ticket/front/services/index.html +++ b/modules/ticket/front/services/index.html @@ -22,7 +22,7 @@ @@ -72,26 +72,28 @@ + vn-id="newServiceTypeDialog" + on-accept="$ctrl.onNewServiceTypeAccept($data)" + on-close="newServiceType = null">
New service type
- + ng-model="newServiceType.expenseFk">
diff --git a/modules/ticket/front/services/index.js b/modules/ticket/front/services/index.js index 8627360c6b..efb62fe2e4 100644 --- a/modules/ticket/front/services/index.js +++ b/modules/ticket/front/services/index.js @@ -17,43 +17,33 @@ class Controller extends Section { } add() { - if (this.defaultTaxClass) { - this.$.model.insert({ - taxClassFk: this.defaultTaxClass.id, - quantity: 1, - ticketFk: this.$params.id - }); - } + this.$.model.insert({ + taxClassFk: this.defaultTaxClass.id, + quantity: 1, + ticketFk: this.$params.id + }); } - onNewServiceTypeOpen() { - this.newServiceType = {}; - } - - newServiceTypeDialog(elementIndex, event) { + onNewServiceTypeClick(service, event) { event.preventDefault(); - this.$.createServiceTypeDialog.show(); - this.currentServiceIndex = elementIndex; + this.$.newServiceType = {}; + this.$.newServiceTypeDialog.show(service); } - onNewServiceTypeResponse(response) { - if (response == 'accept') { - if (!this.newServiceType.name) - throw new UserError(`Name can't be empty`); + onNewServiceTypeAccept(service) { + if (!this.$.newServiceType.name) + throw new UserError(`Name can't be empty`); - this.$http.post(`TicketServiceTypes`, this.newServiceType).then(response => { - this.services[this.currentServiceIndex].ticketServiceTypeFk = response.data.id; - }); - } + return this.$http.post(`TicketServiceTypes`, this.$.newServiceType) + .then(res => service.ticketServiceTypeFk = res.data.id); } onSubmit() { this.$.watcher.check(); - this.$.model.save().then(() => { - this.$.watcher.notifySaved(); - this.$.model.refresh(); - }); + this.$.model.save() + .then(() => this.$.model.refresh()) + .then(() => this.$.watcher.notifySaved()); } } diff --git a/modules/ticket/front/services/index.spec.js b/modules/ticket/front/services/index.spec.js index 30bcd821a7..10e3ad47ed 100644 --- a/modules/ticket/front/services/index.spec.js +++ b/modules/ticket/front/services/index.spec.js @@ -3,17 +3,16 @@ import './index.js'; describe('Ticket component vnTicketService', () => { let controller; let $httpBackend; - let $httpParamSerializer; let $scope; let $element; beforeEach(ngModule('ticket')); - beforeEach(angular.mock.inject(($componentController, _$httpBackend_, _$httpParamSerializer_, $rootScope) => { - $element = angular.element(`
`); + beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope) => { $httpBackend = _$httpBackend_; - $httpParamSerializer = _$httpParamSerializer_; $scope = $rootScope.$new(); + + $element = angular.element(`
`); controller = $componentController('vnTicketService', {$scope, $element}); })); @@ -32,13 +31,13 @@ describe('Ticket component vnTicketService', () => { }); }); - describe('onNewServiceTypeResponse', () => { - it(`should throw an error if the new service description is empty`, () => { - controller.newServiceType = {name: undefined}; + describe('onNewServiceTypeAccept', () => { + it(`should throw an error if the new service type name is empty`, () => { + $scope.newServiceType = {}; let error; try { - controller.onNewServiceTypeResponse('accept'); + controller.onNewServiceTypeAccept({}); } catch (e) { error = e.message; } @@ -47,18 +46,22 @@ describe('Ticket component vnTicketService', () => { }); it('should set the description of the selected service upon service type creation', () => { - controller.services = [ - {id: 1, description: 'not too great service'} - ]; + const service = { + id: 1, + quantity: 10 + }; + $scope.newServiceType = { + name: 'Totally new stuff' + }; - controller.newServiceType = {name: 'totally new stuff'}; - controller.currentServiceIndex = 0; - - $httpBackend.when('POST', 'TicketServiceTypes').respond({id: 4001, name: 'totally new stuff'}); - controller.onNewServiceTypeResponse('accept'); + $httpBackend.when('POST', 'TicketServiceTypes').respond({ + id: 4001, + name: 'Totally new stuff' + }); + controller.onNewServiceTypeAccept(service); $httpBackend.flush(); - expect(controller.services[0].ticketServiceTypeFk).toEqual(4001); + expect(service.ticketServiceTypeFk).toEqual(4001); }); }); }); From 1502592818805aa51ae501acb9c6c334b79551ab Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 30 Mar 2020 17:32:23 +0200 Subject: [PATCH 12/53] Focus removed --- e2e/paths/09-invoice-out/02_descriptor.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 5b0bee67e1..ceb2175e2d 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('InvoiceOut descriptor path', () => { +describe('InvoiceOut descriptor path', () => { let browser; let page; From 98ed5e93d58047ff1ccf15c5c7af73ba062e992e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 10:02:25 +0200 Subject: [PATCH 13/53] E2E fixes: client balance, ticket index --- e2e/helpers/selectors.js | 2 +- e2e/paths/02-client/14_balance.spec.js | 4 ++-- e2e/paths/05-ticket/18_index_payout.spec.js | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 9d6992be00..4e94c73ffe 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -372,7 +372,7 @@ export default { payoutButton: 'vn-ticket-index vn-button[icon="icon-recovery"]', payoutCompany: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.companyFk"]', payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.receipt.bankFk"]', - submitPayout: '.vn-dialog vn-button[label="Save"]', + submitPayout: '.vn-dialog button[response="accept"]', searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr', searchResultDate: 'vn-ticket-summary [label=Landed] span', topbarSearch: 'vn-searchbar', diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index 15486b72c0..eb3608f47c 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client balance path', () => { +fdescribe('Client balance path', () => { let browser; let page; beforeAll(async() => { @@ -108,7 +108,7 @@ describe('Client balance path', () => { it('should now search for the user Petter Parker', async() => { await page.accessToSearchResult('Petter Parker'); - await page.waitForState('client.card.balance.index'); + await page.accessToSection('client.card.balance.index'); }); it('should not be able to click the new payment button as it isnt present', async() => { diff --git a/e2e/paths/05-ticket/18_index_payout.spec.js b/e2e/paths/05-ticket/18_index_payout.spec.js index 749428c443..3bbe4b5503 100644 --- a/e2e/paths/05-ticket/18_index_payout.spec.js +++ b/e2e/paths/05-ticket/18_index_payout.spec.js @@ -16,9 +16,7 @@ describe('Ticket index payout path', () => { it('should navigate to the ticket index', async() => { await page.loginAndModule('administrative', 'ticket'); - let url = await page.expectURL('#!/ticket/index'); - - expect(url).toBe(true); + await page.waitForState('ticket.index'); }); it('should check three tickets 2 of a clinet and 1 of another', async() => { From 425b54282a36a6d0f6e08815670dde5e5545533c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 10:11:05 +0200 Subject: [PATCH 14/53] fdescribe removed --- e2e/paths/02-client/14_balance.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/paths/02-client/14_balance.spec.js b/e2e/paths/02-client/14_balance.spec.js index eb3608f47c..cfa72c0243 100644 --- a/e2e/paths/02-client/14_balance.spec.js +++ b/e2e/paths/02-client/14_balance.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Client balance path', () => { +describe('Client balance path', () => { let browser; let page; beforeAll(async() => { From d6fda676f6fe4b9ed21b7045e6fda30f1ffaf618 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 10:19:01 +0200 Subject: [PATCH 15/53] E2E fixes: Client balance --- modules/client/front/balance/create/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index c39536746e..5844e2204d 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -70,8 +70,8 @@ class Controller extends Dialog { return super.responseHandler(response); return this.$http.post(`Receipts`, this.receipt) - .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))) - .then(() => super.responseHandler(response)); + .then(() => super.responseHandler(response)) + .then(() => this.vnApp.showSuccess(this.$t('Data saved!'))); } } From 5d1e0ee682d734e9de8a4dc7ed078238b4c3011c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 15:15:16 +0200 Subject: [PATCH 16/53] E2E fixes: client billing data, invoiceOut descriptor --- .../02-client/04_edit_billing_data.spec.js | 4 ++ .../09-invoice-out/02_descriptor.spec.js | 2 + .../invoiceOut/front/descriptor/index.html | 4 +- modules/invoiceOut/front/descriptor/index.js | 41 ++++++++++--------- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index b757940be5..7f37a61c11 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -32,6 +32,10 @@ describe('Client Edit billing data path', () => { }); it(`should create a new BIC code`, async() => { + // XXX: Windows fix, entity code doesn't get the focus, so the text + // '9999' is written in entity name. + await page.waitFor(500); + await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index ceb2175e2d..535e37bdd6 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -52,6 +52,7 @@ describe('InvoiceOut descriptor path', () => { it(`should search for the deleted invouceOut to find no results`, async() => { await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); await page.waitToClick(selectors.invoiceOutIndex.searchButton); + await page.waitForSpinnerLoad(); await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0); const result = await page.countElement(selectors.invoiceOutIndex.searchResult); @@ -69,6 +70,7 @@ describe('InvoiceOut descriptor path', () => { await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); + await page.waitForSpinnerLoad(); await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0); const result = await page.countElement(selectors.ticketsIndex.searchResult); diff --git a/modules/invoiceOut/front/descriptor/index.html b/modules/invoiceOut/front/descriptor/index.html index 981c23e343..1c18d92edf 100644 --- a/modules/invoiceOut/front/descriptor/index.html +++ b/modules/invoiceOut/front/descriptor/index.html @@ -40,11 +40,11 @@
\ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor/index.js b/modules/invoiceOut/front/descriptor/index.js index fea3c8bada..b813214bc7 100644 --- a/modules/invoiceOut/front/descriptor/index.js +++ b/modules/invoiceOut/front/descriptor/index.js @@ -5,9 +5,18 @@ class Controller extends Component { constructor($element, $) { super($element, $); this.moreOptions = [ - {callback: this.showInvoiceOutPdf, name: 'Show invoice PDF'}, - {callback: this.showDeleteInvoiceOutDialog, name: 'Delete Invoice', acl: 'invoicing'}, - {callback: this.showBookInvoiceOutDialog, name: 'Book invoice', acl: 'invoicing'} + { + name: 'Show invoice PDF', + callback: this.showInvoiceOutPdf + }, { + name: 'Delete Invoice', + callback: this.showDeleteInvoiceOutDialog, + acl: 'invoicing' + }, { + name: 'Book invoice', + callback: this.showBookInvoiceOutDialog, + acl: 'invoicing' + } ]; } @@ -60,24 +69,18 @@ class Controller extends Component { this.$.bookConfirmation.show(); } - deleteInvoiceOut(response) { - if (response === 'accept') { - const query = `InvoiceOuts/${this.invoiceOut.id}/delete`; - this.$http.post(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('InvoiceOut deleted')); - this.$state.go('invoiceOut.index'); - }); - } + deleteInvoiceOut() { + const query = `InvoiceOuts/${this.invoiceOut.id}/delete`; + return this.$http.post(query) + .then(() => this.$state.go('invoiceOut.index')) + .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut deleted'))); } - bookInvoiceOut(response) { - if (response === 'accept') { - const query = `InvoiceOuts/${this.invoiceOut.ref}/book`; - this.$http.post(query).then(() => { - this.vnApp.showSuccess(this.$translate.instant('InvoiceOut booked')); - this.$state.reload(); - }); - } + bookInvoiceOut() { + const query = `InvoiceOuts/${this.invoiceOut.ref}/book`; + return this.$http.post(query) + .then(() => this.$state.reload()) + .then(() => this.vnApp.showSuccess(this.$t('InvoiceOut booked'))); } set quicklinks(value = {}) { From 7cd643c8c7e02a1c021c01490d4fa6900541e12e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 15:30:57 +0200 Subject: [PATCH 17/53] E2E fixes: waitForContentLoaded() extension --- e2e/helpers/extensions.js | 2 +- e2e/paths/02-client/15_user_config.spec.js | 5 ----- e2e/paths/04-item/09_regularize.spec.js | 2 +- e2e/paths/05-ticket/12_descriptor.spec.js | 4 ++-- e2e/paths/06-claim/04_claim_action.spec.js | 5 ++++- e2e/paths/08-route/03_create.spec.js | 1 - e2e/paths/09-invoice-out/02_descriptor.spec.js | 1 - 7 files changed, 8 insertions(+), 12 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 93914d2ff7..1d00739993 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -551,7 +551,7 @@ let actions = { }, waitForContentLoaded: async function() { - // await this.waitFor(250); + await this.waitForSpinnerLoad(); } }; diff --git a/e2e/paths/02-client/15_user_config.spec.js b/e2e/paths/02-client/15_user_config.spec.js index 89d4e004a3..2d412377ae 100644 --- a/e2e/paths/02-client/15_user_config.spec.js +++ b/e2e/paths/02-client/15_user_config.spec.js @@ -16,7 +16,6 @@ describe('User config', () => { describe('as salesPerson', () => { it('should login', async() => { await page.login('salesPerson'); - await page.waitForContentLoaded(); }); it('should now open the user config form to check the settings', async() => { @@ -26,7 +25,6 @@ describe('User config', () => { let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let expectedLocalBank = await page .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); @@ -50,7 +48,6 @@ describe('User config', () => { describe('as employee', () => { it('should log in', async() => { await page.login('employee'); - await page.waitForContentLoaded(); }); it('should open the user config form to check the settings', async() => { @@ -59,7 +56,6 @@ describe('User config', () => { let expectedLocalWarehouse = await page .expectPropertyValue(selectors.globalItems.userLocalWarehouse, 'value', ''); - let expectedLocalBank = await page .expectPropertyValue(selectors.globalItems.userLocalBank, 'value', ''); @@ -92,7 +88,6 @@ describe('User config', () => { describe('as salesPerson 2nd run', () => { it('should log in once more', async() => { await page.login('salesPerson'); - await page.waitForContentLoaded(); }); it('should again open the user config form to check the local settings', async() => { diff --git a/e2e/paths/04-item/09_regularize.spec.js b/e2e/paths/04-item/09_regularize.spec.js index a37d97fa37..9c07d59163 100644 --- a/e2e/paths/04-item/09_regularize.spec.js +++ b/e2e/paths/04-item/09_regularize.spec.js @@ -65,8 +65,8 @@ describe('Item regularize path', () => { }); it('should clear the user local settings now', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.globalItems.userMenuButton); + await page.waitForContentLoaded(); await page.clearInput(selectors.globalItems.userConfigFirstAutocomplete); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/05-ticket/12_descriptor.spec.js b/e2e/paths/05-ticket/12_descriptor.spec.js index ce9f064dd2..4e2fce19e3 100644 --- a/e2e/paths/05-ticket/12_descriptor.spec.js +++ b/e2e/paths/05-ticket/12_descriptor.spec.js @@ -99,8 +99,8 @@ describe('Ticket descriptor path', () => { }); it('should delete the stowaway', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteStowawayButton); await page.waitToClick(selectors.ticketDescriptor.acceptDeleteStowawayButton); const result = await page.waitForLastSnackbar(); @@ -130,8 +130,8 @@ describe('Ticket descriptor path', () => { }); it('should invoice the ticket using the descriptor more menu', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenu); + await page.waitForContentLoaded(); await page.waitToClick(selectors.ticketDescriptor.moreMenuMakeInvoice); await page.waitToClick(selectors.ticketDescriptor.acceptInvoiceOutButton); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/06-claim/04_claim_action.spec.js b/e2e/paths/06-claim/04_claim_action.spec.js index a482e21c3a..fedb5e0cbb 100644 --- a/e2e/paths/06-claim/04_claim_action.spec.js +++ b/e2e/paths/06-claim/04_claim_action.spec.js @@ -25,7 +25,10 @@ describe('Claim action path', () => { }); it('should import the second importable ticket', async() => { - await page.waitFor(3000); // the animation adding the header element for the claimed total obscures somehow other elements for about 2 seconds + // the animation adding the header element for the claimed total + // obscures somehow other elements for about 2 seconds + await page.waitFor(3000); + await page.waitToClick(selectors.claimAction.importTicketButton); await page.waitToClick(selectors.claimAction.secondImportableTicket); const result = await page.waitForLastSnackbar(); diff --git a/e2e/paths/08-route/03_create.spec.js b/e2e/paths/08-route/03_create.spec.js index dafccff7f1..88d7c8d28f 100644 --- a/e2e/paths/08-route/03_create.spec.js +++ b/e2e/paths/08-route/03_create.spec.js @@ -17,7 +17,6 @@ describe('Route create path', () => { describe('as employee', () => { it('should click on the add new route button and open the creation form', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.routeIndex.addNewRouteButton); await page.waitForState('route.create'); }); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 535e37bdd6..605106abf1 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -78,7 +78,6 @@ describe('InvoiceOut descriptor path', () => { }); it('should now navigate to the invoiceOut index', async() => { - await page.waitForContentLoaded(); await page.waitToClick(selectors.globalItems.applicationsMenuButton); await page.wait(selectors.globalItems.applicationsMenuVisible); await page.waitToClick(selectors.globalItems.invoiceOutButton); From 326c92b23fef7822c1542e1bf4ebb532fa9b3909 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 18:33:48 +0200 Subject: [PATCH 18/53] E2E fixes: doSearch extension, item clone intermittence --- e2e/helpers/extensions.js | 13 +++++++-- e2e/paths/02-client/01_create_client.spec.js | 4 +-- e2e/paths/04-item/01_summary.spec.js | 17 +++++------ e2e/paths/04-item/08_create_and_clone.spec.js | 28 ++++++------------- e2e/paths/04-item/11_item_log.spec.js | 8 ++---- e2e/paths/05-ticket/09_weekly.spec.js | 18 ++++-------- e2e/paths/05-ticket/13_services.spec.js | 5 ++-- e2e/paths/06-claim/06_descriptor.spec.js | 8 ++---- .../09-invoice-out/02_descriptor.spec.js | 19 ++++--------- 9 files changed, 49 insertions(+), 71 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 1d00739993..59e98e2176 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -125,7 +125,7 @@ let actions = { let $state = angular.element(document.body).injector().get('$state'); return !$state.transition && $state.is(state); }, {}, state); - await this.waitForSpinnerLoad(state); + await this.waitForSpinnerLoad(); }, waitForTransition: async function() { @@ -133,6 +133,7 @@ let actions = { const $state = angular.element(document.body).injector().get('$state'); return !$state.transition; }); + await this.waitForSpinnerLoad(); }, accessToSection: async function(state) { @@ -167,11 +168,17 @@ let actions = { await this.waitToClick(`vn-left-menu li > a[ui-sref="${sectionRoute}"]`); }, - accessToSearchResult: async function(searchValue) { + doSearch: async function(searchValue) { await this.clearInput('vn-searchbar'); - await this.write('vn-searchbar', searchValue); + if (searchValue) + await this.write('vn-searchbar', searchValue); + await this.waitToClick('vn-searchbar vn-icon[icon="search"]'); await this.waitForTransition(); + }, + + accessToSearchResult: async function(searchValue) { + await this.doSearch(searchValue); await this.waitFor('.vn-descriptor'); }, diff --git a/e2e/paths/02-client/01_create_client.spec.js b/e2e/paths/02-client/01_create_client.spec.js index 0b8c96c167..2efd10d2ba 100644 --- a/e2e/paths/02-client/01_create_client.spec.js +++ b/e2e/paths/02-client/01_create_client.spec.js @@ -15,9 +15,7 @@ describe('Client create path', async() => { }); it(`should search for the user Carol Danvers to confirm it isn't created yet`, async() => { - await page.write(selectors.clientsIndex.topbarSearch, 'Carol Danvers'); - await page.waitToClick(selectors.clientsIndex.searchButton); - await page.waitForNumberOfElements(selectors.clientsIndex.searchResult, 0); + await page.doSearch('Carol Danvers'); const result = await page.countElement(selectors.clientsIndex.searchResult); expect(result).toEqual(0); diff --git a/e2e/paths/04-item/01_summary.spec.js b/e2e/paths/04-item/01_summary.spec.js index 6f2c2c9265..7658cb7520 100644 --- a/e2e/paths/04-item/01_summary.spec.js +++ b/e2e/paths/04-item/01_summary.spec.js @@ -15,14 +15,14 @@ describe('Item summary path', () => { }); it('should search for an item', async() => { - await page.clearInput(selectors.itemsIndex.topbarSearch); - await page.write(selectors.itemsIndex.topbarSearch, 'Ranged weapon'); - await page.waitToClick(selectors.itemsIndex.searchButton); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3); + await page.doSearch('Ranged weapon'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); + await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon'); await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton); const isVisible = await page.isVisible(selectors.itemSummary.basicData); + expect(nResults).toBe(3); expect(isVisible).toBeTruthy(); }); @@ -67,12 +67,13 @@ describe('Item summary path', () => { }); it('should search for other item', async() => { - await page.clearInput('vn-searchbar'); - await page.write(selectors.itemsIndex.topbarSearch, 'Melee Reinforced'); - await page.keyboard.press('Enter'); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); + await page.doSearch('Melee Reinforced'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); + await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton); await page.waitForSelector(selectors.itemSummary.basicData, {visible: true}); + + expect(nResults).toBe(2); }); it(`should now check the item summary preview shows fields from basic data`, async() => { diff --git a/e2e/paths/04-item/08_create_and_clone.spec.js b/e2e/paths/04-item/08_create_and_clone.spec.js index 73249a0b94..8fa40ed82b 100644 --- a/e2e/paths/04-item/08_create_and_clone.spec.js +++ b/e2e/paths/04-item/08_create_and_clone.spec.js @@ -16,13 +16,10 @@ describe('Item Create/Clone path', () => { describe('create', () => { it(`should search for the item Infinity Gauntlet to confirm it isn't created yet`, async() => { - await page.clearInput(selectors.itemsIndex.topbarSearch); - await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); - await page.waitToClick(selectors.itemsIndex.searchButton); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); - const result = await page.countElement(selectors.itemsIndex.searchResult); + await page.doSearch('Infinity Gauntlet'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); it('should access to the create item view by clicking the create floating button', async() => { @@ -85,13 +82,10 @@ describe('Item Create/Clone path', () => { }); it(`should search for the item Infinity Gauntlet`, async() => { - await page.clearInput(selectors.itemsIndex.topbarSearch); - await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); - await page.waitToClick(selectors.itemsIndex.searchButton); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1); - const result = await page.countElement(selectors.itemsIndex.searchResult); + await page.doSearch('Infinity Gauntlet'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); - expect(result).toEqual(1); + expect(nResults).toEqual(1); }); it(`should clone the Infinity Gauntlet`, async() => { @@ -102,14 +96,10 @@ describe('Item Create/Clone path', () => { }); it('should search for the item Infinity Gauntlet and find two', async() => { - await page.waitToClick(selectors.itemTags.goToItemIndexButton); - await page.clearInput(selectors.itemsIndex.topbarSearch); - await page.write(selectors.itemsIndex.topbarSearch, 'Infinity Gauntlet'); - await page.waitToClick(selectors.itemsIndex.searchButton); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2); - const result = await page.countElement(selectors.itemsIndex.searchResult); + await page.doSearch('Infinity Gauntlet'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); - expect(result).toEqual(2); + expect(nResults).toEqual(2); }); }); }); diff --git a/e2e/paths/04-item/11_item_log.spec.js b/e2e/paths/04-item/11_item_log.spec.js index 82800b9b87..40025de74b 100644 --- a/e2e/paths/04-item/11_item_log.spec.js +++ b/e2e/paths/04-item/11_item_log.spec.js @@ -15,12 +15,10 @@ describe('Item log path', () => { }); it(`should search for the Knowledge artifact to confirm it isn't created yet`, async() => { - await page.write(selectors.itemsIndex.topbarSearch, 'Knowledge artifact'); - await page.waitToClick(selectors.itemsIndex.searchButton); - await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 0); - const result = await page.countElement(selectors.itemsIndex.searchResult); + await page.doSearch('Knowledge artifact'); + const nResults = await page.countElement(selectors.itemsIndex.searchResult); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); it('should access to the create item view by clicking the create floating button', async() => { diff --git a/e2e/paths/05-ticket/09_weekly.spec.js b/e2e/paths/05-ticket/09_weekly.spec.js index 1629107fb8..f0b814dd85 100644 --- a/e2e/paths/05-ticket/09_weekly.spec.js +++ b/e2e/paths/05-ticket/09_weekly.spec.js @@ -17,7 +17,6 @@ describe('Ticket descriptor path', () => { }); it('should count the amount of tickets in the turns section', async() => { - await page.waitForNumberOfElements(selectors.ticketsIndex.weeklyTicket, 5); const result = await page.countElement(selectors.ticketsIndex.weeklyTicket); expect(result).toEqual(5); @@ -87,12 +86,10 @@ describe('Ticket descriptor path', () => { }); it('should now search for the weekly ticket 11', async() => { - await page.write(selectors.ticketsIndex.topbarSearch, '11'); - await page.waitToClick(selectors.ticketsIndex.searchButton); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 1); - const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); + await page.doSearch('11'); + const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); - expect(result).toEqual(1); + expect(nResults).toEqual(1); }); it('should delete the weekly ticket 11', async() => { @@ -104,12 +101,9 @@ describe('Ticket descriptor path', () => { }); it('should confirm the sixth weekly ticket was deleted', async() => { - await page.waitForContentLoaded(); - await page.clearInput('vn-searchbar'); - await page.waitToClick(selectors.ticketsIndex.searchWeeklyButton); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchWeeklyResult, 5); - const result = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); + await page.doSearch(); + const nResults = await page.countElement(selectors.ticketsIndex.searchWeeklyResult); - expect(result).toEqual(5); + expect(nResults).toEqual(5); }); }); diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index 170841fda5..aaab0791b3 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -127,10 +127,9 @@ describe('Ticket services path', () => { it(`should confirm the service was removed`, async() => { await page.reloadSection('ticket.card.service'); - await page.waitForNumberOfElements(selectors.ticketService.serviceLine, 0); - const result = await page.countElement(selectors.ticketService.serviceLine); + const nResults = await page.countElement(selectors.ticketService.serviceLine); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); }); }); diff --git a/e2e/paths/06-claim/06_descriptor.spec.js b/e2e/paths/06-claim/06_descriptor.spec.js index ee49fe2457..ea18e223b8 100644 --- a/e2e/paths/06-claim/06_descriptor.spec.js +++ b/e2e/paths/06-claim/06_descriptor.spec.js @@ -50,11 +50,9 @@ describe('claim Descriptor path', () => { }); it(`should search for the deleted claim to find no results`, async() => { - await page.write(selectors.claimsIndex.searchClaimInput, claimId); - await page.waitToClick(selectors.claimsIndex.searchButton); - await page.waitForNumberOfElements(selectors.claimsIndex.searchResult, 0); - const result = await page.countElement(selectors.claimsIndex.searchResult); + await page.doSearch(claimId); + const nResults = await page.countElement(selectors.claimsIndex.searchResult); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); }); diff --git a/e2e/paths/09-invoice-out/02_descriptor.spec.js b/e2e/paths/09-invoice-out/02_descriptor.spec.js index 605106abf1..9f378bf3e5 100644 --- a/e2e/paths/09-invoice-out/02_descriptor.spec.js +++ b/e2e/paths/09-invoice-out/02_descriptor.spec.js @@ -50,13 +50,10 @@ describe('InvoiceOut descriptor path', () => { }); it(`should search for the deleted invouceOut to find no results`, async() => { - await page.write(selectors.invoiceOutIndex.topbarSearch, 'T2222222'); - await page.waitToClick(selectors.invoiceOutIndex.searchButton); - await page.waitForSpinnerLoad(); - await page.waitForNumberOfElements(selectors.invoiceOutIndex.searchResult, 0); - const result = await page.countElement(selectors.invoiceOutIndex.searchResult); + await page.doSearch('T2222222'); + const nResults = await page.countElement(selectors.invoiceOutIndex.searchResult); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); it('should navigate to the ticket index', async() => { @@ -67,14 +64,10 @@ describe('InvoiceOut descriptor path', () => { }); it('should search for tickets with an specific invoiceOut to find no results', async() => { - await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton); - await page.write(selectors.ticketsIndex.advancedSearchInvoiceOut, 'T2222222'); - await page.waitToClick(selectors.ticketsIndex.advancedSearchButton); - await page.waitForSpinnerLoad(); - await page.waitForNumberOfElements(selectors.ticketsIndex.searchResult, 0); - const result = await page.countElement(selectors.ticketsIndex.searchResult); + await page.doSearch('T2222222'); + const nResults = await page.countElement(selectors.ticketsIndex.searchResult); - expect(result).toEqual(0); + expect(nResults).toEqual(0); }); it('should now navigate to the invoiceOut index', async() => { From 43ba34c7f058f5b2bd2eb27548bbd6e4ec496f09 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 31 Mar 2020 18:53:25 +0200 Subject: [PATCH 19/53] E2E skipped: Client edit billing data --- e2e/paths/02-client/04_edit_billing_data.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index 7f37a61c11..4c3e9cc1f8 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -1,7 +1,8 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -describe('Client Edit billing data path', () => { +// 2215 Don't work in windows +xdescribe('Client Edit billing data path', () => { let browser; let page; beforeAll(async() => { From eb586c510e2fdf10285ca87da3296dfaf2a0ede2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Wed, 1 Apr 2020 16:05:43 +0200 Subject: [PATCH 20/53] E2E focus fixes --- front/core/components/autocomplete/index.html | 1 + front/core/components/field/index.html | 2 +- front/core/components/field/index.js | 24 ++++--------------- front/core/components/field/style.scss | 2 +- front/core/components/input-number/index.html | 2 +- front/core/components/popup/index.html | 1 + front/core/components/popup/index.js | 1 + front/core/components/popup/style.scss | 1 + front/core/directives/focus.js | 24 +++++++++---------- front/core/directives/specs/focus.spec.js | 4 ++-- modules/client/front/billing-data/index.html | 3 ++- 11 files changed, 26 insertions(+), 39 deletions(-) diff --git a/front/core/components/autocomplete/index.html b/front/core/components/autocomplete/index.html index 725d389770..feaa47bdb2 100755 --- a/front/core/components/autocomplete/index.html +++ b/front/core/components/autocomplete/index.html @@ -1,5 +1,6 @@
+
diff --git a/front/core/components/field/index.js b/front/core/components/field/index.js index 62adf3233a..81fd4cc6a2 100644 --- a/front/core/components/field/index.js +++ b/front/core/components/field/index.js @@ -9,20 +9,17 @@ export default class Field extends FormInput { this.prefix = null; this.suffix = null; - this.control = this.element.querySelector('.control'); - this.element.addEventListener('click', e => this.onClick(e)); - this.container = this.element.querySelector('.container'); - this.container.addEventListener('mousedown', e => this.onMouseDown(e)); + this.container.addEventListener('focusout', () => this.onFocus(false)); + this.container.addEventListener('focusin', () => this.onFocus(true)); + + this.control = this.element.querySelector('.control'); } $onInit() { super.$onInit(); if (this.info) this.classList.add('has-icons'); - - this.input.addEventListener('focus', () => this.onFocus(true)); - this.input.addEventListener('blur', () => this.onFocus(false)); this.input.addEventListener('change', () => this.onChange()); } @@ -160,19 +157,6 @@ export default class Field extends FormInput { fix.innerText = text || ''; } - onClick() { - // if (event.defaultPrevented) return; - - if (this.input !== document.activeElement) - this.focus(); - } - - onMouseDown(event) { - if (event.target == this.input) return; - event.preventDefault(); - this.focus(); - } - onFocus(hasFocus) { this.classList.toggle('focused', hasFocus); } diff --git a/front/core/components/field/style.scss b/front/core/components/field/style.scss index f3bc0ae046..ad1ab5f457 100644 --- a/front/core/components/field/style.scss +++ b/front/core/components/field/style.scss @@ -9,6 +9,7 @@ display: flex; align-items: stretch; position: relative; + outline: none; & > .infix { position: relative; @@ -30,7 +31,6 @@ & > .required { display: none; - color: $color-alert } } & > .fix { diff --git a/front/core/components/input-number/index.html b/front/core/components/input-number/index.html index 2c6f7d824b..acce849e22 100644 --- a/front/core/components/input-number/index.html +++ b/front/core/components/input-number/index.html @@ -1,4 +1,4 @@ -
+
diff --git a/front/core/components/popup/index.html b/front/core/components/popup/index.html index 3e542d51f9..ad8fb2598a 100644 --- a/front/core/components/popup/index.html +++ b/front/core/components/popup/index.html @@ -2,6 +2,7 @@
\ No newline at end of file diff --git a/front/core/components/popup/index.js b/front/core/components/popup/index.js index 994f4a0e7f..0dea66254f 100644 --- a/front/core/components/popup/index.js +++ b/front/core/components/popup/index.js @@ -51,6 +51,7 @@ export default class Popup extends Component { {parentBoundTranscludeFn: this.$transclude} )[0]; this.windowEl = this.popup.querySelector('.window'); + this.windowEl.focus(); let classList = this.popup.classList; classList.add(this.displayMode); diff --git a/front/core/components/popup/style.scss b/front/core/components/popup/style.scss index 42d69141d0..678a683034 100644 --- a/front/core/components/popup/style.scss +++ b/front/core/components/popup/style.scss @@ -32,6 +32,7 @@ max-height: 100%; transform: scale3d(.9, .9, .9); transition: transform 200ms ease-in-out; + outline: none; } &.shown > .window { transform: scale3d(1, 1, 1); diff --git a/front/core/directives/focus.js b/front/core/directives/focus.js index 869e9a7f04..8b75adcbca 100644 --- a/front/core/directives/focus.js +++ b/front/core/directives/focus.js @@ -1,11 +1,11 @@ import ngModule from '../module'; import isMobile from '../lib/is-mobile'; -export function focus($scope, input) { +export function focus($timeout, input) { if (isMobile) return; const element = input; - let selector = 'input, textarea, button, submit'; + const selector = 'input, textarea, button, submit'; if (!input.matches(selector)) input = input.querySelector(selector); @@ -20,26 +20,24 @@ export function focus($scope, input) { return; } - input.focus(); - - if (input.select) { - $scope.$applyAsync(() => { + $timeout(() => { + input.focus(); + if (input.select) input.select(); - }); - } + }); } -/** +/* * Sets the focus and selects the text on the input. - * - * @return {Object} The directive */ -export function directive() { +export function directive($timeout) { return { restrict: 'A', link: function($scope, $element) { - $scope.$watch('', () => focus($scope, $element[0])); + $scope.$watch('', () => focus($timeout, $element[0])); } }; } +directive.$inject = ['$timeout']; + ngModule.directive('vnFocus', directive); diff --git a/front/core/directives/specs/focus.spec.js b/front/core/directives/specs/focus.spec.js index 11c60688a1..dd917dc298 100644 --- a/front/core/directives/specs/focus.spec.js +++ b/front/core/directives/specs/focus.spec.js @@ -6,7 +6,7 @@ describe('Directive focus', () => { beforeEach(ngModule('vnCore')); compile = (_element, _childElement) => { - inject(($compile, $rootScope) => { + inject(($compile, $rootScope, $flushPendingTasks) => { $scope = $rootScope.$new(); $element = angular.element(_element); if (_childElement) @@ -15,7 +15,7 @@ describe('Directive focus', () => { $element[0].focus = jasmine.createSpy('focus'); $element[0].select = jasmine.createSpy('select'); $compile($element)($scope); - $scope.$digest(); + $flushPendingTasks(); }); }; diff --git a/modules/client/front/billing-data/index.html b/modules/client/front/billing-data/index.html index 891c9364f9..3be5de9726 100644 --- a/modules/client/front/billing-data/index.html +++ b/modules/client/front/billing-data/index.html @@ -106,7 +106,8 @@ vn-one label="Name" ng-model="$ctrl.newBankEntity.name" - required="true"> + required="true" + vn-focus> From bf68d152642e6a04f05a58674847b5e67d951211 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 11:39:39 +0200 Subject: [PATCH 21/53] E2E expeditions fixes, scss px/em fixes --- e2e/paths/05-ticket/02_expeditions_and_log.spec.js | 2 +- front/core/components/button/style.scss | 12 ++++++------ front/core/components/calendar/style.scss | 14 +++++++------- front/core/components/chip/style.scss | 4 ++-- front/core/components/multi-check/style.scss | 2 +- front/core/components/snackbar/style.scss | 12 ++++++------ front/core/components/step-control/style.scss | 6 +++--- front/core/directives/droppable.scss | 4 ++-- front/core/directives/zoom-image.scss | 2 +- front/core/styles/global.scss | 2 +- front/core/styles/layout.scss | 2 +- front/core/styles/responsive.scss | 14 +++++++++----- front/salix/components/home/style.scss | 2 +- front/salix/styles/misc.scss | 4 ++-- front/salix/styles/photo-list.scss | 2 +- modules/claim/front/action/style.scss | 2 +- modules/claim/front/detail/style.scss | 2 +- modules/claim/front/photos/style.scss | 2 +- modules/claim/front/summary/style.scss | 2 +- modules/client/front/sample/create/style.scss | 2 +- modules/item/front/index/style.scss | 6 +++--- modules/item/front/waste/style.scss | 2 +- modules/ticket/front/sale/style.scss | 4 ++-- modules/ticket/front/summary/style.scss | 2 +- 24 files changed, 56 insertions(+), 52 deletions(-) diff --git a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js index f0accedaf8..2d046e3a9b 100644 --- a/e2e/paths/05-ticket/02_expeditions_and_log.spec.js +++ b/e2e/paths/05-ticket/02_expeditions_and_log.spec.js @@ -30,7 +30,7 @@ describe('Ticket expeditions and log path', () => { }); it(`should confirm the expedition deleted is shown now in the ticket log`, async() => { - await page.waitToClick(selectors.ticketLog.logButton); + await page.accessToSection('ticket.card.log'); const changedBy = await page .waitToGetProperty(selectors.ticketLog.changedBy, 'innerText'); diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss index f799a21ae9..25554176f1 100644 --- a/front/core/components/button/style.scss +++ b/front/core/components/button/style.scss @@ -4,19 +4,19 @@ display: inline-flex; align-items: center; justify-content: center; - height: 36px; + height: 2.8em; border: none; border-radius: .1em; font-family: vn-font-bold; text-transform: uppercase; - font-size: 14px; + font-size: .87rem; cursor: pointer; box-sizing: border-box; outline: none; & > button { width: 100%; - padding: 0 12px; + padding: 0 1em; box-sizing: border-box; background-color: transparent; border: none; @@ -88,15 +88,15 @@ } &.xs { - font-size: 0.5em; + font-size: .5em; } &.sm { - font-size: 0.7em; + font-size: .7em; } &.md { - font-size: 0.9em; + font-size: .9em; } &.lg { diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index 8492d09f16..a4e98fb94a 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -6,14 +6,14 @@ & > div { & > .header { display: flex; - margin-bottom: 0.5em; + margin-bottom: .5em; align-items: center; height: 2.4em; & > .title { flex: 1; text-align: center; - padding: 0.2em 0; + padding: .2em 0; } & > .vn-button { color: inherit; @@ -22,10 +22,10 @@ & > .weekdays { display: flex; color: $color-font-secondary; - margin-bottom: 0.5em; - padding: 0.5em 0; + margin-bottom: .5em; + padding: .5em 0; font-weight: bold; - font-size: 0.8em; + font-size: .8em; text-align: center; & > section { @@ -41,7 +41,7 @@ & > .day { width: 14.28%; - height: 40px; + height: 2.5em; display: flex; justify-content: center; align-items: center; @@ -62,7 +62,7 @@ justify-content: center; align-items: center; border-radius: 50%; - font-size: 14px; + font-size: .87em; width: 2.2em; height: 2.2em; cursor: pointer; diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index 974a55a82a..b82c57fff7 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -16,8 +16,8 @@ vn-chip { height: 1.5em; & > div { - padding: 0.6em; - font-size: 0.8rem; + padding: .6em; + font-size: .8rem; } } diff --git a/front/core/components/multi-check/style.scss b/front/core/components/multi-check/style.scss index bc6a0e8c5c..36f3dff60d 100644 --- a/front/core/components/multi-check/style.scss +++ b/front/core/components/multi-check/style.scss @@ -1,5 +1,5 @@ vn-multi-check { .vn-check { - margin-bottom: 0.8em + margin-bottom: .8em } } \ No newline at end of file diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index deaf010fc9..0a72a1a9be 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -11,7 +11,7 @@ vn-snackbar #shapes { } vn-snackbar .shape { - background-color: rgba(0, 0, 0, 0.8); + background-color: rgba(0, 0, 0, .8); box-shadow: 0 0 .4em $color-shadow; transition: transform 300ms ease-in-out; transform: translateY(20em); @@ -19,7 +19,7 @@ vn-snackbar .shape { border-radius: .2em; margin-bottom: 15px; color: white; - padding: 0.8em; + padding: .8em; & > .text { text-align: center; @@ -36,19 +36,19 @@ vn-snackbar .shape { } &.success { - background-color: rgba(163, 209, 49, 0.8); + background-color: rgba(163, 209, 49, .8); color: #445911; & > button { - color: rgba(1, 1, 1, 0.6); + color: rgba(1, 1, 1, .6); } } &.error { - background-color: rgba(198, 40, 40, 0.8); + background-color: rgba(198, 40, 40, .8); & > button { - color: rgba(1, 1, 1, 0.6); + color: rgba(1, 1, 1, .6); } } diff --git a/front/core/components/step-control/style.scss b/front/core/components/step-control/style.scss index 9acc1f314a..b4d0d5afe8 100644 --- a/front/core/components/step-control/style.scss +++ b/front/core/components/step-control/style.scss @@ -22,11 +22,11 @@ vn-step-control { border: 2px solid $color-main; background-color: white; align-content: center; - margin-top: -9.5px; + margin-top: -10px; border-radius: 50%; cursor: pointer; height: 15px; - width: 15px + width: 15px; } & > .steps > .step .circle.active { background-color: $color-main; @@ -36,7 +36,7 @@ vn-step-control { flex: auto; flex-direction: row; justify-content: space-between; - margin-top: 10px + margin-top: 10px; } & > .buttons > .step { display: flex diff --git a/front/core/directives/droppable.scss b/front/core/directives/droppable.scss index f2e18a3ad6..0493100372 100644 --- a/front/core/directives/droppable.scss +++ b/front/core/directives/droppable.scss @@ -5,8 +5,8 @@ .vn-draggable, [vn-droppable] { border: 2px dashed transparent; - border-radius: 0.5em; - transition: all 0.5s; + border-radius: .5em; + transition: all .5s; } .vn-droppable, diff --git a/front/core/directives/zoom-image.scss b/front/core/directives/zoom-image.scss index e075ff3a18..5628e6f1d6 100644 --- a/front/core/directives/zoom-image.scss +++ b/front/core/directives/zoom-image.scss @@ -5,7 +5,7 @@ position: fixed; top: 0; z-index: 25; - background-color: rgba(1, 1, 1, 0.6); + background-color: rgba(1, 1, 1, .6); & > div { display: flex; diff --git a/front/core/styles/global.scss b/front/core/styles/global.scss index 8b3d465f18..a4a0135366 100644 --- a/front/core/styles/global.scss +++ b/front/core/styles/global.scss @@ -44,4 +44,4 @@ a { .ng-leave, .ng-enter { transition: none; -} \ No newline at end of file +} diff --git a/front/core/styles/layout.scss b/front/core/styles/layout.scss index 925526dca5..85088db6a2 100644 --- a/front/core/styles/layout.scss +++ b/front/core/styles/layout.scss @@ -40,7 +40,7 @@ html [vn-nine], html [vn-ten], html [vn-eleven], html [vn-twelve]{ - flex-basis: 0.000000001px; + flex-basis: .1px; } html [vn-auto], vn-auto, .vn-auto { flex-basis: auto; diff --git a/front/core/styles/responsive.scss b/front/core/styles/responsive.scss index 9cc58dd12c..14053086b2 100644 --- a/front/core/styles/responsive.scss +++ b/front/core/styles/responsive.scss @@ -1,12 +1,16 @@ @import "variables"; -/* Desktop - Laptop 1360x768 */ +// XXX: For testing +body { font-size: 8pt; } + +/* +// Desktop - Laptop 1360x768 @media (max-resolution: 119dpi) and (min-device-width: 1340px) and (max-device-width: 1899px) { body { font-size: 10pt; } } -/* Mobile - Low DPI */ +// Mobile - Low DPI @media (min-resolution: 120dpi), (-webkit-min-device-pixel-ratio: 1.5) @@ -20,7 +24,7 @@ body { font-size: 11pt; } } -/* Mobile - Normal DPI */ +// Mobile - Normal DPI @media (max-device-width: 383px) and (min-resolution: 192dpi), (max-device-width: 383px) and (-webkit-min-device-pixel-ratio: 2) @@ -34,7 +38,7 @@ body { font-size: 11pt; } } -/* Mobile - High DPI */ +// Mobile - High DPI @media (max-device-width: 411px) and (min-resolution: 249dpi), (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3) @@ -47,7 +51,7 @@ { body { font-size: 11pt; } } - +*/ .vn-hide-narrow { @media (max-width: $mobile-width) { display: none; diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index 268260bbdb..cd3c1f31db 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -45,7 +45,7 @@ vn-home { } } & > span { - font-size: 0.9em; + font-size: .9em; text-align: center; } & > h4 { diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index b2f28032e6..c081121a60 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -104,7 +104,7 @@ vn-tool-bar { html [scrollable] { min-height: 1px; flex: 1; - flex-basis: 0.000000001px; + flex-basis: .1px; } .ellipsize { text-overflow: ellipsis; @@ -115,7 +115,7 @@ html [scrollable] { @extend %active; &.small { - font-size: 0.7em + font-size: .7em } } diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index b0c926def7..0423c5793d 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -8,7 +8,7 @@ .photo { box-sizing: border-box; - transition: all 0.5s; + transition: all .5s; padding: $spacing-sm; position: relative; width: 28em; diff --git a/modules/claim/front/action/style.scss b/modules/claim/front/action/style.scss index aef8d2cfd7..bac316287f 100644 --- a/modules/claim/front/action/style.scss +++ b/modules/claim/front/action/style.scss @@ -36,7 +36,7 @@ vn-claim-action { div.ticketList { overflow: auto; - max-height: 350px + max-height: 350px; } } } \ No newline at end of file diff --git a/modules/claim/front/detail/style.scss b/modules/claim/front/detail/style.scss index 6229e56fb6..74f3ed6749 100644 --- a/modules/claim/front/detail/style.scss +++ b/modules/claim/front/detail/style.scss @@ -13,7 +13,7 @@ } } .simulatorTitle { - margin-bottom: 0px; + margin-bottom: 0; font-size: 12px; color: $color-main; } diff --git a/modules/claim/front/photos/style.scss b/modules/claim/front/photos/style.scss index 35f5485603..c0b053e05a 100644 --- a/modules/claim/front/photos/style.scss +++ b/modules/claim/front/photos/style.scss @@ -6,7 +6,7 @@ vn-claim-photos { .drop-zone { color: $color-font-secondary; box-sizing: border-box; - border-radius: 0.5em; + border-radius: .5em; text-align: center; min-height: 100%; diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss index afd3838be2..b108b0c8dd 100644 --- a/modules/claim/front/summary/style.scss +++ b/modules/claim/front/summary/style.scss @@ -5,6 +5,6 @@ vn-claim-summary { height: 15.5em } .photo .image { - border-radius: 0.2em + border-radius: .2em } } \ No newline at end of file diff --git a/modules/client/front/sample/create/style.scss b/modules/client/front/sample/create/style.scss index fdd01f729b..cd9764bf3e 100644 --- a/modules/client/front/sample/create/style.scss +++ b/modules/client/front/sample/create/style.scss @@ -17,7 +17,7 @@ div.vn-dialog { footer p { font-size: 10px !important; - line-height: 10px + line-height: 10px; } } diff --git a/modules/item/front/index/style.scss b/modules/item/front/index/style.scss index 1cbc881241..b5f700818d 100644 --- a/modules/item/front/index/style.scss +++ b/modules/item/front/index/style.scss @@ -6,7 +6,7 @@ vn-item-product { .id { background-color: $color-main; color: $color-font-dark; - margin-bottom: 0em; + margin-bottom: 0; } .image { height: 7em; @@ -19,10 +19,10 @@ vn-item-product { } } vn-label-value:first-of-type section{ - margin-top: 0.6em; + margin-top: .6em; } vn-fetched-tags vn-horizontal{ - margin-top: 0.9em; + margin-top: .9em; } } diff --git a/modules/item/front/waste/style.scss b/modules/item/front/waste/style.scss index 59e9a3b683..7e9f9a9412 100644 --- a/modules/item/front/waste/style.scss +++ b/modules/item/front/waste/style.scss @@ -11,7 +11,7 @@ vn-item-waste { padding-bottom: 4px; font-weight: lighter; background-color: #fde6ca; - border-bottom: 0.1em solid #f7931e; + border-bottom: .1em solid #f7931e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; diff --git a/modules/ticket/front/sale/style.scss b/modules/ticket/front/sale/style.scss index 1eb7556e97..8d3fd8ce41 100644 --- a/modules/ticket/front/sale/style.scss +++ b/modules/ticket/front/sale/style.scss @@ -69,7 +69,7 @@ vn-ticket-sale { } } vn-table, table { - margin-bottom: 10px + margin-bottom: 10px; } vn-table { overflow-x: hidden; @@ -96,7 +96,7 @@ vn-ticket-sale { } p.simulatorTitle { - margin-bottom: 0px; + margin-bottom: 0; font-size: 12px; color: $color-main; } diff --git a/modules/ticket/front/summary/style.scss b/modules/ticket/front/summary/style.scss index 4502c5dca4..ab5ce78851 100644 --- a/modules/ticket/front/summary/style.scss +++ b/modules/ticket/front/summary/style.scss @@ -54,7 +54,7 @@ vn-ticket-summary .summary { .vn-table > vn-thead .tax-class, .vn-table > vn-tbody .tax-class { min-width: 11em; - width: 1px + width: 1px; } .vn-table > vn-tbody vn-td:first-child { From c43727aef901f186ad968593c2165e4da17dda4e Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 14:08:38 +0200 Subject: [PATCH 22/53] Global style fixes px/em --- front/core/styles/global.scss | 2 +- front/core/styles/responsive.scss | 20 ++++++++------------ front/core/styles/variables.scss | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/front/core/styles/global.scss b/front/core/styles/global.scss index a4a0135366..ed017fafdf 100644 --- a/front/core/styles/global.scss +++ b/front/core/styles/global.scss @@ -4,12 +4,12 @@ html { background-color: $color-bg; overflow: auto; height: 100%; + font-size: $font-size; } body { height: 100%; font-family: vn-font; color: $color-font; - font-size: $font-size; margin: 0; padding: 0; } diff --git a/front/core/styles/responsive.scss b/front/core/styles/responsive.scss index 14053086b2..03cdf24236 100644 --- a/front/core/styles/responsive.scss +++ b/front/core/styles/responsive.scss @@ -1,13 +1,9 @@ @import "variables"; -// XXX: For testing -body { font-size: 8pt; } - -/* // Desktop - Laptop 1360x768 @media (max-resolution: 119dpi) and (min-device-width: 1340px) and (max-device-width: 1899px) { - body { font-size: 10pt; } + html { font-size: 10pt; } } // Mobile - Low DPI @@ -15,13 +11,13 @@ body { font-size: 8pt; } (min-resolution: 120dpi), (-webkit-min-device-pixel-ratio: 1.5) { - body { font-size: 9pt; } + html { font-size: 9pt; } } @media (min-resolution: 144dpi), (-webkit-min-device-pixel-ratio: 1.5) { - body { font-size: 11pt; } + html { font-size: 11pt; } } // Mobile - Normal DPI @@ -29,13 +25,13 @@ body { font-size: 8pt; } (max-device-width: 383px) and (min-resolution: 192dpi), (max-device-width: 383px) and (-webkit-min-device-pixel-ratio: 2) { - body { font-size: 10pt; } + html { font-size: 10pt; } } @media (min-device-width: 384px) and (min-resolution: 192dpi), (min-device-width: 384px) and (-webkit-min-device-pixel-ratio: 2) { - body { font-size: 11pt; } + html { font-size: 11pt; } } // Mobile - High DPI @@ -43,15 +39,15 @@ body { font-size: 8pt; } (max-device-width: 411px) and (min-resolution: 249dpi), (max-device-width: 411px) and (-webkit-min-device-pixel-ratio: 3) { - body { font-size: 10pt; } + html { font-size: 10pt; } } @media (min-device-width: 412px) and (min-resolution: 249dpi), (min-device-width: 412px) and (-webkit-min-device-pixel-ratio: 3) { - body { font-size: 11pt; } + html { font-size: 11pt; } } -*/ + .vn-hide-narrow { @media (max-width: $mobile-width) { display: none; diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index 89e487ad7b..5dff61f2d1 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -1,7 +1,7 @@ @import "./util"; $menu-width: 16em; -$topbar-height: 4em; +$topbar-height: 3.5em; $mobile-width: 800px; $font-size: 16px; From 734c86c5f5f3bd3c0c3755fd28bdb8f9899fec98 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 14:20:57 +0200 Subject: [PATCH 23/53] SCSS px to em - First step --- front/core/components/button/style.scss | 10 ++--- front/core/components/calendar/style.scss | 10 ++--- front/core/components/chip/style.scss | 16 ++++---- front/core/components/debug-info/style.scss | 14 +++---- front/core/components/dialog/style.scss | 10 ++--- front/core/components/drop-down/style.scss | 12 +++--- front/core/components/field/style.scss | 2 +- front/core/components/icon-button/style.scss | 2 +- front/core/components/list/style.scss | 4 +- front/core/components/multi-check/style.scss | 2 +- front/core/components/pagination/style.scss | 2 +- front/core/components/popover/style.scss | 10 ++--- front/core/components/popup/style.scss | 6 +-- front/core/components/range/style.scss | 2 +- front/core/components/scroll-up/style.scss | 2 +- front/core/components/searchbar/style.scss | 8 ++-- front/core/components/snackbar/style.scss | 10 ++--- front/core/components/table/style.scss | 18 ++++----- front/core/components/td-editable/style.scss | 12 +++--- front/core/components/toggle/style.scss | 2 +- front/core/components/tooltip/style.scss | 2 +- front/core/components/wday-picker/style.scss | 4 +- front/core/directives/droppable.scss | 2 +- front/core/directives/zoom-image.scss | 4 +- front/core/styles/border.scss | 2 +- front/core/styles/text.scss | 2 +- front/salix/components/descriptor/style.scss | 2 +- front/salix/components/home/style.scss | 12 +++--- front/salix/components/layout/style.scss | 38 +++++++++---------- front/salix/components/login/style.scss | 14 +++---- front/salix/components/side-menu/style.scss | 2 +- front/salix/components/summary/style.scss | 4 +- .../salix/components/user-popover/style.scss | 6 +-- front/salix/styles/misc.scss | 6 +-- front/salix/styles/order-product.scss | 24 ++++++------ front/salix/styles/photo-list.scss | 4 +- modules/claim/front/basic-data/style.scss | 2 +- modules/claim/front/photos/style.scss | 6 +-- modules/claim/front/summary/style.scss | 2 +- modules/client/front/sample/create/style.scss | 6 +-- modules/item/front/fetched-tags/style.scss | 24 ++++++------ modules/item/front/index/style.scss | 10 ++--- modules/item/front/summary/style.scss | 6 +-- modules/item/front/waste/style.scss | 6 +-- modules/order/front/catalog/style.scss | 6 +-- modules/order/front/prices-popover/style.scss | 6 +-- modules/order/front/summary/style.scss | 6 +-- modules/ticket/front/component/style.scss | 12 +++--- modules/ticket/front/sale/style.scss | 10 ++--- modules/ticket/front/summary/style.scss | 8 ++-- modules/worker/front/time-control/style.scss | 4 +- 51 files changed, 198 insertions(+), 198 deletions(-) diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss index 25554176f1..b583dacd56 100644 --- a/front/core/components/button/style.scss +++ b/front/core/components/button/style.scss @@ -6,7 +6,7 @@ justify-content: center; height: 2.8em; border: none; - border-radius: .1em; + border-radius: 1px; font-family: vn-font-bold; text-transform: uppercase; font-size: .87rem; @@ -16,7 +16,7 @@ & > button { width: 100%; - padding: 0 1em; + padding: 0 16px; box-sizing: border-box; background-color: transparent; border: none; @@ -88,15 +88,15 @@ } &.xs { - font-size: .5em; + font-size: 8px; } &.sm { - font-size: .7em; + font-size: 11px; } &.md { - font-size: .9em; + font-size: 14px; } &.lg { diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index a4e98fb94a..fa7b92da7f 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -6,14 +6,14 @@ & > div { & > .header { display: flex; - margin-bottom: .5em; + margin-bottom: 8px; align-items: center; height: 2.4em; & > .title { flex: 1; text-align: center; - padding: .2em 0; + padding: 3px 0; } & > .vn-button { color: inherit; @@ -22,10 +22,10 @@ & > .weekdays { display: flex; color: $color-font-secondary; - margin-bottom: .5em; - padding: .5em 0; + margin-bottom: 8px; + padding: 8px 0; font-weight: bold; - font-size: .8em; + font-size: 12px; text-align: center; & > section { diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index b82c57fff7..2423126875 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -1,14 +1,14 @@ @import "variables"; vn-chip { - border-radius: 1em; + border-radius: 16px; background-color: $color-bg; color: $color-font; font-size: .9rem; margin: .25em; display: inline-flex; align-items: center; - height: 2em; + height: 32px; max-width: 100%; box-sizing: border-box; @@ -16,7 +16,7 @@ vn-chip { height: 1.5em; & > div { - padding: .6em; + padding: 9px; font-size: .8rem; } } @@ -46,17 +46,17 @@ vn-chip { display: flex; align-items: center; height: 100%; - padding: 0 .7em; + padding: 0 11px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; & > vn-avatar { margin-left: -0.7em; - margin-right: .3em; + margin-right: 4px; vertical-align: middle; - height: 2em; - width: 2em; + height: 32px; + width: 32px; } } & > vn-icon { @@ -76,6 +76,6 @@ vn-chip { vn-avatar { display: inline-block; - min-width: 2em; + min-width: 32px; border-radius: 50%; } \ No newline at end of file diff --git a/front/core/components/debug-info/style.scss b/front/core/components/debug-info/style.scss index 95c024a6d2..0ca30266df 100644 --- a/front/core/components/debug-info/style.scss +++ b/front/core/components/debug-info/style.scss @@ -2,10 +2,10 @@ vn-debug-info { position: fixed; - bottom: 1em; - left: 1em; - padding: 1em; - min-width: 8em; + bottom: 16px; + left: 16px; + padding: 16px; + min-width: 128px; background-color: #3f51b5; color: $color-font-dark; border-radius: 4px; @@ -19,7 +19,7 @@ vn-debug-info { & > h6 { font-weight: normal; color: rgba(255, 255, 255, .5); - font-size: 1em; + font-size: 16px; } ul { list-style-type: none; @@ -27,11 +27,11 @@ vn-debug-info { margin: 0; & > li { - margin-top: .2em; + margin-top: 3px; font-size: .95em; & > span { - padding: .05em .2em; + padding: .05em 3px; border-radius: 4px; transition: background-color 200ms ease-in-out; diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index 2f3d9a0284..6023a46668 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -8,11 +8,11 @@ text-transform: uppercase; background-color: transparent; border: none; - border-radius: .1em; + border-radius: 1px; position: absolute; top: 0; right: 0; - padding: .3em; + padding: 4px; color: #666; } & > form { @@ -35,12 +35,12 @@ text-transform: uppercase; background-color: transparent; border: none; - border-radius: .1em; + border-radius: 1px; color: $color-button; font-family: vn-font-bold; - padding: .7em; + padding: 11px; margin: -0.7em; - margin-left: .7em; + margin-left: 11px; } } } diff --git a/front/core/components/drop-down/style.scss b/front/core/components/drop-down/style.scss index fb346135f0..2c1f65c438 100755 --- a/front/core/components/drop-down/style.scss +++ b/front/core/components/drop-down/style.scss @@ -19,9 +19,9 @@ display: none; cursor: pointer; position: absolute; - right: .5em; - top: .6em; - height: 1em; + right: 8px; + top: 9px; + height: 16px; color: #888; border-radius: 50%; background-color: rgba(255, 255, 255, .8); @@ -36,7 +36,7 @@ } } & > .list { - max-height: 20em; + max-height: 320px; overflow: auto; ul { @@ -46,13 +46,13 @@ } li, .status { @extend %clickable; - padding: .6em; + padding: 9px; white-space: nowrap; display: flex; & > input[type=checkbox] { margin: 0; - margin-right: .6em; + margin-right: 9px; } &.active { @extend %active; diff --git a/front/core/components/field/style.scss b/front/core/components/field/style.scss index ad1ab5f457..77d77e872f 100644 --- a/front/core/components/field/style.scss +++ b/front/core/components/field/style.scss @@ -197,7 +197,7 @@ } } &.standout { - border-radius: .1em; + border-radius: 1px; background-color: rgba(255, 255, 255, .1); padding: 0 12px; transition-property: background-color, color; diff --git a/front/core/components/icon-button/style.scss b/front/core/components/icon-button/style.scss index d59980a62a..2b52d48bd7 100644 --- a/front/core/components/icon-button/style.scss +++ b/front/core/components/icon-button/style.scss @@ -5,7 +5,7 @@ color: $color-button; & > button { - padding: .2em !important; + padding: 3px !important; } &:focus { opacity: .6; diff --git a/front/core/components/list/style.scss b/front/core/components/list/style.scss index 6f12ce7c69..da43787889 100644 --- a/front/core/components/list/style.scss +++ b/front/core/components/list/style.scss @@ -11,7 +11,7 @@ ul.menu { @extend %clickable; display: block; color: inherit; - padding: .6em 2em; + padding: 9px 32px; } } */ @@ -86,7 +86,7 @@ vn-item, & > .vn-button { opacity: .4; - margin-left: .5em; + margin-left: 8px; transition: opacity 250ms ease-out; padding: 0; font-size: 1.05em; diff --git a/front/core/components/multi-check/style.scss b/front/core/components/multi-check/style.scss index 36f3dff60d..79c2397bcd 100644 --- a/front/core/components/multi-check/style.scss +++ b/front/core/components/multi-check/style.scss @@ -1,5 +1,5 @@ vn-multi-check { .vn-check { - margin-bottom: .8em + margin-bottom: 12px } } \ No newline at end of file diff --git a/front/core/components/pagination/style.scss b/front/core/components/pagination/style.scss index 2610bc5026..0d5ad615aa 100644 --- a/front/core/components/pagination/style.scss +++ b/front/core/components/pagination/style.scss @@ -4,7 +4,7 @@ vn-pagination { text-align: center; & > div > vn-icon-button { - font-size: 2em; + font-size: 32px; padding: 0; } } \ No newline at end of file diff --git a/front/core/components/popover/style.scss b/front/core/components/popover/style.scss index decfc47337..274b967829 100644 --- a/front/core/components/popover/style.scss +++ b/front/core/components/popover/style.scss @@ -21,21 +21,21 @@ } & > .window { position: absolute; - box-shadow: 0 .1em .4em $color-shadow; + box-shadow: 0 1px 6px $color-shadow; z-index: 0; & > .arrow { - width: 1em; - height: 1em; + width: 16px; + height: 16px; margin: -.5em; background-color: $color-bg-panel; - box-shadow: 0 .1em .4em $color-shadow; + box-shadow: 0 1px 6px $color-shadow; position: absolute; transform: rotate(45deg); z-index: -1; } & > .content { - border-radius: .1em; + border-radius: 1px; background-color: $color-bg-panel; height: inherit; overflow: auto; diff --git a/front/core/components/popup/style.scss b/front/core/components/popup/style.scss index 678a683034..c3e45ccf06 100644 --- a/front/core/components/popup/style.scss +++ b/front/core/components/popup/style.scss @@ -19,14 +19,14 @@ justify-content: center; align-items: center; background-color: rgba(0, 0, 0, .6); - padding: 1em; + padding: 16px; box-sizing: border-box; & > .window { position: relative; - box-shadow: 0 0 .4em $color-shadow; + box-shadow: 0 0 6px $color-shadow; background-color: $color-bg-panel; - border-radius: .2em; + border-radius: 3px; overflow: auto; box-sizing: border-box; max-height: 100%; diff --git a/front/core/components/range/style.scss b/front/core/components/range/style.scss index 6898f8cdab..bc53149556 100644 --- a/front/core/components/range/style.scss +++ b/front/core/components/range/style.scss @@ -57,7 +57,7 @@ background: transparent; border-color: transparent; -webkit-appearance: none; - margin: .2em 0; + margin: 3px 0; &:focus { outline: none; diff --git a/front/core/components/scroll-up/style.scss b/front/core/components/scroll-up/style.scss index 1bf7ea9827..40ca92322f 100644 --- a/front/core/components/scroll-up/style.scss +++ b/front/core/components/scroll-up/style.scss @@ -1,6 +1,6 @@ vn-scroll-up { top: 5.5em; - right: 2em; + right: 32px; display: none; position: fixed; } \ No newline at end of file diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index 31907792c2..9275f03e25 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -15,11 +15,11 @@ vn-searchbar { & > .search-param { color: rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, .1); - padding: .1em .4em; - margin-left: .2em; + padding: 1px 6px; + margin-left: 3px; display: inline-block; - border-radius: .8em; - max-width: 12em; + border-radius: 12px; + max-width: 192px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index 0a72a1a9be..55c8042313 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -12,14 +12,14 @@ vn-snackbar #shapes { vn-snackbar .shape { background-color: rgba(0, 0, 0, .8); - box-shadow: 0 0 .4em $color-shadow; + box-shadow: 0 0 6px $color-shadow; transition: transform 300ms ease-in-out; transform: translateY(20em); box-sizing: border-box; - border-radius: .2em; + border-radius: 3px; margin-bottom: 15px; color: white; - padding: .8em; + padding: 12px; & > .text { text-align: center; @@ -55,13 +55,13 @@ vn-snackbar .shape { & > button { background-color: transparent; text-transform: uppercase; - margin-left: .5em; + margin-left: 8px; font-weight: bold; cursor: pointer; color: $color-main; float: right; border: none; - padding: .5em; + padding: 8px; margin: -.5em } } \ No newline at end of file diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index 41d1f6db89..4f1e1a5ba4 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -59,7 +59,7 @@ vn-table { & > * > a.vn-tr, & > * > tr { display: table-row; - height: 3em; + height: 48px; } vn-thead, vn-tbody, vn-tfoot, thead, tbody, tfoot { @@ -69,8 +69,8 @@ vn-table { & > vn-th, & > th { color: $color-font-light; - padding-top: 1em; - padding-bottom: .8em; + padding-top: 16px; + padding-bottom: 12px; } & > vn-th, & > vn-td, @@ -86,14 +86,14 @@ vn-table { vertical-align: middle; display: table-cell; text-align: left; - padding: .6em .5em; + padding: 9px 8px; white-space: nowrap; text-overflow: ellipsis; - max-width: 5em; + max-width: 80px; &[number] { text-align: right; - width: 6em; + width: 96px; } &[center] { text-align: center; @@ -123,7 +123,7 @@ vn-table { } vn-tbody > *, tbody > * { - border-bottom: .1em solid $color-spacer-light; + border-bottom: 1px solid $color-spacer-light; &:last-child { border-bottom: none; @@ -134,8 +134,8 @@ vn-table { & > vn-td, & > td { .chip { - padding: .3em; - border-radius: .3em; + padding: 4px; + border-radius: 4px; color: $color-font-bg; &.notice { diff --git a/front/core/components/td-editable/style.scss b/front/core/components/td-editable/style.scss index e37e1086ce..a1fe4664e0 100644 --- a/front/core/components/td-editable/style.scss +++ b/front/core/components/td-editable/style.scss @@ -8,7 +8,7 @@ vn-td-editable { text { border: 1px dashed rgba(0, 0, 0, .15); - border-radius: 1em; + border-radius: 16px; padding: 5px 10px; min-height: 15px; display: block; @@ -36,16 +36,16 @@ vn-td-editable { left: 0; box-sizing: border-box; align-items: center; - padding: .6em; + padding: 9px; overflow: visible; & > field { flex: 1; background-color: $color-bg-panel; - padding: .5em; - box-shadow: 0 0 .4em rgba(0, 0, 0, .2); - border-radius: .1em; - min-width: 6em; + padding: 8px; + box-shadow: 0 0 6px rgba(0, 0, 0, .2); + border-radius: 1px; + min-width: 96px; & > * { width: 100%; diff --git a/front/core/components/toggle/style.scss b/front/core/components/toggle/style.scss index 31769d2a55..5213215d66 100644 --- a/front/core/components/toggle/style.scss +++ b/front/core/components/toggle/style.scss @@ -22,7 +22,7 @@ height: 20px; min-width: 20px; margin: 6px 0; - margin-right: .6em; + margin-right: 9px; border: 2px solid #666; } & > .btn > .focus-mark { diff --git a/front/core/components/tooltip/style.scss b/front/core/components/tooltip/style.scss index 9261425823..926419c243 100644 --- a/front/core/components/tooltip/style.scss +++ b/front/core/components/tooltip/style.scss @@ -6,7 +6,7 @@ z-index: 150; background-color: $color-bg-dark; color: $color-active-font; - border-radius: .2em; + border-radius: 3px; &.show { display: inherit; diff --git a/front/core/components/wday-picker/style.scss b/front/core/components/wday-picker/style.scss index be610c7330..ab14c448cf 100644 --- a/front/core/components/wday-picker/style.scss +++ b/front/core/components/wday-picker/style.scss @@ -9,8 +9,8 @@ & > span { @extend %clickable; border-radius: 50%; - padding: .4em; - margin: .2em; + padding: 6px; + margin: 3px; display: inline-flex; width: 1.5em; height: 1.5em; diff --git a/front/core/directives/droppable.scss b/front/core/directives/droppable.scss index 0493100372..02261b5bc4 100644 --- a/front/core/directives/droppable.scss +++ b/front/core/directives/droppable.scss @@ -5,7 +5,7 @@ .vn-draggable, [vn-droppable] { border: 2px dashed transparent; - border-radius: .5em; + border-radius: 8px; transition: all .5s; } diff --git a/front/core/directives/zoom-image.scss b/front/core/directives/zoom-image.scss index 5628e6f1d6..7debed995b 100644 --- a/front/core/directives/zoom-image.scss +++ b/front/core/directives/zoom-image.scss @@ -14,13 +14,13 @@ width: inherit; height: inherit; box-sizing: border-box; - padding: 1em; + padding: 16px; & > img { cursor: zoom-out; max-height: 100%; max-width: 100%; - border-radius: .2em; + border-radius: 3px; } } } diff --git a/front/core/styles/border.scss b/front/core/styles/border.scss index 7450b5857c..757ab453fe 100644 --- a/front/core/styles/border.scss +++ b/front/core/styles/border.scss @@ -19,5 +19,5 @@ /* Border Radius */ .border-radius { - border-radius: .3em; + border-radius: 4px; } \ No newline at end of file diff --git a/front/core/styles/text.scss b/front/core/styles/text.scss index b1624cd26a..31dda34ec1 100644 --- a/front/core/styles/text.scss +++ b/front/core/styles/text.scss @@ -42,7 +42,7 @@ h1, h2, h3, h4, h5, h6 { padding: 0; margin-top: 0; - margin-bottom: .3em; + margin-bottom: 4px; } /* Colors */ diff --git a/front/salix/components/descriptor/style.scss b/front/salix/components/descriptor/style.scss index af719cc0d0..decfe5c56b 100644 --- a/front/salix/components/descriptor/style.scss +++ b/front/salix/components/descriptor/style.scss @@ -3,7 +3,7 @@ @import "./variables"; .vn-descriptor { - box-shadow: 0 .1em .2em $color-shadow; + box-shadow: 0 1px 3px $color-shadow; & > .header { display: flex; diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index cd3c1f31db..4e99341b49 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -2,7 +2,7 @@ vn-home { display: block; - padding: .5em; + padding: 8px; & > div { & > h6 { @@ -27,10 +27,10 @@ vn-home { color: $color-font-dark; display: flex; flex-direction: column; - height: 8em; - width: 8em; - margin: .5em; - padding: 1em; + height: 128px; + width: 128px; + margin: 8px; + padding: 16px; justify-content: center; & > div { @@ -45,7 +45,7 @@ vn-home { } } & > span { - font-size: .9em; + font-size: 14px; text-align: center; } & > h4 { diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index b775ab4c03..691423678b 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -7,24 +7,24 @@ vn-layout { right: 0; left: 0; z-index: 10; - box-shadow: 0 .1em .2em $color-shadow; + box-shadow: 0 1px 3px $color-shadow; height: $topbar-height; - padding: 0 1em; + padding: 0 16px; justify-content: space-between; & > .side { flex: auto; display: flex; align-items: center; - width: 5em; + width: 80px; transition: width 200ms; } & > .start { - padding-right: 1em; + padding-right: 16px; overflow: hidden; & > .logo > img { - height: 2em; + height: 32px; display: block; } & > .main-title { @@ -32,17 +32,17 @@ vn-layout { text-overflow: ellipsis; white-space: nowrap; overflow: hidden; - padding-left: .4em; + padding-left: 6px; } & > vn-spinner { - padding: 0 .4em; + padding: 0 6px; } } & > vn-slot { flex: auto; } & > .end { - padding-left: 1em; + padding-left: 16px; justify-content: flex-end; } .show-menu { @@ -66,7 +66,7 @@ vn-layout { } &.left-menu { & > vn-topbar > .start { - width: 5em + $menu-width; + width: 80px + $menu-width; } & > .main-view { padding-left: $menu-width; @@ -74,13 +74,13 @@ vn-layout { } &.right-menu { & > vn-topbar > .end { - width: 5em + $menu-width; + width: 80px + $menu-width; } & > .main-view { padding-right: $menu-width; } [fixed-bottom-right] { - right: 4em + $menu-width; + right: 64px + $menu-width; } } & > .main-view { @@ -94,8 +94,8 @@ vn-layout { } [fixed-bottom-right] { position: fixed; - bottom: 2em; - right: 2em; + bottom: 32px; + right: 32px; } &.ng-enter { vn-side-menu { @@ -133,7 +133,7 @@ vn-layout { padding-right: 0; } [fixed-bottom-right] { - right: 2em; + right: 32px; } } ui-view > * { @@ -150,17 +150,17 @@ vn-layout { & > li { @extend %clickable-light; background-color: $color-main; - margin-bottom: .6em; - padding: .8em; - border-radius: .1em; - min-width: 8em; + margin-bottom: 9px; + padding: 12px; + border-radius: 1px; + min-width: 128px; white-space: nowrap; &:last-child { margin-bottom: 0; } & > vn-icon { - padding-right: .3em; + padding-right: 4px; vertical-align: middle; } } diff --git a/front/salix/components/login/style.scss b/front/salix/components/login/style.scss index e098fbdb4e..121d12bfad 100644 --- a/front/salix/components/login/style.scss +++ b/front/salix/components/login/style.scss @@ -20,14 +20,14 @@ vn-login { position: absolute; max-width: 19em; min-width: 15em; - padding: 3em; + padding: 48px; background-color: $color-bg-panel; - box-shadow: 0 0 1em 0 rgba(0, 0, 0, .6); - border-radius: .5em; + box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); + border-radius: 8px; & > img { width: 100%; - padding-bottom: 1em; + padding-bottom: 16px; } & > form { & > .vn-textfield { @@ -40,7 +40,7 @@ vn-login { } } & > .footer { - margin-top: 2em; + margin-top: 32px; text-align: center; position: relative; @@ -55,7 +55,7 @@ vn-login { & > .spinner-wrapper { position: absolute; width: 0; - top: .2em; + top: 3px; right: -.5em; overflow: visible; } @@ -67,7 +67,7 @@ vn-login { background-color: $color-bg-panel; & > .box { - padding: 1em; + padding: 16px; box-shadow: none; } } diff --git a/front/salix/components/side-menu/style.scss b/front/salix/components/side-menu/style.scss index 239d15cf60..b9722d519c 100644 --- a/front/salix/components/side-menu/style.scss +++ b/front/salix/components/side-menu/style.scss @@ -11,7 +11,7 @@ vn-side-menu > .menu { width: $menu-width; min-width: $menu-width; background-color: $color-bg-panel; - box-shadow: 0 .1em .2em $color-shadow; + box-shadow: 0 1px 3px $color-shadow; overflow: auto; top: $topbar-height; diff --git a/front/salix/components/summary/style.scss b/front/salix/components/summary/style.scss index f0d6ae0384..ad04a7b313 100644 --- a/front/salix/components/summary/style.scss +++ b/front/salix/components/summary/style.scss @@ -31,7 +31,7 @@ padding-bottom: 4px; /* Bottom line-height fix */ font-weight: lighter; background-color: $color-main-light; - border-bottom: .1em solid $color-main; + border-bottom: 1px solid $color-main; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -45,7 +45,7 @@ width: 100%; } vn-label-value > section { - margin-bottom: .3em; + margin-bottom: 4px; } } p:after { diff --git a/front/salix/components/user-popover/style.scss b/front/salix/components/user-popover/style.scss index c8325c9f67..abe36033fa 100644 --- a/front/salix/components/user-popover/style.scss +++ b/front/salix/components/user-popover/style.scss @@ -19,11 +19,11 @@ & > div { display: flex; - padding-bottom: .5em; + padding-bottom: 8px; & > .user { flex: 1; - max-width: 8em; + max-width: 128px; } } } @@ -33,5 +33,5 @@ float: right; height: initial; vertical-align: middle; - font-size: 1em; + font-size: 16px; } \ No newline at end of file diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index c081121a60..66a24e2aa2 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -55,7 +55,7 @@ form vn-horizontal { vn-bg-title { display: block; text-align: center; - padding: 1em; + padding: 16px; color: gray; font-size: 1.3em; } @@ -98,7 +98,7 @@ vn-tool-bar { display: flex; & > * { - margin-right: .6em; + margin-right: 9px; } } html [scrollable] { @@ -115,7 +115,7 @@ html [scrollable] { @extend %active; &.small { - font-size: .7em + font-size: 11px } } diff --git a/front/salix/styles/order-product.scss b/front/salix/styles/order-product.scss index df14f55583..7b7e0829e7 100644 --- a/front/salix/styles/order-product.scss +++ b/front/salix/styles/order-product.scss @@ -13,11 +13,11 @@ & > vn-card { display: flex; - height: 12em; + height: 192px; .image { - width: 12em; - height: 12em; + width: 192px; + height: 192px; img { width: 100%; @@ -32,12 +32,12 @@ height: 100%; width: 100%; overflow: hidden; - padding: .8em; + padding: 12px; & > h3 { font-family: vn-font; margin: 0; - margin-bottom: .3em; + margin-bottom: 4px; font-weight: normal; line-height: initial; font-size: 1.05em; @@ -47,22 +47,22 @@ & > h4 { color: $color-font-secondary; text-transform: uppercase; - margin-bottom: .3em; + margin-bottom: 4px; line-height: initial; - font-size: 1em; + font-size: 16px; flex: 1; } & > .tags { - padding-bottom: .2em; - height: 3em; + padding-bottom: 3px; + height: 48px; & > vn-label-value { - font-size: .8em; + font-size: 12px; } } } .footer { - font-size: .8em; + font-size: 12px; & > .price { overflow: hidden; @@ -87,7 +87,7 @@ } & > .priceKg { color: $color-font-secondary; - font-size: .8em; + font-size: 12px; } } } diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index 0423c5793d..3b08051043 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -30,8 +30,8 @@ } .actions { position: absolute; - right: 1em; - top: 1em + right: 16px; + top: 16px } } .photo:hover .image { diff --git a/modules/claim/front/basic-data/style.scss b/modules/claim/front/basic-data/style.scss index 5f14328798..e80361ca8c 100644 --- a/modules/claim/front/basic-data/style.scss +++ b/modules/claim/front/basic-data/style.scss @@ -1,3 +1,3 @@ vn-claim-basic-data vn-date-picker { - padding-left: 5em; + padding-left: 80px; } diff --git a/modules/claim/front/photos/style.scss b/modules/claim/front/photos/style.scss index c0b053e05a..8201830569 100644 --- a/modules/claim/front/photos/style.scss +++ b/modules/claim/front/photos/style.scss @@ -6,17 +6,17 @@ vn-claim-photos { .drop-zone { color: $color-font-secondary; box-sizing: border-box; - border-radius: .5em; + border-radius: 8px; text-align: center; min-height: 100%; .empty-rows { - padding: 5em $spacing-md; + padding: 80px $spacing-md; font-size: 1.4em } vn-icon { - font-size: 3em + font-size: 48px } } diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss index b108b0c8dd..8a57c0f5c3 100644 --- a/modules/claim/front/summary/style.scss +++ b/modules/claim/front/summary/style.scss @@ -5,6 +5,6 @@ vn-claim-summary { height: 15.5em } .photo .image { - border-radius: .2em + border-radius: 3px } } \ No newline at end of file diff --git a/modules/client/front/sample/create/style.scss b/modules/client/front/sample/create/style.scss index cd9764bf3e..d619d64b2d 100644 --- a/modules/client/front/sample/create/style.scss +++ b/modules/client/front/sample/create/style.scss @@ -4,7 +4,7 @@ div.vn-dialog { .container, .container h1 { font-family: "Roboto","Helvetica","Arial",sans-serif; - font-size: 1em !important; + font-size: 16px !important; h1 { font-weight: bold; @@ -12,7 +12,7 @@ div.vn-dialog { } p { - margin: 1em 0 + margin: 16px 0 } footer p { @@ -23,7 +23,7 @@ div.vn-dialog { .title h1 { - font-size: 2em !important; + font-size: 32px !important; margin: 0 } diff --git a/modules/item/front/fetched-tags/style.scss b/modules/item/front/fetched-tags/style.scss index a15907232c..69aa5c064e 100644 --- a/modules/item/front/fetched-tags/style.scss +++ b/modules/item/front/fetched-tags/style.scss @@ -10,7 +10,7 @@ vn-fetched-tags { & > vn-one { overflow: hidden; text-overflow: ellipsis; - min-width: 5em; + min-width: 80px; } & > vn-one:nth-child(2) h3 { @@ -18,25 +18,25 @@ vn-fetched-tags { text-transform: uppercase; line-height: initial; text-align: center; - font-size: 1em + font-size: 16px } & > vn-auto { display: flex; - padding-left: .4em; - min-width: 12em; + padding-left: 6px; + min-width: 192px; & > .inline-tag { display: inline-block; color: $color-font-secondary; - margin-left: .4em; + margin-left: 6px; text-align: center; - font-size: .8em; + font-size: 12px; height: 1.25em; - padding: .1em; - border-radius: .1em; - width: 4em; - min-width: 4em; + padding: 1px; + border-radius: 1px; + width: 64px; + min-width: 64px; border: 1px solid $color-spacer; &.empty { @@ -48,7 +48,7 @@ vn-fetched-tags { flex-direction: column; & > vn-one { - padding-bottom: .2em + padding-bottom: 3px } & > vn-auto { white-space: initial; @@ -57,7 +57,7 @@ vn-fetched-tags { justify-content: center; & > .inline-tag { - margin: .1em; + margin: 1px; } } } diff --git a/modules/item/front/index/style.scss b/modules/item/front/index/style.scss index b5f700818d..c3d65349eb 100644 --- a/modules/item/front/index/style.scss +++ b/modules/item/front/index/style.scss @@ -9,20 +9,20 @@ vn-item-product { margin-bottom: 0; } .image { - height: 7em; - width: 7em; + height: 112px; + width: 112px; & > img { max-height: 100%; max-width: 100%; - border-radius: .2em; + border-radius: 3px; } } vn-label-value:first-of-type section{ - margin-top: .6em; + margin-top: 9px; } vn-fetched-tags vn-horizontal{ - margin-top: .9em; + margin-top: 14px; } } diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index bb7e5d2272..10799cfdea 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -7,12 +7,12 @@ vn-item-summary { } .item-state { - padding: .4em; + padding: 6px; background-color: $color-main; color: $color-font-dark; p { - font-size: .8em; + font-size: 12px; text-align: center; margin: 0; @@ -29,7 +29,7 @@ vn-item-summary { padding: 0; &:nth-child(1) { - border-right: .1em solid white; + border-right: 1px solid white; } } } \ No newline at end of file diff --git a/modules/item/front/waste/style.scss b/modules/item/front/waste/style.scss index 7e9f9a9412..58cf0b1d12 100644 --- a/modules/item/front/waste/style.scss +++ b/modules/item/front/waste/style.scss @@ -11,7 +11,7 @@ vn-item-waste { padding-bottom: 4px; font-weight: lighter; background-color: #fde6ca; - border-bottom: .1em solid #f7931e; + border-bottom: 1px solid #f7931e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -19,7 +19,7 @@ vn-item-waste { vn-table vn-th.waste-family, vn-table vn-td.waste-family { - max-width: 4em; - width: 4em + max-width: 64px; + width: 64px } } \ No newline at end of file diff --git a/modules/order/front/catalog/style.scss b/modules/order/front/catalog/style.scss index 308acb6b26..fa41098d24 100644 --- a/modules/order/front/catalog/style.scss +++ b/modules/order/front/catalog/style.scss @@ -35,8 +35,8 @@ vn-order-catalog vn-side-menu div { } & > i:before { font-size: 32pt; - width: 1em; - height: 1em; + width: 16px; + height: 16px; } } } @@ -49,6 +49,6 @@ vn-order-catalog vn-side-menu div { max-width: 100%; } vn-autocomplete[vn-id="type"] .list { - max-height: 20em + max-height: 320px } } \ No newline at end of file diff --git a/modules/order/front/prices-popover/style.scss b/modules/order/front/prices-popover/style.scss index 150c2296a6..f6a46fbfbe 100644 --- a/modules/order/front/prices-popover/style.scss +++ b/modules/order/front/prices-popover/style.scss @@ -14,12 +14,12 @@ .prices { vn-table { .warehouse { - width: 3em; - max-width: 3em; + width: 48px; + max-width: 48px; } .price-kg { color: $color-font-secondary; - font-size: .8em + font-size: 12px } .vn-input-number { width: 3.5em; diff --git a/modules/order/front/summary/style.scss b/modules/order/front/summary/style.scss index c225b4b49d..2033a35885 100644 --- a/modules/order/front/summary/style.scss +++ b/modules/order/front/summary/style.scss @@ -4,16 +4,16 @@ vn-order-summary .summary{ max-width: $width-lg; & > div > vn-horizontal > vn-one { - min-width: 10em !important; + min-width: 160px !important; &.taxes { border: $border-thin-light; text-align: right; - padding: .5em !important; + padding: 8px !important; & > p { font-size: 1.2em; - margin: .2em; + margin: 3px; } } } diff --git a/modules/ticket/front/component/style.scss b/modules/ticket/front/component/style.scss index c20b8f720d..d1a8ac9c46 100644 --- a/modules/ticket/front/component/style.scss +++ b/modules/ticket/front/component/style.scss @@ -3,23 +3,23 @@ vn-ticket-components { .vn-table > tbody { &:not(:last-child) { - border-bottom: .1em solid $color-spacer-light; + border-bottom: 1px solid $color-spacer-light; } & > tr { border-bottom: none; &.components { - height: 1em; + height: 16px; & > td { - padding-top: .1em; - padding-bottom: .1em; + padding-top: 1px; + padding-bottom: 1px; } &:nth-child(2) > td { - padding-top: 1em; + padding-top: 16px; } &:last-child > td { - padding-bottom: 1em; + padding-bottom: 16px; } } } diff --git a/modules/ticket/front/sale/style.scss b/modules/ticket/front/sale/style.scss index 8d3fd8ce41..253727ae0f 100644 --- a/modules/ticket/front/sale/style.scss +++ b/modules/ticket/front/sale/style.scss @@ -13,14 +13,14 @@ vn-ticket-sale { } } .taxes { - max-width: 10em; + max-width: 160px; border: $border-thin-light; text-align: right; - padding: .5em !important; + padding: 8px !important; & > p { font-size: 1.2em; - margin: .2em; + margin: 3px; } } vn-dialog.edit { @@ -61,11 +61,11 @@ vn-ticket-sale { vn-horizontal { & > vn-one:nth-child(1) { border-right: 1px solid $color-bg; - padding-right: 1em; + padding-right: 16px; } & > vn-one:nth-child(2) { - margin-left: 1em + margin-left: 16px } } vn-table, table { diff --git a/modules/ticket/front/summary/style.scss b/modules/ticket/front/summary/style.scss index ab5ce78851..d7618a4202 100644 --- a/modules/ticket/front/summary/style.scss +++ b/modules/ticket/front/summary/style.scss @@ -32,16 +32,16 @@ vn-ticket-summary .summary { } & > vn-horizontal > vn-one { - min-width: 10em; + min-width: 160px; &.taxes { border: $border-thin-light; text-align: right; - padding: .5em; + padding: 8px; & > p { font-size: 1.2em; - margin: .2em; + margin: 3px; } } @@ -53,7 +53,7 @@ vn-ticket-summary .summary { .vn-table > vn-thead .tax-class, .vn-table > vn-tbody .tax-class { - min-width: 11em; + min-width: 176px; width: 1px; } diff --git a/modules/worker/front/time-control/style.scss b/modules/worker/front/time-control/style.scss index 8555e827b7..99a21883f2 100644 --- a/modules/worker/front/time-control/style.scss +++ b/modules/worker/front/time-control/style.scss @@ -13,11 +13,11 @@ vn-worker-time-control { display: flex; align-items: center; justify-content: center; - padding: .3em 0; + padding: 4px 0; & > vn-icon { color: $color-font-secondary; - padding-right: .1em; + padding-right: 1px; } } } From 559cc5eb8c8d831302bc6b0388bb8bb3e94e0f4c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 14:52:02 +0200 Subject: [PATCH 24/53] SCSS em to px: Second step --- front/core/components/button/style.scss | 12 +++++----- front/core/components/calendar/style.scss | 10 ++++----- front/core/components/chip/style.scss | 10 ++++----- front/core/components/confirm/style.scss | 2 +- front/core/components/data-viewer/style.scss | 4 ++-- front/core/components/debug-info/style.scss | 6 ++--- front/core/components/dialog/style.scss | 6 ++--- front/core/components/label-value/style.scss | 2 +- front/core/components/list/style.scss | 4 ++-- front/core/components/pagination/style.scss | 2 +- front/core/components/popover/style.scss | 4 ++-- front/core/components/scroll-up/style.scss | 2 +- front/core/components/searchbar/style.scss | 8 +++---- front/core/components/snackbar/style.scss | 14 ++++++------ front/core/components/table/style.scss | 12 +++++----- front/core/components/treeview/style.scss | 4 ++-- front/core/components/wday-picker/style.scss | 4 ++-- front/core/directives/uvc.scss | 2 +- front/core/styles/animations.scss | 2 +- front/core/styles/global.scss | 2 +- front/core/styles/responsive.scss | 2 ++ front/core/styles/variables.scss | 22 +++++++++---------- front/salix/components/descriptor/style.scss | 6 ++--- front/salix/components/home/style.scss | 6 ++--- front/salix/components/layout/style.scss | 6 ++--- front/salix/components/login/style.scss | 8 +++---- front/salix/components/summary/style.scss | 4 ++-- .../salix/components/user-popover/style.scss | 4 ++-- front/salix/styles/misc.scss | 6 ++--- front/salix/styles/order-product.scss | 10 ++++----- front/salix/styles/photo-list.scss | 2 +- modules/claim/front/detail/style.scss | 2 +- modules/claim/front/photos/style.scss | 6 ++--- modules/claim/front/summary/style.scss | 4 ++-- .../front/descriptor-popover/style.scss | 2 +- modules/client/front/sample/create/style.scss | 4 ++-- modules/client/front/sms/style.scss | 2 +- .../front/descriptor-popover/style.scss | 4 ++-- .../item/front/descriptor-popover/style.scss | 4 ++-- modules/item/front/fetched-tags/style.scss | 4 ++-- modules/item/front/summary/style.scss | 2 +- modules/order/front/catalog-view/style.scss | 2 +- modules/order/front/prices-popover/style.scss | 2 +- modules/order/front/summary/style.scss | 2 +- .../route/front/descriptor-popover/style.scss | 2 +- .../front/descriptor-popover/style.scss | 4 ++-- modules/ticket/front/descriptor/style.scss | 2 +- modules/ticket/front/sale/style.scss | 8 +++---- modules/ticket/front/sms/style.scss | 2 +- modules/ticket/front/summary/style.scss | 4 ++-- modules/worker/front/calendar/style.scss | 2 +- modules/zone/front/calendar/style.scss | 2 +- modules/zone/front/delivery-days/style.scss | 2 +- 53 files changed, 129 insertions(+), 127 deletions(-) diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss index b583dacd56..4969ea60b4 100644 --- a/front/core/components/button/style.scss +++ b/front/core/components/button/style.scss @@ -4,7 +4,7 @@ display: inline-flex; align-items: center; justify-content: center; - height: 2.8em; + height: 44px; border: none; border-radius: 1px; font-family: vn-font-bold; @@ -34,13 +34,13 @@ & > vn-icon { vertical-align: middle; color: inherit; - font-size: 1.7em; + font-size: 27px; } } &.colored { color: white; background-color: $color-button; - box-shadow: 0 .15em .15em 0 rgba(0, 0, 0, .3); + box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .3); transition: background 200ms ease-in-out; &:not(.disabled) { @@ -80,8 +80,8 @@ } &.round { border-radius: 50%; - height: 3.8em; - width: 3.8em; + height: 60px; + width: 60px; & > button > span { display: none; @@ -100,7 +100,7 @@ } &.lg { - font-size: 1.2em; + font-size: 19px; } } &.disabled { diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index fa7b92da7f..80964f5d89 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -8,7 +8,7 @@ display: flex; margin-bottom: 8px; align-items: center; - height: 2.4em; + height: 38px; & > .title { flex: 1; @@ -41,7 +41,7 @@ & > .day { width: 14.28%; - height: 2.5em; + height: 40px; display: flex; justify-content: center; align-items: center; @@ -62,9 +62,9 @@ justify-content: center; align-items: center; border-radius: 50%; - font-size: .87em; - width: 2.2em; - height: 2.2em; + font-size: .85rem; + width: 35px; + height: 35px; cursor: pointer; outline: 0; transition: background-color 300ms ease-in-out; diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index 2423126875..17518df7d4 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -5,7 +5,7 @@ vn-chip { background-color: $color-bg; color: $color-font; font-size: .9rem; - margin: .25em; + margin: 4px; display: inline-flex; align-items: center; height: 32px; @@ -13,7 +13,7 @@ vn-chip { box-sizing: border-box; &.small { - height: 1.5em; + height: 24px; & > div { padding: 9px; @@ -52,7 +52,7 @@ vn-chip { overflow: hidden; & > vn-avatar { - margin-left: -0.7em; + margin-left: -11px; margin-right: 4px; vertical-align: middle; height: 32px; @@ -60,8 +60,8 @@ vn-chip { } } & > vn-icon { - margin-right: .12em; - margin-left: -.12em; + margin-right: 1px; + margin-left: -1px; vertical-align: middle; opacity: .6; cursor: pointer; diff --git a/front/core/components/confirm/style.scss b/front/core/components/confirm/style.scss index d3cea6cb16..154e3b478f 100644 --- a/front/core/components/confirm/style.scss +++ b/front/core/components/confirm/style.scss @@ -1,3 +1,3 @@ .vn-confirm .window { - max-width: 30em + max-width: 480px } \ No newline at end of file diff --git a/front/core/components/data-viewer/style.scss b/front/core/components/data-viewer/style.scss index d0b3c727d9..0dc05c6d1f 100644 --- a/front/core/components/data-viewer/style.scss +++ b/front/core/components/data-viewer/style.scss @@ -6,9 +6,9 @@ vn-data-viewer { & > .empty-rows { display: block; text-align: center; - padding: 1.5em; + padding: 24px; box-sizing: border-box; color: $color-font-secondary; - font-size: 1.4em; + font-size: 22px; } } \ No newline at end of file diff --git a/front/core/components/debug-info/style.scss b/front/core/components/debug-info/style.scss index 0ca30266df..13c04dcae7 100644 --- a/front/core/components/debug-info/style.scss +++ b/front/core/components/debug-info/style.scss @@ -19,7 +19,7 @@ vn-debug-info { & > h6 { font-weight: normal; color: rgba(255, 255, 255, .5); - font-size: 16px; + font-size: 1rem; } ul { list-style-type: none; @@ -28,10 +28,10 @@ vn-debug-info { & > li { margin-top: 3px; - font-size: .95em; + font-size: 15px; & > span { - padding: .05em 3px; + padding: 1px 3px; border-radius: 4px; transition: background-color 200ms ease-in-out; diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index 6023a46668..7aa3d34ebb 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -20,11 +20,11 @@ & > .body > tpl-body { display: block; - min-width: 16em; + min-width: 256px; } & > .buttons > tpl-buttons { display: block; - margin-top: 1.5em; + margin-top: 24px; text-align: right; button, @@ -39,7 +39,7 @@ color: $color-button; font-family: vn-font-bold; padding: 11px; - margin: -0.7em; + margin: -1px; margin-left: 11px; } } diff --git a/front/core/components/label-value/style.scss b/front/core/components/label-value/style.scss index e4a2cca038..d0fd19b3d2 100644 --- a/front/core/components/label-value/style.scss +++ b/front/core/components/label-value/style.scss @@ -4,6 +4,6 @@ vn-label-value > section { & > vn-icon { vertical-align: middle; color: $color-font-secondary; - font-size: 1.2em + font-size: 19px } } \ No newline at end of file diff --git a/front/core/components/list/style.scss b/front/core/components/list/style.scss index da43787889..b1b6dcf489 100644 --- a/front/core/components/list/style.scss +++ b/front/core/components/list/style.scss @@ -76,7 +76,7 @@ vn-item, margin-right: $spacing-md; & > .vn-icon { - font-size: 1.2em; + font-size: 19px; } } &[side] { @@ -89,7 +89,7 @@ vn-item, margin-left: 8px; transition: opacity 250ms ease-out; padding: 0; - font-size: 1.05em; + font-size: 1rem; &:hover { opacity: 1; diff --git a/front/core/components/pagination/style.scss b/front/core/components/pagination/style.scss index 0d5ad615aa..413a6fb5f4 100644 --- a/front/core/components/pagination/style.scss +++ b/front/core/components/pagination/style.scss @@ -4,7 +4,7 @@ vn-pagination { text-align: center; & > div > vn-icon-button { - font-size: 32px; + font-size: 2rem; padding: 0; } } \ No newline at end of file diff --git a/front/core/components/popover/style.scss b/front/core/components/popover/style.scss index 274b967829..e27ef6012d 100644 --- a/front/core/components/popover/style.scss +++ b/front/core/components/popover/style.scss @@ -10,7 +10,7 @@ color: $color-font; opacity: 0; - transform: translateY(-.6em); + transform: translateY(-9px); transition-property: opacity, transform; transition-duration: 200ms; transition-timing-function: ease-in-out; @@ -27,7 +27,7 @@ & > .arrow { width: 16px; height: 16px; - margin: -.5em; + margin: -8px; background-color: $color-bg-panel; box-shadow: 0 1px 6px $color-shadow; position: absolute; diff --git a/front/core/components/scroll-up/style.scss b/front/core/components/scroll-up/style.scss index 40ca92322f..44d12f14f8 100644 --- a/front/core/components/scroll-up/style.scss +++ b/front/core/components/scroll-up/style.scss @@ -1,5 +1,5 @@ vn-scroll-up { - top: 5.5em; + top: 88px; right: 32px; display: none; position: fixed; diff --git a/front/core/components/searchbar/style.scss b/front/core/components/searchbar/style.scss index 9275f03e25..c1d4be21c3 100644 --- a/front/core/components/searchbar/style.scss +++ b/front/core/components/searchbar/style.scss @@ -2,15 +2,15 @@ vn-searchbar { display: block; - max-width: 35em; + max-width: 560px; margin: 0 auto; .search-params { flex: 1; - margin: .05em 0; + margin: 1px 0; overflow: visible; display: flex; - max-width: 24em; + max-width: 384px; & > .search-param { color: rgba(0, 0, 0, .6); @@ -39,7 +39,7 @@ vn-searchbar { } .search-panel { - max-height: 48em; + max-height: 768px; & > form { padding: $spacing-lg; diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index 55c8042313..e7ca1fba80 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -1,11 +1,11 @@ @import "variables"; vn-snackbar #shapes { - max-height: 20.625em; - margin-left: -12.5em; + max-height: 330px; + margin-left: -200px; position: fixed; z-index: 100; - width: 25em; + width: 400px; left: 50%; bottom: 0 } @@ -14,7 +14,7 @@ vn-snackbar .shape { background-color: rgba(0, 0, 0, .8); box-shadow: 0 0 6px $color-shadow; transition: transform 300ms ease-in-out; - transform: translateY(20em); + transform: translateY(320px); box-sizing: border-box; border-radius: 3px; margin-bottom: 15px; @@ -26,8 +26,8 @@ vn-snackbar .shape { vn-chip { position: absolute; - left: -1em; - top: -1em; + left: -16px; + top: -16px; } } @@ -62,6 +62,6 @@ vn-snackbar .shape { float: right; border: none; padding: 8px; - margin: -.5em + margin: -8px; } } \ No newline at end of file diff --git a/front/core/components/table/style.scss b/front/core/components/table/style.scss index 4f1e1a5ba4..7dd69d89f3 100644 --- a/front/core/components/table/style.scss +++ b/front/core/components/table/style.scss @@ -14,7 +14,7 @@ vn-table { & > vn-thead, & > thead { display: table-header-group; - border-bottom: .15em solid $color-spacer; + border-bottom: 2px solid $color-spacer; & > * > th { font-weight: normal; @@ -52,7 +52,7 @@ vn-table { } & > vn-tfoot, & > tfoot { - border-top: .15em solid $color-spacer; + border-top: 2px solid $color-spacer; display: table-footer-group } & > * > vn-tr, @@ -103,7 +103,7 @@ vn-table { text-align: center; } &[expand] { - max-width: 25em; + max-width: 400px; min-width: 0; } vn-icon.bright, i.bright { @@ -111,10 +111,10 @@ vn-table { } } & > :last-child { - padding-right: 1.4em; + padding-right: 22px; } & > :first-child { - padding-left: 1.4em; + padding-left: 22px; } } & > a.vn-tr { @@ -158,7 +158,7 @@ vn-table { vn-icon-menu { display: inline-block; color: $color-main; - padding: .25em + padding: 4px } } & > [actions] { diff --git a/front/core/components/treeview/style.scss b/front/core/components/treeview/style.scss index 7cd8c8beac..b8af114c1e 100644 --- a/front/core/components/treeview/style.scss +++ b/front/core/components/treeview/style.scss @@ -11,7 +11,7 @@ vn-treeview-childs { list-style: none; ul { - padding-left: 2.2em; + padding-left: 35px; } } } @@ -37,7 +37,7 @@ vn-treeview-childs { vn-treeview-child { line-height: 38px; - font-size: 16px; + font-size: 1rem; display: block; .node { diff --git a/front/core/components/wday-picker/style.scss b/front/core/components/wday-picker/style.scss index ab14c448cf..a8e3a65abc 100644 --- a/front/core/components/wday-picker/style.scss +++ b/front/core/components/wday-picker/style.scss @@ -12,8 +12,8 @@ padding: 6px; margin: 3px; display: inline-flex; - width: 1.5em; - height: 1.5em; + width: 24px; + height: 24px; justify-content: center; align-items: center; outline: none; diff --git a/front/core/directives/uvc.scss b/front/core/directives/uvc.scss index 5221b8bdd3..0cdf0ba1a4 100644 --- a/front/core/directives/uvc.scss +++ b/front/core/directives/uvc.scss @@ -1,6 +1,6 @@ vn-table vn-dialog[vn-id="uvc"]{ & > div { - min-width: 18em; + min-width: 288px; align-items: center; } diff --git a/front/core/styles/animations.scss b/front/core/styles/animations.scss index 039f79c77f..8ae119fb4c 100644 --- a/front/core/styles/animations.scss +++ b/front/core/styles/animations.scss @@ -2,7 +2,7 @@ @keyframes nothing {} @keyframes slideIn { from { - transform: translate3d(-2em, 0, 0); + transform: translate3d(-32px, 0, 0); opacity: 0; } to { diff --git a/front/core/styles/global.scss b/front/core/styles/global.scss index ed017fafdf..555b54f9e1 100644 --- a/front/core/styles/global.scss +++ b/front/core/styles/global.scss @@ -1,10 +1,10 @@ @import "variables"; html { + font-size: $font-size; background-color: $color-bg; overflow: auto; height: 100%; - font-size: $font-size; } body { height: 100%; diff --git a/front/core/styles/responsive.scss b/front/core/styles/responsive.scss index 03cdf24236..735114cd80 100644 --- a/front/core/styles/responsive.scss +++ b/front/core/styles/responsive.scss @@ -48,6 +48,8 @@ html { font-size: 11pt; } } +html { font-size: 9pt; } + .vn-hide-narrow { @media (max-width: $mobile-width) { display: none; diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index 5dff61f2d1..5401ac5b6b 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -1,17 +1,17 @@ @import "./util"; -$menu-width: 16em; -$topbar-height: 3.5em; +$menu-width: 256px; +$topbar-height: 56px; $mobile-width: 800px; -$font-size: 16px; +$font-size: 1rem; // Width -$width-xs: 25em; -$width-sm: 34em; -$width-md: 50em; -$width-lg: 80em; -$width-xl: 100em; +$width-xs: 400px; +$width-sm: 544px; +$width-md: 800px; +$width-lg: 1280px; +$width-xl: 1600px; // Spacing @@ -115,6 +115,6 @@ $color-alert-light: darken($color-alert, 35%); // Border -$border-thin: .05em solid $color-spacer; -$border-thin-light: .05em solid $color-spacer-light; -$shadow: 0 .15em .15em 0 rgba(0, 0, 0, .3); +$border-thin: 1px solid $color-spacer; +$border-thin-light: 1px solid $color-spacer-light; +$shadow: 0 2px 2px 0 rgba(0, 0, 0, .3); diff --git a/front/salix/components/descriptor/style.scss b/front/salix/components/descriptor/style.scss index decfe5c56b..c473571311 100644 --- a/front/salix/components/descriptor/style.scss +++ b/front/salix/components/descriptor/style.scss @@ -26,7 +26,7 @@ padding: 10px; } vn-icon { - font-size: 1.8em; + font-size: 28px; } } } @@ -51,7 +51,7 @@ & > vn-icon { padding: $spacing-sm; color: $color-marginal; - font-size: 1.5em; + font-size: 24px; &.bright { color: $color-main; @@ -70,7 +70,7 @@ margin: 0 $spacing-sm; & > vn-icon { - font-size: 1.8em; + font-size: 28px; padding: 0; } } diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index 4e99341b49..dac9d422e7 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -16,7 +16,7 @@ vn-home { flex-direction: row; justify-content: center; flex-wrap: wrap; - max-width: 44em; + max-width: 704px; margin: 0 auto; & > a { @@ -41,7 +41,7 @@ vn-home { & > vn-icon { display: block; - font-size: 3.5em; + font-size: 56px; } } & > span { @@ -55,7 +55,7 @@ vn-home { overflow: hidden; color: inherit; margin: 0; - line-height: 1.5em; + line-height: 24px; /* & > .bind-letter { color: #FD0; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 691423678b..f65f511d10 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -28,7 +28,7 @@ vn-layout { display: block; } & > .main-title { - font-size: 1.6em; + font-size: 25px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; @@ -50,7 +50,7 @@ vn-layout { } .vn-button { color: inherit; - font-size: 1.05em; + font-size: 1rem; padding: 0; } } @@ -166,6 +166,6 @@ vn-layout { } } #user { - font-size: 1.5em; + font-size: 24px; height: auto; } diff --git a/front/salix/components/login/style.scss b/front/salix/components/login/style.scss index 121d12bfad..b8a81ef2d2 100644 --- a/front/salix/components/login/style.scss +++ b/front/salix/components/login/style.scss @@ -7,7 +7,7 @@ vn-login { margin: 0; padding: 0; color: $color-font; - font-size: 1.1em; + font-size: 17px; font-weight: normal; background-color: $color-bg-dark; display: flex; @@ -18,8 +18,8 @@ vn-login { & > .box { box-sizing: border-box; position: absolute; - max-width: 19em; - min-width: 15em; + max-width: 304px; + min-width: 240px; padding: 48px; background-color: $color-bg-panel; box-shadow: 0 0 16px 0 rgba(0, 0, 0, .6); @@ -56,7 +56,7 @@ vn-login { position: absolute; width: 0; top: 3px; - right: -.5em; + right: -8px; overflow: visible; } } diff --git a/front/salix/components/summary/style.scss b/front/salix/components/summary/style.scss index ad04a7b313..8d302af4ac 100644 --- a/front/salix/components/summary/style.scss +++ b/front/salix/components/summary/style.scss @@ -11,7 +11,7 @@ color: $color-font-dark; margin: 0; text-align: center; - line-height: 1.3em; + line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -38,7 +38,7 @@ } & > * { margin: $spacing-sm; - min-width: 14em; + min-width: 224px; padding: 0; } & > vn-auto { diff --git a/front/salix/components/user-popover/style.scss b/front/salix/components/user-popover/style.scss index abe36033fa..cb1cc08a0f 100644 --- a/front/salix/components/user-popover/style.scss +++ b/front/salix/components/user-popover/style.scss @@ -1,7 +1,7 @@ @import "variables"; .vn-popover .user-popover { - width: 16em; + width: 256px; & > .profile-card { display: flex; @@ -33,5 +33,5 @@ float: right; height: initial; vertical-align: middle; - font-size: 16px; + font-size: 1rem; } \ No newline at end of file diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index 66a24e2aa2..453e362946 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -3,7 +3,7 @@ form vn-horizontal { align-items: center; - min-height: 2.8em; + min-height: 44px; & > * { box-sizing: border-box; @@ -57,7 +57,7 @@ vn-bg-title { text-align: center; padding: 16px; color: gray; - font-size: 1.3em; + font-size: 20px; } .totalBox { border: 1px solid #CCC; @@ -65,7 +65,7 @@ vn-bg-title { justify-content: center; align-items: center; padding: $spacing-md; - max-width: 14em; + max-width: 224px; } .form { height: 100%; diff --git a/front/salix/styles/order-product.scss b/front/salix/styles/order-product.scss index 7b7e0829e7..fe73a03156 100644 --- a/front/salix/styles/order-product.scss +++ b/front/salix/styles/order-product.scss @@ -8,7 +8,7 @@ & > .product { box-sizing: border-box; padding: $spacing-sm; - width: 28em; + width: 448px; overflow: hidden; & > vn-card { @@ -40,8 +40,8 @@ margin-bottom: 4px; font-weight: normal; line-height: initial; - font-size: 1.05em; - max-height:2.4em; + font-size: 1rem; + max-height: 38px; overflow: hidden; } & > h4 { @@ -49,7 +49,7 @@ text-transform: uppercase; margin-bottom: 4px; line-height: initial; - font-size: 16px; + font-size: 1rem; flex: 1; } & > .tags { @@ -77,7 +77,7 @@ &:first-child, &:last-child { - font-size: 1.4em; + font-size: 22px; } } diff --git a/front/salix/styles/photo-list.scss b/front/salix/styles/photo-list.scss index 3b08051043..67d848fa7f 100644 --- a/front/salix/styles/photo-list.scss +++ b/front/salix/styles/photo-list.scss @@ -11,7 +11,7 @@ transition: all .5s; padding: $spacing-sm; position: relative; - width: 28em; + width: 448px; .image { box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), diff --git a/modules/claim/front/detail/style.scss b/modules/claim/front/detail/style.scss index 74f3ed6749..45e455ba14 100644 --- a/modules/claim/front/detail/style.scss +++ b/modules/claim/front/detail/style.scss @@ -1,7 +1,7 @@ @import "variables"; .vn-popover .discount-popover { - width: 16em; + width: 256px; .header { background-color: $color-main; diff --git a/modules/claim/front/photos/style.scss b/modules/claim/front/photos/style.scss index 8201830569..c17ce1523e 100644 --- a/modules/claim/front/photos/style.scss +++ b/modules/claim/front/photos/style.scss @@ -12,7 +12,7 @@ vn-claim-photos { .empty-rows { padding: 80px $spacing-md; - font-size: 1.4em + font-size: 22px } vn-icon { @@ -25,8 +25,8 @@ vn-claim-photos { min-height: 100%; .photo { - width: 32em; - height: 18em; + width: 512px; + height: 288px; } } } \ No newline at end of file diff --git a/modules/claim/front/summary/style.scss b/modules/claim/front/summary/style.scss index 8a57c0f5c3..e0542dea00 100644 --- a/modules/claim/front/summary/style.scss +++ b/modules/claim/front/summary/style.scss @@ -2,9 +2,9 @@ vn-claim-summary { section.photo { - height: 15.5em + height: 248px; } .photo .image { - border-radius: 3px + border-radius: 3px; } } \ No newline at end of file diff --git a/modules/client/front/descriptor-popover/style.scss b/modules/client/front/descriptor-popover/style.scss index 0262c4ac0a..8de03b90bc 100644 --- a/modules/client/front/descriptor-popover/style.scss +++ b/modules/client/front/descriptor-popover/style.scss @@ -1,7 +1,7 @@ vn-client-descriptor-popover { vn-client-descriptor { display: block; - width: 16em; + width: 256px; & > vn-card{ margin: 0!important; } diff --git a/modules/client/front/sample/create/style.scss b/modules/client/front/sample/create/style.scss index d619d64b2d..288471be19 100644 --- a/modules/client/front/sample/create/style.scss +++ b/modules/client/front/sample/create/style.scss @@ -4,7 +4,7 @@ div.vn-dialog { .container, .container h1 { font-family: "Roboto","Helvetica","Arial",sans-serif; - font-size: 16px !important; + font-size: 1rem !important; h1 { font-weight: bold; @@ -23,7 +23,7 @@ div.vn-dialog { .title h1 { - font-size: 32px !important; + font-size: 2rem !important; margin: 0 } diff --git a/modules/client/front/sms/style.scss b/modules/client/front/sms/style.scss index 89723b1962..84571a5f42 100644 --- a/modules/client/front/sms/style.scss +++ b/modules/client/front/sms/style.scss @@ -1,5 +1,5 @@ @import "variables"; .SMSDialog { - min-width: 25em + min-width: 400px } \ No newline at end of file diff --git a/modules/invoiceOut/front/descriptor-popover/style.scss b/modules/invoiceOut/front/descriptor-popover/style.scss index 58e65d3206..f504810830 100644 --- a/modules/invoiceOut/front/descriptor-popover/style.scss +++ b/modules/invoiceOut/front/descriptor-popover/style.scss @@ -1,8 +1,8 @@ vn-ticket-descriptor-popover { vn-ticket-descriptor { display: block; - width: 16em; - max-height: 28em; + width: 256px; + max-height: 448px; & > vn-card { margin: 0!important; diff --git a/modules/item/front/descriptor-popover/style.scss b/modules/item/front/descriptor-popover/style.scss index 6c03a004ea..219e68baed 100644 --- a/modules/item/front/descriptor-popover/style.scss +++ b/modules/item/front/descriptor-popover/style.scss @@ -1,5 +1,5 @@ body > .vn-popover vn-item-descriptor { display: block; - width: 16em; - min-height: 28em; + width: 256px; + min-height: 448px; } \ No newline at end of file diff --git a/modules/item/front/fetched-tags/style.scss b/modules/item/front/fetched-tags/style.scss index 69aa5c064e..854d390db6 100644 --- a/modules/item/front/fetched-tags/style.scss +++ b/modules/item/front/fetched-tags/style.scss @@ -18,7 +18,7 @@ vn-fetched-tags { text-transform: uppercase; line-height: initial; text-align: center; - font-size: 16px + font-size: 1rem } & > vn-auto { @@ -32,7 +32,7 @@ vn-fetched-tags { margin-left: 6px; text-align: center; font-size: 12px; - height: 1.25em; + height: 20px; padding: 1px; border-radius: 1px; width: 64px; diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 10799cfdea..2b28ed3757 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -21,7 +21,7 @@ vn-item-summary { line-height: 1; } &:last-child { - font-size: 1.5em; + font-size: 24px; font-weight: bold; } } diff --git a/modules/order/front/catalog-view/style.scss b/modules/order/front/catalog-view/style.scss index 18dc51bb0d..aa4e301a91 100644 --- a/modules/order/front/catalog-view/style.scss +++ b/modules/order/front/catalog-view/style.scss @@ -15,7 +15,7 @@ vn-order-catalog { } } & > vn-auto { - width: 28em; + width: 448px; display: flex; overflow: hidden; diff --git a/modules/order/front/prices-popover/style.scss b/modules/order/front/prices-popover/style.scss index f6a46fbfbe..4ce8dd2f93 100644 --- a/modules/order/front/prices-popover/style.scss +++ b/modules/order/front/prices-popover/style.scss @@ -22,7 +22,7 @@ font-size: 12px } .vn-input-number { - width: 3.5em; + width: 56px; } } .footer { diff --git a/modules/order/front/summary/style.scss b/modules/order/front/summary/style.scss index 2033a35885..140ca9b7ba 100644 --- a/modules/order/front/summary/style.scss +++ b/modules/order/front/summary/style.scss @@ -12,7 +12,7 @@ vn-order-summary .summary{ padding: 8px !important; & > p { - font-size: 1.2em; + font-size: 19px; margin: 3px; } } diff --git a/modules/route/front/descriptor-popover/style.scss b/modules/route/front/descriptor-popover/style.scss index 0c84ff2fee..163a032e35 100644 --- a/modules/route/front/descriptor-popover/style.scss +++ b/modules/route/front/descriptor-popover/style.scss @@ -1,7 +1,7 @@ vn-route-descriptor-popover { vn-route-descriptor { display: block; - width: 16em; + width: 256px; & > vn-card{ margin: 0!important; } diff --git a/modules/ticket/front/descriptor-popover/style.scss b/modules/ticket/front/descriptor-popover/style.scss index 58e65d3206..f504810830 100644 --- a/modules/ticket/front/descriptor-popover/style.scss +++ b/modules/ticket/front/descriptor-popover/style.scss @@ -1,8 +1,8 @@ vn-ticket-descriptor-popover { vn-ticket-descriptor { display: block; - width: 16em; - max-height: 28em; + width: 256px; + max-height: 448px; & > vn-card { margin: 0!important; diff --git a/modules/ticket/front/descriptor/style.scss b/modules/ticket/front/descriptor/style.scss index 4becf97890..1a69feeffe 100644 --- a/modules/ticket/front/descriptor/style.scss +++ b/modules/ticket/front/descriptor/style.scss @@ -2,7 +2,7 @@ .add-stowaway { vn-data-viewer { - width: 40em + width: 640px } } diff --git a/modules/ticket/front/sale/style.scss b/modules/ticket/front/sale/style.scss index 253727ae0f..e6486caaa4 100644 --- a/modules/ticket/front/sale/style.scss +++ b/modules/ticket/front/sale/style.scss @@ -19,7 +19,7 @@ vn-ticket-sale { padding: 8px !important; & > p { - font-size: 1.2em; + font-size: 19px; margin: 3px; } } @@ -74,11 +74,11 @@ vn-ticket-sale { vn-table { overflow-x: hidden; overflow-y: auto; - max-height: 25em; - width: 30em; + max-height: 400px; + width: 480px; } table { - width: 25em + width: 400px } } .edit-price { diff --git a/modules/ticket/front/sms/style.scss b/modules/ticket/front/sms/style.scss index 89723b1962..84571a5f42 100644 --- a/modules/ticket/front/sms/style.scss +++ b/modules/ticket/front/sms/style.scss @@ -1,5 +1,5 @@ @import "variables"; .SMSDialog { - min-width: 25em + min-width: 400px } \ No newline at end of file diff --git a/modules/ticket/front/summary/style.scss b/modules/ticket/front/summary/style.scss index d7618a4202..05bb366b98 100644 --- a/modules/ticket/front/summary/style.scss +++ b/modules/ticket/front/summary/style.scss @@ -40,7 +40,7 @@ vn-ticket-summary .summary { padding: 8px; & > p { - font-size: 1.2em; + font-size: 19px; margin: 3px; } } @@ -48,7 +48,7 @@ vn-ticket-summary .summary { &.services { .vn-table > vn-thead .identifier, .vn-table > vn-tbody .identifier { - min-width: 3.5em + min-width: 56px } .vn-table > vn-thead .tax-class, diff --git a/modules/worker/front/calendar/style.scss b/modules/worker/front/calendar/style.scss index e622dda649..9b3fc749be 100644 --- a/modules/worker/front/calendar/style.scss +++ b/modules/worker/front/calendar/style.scss @@ -13,7 +13,7 @@ vn-worker-calendar { border: 1px solid #ddd; margin: $spacing-md; padding: $spacing-xs; - max-width: 18em; + max-width: 288px; } } } diff --git a/modules/zone/front/calendar/style.scss b/modules/zone/front/calendar/style.scss index 3fe23278e6..14d234c1b4 100644 --- a/modules/zone/front/calendar/style.scss +++ b/modules/zone/front/calendar/style.scss @@ -24,7 +24,7 @@ vn-zone-calendar { justify-content: space-evenly; & > .vn-calendar { - max-width: 18em; + max-width: 288px; .day { &.event .day-number { diff --git a/modules/zone/front/delivery-days/style.scss b/modules/zone/front/delivery-days/style.scss index a279ca0b9f..3dd4abb7c3 100644 --- a/modules/zone/front/delivery-days/style.scss +++ b/modules/zone/front/delivery-days/style.scss @@ -7,7 +7,7 @@ vn-zone-delivery-days { flex-wrap: wrap; & > vn-calendar { - min-width: 16.5em; + min-width: 264px; } } form { From 2249f68d6e27a0abbf9849f8323663b63cad326c Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 15:11:42 +0200 Subject: [PATCH 25/53] SCSS px to em: rem for font-size --- front/core/components/button/style.scss | 10 ++++---- front/core/components/calendar/style.scss | 2 +- front/core/components/data-viewer/style.scss | 2 +- front/core/components/debug-info/style.scss | 2 +- front/core/components/drop-down/style.scss | 2 +- front/core/components/field/style.scss | 6 ++--- front/core/components/icon/style.scss | 2 +- front/core/components/label-value/style.scss | 2 +- front/core/components/list/style.scss | 2 +- front/core/components/range/style.scss | 2 +- front/core/styles/font-family.scss | 2 +- front/core/styles/responsive.scss | 5 ++-- front/core/styles/text.scss | 24 +++++++++---------- front/core/styles/variables.scss | 2 +- front/salix/components/descriptor/style.scss | 6 ++--- front/salix/components/home/style.scss | 6 ++--- front/salix/components/layout/style.scss | 4 ++-- front/salix/components/login/style.scss | 2 +- front/salix/components/summary/style.scss | 2 +- .../salix/components/user-popover/style.scss | 2 +- front/salix/styles/misc.scss | 4 ++-- front/salix/styles/order-product.scss | 8 +++---- modules/claim/front/detail/style.scss | 2 +- modules/claim/front/photos/style.scss | 4 ++-- modules/client/front/sample/create/style.scss | 2 +- modules/item/front/fetched-tags/style.scss | 2 +- modules/item/front/summary/style.scss | 4 ++-- modules/item/front/waste/style.scss | 2 +- modules/order/front/catalog/style.scss | 2 +- modules/order/front/prices-popover/style.scss | 2 +- modules/order/front/summary/style.scss | 2 +- modules/ticket/front/sale/style.scss | 4 ++-- modules/ticket/front/summary/style.scss | 2 +- 33 files changed, 63 insertions(+), 64 deletions(-) diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss index 4969ea60b4..8cdb2e8f74 100644 --- a/front/core/components/button/style.scss +++ b/front/core/components/button/style.scss @@ -34,7 +34,7 @@ & > vn-icon { vertical-align: middle; color: inherit; - font-size: 27px; + font-size: 1.68rem; } } &.colored { @@ -88,19 +88,19 @@ } &.xs { - font-size: 8px; + font-size: .5rem; } &.sm { - font-size: 11px; + font-size: .7rem; } &.md { - font-size: 14px; + font-size: .875rem; } &.lg { - font-size: 19px; + font-size: 1.2rem; } } &.disabled { diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index 80964f5d89..c686e1c9ca 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -25,7 +25,7 @@ margin-bottom: 8px; padding: 8px 0; font-weight: bold; - font-size: 12px; + font-size: .75rem; text-align: center; & > section { diff --git a/front/core/components/data-viewer/style.scss b/front/core/components/data-viewer/style.scss index 0dc05c6d1f..bb2cc2a834 100644 --- a/front/core/components/data-viewer/style.scss +++ b/front/core/components/data-viewer/style.scss @@ -9,6 +9,6 @@ vn-data-viewer { padding: 24px; box-sizing: border-box; color: $color-font-secondary; - font-size: 22px; + font-size: 1.375rem; } } \ No newline at end of file diff --git a/front/core/components/debug-info/style.scss b/front/core/components/debug-info/style.scss index 13c04dcae7..b6171d4da8 100644 --- a/front/core/components/debug-info/style.scss +++ b/front/core/components/debug-info/style.scss @@ -28,7 +28,7 @@ vn-debug-info { & > li { margin-top: 3px; - font-size: 15px; + font-size: .94rem; & > span { padding: 1px 3px; diff --git a/front/core/components/drop-down/style.scss b/front/core/components/drop-down/style.scss index 2c1f65c438..085f94c976 100755 --- a/front/core/components/drop-down/style.scss +++ b/front/core/components/drop-down/style.scss @@ -25,7 +25,7 @@ color: #888; border-radius: 50%; background-color: rgba(255, 255, 255, .8); - font-size: 18px; + font-size: 1.125rem; &:hover { color: $color-font; diff --git a/front/core/components/field/style.scss b/front/core/components/field/style.scss index 77d77e872f..5f77e904ee 100644 --- a/front/core/components/field/style.scss +++ b/front/core/components/field/style.scss @@ -135,7 +135,7 @@ align-items: center; & > vn-icon { - font-size: 24px; + font-size: 1.5rem; } } & > .prepend > prepend { @@ -248,7 +248,7 @@ top: 5px; color: $color-primary; padding: 0; - font-size: 12px; + font-size: .75rem; } & > .control > * { &[type=time], @@ -298,7 +298,7 @@ padding: 4px 0; height: 12px; color: rgba(0, 0, 0, .4); - font-size: 12px; + font-size: .75rem; transform: translateY(-12px); transition-property: opacity, transform, color; transition-duration: 200ms; diff --git a/front/core/components/icon/style.scss b/front/core/components/icon/style.scss index 07a1584e35..ad402be1bc 100644 --- a/front/core/components/icon/style.scss +++ b/front/core/components/icon/style.scss @@ -1,6 +1,6 @@ vn-icon { display: inline-block; - font-size: 18pt; + font-size: 1.5rem; text-align: center; outline: 0; diff --git a/front/core/components/label-value/style.scss b/front/core/components/label-value/style.scss index d0fd19b3d2..10f3c016c7 100644 --- a/front/core/components/label-value/style.scss +++ b/front/core/components/label-value/style.scss @@ -4,6 +4,6 @@ vn-label-value > section { & > vn-icon { vertical-align: middle; color: $color-font-secondary; - font-size: 19px + font-size: 1.2rem } } \ No newline at end of file diff --git a/front/core/components/list/style.scss b/front/core/components/list/style.scss index b1b6dcf489..fdadf460bf 100644 --- a/front/core/components/list/style.scss +++ b/front/core/components/list/style.scss @@ -76,7 +76,7 @@ vn-item, margin-right: $spacing-md; & > .vn-icon { - font-size: 19px; + font-size: 1.2rem; } } &[side] { diff --git a/front/core/components/range/style.scss b/front/core/components/range/style.scss index bc53149556..2a894492e2 100644 --- a/front/core/components/range/style.scss +++ b/front/core/components/range/style.scss @@ -37,7 +37,7 @@ .vn-range { & > label { - font-size: 12px; + font-size: .75rem; &.main { color: $color-button; diff --git a/front/core/styles/font-family.scss b/front/core/styles/font-family.scss index b461917cec..db41ad7505 100644 --- a/front/core/styles/font-family.scss +++ b/front/core/styles/font-family.scss @@ -21,7 +21,7 @@ font-family: 'Material Icons'; font-weight: normal; font-style: normal; - font-size: 24px; /* Preferred icon size */ + font-size: 1.5rem; /* Preferred icon size */ display: inline-block; line-height: 1; text-transform: none; diff --git a/front/core/styles/responsive.scss b/front/core/styles/responsive.scss index 735114cd80..3e16cf128c 100644 --- a/front/core/styles/responsive.scss +++ b/front/core/styles/responsive.scss @@ -1,5 +1,5 @@ @import "variables"; - +/* // Desktop - Laptop 1360x768 @media (max-resolution: 119dpi) and (min-device-width: 1340px) and (max-device-width: 1899px) { @@ -47,8 +47,7 @@ { html { font-size: 11pt; } } - -html { font-size: 9pt; } +*/ .vn-hide-narrow { @media (max-width: $mobile-width) { diff --git a/front/core/styles/text.scss b/front/core/styles/text.scss index 31dda34ec1..751a5594b1 100644 --- a/front/core/styles/text.scss +++ b/front/core/styles/text.scss @@ -3,40 +3,40 @@ /* Headings */ .text-h1, h1 { - font-size: 32pt; + font-size: 2.3rem; } .text-h2, h2 { - font-size: 28pt; + font-size: 2.25rem; } .text-h3, h3 { - font-size: 24pt; + font-size: 2rem; } .text-h4, h4 { - font-size: 20pt; + font-size: 1.6rem; } .text-h5, h5 { - font-size: 16pt; + font-size: 1.3rem; } .text-h6, h6 { - font-size: 14pt; + font-size: 1.125rem; } .text-subtitle1 { - font-size: 13pt; + font-size: 1.06rem; } .text-subtitle2 { - font-size: 12pt; + font-size: 1rem; } .text-body1 { - font-size: 11pt; + font-size: .875rem; } .text-body2 { - font-size: 11pt; + font-size: .875rem; } .text-caption { - font-size: 11pt; + font-size: .875rem; } .text-overline { - font-size: 10pt; + font-size: .8rem; } h1, h2, h3, h4, h5, h6 { diff --git a/front/core/styles/variables.scss b/front/core/styles/variables.scss index 5401ac5b6b..0958c88b81 100644 --- a/front/core/styles/variables.scss +++ b/front/core/styles/variables.scss @@ -1,9 +1,9 @@ @import "./util"; +$font-size: 12pt; $menu-width: 256px; $topbar-height: 56px; $mobile-width: 800px; -$font-size: 1rem; // Width diff --git a/front/salix/components/descriptor/style.scss b/front/salix/components/descriptor/style.scss index c473571311..a048c12b39 100644 --- a/front/salix/components/descriptor/style.scss +++ b/front/salix/components/descriptor/style.scss @@ -26,7 +26,7 @@ padding: 10px; } vn-icon { - font-size: 28px; + font-size: 1.75rem; } } } @@ -51,7 +51,7 @@ & > vn-icon { padding: $spacing-sm; color: $color-marginal; - font-size: 24px; + font-size: 1.5rem; &.bright { color: $color-main; @@ -70,7 +70,7 @@ margin: 0 $spacing-sm; & > vn-icon { - font-size: 28px; + font-size: 1.75rem; padding: 0; } } diff --git a/front/salix/components/home/style.scss b/front/salix/components/home/style.scss index dac9d422e7..7524d2be35 100644 --- a/front/salix/components/home/style.scss +++ b/front/salix/components/home/style.scss @@ -41,17 +41,17 @@ vn-home { & > vn-icon { display: block; - font-size: 56px; + font-size: 3.5rem; } } & > span { - font-size: 14px; + font-size: .875rem; text-align: center; } & > h4 { max-width: 100%; text-align: center; - font-size: 12pt; + font-size: 1rem; overflow: hidden; color: inherit; margin: 0; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index f65f511d10..61f451f06f 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -28,7 +28,7 @@ vn-layout { display: block; } & > .main-title { - font-size: 25px; + font-size: 1.56rem; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; @@ -166,6 +166,6 @@ vn-layout { } } #user { - font-size: 24px; + font-size: 1.5rem; height: auto; } diff --git a/front/salix/components/login/style.scss b/front/salix/components/login/style.scss index b8a81ef2d2..8ebf2a68c5 100644 --- a/front/salix/components/login/style.scss +++ b/front/salix/components/login/style.scss @@ -7,7 +7,7 @@ vn-login { margin: 0; padding: 0; color: $color-font; - font-size: 17px; + font-size: 1.1rem; font-weight: normal; background-color: $color-bg-dark; display: flex; diff --git a/front/salix/components/summary/style.scss b/front/salix/components/summary/style.scss index 8d302af4ac..5c53eea957 100644 --- a/front/salix/components/summary/style.scss +++ b/front/salix/components/summary/style.scss @@ -25,7 +25,7 @@ h4 { margin-bottom: $spacing-md; text-transform: uppercase; - font-size: 15pt; + font-size: 1.25rem; line-height: 1; padding: 7px; padding-bottom: 4px; /* Bottom line-height fix */ diff --git a/front/salix/components/user-popover/style.scss b/front/salix/components/user-popover/style.scss index cb1cc08a0f..5f17ed293b 100644 --- a/front/salix/components/user-popover/style.scss +++ b/front/salix/components/user-popover/style.scss @@ -8,7 +8,7 @@ align-items: center; & > vn-icon { - font-size: 80px; + font-size: 5rem; color: $color-font-bg-marginal; } & > div { diff --git a/front/salix/styles/misc.scss b/front/salix/styles/misc.scss index 453e362946..55de5eb0c2 100644 --- a/front/salix/styles/misc.scss +++ b/front/salix/styles/misc.scss @@ -57,7 +57,7 @@ vn-bg-title { text-align: center; padding: 16px; color: gray; - font-size: 20px; + font-size: 1.25rem; } .totalBox { border: 1px solid #CCC; @@ -115,7 +115,7 @@ html [scrollable] { @extend %active; &.small { - font-size: 11px + font-size: .7rem } } diff --git a/front/salix/styles/order-product.scss b/front/salix/styles/order-product.scss index fe73a03156..cc22760638 100644 --- a/front/salix/styles/order-product.scss +++ b/front/salix/styles/order-product.scss @@ -57,12 +57,12 @@ height: 48px; & > vn-label-value { - font-size: 12px; + font-size: .75rem; } } } .footer { - font-size: 12px; + font-size: .75rem; & > .price { overflow: hidden; @@ -77,7 +77,7 @@ &:first-child, &:last-child { - font-size: 22px; + font-size: 1.375rem; } } @@ -87,7 +87,7 @@ } & > .priceKg { color: $color-font-secondary; - font-size: 12px; + font-size: .75rem; } } } diff --git a/modules/claim/front/detail/style.scss b/modules/claim/front/detail/style.scss index 45e455ba14..63d6e2e04b 100644 --- a/modules/claim/front/detail/style.scss +++ b/modules/claim/front/detail/style.scss @@ -14,7 +14,7 @@ } .simulatorTitle { margin-bottom: 0; - font-size: 12px; + font-size: .75rem; color: $color-main; } vn-label-value { diff --git a/modules/claim/front/photos/style.scss b/modules/claim/front/photos/style.scss index c17ce1523e..d747dd9b8b 100644 --- a/modules/claim/front/photos/style.scss +++ b/modules/claim/front/photos/style.scss @@ -12,11 +12,11 @@ vn-claim-photos { .empty-rows { padding: 80px $spacing-md; - font-size: 22px + font-size: 1.375rem } vn-icon { - font-size: 48px + font-size: 3rem } } diff --git a/modules/client/front/sample/create/style.scss b/modules/client/front/sample/create/style.scss index 288471be19..b6cb688b5d 100644 --- a/modules/client/front/sample/create/style.scss +++ b/modules/client/front/sample/create/style.scss @@ -16,7 +16,7 @@ div.vn-dialog { } footer p { - font-size: 10px !important; + font-size: .625rem !important; line-height: 10px; } } diff --git a/modules/item/front/fetched-tags/style.scss b/modules/item/front/fetched-tags/style.scss index 854d390db6..393c176519 100644 --- a/modules/item/front/fetched-tags/style.scss +++ b/modules/item/front/fetched-tags/style.scss @@ -31,7 +31,7 @@ vn-fetched-tags { color: $color-font-secondary; margin-left: 6px; text-align: center; - font-size: 12px; + font-size: .75rem; height: 20px; padding: 1px; border-radius: 1px; diff --git a/modules/item/front/summary/style.scss b/modules/item/front/summary/style.scss index 2b28ed3757..7d5e3b6099 100644 --- a/modules/item/front/summary/style.scss +++ b/modules/item/front/summary/style.scss @@ -12,7 +12,7 @@ vn-item-summary { color: $color-font-dark; p { - font-size: 12px; + font-size: .75rem; text-align: center; margin: 0; @@ -21,7 +21,7 @@ vn-item-summary { line-height: 1; } &:last-child { - font-size: 24px; + font-size: 1.5rem; font-weight: bold; } } diff --git a/modules/item/front/waste/style.scss b/modules/item/front/waste/style.scss index 58cf0b1d12..55a6eb2ef9 100644 --- a/modules/item/front/waste/style.scss +++ b/modules/item/front/waste/style.scss @@ -4,7 +4,7 @@ vn-item-waste { .header { margin-bottom: 16px; text-transform: uppercase; - font-size: 15pt; + font-size: 1.25rem; line-height: 1; padding: 7px; padding-bottom: 7px; diff --git a/modules/order/front/catalog/style.scss b/modules/order/front/catalog/style.scss index fa41098d24..9ffe81dfb7 100644 --- a/modules/order/front/catalog/style.scss +++ b/modules/order/front/catalog/style.scss @@ -34,7 +34,7 @@ vn-order-catalog vn-side-menu div { color: #FFF } & > i:before { - font-size: 32pt; + font-size: 2.6rem; width: 16px; height: 16px; } diff --git a/modules/order/front/prices-popover/style.scss b/modules/order/front/prices-popover/style.scss index 4ce8dd2f93..edd2d1513f 100644 --- a/modules/order/front/prices-popover/style.scss +++ b/modules/order/front/prices-popover/style.scss @@ -19,7 +19,7 @@ } .price-kg { color: $color-font-secondary; - font-size: 12px + font-size: .75rem } .vn-input-number { width: 56px; diff --git a/modules/order/front/summary/style.scss b/modules/order/front/summary/style.scss index 140ca9b7ba..a0ed56d426 100644 --- a/modules/order/front/summary/style.scss +++ b/modules/order/front/summary/style.scss @@ -12,7 +12,7 @@ vn-order-summary .summary{ padding: 8px !important; & > p { - font-size: 19px; + font-size: 1.2rem; margin: 3px; } } diff --git a/modules/ticket/front/sale/style.scss b/modules/ticket/front/sale/style.scss index e6486caaa4..142c722953 100644 --- a/modules/ticket/front/sale/style.scss +++ b/modules/ticket/front/sale/style.scss @@ -19,7 +19,7 @@ vn-ticket-sale { padding: 8px !important; & > p { - font-size: 19px; + font-size: 1.2rem; margin: 3px; } } @@ -97,7 +97,7 @@ vn-ticket-sale { p.simulatorTitle { margin-bottom: 0; - font-size: 12px; + font-size: .75rem; color: $color-main; } vn-label-value { diff --git a/modules/ticket/front/summary/style.scss b/modules/ticket/front/summary/style.scss index 05bb366b98..d92121194a 100644 --- a/modules/ticket/front/summary/style.scss +++ b/modules/ticket/front/summary/style.scss @@ -40,7 +40,7 @@ vn-ticket-summary .summary { padding: 8px; & > p { - font-size: 19px; + font-size: 1.2rem; margin: 3px; } } From d75b975b141955ad14d2ba688b3b4abc32121ac6 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 16:29:13 +0200 Subject: [PATCH 26/53] SCSS em to px: last refactor fixes --- front/core/components/button/style.scss | 9 ++++----- front/core/components/calendar/style.scss | 10 +++++----- front/core/components/dialog/style.scss | 2 +- front/core/components/icon/style.scss | 2 +- front/salix/components/layout/style.scss | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/front/core/components/button/style.scss b/front/core/components/button/style.scss index 8cdb2e8f74..67c9b404f1 100644 --- a/front/core/components/button/style.scss +++ b/front/core/components/button/style.scss @@ -4,7 +4,7 @@ display: inline-flex; align-items: center; justify-content: center; - height: 44px; + height: 36px; border: none; border-radius: 1px; font-family: vn-font-bold; @@ -16,7 +16,7 @@ & > button { width: 100%; - padding: 0 16px; + padding: 0 12px; box-sizing: border-box; background-color: transparent; border: none; @@ -34,7 +34,6 @@ & > vn-icon { vertical-align: middle; color: inherit; - font-size: 1.68rem; } } &.colored { @@ -80,8 +79,8 @@ } &.round { border-radius: 50%; - height: 60px; - width: 60px; + height: 54px; + width: 54px; & > button > span { display: none; diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index c686e1c9ca..bb95faa793 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -25,7 +25,7 @@ margin-bottom: 8px; padding: 8px 0; font-weight: bold; - font-size: .75rem; + font-size: .8rem; text-align: center; & > section { @@ -41,7 +41,7 @@ & > .day { width: 14.28%; - height: 40px; + height: 42px; display: flex; justify-content: center; align-items: center; @@ -62,9 +62,9 @@ justify-content: center; align-items: center; border-radius: 50%; - font-size: .85rem; - width: 35px; - height: 35px; + font-size: .9rem; + width: 32px; + height: 32px; cursor: pointer; outline: 0; transition: background-color 300ms ease-in-out; diff --git a/front/core/components/dialog/style.scss b/front/core/components/dialog/style.scss index 7aa3d34ebb..e4884c362c 100644 --- a/front/core/components/dialog/style.scss +++ b/front/core/components/dialog/style.scss @@ -39,7 +39,7 @@ color: $color-button; font-family: vn-font-bold; padding: 11px; - margin: -1px; + margin: -11px; margin-left: 11px; } } diff --git a/front/core/components/icon/style.scss b/front/core/components/icon/style.scss index ad402be1bc..86345cbf44 100644 --- a/front/core/components/icon/style.scss +++ b/front/core/components/icon/style.scss @@ -1,6 +1,6 @@ vn-icon { display: inline-block; - font-size: 1.5rem; + font-size: 1.7em; text-align: center; outline: 0; diff --git a/front/salix/components/layout/style.scss b/front/salix/components/layout/style.scss index 61f451f06f..14af8ac23c 100644 --- a/front/salix/components/layout/style.scss +++ b/front/salix/components/layout/style.scss @@ -50,7 +50,7 @@ vn-layout { } .vn-button { color: inherit; - font-size: 1rem; + font-size: 1.05rem; padding: 0; } } From 81d50c92ae60edc75f7296610ce73707dbd6a6e2 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 17:06:07 +0200 Subject: [PATCH 27/53] SCSS em to px: Fixes --- front/core/components/calendar/style.scss | 6 +++--- front/core/components/chip/style.scss | 14 +++++++------- front/core/components/snackbar/style.scss | 4 ++-- front/salix/styles/order-product.scss | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/front/core/components/calendar/style.scss b/front/core/components/calendar/style.scss index bb95faa793..28c87793b2 100644 --- a/front/core/components/calendar/style.scss +++ b/front/core/components/calendar/style.scss @@ -41,7 +41,7 @@ & > .day { width: 14.28%; - height: 42px; + height: 40px; display: flex; justify-content: center; align-items: center; @@ -63,8 +63,8 @@ align-items: center; border-radius: 50%; font-size: .9rem; - width: 32px; - height: 32px; + width: 30px; + height: 30px; cursor: pointer; outline: 0; transition: background-color 300ms ease-in-out; diff --git a/front/core/components/chip/style.scss b/front/core/components/chip/style.scss index 17518df7d4..34ee947baa 100644 --- a/front/core/components/chip/style.scss +++ b/front/core/components/chip/style.scss @@ -8,7 +8,7 @@ vn-chip { margin: 4px; display: inline-flex; align-items: center; - height: 32px; + height: 28px; max-width: 100%; box-sizing: border-box; @@ -53,15 +53,15 @@ vn-chip { & > vn-avatar { margin-left: -11px; - margin-right: 4px; + margin-right: 6px; vertical-align: middle; - height: 32px; - width: 32px; + height: 28px; + width: 28px; } } & > vn-icon { - margin-right: 1px; - margin-left: -1px; + margin-right: 2px; + margin-left: -2px; vertical-align: middle; opacity: .6; cursor: pointer; @@ -76,6 +76,6 @@ vn-chip { vn-avatar { display: inline-block; - min-width: 32px; + min-width: 28px; border-radius: 50%; } \ No newline at end of file diff --git a/front/core/components/snackbar/style.scss b/front/core/components/snackbar/style.scss index e7ca1fba80..465c53851a 100644 --- a/front/core/components/snackbar/style.scss +++ b/front/core/components/snackbar/style.scss @@ -2,10 +2,10 @@ vn-snackbar #shapes { max-height: 330px; - margin-left: -200px; + margin-left: -160px; position: fixed; z-index: 100; - width: 400px; + width: 320px; left: 50%; bottom: 0 } diff --git a/front/salix/styles/order-product.scss b/front/salix/styles/order-product.scss index cc22760638..bd77144f2c 100644 --- a/front/salix/styles/order-product.scss +++ b/front/salix/styles/order-product.scss @@ -62,7 +62,7 @@ } } .footer { - font-size: .75rem; + font-size: .8rem; & > .price { overflow: hidden; From a33bbd428fbd2231b788ef8b6c5a18d04334e7ab Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Thu, 2 Apr 2020 18:55:07 +0200 Subject: [PATCH 28/53] E2E fixes --- e2e/helpers/extensions.js | 6 +++++- e2e/paths/02-client/04_edit_billing_data.spec.js | 8 +------- e2e/paths/02-client/07_edit_web_access.spec.js | 6 ++---- e2e/paths/02-client/13_log.spec.js | 3 +-- e2e/paths/05-ticket/17_log.spec.js | 1 - 5 files changed, 9 insertions(+), 15 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 59e98e2176..5ab02cfeaf 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -143,7 +143,11 @@ let actions = { }, state); if (nested) { - await this.waitToClick('vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]'); + let selector = 'vn-left-menu vn-item-section > vn-icon[icon=keyboard_arrow_down]'; + await this.evaluate(selector => { + document.querySelector(selector).scrollIntoViewIfNeeded(); + }, selector); + await this.waitToClick(selector); await this.wait('vn-left-menu .expanded'); } diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index 4c3e9cc1f8..b02c87de04 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -1,8 +1,7 @@ import selectors from '../../helpers/selectors'; import getBrowser from '../../helpers/puppeteer'; -// 2215 Don't work in windows -xdescribe('Client Edit billing data path', () => { +describe('Client Edit billing data path', () => { let browser; let page; beforeAll(async() => { @@ -33,10 +32,6 @@ xdescribe('Client Edit billing data path', () => { }); it(`should create a new BIC code`, async() => { - // XXX: Windows fix, entity code doesn't get the focus, so the text - // '9999' is written in entity name. - await page.waitFor(500); - await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); @@ -65,7 +60,6 @@ xdescribe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/02-client/07_edit_web_access.spec.js b/e2e/paths/02-client/07_edit_web_access.spec.js index f9b023716d..cbcc8723d1 100644 --- a/e2e/paths/02-client/07_edit_web_access.spec.js +++ b/e2e/paths/02-client/07_edit_web_access.spec.js @@ -27,10 +27,8 @@ describe('Client Edit web access path', () => { }); it('should confirm web access is now unchecked', async() => { - await page.waitToClick(selectors.clientBasicData.basicDataButton); - await page.wait(selectors.clientBasicData.name); - await page.waitToClick(selectors.clientsIndex.othersButton); - await page.waitToClick(selectors.clientWebAccess.webAccessButton); + await page.accessToSection('client.card.basicData'); + await page.accessToSection('client.card.webAccess'); const result = await page.checkboxState(selectors.clientWebAccess.enableWebAccessCheckbox); expect(result).toBe('unchecked'); diff --git a/e2e/paths/02-client/13_log.spec.js b/e2e/paths/02-client/13_log.spec.js index fc4b98b8b2..338083d8bd 100644 --- a/e2e/paths/02-client/13_log.spec.js +++ b/e2e/paths/02-client/13_log.spec.js @@ -26,8 +26,7 @@ describe('Client log path', () => { }); it('should navigate to the log section', async() => { - await page.waitToClick(selectors.clientLog.logButton); - await page.waitForState('client.card.log'); + await page.accessToSection('client.card.log'); }); it('should check the previous value of the last logged change', async() => { diff --git a/e2e/paths/05-ticket/17_log.spec.js b/e2e/paths/05-ticket/17_log.spec.js index c677d2e620..1ea7c9f265 100644 --- a/e2e/paths/05-ticket/17_log.spec.js +++ b/e2e/paths/05-ticket/17_log.spec.js @@ -34,7 +34,6 @@ describe('Ticket log path', () => { it('should navigate to the log section', async() => { await page.accessToSection('ticket.card.log'); - await page.waitForState('ticket.card.log'); }); it('should set the viewport width to 1920 to see the table full width', async() => { From aca687bafc60b63c5a388858410aec250263c0c9 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 3 Apr 2020 15:14:53 +0200 Subject: [PATCH 29/53] E2Efixes: E2E_DEBUG, client billing data skipped --- e2e/helpers/extensions.js | 2 +- e2e/helpers/puppeteer.js | 10 +++++++--- e2e/paths/02-client/04_edit_billing_data.spec.js | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index 5ab02cfeaf..28c5b4817a 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -351,7 +351,7 @@ let actions = { hideSnackbar: async function() { // Holds up for the snackbar to be visible for a small period of time. - if (process.env.DEBUG) + if (process.env.E2E_DEBUG) await this.waitFor(300); await this.evaluate(() => { diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 67f9da4270..02ef82b1b7 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -9,10 +9,14 @@ export async function getBrowser() { `--window-size=${ 1920 },${ 1080 }` ]; - if (process.env.DEBUG) - args.push('--auto-open-devtools-for-tabs'); + let env = process.env; - const headless = !(process.env.E2E_SHOW || process.env.DEBUG); + if (env.E2E_DEBUG) { + args.push('--auto-open-devtools-for-tabs'); + env.E2E_SHOW = true; + } + + const headless = !env.E2E_SHOW; const browser = await Puppeteer.launch({ args, defaultViewport: null, diff --git a/e2e/paths/02-client/04_edit_billing_data.spec.js b/e2e/paths/02-client/04_edit_billing_data.spec.js index b02c87de04..6e0465f1ff 100644 --- a/e2e/paths/02-client/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client/04_edit_billing_data.spec.js @@ -31,7 +31,8 @@ describe('Client Edit billing data path', () => { expect(snackbarMessage).toEqual('That payment method requires an IBAN'); }); - it(`should create a new BIC code`, async() => { + // 2215: Windows (hidden mode): Entity code doesn't get the focus, '9999' is written in entity name. + xit(`should create a new BIC code`, async() => { await page.waitToClick(selectors.clientBillingData.newBankEntityButton); await page.write(selectors.clientBillingData.newBankEntityName, 'Gotham City Bank'); await page.write(selectors.clientBillingData.newBankEntityCode, '9999'); @@ -43,7 +44,7 @@ describe('Client Edit billing data path', () => { expect(newcode).toEqual('GTHMCT Gotham City Bank'); }); - it(`should confirm the IBAN pay method was sucessfully saved`, async() => { + xit(`should confirm the IBAN pay method was sucessfully saved`, async() => { let payMethod = await page.waitToGetProperty(selectors.clientBillingData.payMethod, 'value'); expect(payMethod).toEqual('PayMethod with IBAN'); From ea1cc68d293ff391716cf3fc33f6657fb21eef18 Mon Sep 17 00:00:00 2001 From: jgallego Date: Fri, 3 Apr 2020 17:52:47 +0200 Subject: [PATCH 30/53] test passed --- .gitignore | 1 + back/methods/dms/checkRole.js | 12 ----- back/methods/dms/downloadFile.js | 10 ++-- back/methods/dms/getFile.js | 29 ---------- back/methods/dms/specs/downloadFile.spec.js | 4 +- back/models/dms.js | 31 +++++++++++ back/models/specs/dms.spec.js | 53 +++++++++++++++++++ db/changes/10170-NOFallas/00-aclWorkerDms.sql | 5 ++ db/dump/fixtures.sql | 17 +++--- e2e/dms/a87/4.txt | 1 + .../back/methods/worker-dms/downloadFile.js | 40 ++++++++++++++ .../worker/back/methods/worker-dms/filter.js | 53 +++++++++++++++++++ .../worker-dms/specs/downloadFile.spec.js | 27 ++++++++++ modules/worker/back/methods/worker/filter.js | 1 - modules/worker/back/models/worker-dms.js | 14 ++++- modules/worker/front/dms/index/index.html | 27 +++++----- modules/worker/front/routes.json | 2 +- 17 files changed, 254 insertions(+), 73 deletions(-) delete mode 100644 back/methods/dms/checkRole.js delete mode 100644 back/methods/dms/getFile.js create mode 100644 back/models/specs/dms.spec.js create mode 100644 db/changes/10170-NOFallas/00-aclWorkerDms.sql create mode 100644 e2e/dms/a87/4.txt create mode 100644 modules/worker/back/methods/worker-dms/downloadFile.js create mode 100644 modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js diff --git a/.gitignore b/.gitignore index 8cb76a8292..f4b1ab2702 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ e2e/dms/*/ !e2e/dms/c4c !e2e/dms/c81 !e2e/dms/ecc +!e2e/dms/a87 npm-debug.log .eslintcache datasources.*.json diff --git a/back/methods/dms/checkRole.js b/back/methods/dms/checkRole.js deleted file mode 100644 index b8beed3cb7..0000000000 --- a/back/methods/dms/checkRole.js +++ /dev/null @@ -1,12 +0,0 @@ -const UserError = require('vn-loopback/util/user-error'); - -checkRole = async function(ctx, id) { - const models = Self.app.models; - const dms = await Self.findById(id); - - const hasReadRole = await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); - if (!hasReadRole) - throw new UserError(`You don't have enough privileges`); - - return true; -}; diff --git a/back/methods/dms/downloadFile.js b/back/methods/dms/downloadFile.js index 6f0d379aa1..1b91500536 100644 --- a/back/methods/dms/downloadFile.js +++ b/back/methods/dms/downloadFile.js @@ -1,7 +1,4 @@ - -const checkRole = require('./checkRole'); -const getfile = require('./getfile'); - +const UserError = require('vn-loopback/util/user-error'); module.exports = Self => { Self.remoteMethodCtx('downloadFile', { description: 'Download a document', @@ -36,7 +33,8 @@ module.exports = Self => { }); Self.downloadFile = async function(ctx, id) { - await checkRole(ctx, id); - return await getfile(ctx, id); + if (!await Self.checkRole(ctx, id)) + throw new UserError(`You don't have enough privileges`); + return await Self.getFile(id); }; }; diff --git a/back/methods/dms/getFile.js b/back/methods/dms/getFile.js deleted file mode 100644 index 5c1000b69d..0000000000 --- a/back/methods/dms/getFile.js +++ /dev/null @@ -1,29 +0,0 @@ -const UserError = require('vn-loopback/util/user-error'); - -getFile = async function(ctx, id) { - const storageConnector = Self.app.dataSources.storage.connector; - const models = Self.app.models; - const dms = await Self.findById(id); - - const hasReadRole = await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); - if (!hasReadRole) - - throw new UserError(`You don't have enough privileges`); - - const pathHash = storageConnector.getPathHash(dms.id); - try { - await models.Container.getFile(pathHash, dms.file); - } catch (e) { - if (e.code != 'ENOENT') - throw e; - - const error = new UserError(`File doesn't exists`); - error.statusCode = 404; - - throw error; - } - - const stream = models.Container.downloadStream(pathHash, dms.file); - - return [stream, dms.contentType, `filename="${dms.file}"`]; -}; diff --git a/back/methods/dms/specs/downloadFile.spec.js b/back/methods/dms/specs/downloadFile.spec.js index 43969fc1f0..701a484dff 100644 --- a/back/methods/dms/specs/downloadFile.spec.js +++ b/back/methods/dms/specs/downloadFile.spec.js @@ -1,6 +1,6 @@ const app = require('vn-loopback/server/server'); -fdescribe('dms downloadFile()', () => { +describe('dms downloadFile()', () => { let dmsId = 1; it('should return a response for an employee with text content-type', async() => { @@ -11,7 +11,7 @@ fdescribe('dms downloadFile()', () => { expect(result[1]).toEqual('text/plain'); }); - it(`should return an error for a user without enough privileges`, async() => { + it('should return an error for a user without enough privileges', async() => { let clientId = 101; let ctx = {req: {accessToken: {userId: clientId}}}; diff --git a/back/models/dms.js b/back/models/dms.js index 9a06928dbe..8be539a0ff 100644 --- a/back/models/dms.js +++ b/back/models/dms.js @@ -1,6 +1,37 @@ +const UserError = require('vn-loopback/util/user-error'); + module.exports = Self => { require('../methods/dms/downloadFile')(Self); require('../methods/dms/uploadFile')(Self); require('../methods/dms/removeFile')(Self); require('../methods/dms/updateFile')(Self); + + Self.checkRole = async function(ctx, id) { + const models = Self.app.models; + const dms = await Self.findById(id); + + return await models.DmsType.hasReadRole(ctx, dms.dmsTypeFk); + }; + + Self.getFile = async function(id) { + const storageConnector = Self.app.dataSources.storage.connector; + const models = Self.app.models; + const dms = await Self.findById(id); + const pathHash = storageConnector.getPathHash(dms.id); + try { + await models.Container.getFile(pathHash, dms.file); + } catch (e) { + if (e.code != 'ENOENT') + throw e; + + const error = new UserError(`File doesn't exists`); + error.statusCode = 404; + + throw error; + } + + const stream = models.Container.downloadStream(pathHash, dms.file); + + return [stream, dms.contentType, `filename="${dms.file}"`]; + }; }; diff --git a/back/models/specs/dms.spec.js b/back/models/specs/dms.spec.js new file mode 100644 index 0000000000..8e76a4956a --- /dev/null +++ b/back/models/specs/dms.spec.js @@ -0,0 +1,53 @@ +const app = require('vn-loopback/server/server'); +describe('Dms', () => { + const Dms = app.models.Dms; + + describe('getFile()', () => { + it('should return a response with text content-type', async() => { + const result = await Dms.getFile(1); + + expect(result[1]).toEqual('text/plain'); + }); + + it('should return an error for a file does not exists', async() => { + let error = {}; + try { + await Dms.getFile(6); + } catch (e) { + error = e; + } + + expect(error.statusCode).toBe(404); + }); + + it('should return an error for a record does not exists', async() => { + let error = {}; + try { + await app.models.Dms.getFile('NotExistentId'); + } catch (e) { + error = e; + } + + expect(error.statusCode).not.toBe(404); + expect(error).toEqual(jasmine.any(Error)); + }); + }); + + describe('checkRole()', () => { + const dmsId = 1; + it('should return a true for an employee with permission', async() => { + let ctx = {req: {accessToken: {userId: 107}}}; + const result = await Dms.checkRole(ctx, dmsId); + + expect(result).toBeTruthy(); + }); + + it('should return false for an employee without permission', async() => { + let ctx = {req: {accessToken: {userId: 101}}}; + const result = await Dms.checkRole(ctx, dmsId); + + expect(result).toBeFalsy(); + }); + }); +}); + diff --git a/db/changes/10170-NOFallas/00-aclWorkerDms.sql b/db/changes/10170-NOFallas/00-aclWorkerDms.sql new file mode 100644 index 0000000000..46e56f77e8 --- /dev/null +++ b/db/changes/10170-NOFallas/00-aclWorkerDms.sql @@ -0,0 +1,5 @@ +INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) +VALUES +('WorkerDms', 'filter', 'READ', 'ALLOW', 'ROLE', 'employee'), +('WorkerDms', 'downloadFile', 'READ', 'ALLOW', 'ROLE', 'employee'); +DELETE FROM `salix`.`ACL` WHERE (`id` = '205'); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index effd1a3482..e7cd2f3b19 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1953,11 +1953,13 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`, `c INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`) VALUES - (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), - (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), - (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), - (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), - (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()); + (1, 14, '1.txt', 'text/plain', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()), + (2, 5, '2.txt', 'text/plain', 5, 1, 442, 1, TRUE, 'Client:104', 'Client:104 dms for the client', CURDATE()), + (3, 5, '3.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Client: 104', 'Client:104 readme', CURDATE()), + (4, 3, '4.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'Worker: 106', 'Worker:106 readme', CURDATE()), + (5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', CURDATE()), + (6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', CURDATE()); + INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`) VALUES @@ -1968,9 +1970,10 @@ INSERT INTO `vn`.`clientDms`(`clientFk`, `dmsFk`) (104, 2), (104, 3); -INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`) +INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker`) VALUES - (1, 106, 4); + (1, 106, 4, TRUE), + (2, 107, 3, FALSE); INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`) VALUES diff --git a/e2e/dms/a87/4.txt b/e2e/dms/a87/4.txt new file mode 100644 index 0000000000..a46bfbeda2 --- /dev/null +++ b/e2e/dms/a87/4.txt @@ -0,0 +1 @@ +File: 4.txt. It works! \ No newline at end of file diff --git a/modules/worker/back/methods/worker-dms/downloadFile.js b/modules/worker/back/methods/worker-dms/downloadFile.js new file mode 100644 index 0000000000..cc8653e0e5 --- /dev/null +++ b/modules/worker/back/methods/worker-dms/downloadFile.js @@ -0,0 +1,40 @@ +const UserError = require('vn-loopback/util/user-error'); +module.exports = Self => { + Self.remoteMethodCtx('downloadFile', { + description: 'Download a worker document', + accessType: 'READ', + accepts: [ + { + arg: 'id', + type: 'Number', + description: 'The document id', + http: {source: 'path'} + } + ], + returns: [ + { + arg: 'body', + type: 'file', + root: true + }, { + arg: 'Content-Type', + type: 'String', + http: {target: 'header'} + }, { + arg: 'Content-Disposition', + type: 'String', + http: {target: 'header'} + } + ], + http: { + path: `/:id/downloadFile`, + verb: 'GET' + } + }); + + Self.downloadFile = async function(ctx, id) { + if (!await Self.app.models.Dms.checkRole(ctx, id) && !await Self.isMine(ctx, id)) + throw new UserError(`You don't have enough privileges`); + return await Self.app.models.Dms.getFile(id); + }; +}; diff --git a/modules/worker/back/methods/worker-dms/filter.js b/modules/worker/back/methods/worker-dms/filter.js index e69de29bb2..553cf2a25b 100644 --- a/modules/worker/back/methods/worker-dms/filter.js +++ b/modules/worker/back/methods/worker-dms/filter.js @@ -0,0 +1,53 @@ +const ParameterizedSQL = require('loopback-connector').ParameterizedSQL; + +module.exports = Self => { + Self.remoteMethodCtx('filter', { + description: 'Find all instances of the model matched by filter from the data source.', + accessType: 'READ', + accepts: [ + { + arg: 'filter', + type: 'Object', + description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string', + http: {source: 'query'} + } + ], + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/filter`, + verb: 'GET' + } + }); + + Self.filter = async(ctx, filter) => { + const conn = Self.dataSource.connector; + const userId = ctx.req.accessToken.userId; + + const account = await Self.app.models.Account.findById(userId); + const stmt = new ParameterizedSQL( + `SELECT d.id dmsFk, d.reference, d.description, d.file, d.created + FROM workerDocument wd + JOIN dms d ON d.id = wd.document + JOIN dmsType dt ON dt.id = d.dmsTypeFk + LEFT JOIN account.roleRole rr ON rr.inheritsFrom = dt.readRoleFk AND rr.role = ? + `, [account.roleFk] + ); + const oldWhere = filter.where; + const yourOwnDms = {and: [{isReadableByWorker: true}, {worker: userId}]}; + + filter.where = { + and: [{ + or: [yourOwnDms, { + role: { + neq: null + } + }] + }, oldWhere]}; + stmt.merge(conn.makeSuffix(filter)); + + return await conn.executeStmt(stmt); + }; +}; diff --git a/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js b/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js new file mode 100644 index 0000000000..27ed204add --- /dev/null +++ b/modules/worker/back/methods/worker-dms/specs/downloadFile.spec.js @@ -0,0 +1,27 @@ +const app = require('vn-loopback/server/server'); + +describe('worker-dms downloadFile()', () => { + let dmsId = 4; + + it('should return a response for an employee with text content-type', async() => { + let workerId = 106; + let ctx = {req: {accessToken: {userId: workerId}}}; + const result = await app.models.WorkerDms.downloadFile(ctx, dmsId); + + expect(result[1]).toEqual('text/plain'); + }); + + it('should return an error for a user without enough privileges', async() => { + let clientId = 1; + let ctx = {req: {accessToken: {userId: clientId}}}; + + let error; + try { + await app.models.WorkerDms.downloadFile(ctx, dmsId); + } catch (e) { + error = e; + } + + expect(error).toBeDefined(); + }); +}); diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index 21462eb426..d08b27a184 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -125,7 +125,6 @@ module.exports = Self => { LEFT JOIN account.emailUser mu ON mu.userFk = u.id` ); - stmt.merge(conn.makeSuffix(filter)); let itemsIndex = stmts.push(stmt) - 1; diff --git a/modules/worker/back/models/worker-dms.js b/modules/worker/back/models/worker-dms.js index c81ec1560e..4b862a81e3 100644 --- a/modules/worker/back/models/worker-dms.js +++ b/modules/worker/back/models/worker-dms.js @@ -1,5 +1,17 @@ module.exports = Self => { + require('../methods/worker-dms/downloadFile')(Self); require('../methods/worker-dms/removeFile')(Self); require('../methods/worker-dms/allowedContentTypes')(Self); - // require('../methods/worker-dms/filter')(Self); + require('../methods/worker-dms/filter')(Self); + + Self.isMine = async function(ctx, dmsId) { + const myUserId = ctx.req.accessToken.userId; + let workerDms = await Self.findOne({ + where: { + workerFk: myUserId, + dmsFk: dmsId + } + }); + return workerDms !== null; + }; }; diff --git a/modules/worker/front/dms/index/index.html b/modules/worker/front/dms/index/index.html index 6db8247874..1bf1af61ec 100644 --- a/modules/worker/front/dms/index/index.html +++ b/modules/worker/front/dms/index/index.html @@ -1,8 +1,7 @@ {{::document.dmsFk}} - - - {{::document.dms.reference}} + + + {{::document.reference}} - - {{::document.dms.description}} + + {{::document.description}} - + {{::document.dms.file}} + href="api/workerDms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.vnToken.token}}">{{::document.file}} - {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}} + {{::document.created | date:'dd/MM/yyyy HH:mm'}} + href="api/workerDms/{{::document.dmsFk}}/downloadFile?access_token={{::$ctrl.vnToken.token}}"> @@ -57,7 +56,7 @@ - @@ -78,7 +77,7 @@ - diff --git a/modules/worker/front/routes.json b/modules/worker/front/routes.json index 39ca155ed4..49156fc6d2 100644 --- a/modules/worker/front/routes.json +++ b/modules/worker/front/routes.json @@ -99,7 +99,7 @@ "state": "worker.card.dms.index", "component": "vn-worker-dms-index", "description": "My documentation", - "acl": ["hr"] + "acl": ["employee"] }, { "url": "/create", From d835dd60edaa721b1e9cfa03550aa587fd60eeee Mon Sep 17 00:00:00 2001 From: jgallego Date: Mon, 6 Apr 2020 12:40:21 +0200 Subject: [PATCH 31/53] =?UTF-8?q?2219=20A=C3=B1adir=20menu=20wikipedia?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salix/components/left-menu/left-menu.html | 15 +++++++++++-- front/salix/components/left-menu/left-menu.js | 21 ++++++++++++------- modules/worker/front/routes.json | 6 ++++++ 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/front/salix/components/left-menu/left-menu.html b/front/salix/components/left-menu/left-menu.html index 73488a24b7..7db36177ba 100644 --- a/front/salix/components/left-menu/left-menu.html +++ b/front/salix/components/left-menu/left-menu.html @@ -1,10 +1,11 @@