From d3406fecde63685b26648aa3f3d3fac8876693fa Mon Sep 17 00:00:00 2001 From: Joan Date: Tue, 4 Sep 2018 15:08:36 +0200 Subject: [PATCH] claim search-panel & connector-mysql fix date --- client/claim/src/index.js | 1 + client/claim/src/index/index.html | 4 +- client/claim/src/index/index.js | 18 +++++++ client/claim/src/search-panel/index.html | 54 +++++++++++++++++++ client/claim/src/search-panel/index.js | 7 +++ client/claim/src/search-panel/locale/es.yml | 7 +++ .../claim-module/01_edit_basic_data.spec.js | 23 ++++---- .../loopback/server/connectors/vn-mysql.js | 30 +++++------ 8 files changed, 114 insertions(+), 30 deletions(-) create mode 100644 client/claim/src/search-panel/index.html create mode 100644 client/claim/src/search-panel/index.js create mode 100644 client/claim/src/search-panel/locale/es.yml diff --git a/client/claim/src/index.js b/client/claim/src/index.js index e779cd595..74b6343ee 100644 --- a/client/claim/src/index.js +++ b/client/claim/src/index.js @@ -2,6 +2,7 @@ export * from './module'; import './index/'; import './card'; +import './search-panel'; import './detail'; import './descriptor'; import './basic-data'; diff --git a/client/claim/src/index/index.html b/client/claim/src/index/index.html index 907bab746..861697a4a 100644 --- a/client/claim/src/index/index.html +++ b/client/claim/src/index/index.html @@ -10,7 +10,7 @@
@@ -25,7 +25,6 @@ Client Created Worker - Observation State @@ -37,7 +36,6 @@ {{::claim.client.name}} {{::claim.created | date:'dd/MM/yyyy'}} {{::claim.worker.firstName}} {{::claim.worker.name}} - {{::claim.observation}} {{::claim.claimState.description}} +
+ + + + + + + + + + + + + {{description}} + + + {{firstName}} {{name}} + + + + + + + + + +
+
\ No newline at end of file diff --git a/client/claim/src/search-panel/index.js b/client/claim/src/search-panel/index.js new file mode 100644 index 000000000..c15bf4be9 --- /dev/null +++ b/client/claim/src/search-panel/index.js @@ -0,0 +1,7 @@ +import ngModule from '../module'; +import SearchPanel from 'core/src/components/searchbar/search-panel'; + +ngModule.component('vnClaimSearchPanel', { + template: require('./index.html'), + controller: SearchPanel +}); diff --git a/client/claim/src/search-panel/locale/es.yml b/client/claim/src/search-panel/locale/es.yml new file mode 100644 index 000000000..1f892a742 --- /dev/null +++ b/client/claim/src/search-panel/locale/es.yml @@ -0,0 +1,7 @@ +Ticket id: Id ticket +Client id: Id cliente +Nickname: Alias +From: Desde +To: Hasta +Agency: Agencia +Warehouse: Almacén \ No newline at end of file diff --git a/e2e/paths/claim-module/01_edit_basic_data.spec.js b/e2e/paths/claim-module/01_edit_basic_data.spec.js index 44ed03231..574b20c32 100644 --- a/e2e/paths/claim-module/01_edit_basic_data.spec.js +++ b/e2e/paths/claim-module/01_edit_basic_data.spec.js @@ -22,18 +22,17 @@ describe('Claim', () => { }); }); - // descomentar este test despues de completar la tarea #629 claim index buscador avanzado - // it('should search for the claim with id 1', () => { - // return nightmare - // .wait(selectors.claimsIndex.searchResult) - // .type(selectors.claimsIndex.searchClaimInput, '1') - // .click(selectors.claimsIndex.searchButton) - // .waitForNumberOfElements(selectors.claimsIndex.searchResult, 1) - // .countElement(selectors.claimsIndex.searchResult) - // .then(result => { - // expect(result).toEqual(1); - // }); - // }); + it('should search for the claim with id 1', () => { + return nightmare + .wait(selectors.claimsIndex.searchResult) + .type(selectors.claimsIndex.searchClaimInput, '1') + .click(selectors.claimsIndex.searchButton) + .waitForNumberOfElements(selectors.claimsIndex.searchResult, 1) + .countElement(selectors.claimsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); it(`should click on the search result to access to the ticket Basic Data`, () => { return nightmare diff --git a/services/loopback/server/connectors/vn-mysql.js b/services/loopback/server/connectors/vn-mysql.js index 0f63211c6..ead44653c 100644 --- a/services/loopback/server/connectors/vn-mysql.js +++ b/services/loopback/server/connectors/vn-mysql.js @@ -45,12 +45,14 @@ VnMySQL.prototype.toColumnValue = function(prop, val) { if (val == null || !prop || prop.type !== Date) return MySQL.prototype.toColumnValue.call(this, prop, val); + val = new Date(val); + return val.getFullYear() + '-' + - fillZeros(val.getMonth() + 1) + '-' + - fillZeros(val.getDate()) + ' ' + - fillZeros(val.getHours()) + ':' + - fillZeros(val.getMinutes()) + ':' + - fillZeros(val.getSeconds()); + fillZeros(val.getMonth() + 1) + '-' + + fillZeros(val.getDate()) + ' ' + + fillZeros(val.getHours()) + ':' + + fillZeros(val.getMinutes()) + ':' + + fillZeros(val.getSeconds()); function fillZeros(v) { return v < 10 ? '0' + v : v; @@ -96,7 +98,7 @@ VnMySQL.prototype._makeWhere = function(model, where) { } stmt.merge({ sql: branches.join(' ' + key.toUpperCase() + ' '), - params: branchParams, + params: branchParams }); whereStmts.push(stmt); continue; @@ -154,15 +156,13 @@ VnMySQL.prototype._makeWhere = function(model, where) { columnValue = self.toColumnValue(p, expression); if (columnValue === null) { stmt.merge(columnName + ' IS NULL'); + } else if (columnValue instanceof ParameterizedSQL) { + stmt.merge(columnName + '=').merge(columnValue); } else { - if (columnValue instanceof ParameterizedSQL) { - stmt.merge(columnName + '=').merge(columnValue); - } else { - stmt.merge({ - sql: columnName + '=?', - params: [columnValue], - }); - } + stmt.merge({ + sql: columnName + '=?', + params: [columnValue] + }); } } whereStmts.push(stmt); @@ -175,7 +175,7 @@ VnMySQL.prototype._makeWhere = function(model, where) { } var whereStmt = new ParameterizedSQL({ sql: sqls.join(' AND '), - params: params, + params: params }); return whereStmt; };