diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ede784f6f..42d05aafa 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -349,7 +349,7 @@ export default { firstSaleColour: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(1)`, firstSaleLength: `vn-ticket-sale vn-tr:nth-child(1) vn-td:nth-child(5) section:nth-child(3)`, firstSaleCheckbox: `vn-ticket-sale vn-tr:nth-child(1) vn-check[field="sale.checked"] label`, - secondSaleClaimId: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', + secondSaleClaimIcon: 'vn-ticket-sale > vn-vertical > vn-card > div > vn-vertical > vn-table > div > vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(2) > a > vn-icon', secondSaleColour: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(5) section:nth-child(5)`, secondSalePrice: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(7)`, secondSaleDiscount: `vn-ticket-sale vn-tr:nth-child(2) vn-td:nth-child(8)`, @@ -402,9 +402,7 @@ export default { addRequestButton: `vn-ticket-request-index > a > vn-float-button > button`, request: 'vn-ticket-request-index > form > vn-card > div > vn-horizontal > vn-table > div > vn-tbody > vn-tr', descriptionInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-textfield > div > div > div.infix > input`, - atenderSelect: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-autocomplete > div > div > input`, - atenderSelectFirstOption: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-autocomplete > vn-drop-down > vn-popover > div > div.content > div > div.list > ul > li:nth-child(1)`, - atenderSelectSecondOption: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(1) > vn-autocomplete > vn-drop-down > vn-popover > div > div.content > div > div.list > ul > li:nth-child(2)`, + atenderAutocomplete: `vn-ticket-request-create vn-autocomplete[field="$ctrl.ticketRequest.atenderFk"]`, quantityInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-textfield:nth-child(1) > div > div > div.infix > input`, priceInput: `vn-ticket-request-create > form > div > vn-card > div > vn-horizontal:nth-child(2) > vn-textfield:nth-child(2) > div > div > div.infix > input`, firstRemoveRequestButton: `vn-ticket-request-index vn-icon[icon="delete"]:nth-child(1)`, diff --git a/e2e/paths/claim-module/02_create_development.spec.js b/e2e/paths/claim-module/02_create_development.spec.js index 9b47f3fbe..d3cac011b 100644 --- a/e2e/paths/claim-module/02_create_development.spec.js +++ b/e2e/paths/claim-module/02_create_development.spec.js @@ -18,7 +18,7 @@ describe('Claim development', () => { .autocompleteSearch(selectors.claimDevelopment.secondClaimReasonAutocomplete, 'Baja calidad') .autocompleteSearch(selectors.claimDevelopment.secondClaimResultAutocomplete, 'Deshidratacion') .autocompleteSearch(selectors.claimDevelopment.secondClaimResponsibleAutocomplete, 'Calidad general') - .autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'delivery') + .autocompleteSearch(selectors.claimDevelopment.secondClaimWorkerAutocomplete, 'deliveryNick') .autocompleteSearch(selectors.claimDevelopment.secondClaimRedeliveryAutocomplete, 'Reparto') .waitToClick(selectors.claimDevelopment.saveDevelopmentButton) .waitForLastSnackbar(); @@ -31,7 +31,7 @@ describe('Claim development', () => { .autocompleteSearch(selectors.claimDevelopment.firstClaimReasonAutocomplete, 'Calor') .autocompleteSearch(selectors.claimDevelopment.firstClaimResultAutocomplete, 'Cocido') .autocompleteSearch(selectors.claimDevelopment.firstClaimResponsibleAutocomplete, 'Calidad general') - .autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistant') + .autocompleteSearch(selectors.claimDevelopment.firstClaimWorkerAutocomplete, 'adminAssistantNick') .autocompleteSearch(selectors.claimDevelopment.firstClaimRedeliveryAutocomplete, 'Cliente') .waitToClick(selectors.claimDevelopment.saveDevelopmentButton) .waitForLastSnackbar(); @@ -59,7 +59,7 @@ describe('Claim development', () => { expect(reason).toEqual('Calor'); expect(result).toEqual('Cocido'); expect(responsible).toEqual('Calidad general'); - expect(worker).toEqual('adminAssistant adminAssistant'); + expect(worker).toEqual('adminAssistantNick'); expect(redelivery).toEqual('Cliente'); }); @@ -82,7 +82,7 @@ describe('Claim development', () => { expect(reason).toEqual('Baja calidad'); expect(result).toEqual('Deshidratacion'); expect(responsible).toEqual('Calidad general'); - expect(worker).toEqual('delivery delivery'); + expect(worker).toEqual('deliveryNick'); expect(redelivery).toEqual('Reparto'); }); @@ -115,7 +115,7 @@ describe('Claim development', () => { expect(reason).toEqual('Prisas'); expect(result).toEqual('Otros daños'); expect(responsible).toEqual('Compradores'); - expect(worker).toEqual('manager manager'); + expect(worker).toEqual('managerNick'); expect(redelivery).toEqual('Cliente'); }); }); diff --git a/e2e/paths/client-module/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js index d1973410d..ddd1dc528 100644 --- a/e2e/paths/client-module/02_edit_basic_data.spec.js +++ b/e2e/paths/client-module/02_edit_basic_data.spec.js @@ -114,7 +114,7 @@ describe('Client Edit basicData path', () => { .write(selectors.clientBasicData.mobileInput, '987654321') .clearInput(selectors.clientBasicData.emailInput) .write(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') - .autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'Accessory') + .autocompleteSearch(selectors.clientBasicData.salesPersonAutocomplete, 'AccessoryNick') .autocompleteSearch(selectors.clientBasicData.channelAutocomplete, 'Metropolis newspaper') .waitToClick(selectors.clientBasicData.saveButton) .waitForLastSnackbar(); @@ -162,7 +162,7 @@ describe('Client Edit basicData path', () => { const result = await nightmare .waitToGetProperty(`${selectors.clientBasicData.salesPersonAutocomplete} input`, 'value'); - expect(result).toEqual('accessory accessory'); + expect(result).toEqual('accessoryNick'); }); it('should now confirm the channel have been selected', async() => { diff --git a/e2e/paths/ticket-module/07_edit_sale.spec.js b/e2e/paths/ticket-module/07_edit_sale.spec.js index 3a5feff15..1e1302ab8 100644 --- a/e2e/paths/ticket-module/07_edit_sale.spec.js +++ b/e2e/paths/ticket-module/07_edit_sale.spec.js @@ -13,7 +13,7 @@ describe('Ticket Edit sale path', () => { it(`should click on the second claim id to navigate over there`, async() => { const url = await nightmare - .waitToClick(selectors.ticketSales.secondSaleClaimId) + .waitToClick(selectors.ticketSales.secondSaleClaimIcon) .wait(selectors.claimBasicData.claimStateAutocomplete) .parsedUrl(); diff --git a/e2e/paths/ticket-module/10_ticket_request.spec.js b/e2e/paths/ticket-module/10_ticket_request.spec.js index a3ece83de..0a31cb75a 100644 --- a/e2e/paths/ticket-module/10_ticket_request.spec.js +++ b/e2e/paths/ticket-module/10_ticket_request.spec.js @@ -16,8 +16,7 @@ describe('Ticket purchase request path', () => { .waitToClick(selectors.ticketRequests.addRequestButton) .write(selectors.ticketRequests.descriptionInput, 'New stuff') .write(selectors.ticketRequests.quantityInput, 99) - .waitToClick(selectors.ticketRequests.atenderSelect) - .waitToClick(selectors.ticketRequests.atenderSelectSecondOption) + .autocompleteSearch(selectors.ticketRequests.atenderAutocomplete, 'buyerNick') .write(selectors.ticketRequests.priceInput, 999) .waitToClick(selectors.ticketRequests.saveButton) .waitForLastSnackbar(); diff --git a/modules/claim/back/methods/claim/getSummary.js b/modules/claim/back/methods/claim/getSummary.js index 04e12f937..ac57447b6 100644 --- a/modules/claim/back/methods/claim/getSummary.js +++ b/modules/claim/back/methods/claim/getSummary.js @@ -28,15 +28,39 @@ module.exports = Self => { let filter = { where: {id: id}, include: [ - {relation: 'worker', scope: {fields: ['name', 'firstName']}}, - {relation: 'claimState', scope: {fields: ['id', 'description']}}, + { + relation: 'worker', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } + }, + { + relation: 'claimState', + scope: { + fields: ['id', 'description'] + } + }, { relation: 'client', scope: { fields: ['salesPersonFk', 'name'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'] + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } } } } diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index f77a658c6..cbd610911 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -18,15 +18,16 @@ label="Client" order="id"> - - {{firstName}} {{name}} + value="{{$ctrl.claim.client.salesPerson.user.nickname}}"> + value="{{$ctrl.claim.worker.user.nickname}}"> diff --git a/modules/claim/front/development/index.html b/modules/claim/front/development/index.html index d733236e0..e80b6866f 100644 --- a/modules/claim/front/development/index.html +++ b/modules/claim/front/development/index.html @@ -71,15 +71,14 @@ - {{firstName}} {{name}} {{::claim.created | date:'dd/MM/yyyy'}} - {{::claim.worker.firstName}} {{::claim.worker.name}} + {{::claim.worker.user.nickname}} {{::claim.claimState.description}} + value="{{$ctrl.summary.claim.client.salesPerson.user.nickname}}"> + value="{{$ctrl.summary.claim.worker.user.nickname}}"> diff --git a/modules/client/back/methods/client/activeWorkersWithRole.js b/modules/client/back/methods/client/activeWorkersWithRole.js index 5e13e9bf6..3b0ccaac2 100644 --- a/modules/client/back/methods/client/activeWorkersWithRole.js +++ b/modules/client/back/methods/client/activeWorkersWithRole.js @@ -40,7 +40,7 @@ module.exports = Self => { return {or: [ {'w.firstName': {like: `%${value}%`}}, {'w.name': {like: `%${value}%`}}, - {'u.name': {like: `%${value}%`}} + {'u.nickname': {like: `%${value}%`}} ]}; case 'id': return {'w.id': value}; @@ -54,7 +54,7 @@ module.exports = Self => { myFilter = mergeFilters(myFilter, clientFilter); let stmt = new ParameterizedSQL( - `SELECT DISTINCT w.id, w.firstName, w.name + `SELECT DISTINCT w.id, w.firstName, w.name, u.nickname FROM worker w JOIN account.user u ON u.id = w.userFk JOIN account.roleRole i ON i.role = u.role diff --git a/modules/client/back/methods/client/getCard.js b/modules/client/back/methods/client/getCard.js index 6a9331a86..6c69d32a8 100644 --- a/modules/client/back/methods/client/getCard.js +++ b/modules/client/back/methods/client/getCard.js @@ -27,7 +27,13 @@ module.exports = function(Self) { { relation: 'salesPerson', scope: { - fields: ['id', 'firstName', 'name'] + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } } }, { relation: 'contactChannel', diff --git a/modules/client/back/methods/client/summary.js b/modules/client/back/methods/client/summary.js index 57d742a13..08d5011cb 100644 --- a/modules/client/back/methods/client/summary.js +++ b/modules/client/back/methods/client/summary.js @@ -35,12 +35,48 @@ module.exports = Self => { async function getSummary(client, clientId) { let filter = { include: [ - {relation: 'account', scope: {fields: ['name', 'active']}}, - {relation: 'salesPerson', scope: {fields: ['firstName', 'name']}}, - {relation: 'country', scope: {fields: ['country']}}, - {relation: 'province', scope: {fields: ['name']}}, - {relation: 'contactChannel', scope: {fields: ['name']}}, - {relation: 'payMethod', scope: {fields: ['name']}}, + { + relation: 'account', + scope: { + fields: ['name', 'active'] + } + }, + { + relation: 'salesPerson', + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } + }, + { + relation: 'country', + scope: { + fields: ['country'] + } + }, + { + relation: 'province', + scope: { + fields: ['name'] + } + }, + { + relation: 'contactChannel', + scope: { + fields: ['name'] + } + }, + { + relation: 'payMethod', + scope: { + fields: ['name'] + } + }, { relation: 'addresses', scope: { diff --git a/modules/client/back/methods/receipt/filter.js b/modules/client/back/methods/receipt/filter.js index b9f26b1ab..aa60e8235 100644 --- a/modules/client/back/methods/receipt/filter.js +++ b/modules/client/back/methods/receipt/filter.js @@ -40,12 +40,12 @@ module.exports = Self => { NULL debit, r.amountPaid credit, r.bankFk, - firstName, - name, + u.nickname userNickname, r.clientFk, FALSE pdf FROM vn.receipt r LEFT JOIN vn.worker w ON w.id = r.workerFk + LEFT JOIN account.user u ON u.id = w.userFk JOIN vn.company c ON c.id = r.companyFk WHERE r.clientFk = ? AND r.companyFk = ? UNION ALL @@ -60,7 +60,6 @@ module.exports = Self => { NULL, NULL, NULL, - NULL, i.clientFk, i.pdf FROM vn.invoiceOut i diff --git a/modules/client/back/models/client-observation.json b/modules/client/back/models/client-observation.json index ea05bed55..a9c7b483a 100644 --- a/modules/client/back/models/client-observation.json +++ b/modules/client/back/models/client-observation.json @@ -1,47 +1,58 @@ { - "name": "ClientObservation", - "description": "Client notes", - "base": "Loggable", - "log": { - "model": "ClientLog", - "relation": "client" - }, - "options": { - "mysql": { - "table": "clientObservation" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" - }, - "clientFk": { - "type": "Number" - }, - "text": { - "type": "string", - "description": "Text" - }, - "created": { - "type": "date", - "description": "Creation date and time" - } - }, - "relations": { - "worker": { - "type": "belongsTo", - "model": "Worker", - "foreignKey": "workerFk" - }, - "client": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "clientFk" - } - }, - "scope": { - "include": "worker" - } + "name": "ClientObservation", + "description": "Client notes", + "base": "Loggable", + "log": { + "model": "ClientLog", + "relation": "client" + }, + "options": { + "mysql": { + "table": "clientObservation" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "clientFk": { + "type": "Number" + }, + "text": { + "type": "string", + "description": "Text" + }, + "created": { + "type": "date", + "description": "Creation date and time" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "client": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "clientFk" + } + }, + "scope": { + "include": { + "relation": "worker", + "scope": { + "fields": ["userFk"], + "include": { + "relation": "user", + "scope": { + "fields": ["nickname"] + } + } + } + } + } } diff --git a/modules/client/back/models/credit-insurance.json b/modules/client/back/models/credit-insurance.json index 58dd53ccc..688c511fb 100644 --- a/modules/client/back/models/credit-insurance.json +++ b/modules/client/back/models/credit-insurance.json @@ -1,14 +1,14 @@ { - "name": "CreditInsurance", - "description": "Credit insurance", - "base": "VnModel", - "options": { - "mysql": { - "table": "creditInsurance" - } - }, - "properties": { - "id": { + "name": "CreditInsurance", + "description": "Credit insurance", + "base": "VnModel", + "options": { + "mysql": { + "table": "creditInsurance" + } + }, + "properties": { + "id": { "id": true, "type": "Number", "description": "Identifier" @@ -18,9 +18,9 @@ }, "created": { "type": "date", - "mysql": { - "columnName": "creationDate" - } + "mysql": { + "columnName": "creationDate" + } }, "grade": { "type": "Number" @@ -30,7 +30,7 @@ "classification": { "type": "belongsTo", "model": "CreditClassification", - "foreignKey": "creditClassification" + "foreignKey": "creditClassification" } } } \ No newline at end of file diff --git a/modules/client/front/basic-data/index.html b/modules/client/front/basic-data/index.html index 189cfe261..f31ab8138 100644 --- a/modules/client/front/basic-data/index.html +++ b/modules/client/front/basic-data/index.html @@ -40,18 +40,17 @@ - - {{firstName}} {{name}} {{::credit.amount | number:2}} € {{::credit.created | date:'dd/MM/yyyy HH:mm'}} - {{::credit.worker.firstName}} {{::credit.worker.name}} + {{::credit.worker.user.nickname}} diff --git a/modules/client/front/credit/index/index.js b/modules/client/front/credit/index/index.js index a12dfc5fe..e8fae8d9d 100644 --- a/modules/client/front/credit/index/index.js +++ b/modules/client/front/credit/index/index.js @@ -8,7 +8,13 @@ class Controller { { relation: 'worker', scope: { - fields: ['firstName', 'name'] + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } } } ] diff --git a/modules/client/front/descriptor/index.html b/modules/client/front/descriptor/index.html index 35df1f929..84f3ca10e 100644 --- a/modules/client/front/descriptor/index.html +++ b/modules/client/front/descriptor/index.html @@ -33,7 +33,7 @@ value="{{$ctrl.client.creditInsurance | currency: 'EUR': 2}}"> + value="{{$ctrl.client.salesPerson.user.nickname}}">
diff --git a/modules/client/front/note/index/index.html b/modules/client/front/note/index/index.html index 6c60c4f03..59267b9c4 100644 --- a/modules/client/front/note/index/index.html +++ b/modules/client/front/note/index/index.html @@ -1,7 +1,7 @@ @@ -15,7 +15,7 @@ border-radius margin-small-bottom> - {{::note.worker.firstName}} {{::note.worker.name}} + {{::note.worker.user.nickname}} {{::note.created | date:'dd/MM/yyyy HH:mm'}} diff --git a/modules/client/front/note/index/index.js b/modules/client/front/note/index/index.js index 2415aa482..63fc6643a 100644 --- a/modules/client/front/note/index/index.js +++ b/modules/client/front/note/index/index.js @@ -3,6 +3,9 @@ import ngModule from '../../module'; export default class Controller { constructor($stateParams) { this.$stateParams = $stateParams; + this.filter = { + order: 'created DESC', + }; } } diff --git a/modules/client/front/risk/index/index.html b/modules/client/front/risk/index/index.html index 8313a12f2..e63a616b5 100644 --- a/modules/client/front/risk/index/index.html +++ b/modules/client/front/risk/index/index.html @@ -60,7 +60,7 @@ {{::risk.payed | dateTime:'dd/MM/yyyy'}} {{::risk.created | dateTime:'dd/MM/yyyy HH:mm'}} - {{::risk.firstName}} {{::risk.name}} + {{::risk.userNickname}} BILL {{::risk.ref}} diff --git a/modules/client/front/sample/index/index.html b/modules/client/front/sample/index/index.html index 3d27eb3d5..bc44265f3 100644 --- a/modules/client/front/sample/index/index.html +++ b/modules/client/front/sample/index/index.html @@ -24,7 +24,7 @@ {{::sample.created | date:'dd/MM/yyyy HH:mm' }} {{::sample.type.description}} - {{::sample.worker.firstName}} {{::sample.worker.name}} + {{::sample.worker.user.nickname}} {{::sample.company.code}} diff --git a/modules/client/front/sample/index/index.js b/modules/client/front/sample/index/index.js index 78fd7f37e..646544eb6 100644 --- a/modules/client/front/sample/index/index.js +++ b/modules/client/front/sample/index/index.js @@ -14,7 +14,13 @@ class Controller { { relation: 'worker', scope: { - fields: ['firstName', 'name'] + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } } }, { diff --git a/modules/client/front/summary/index.html b/modules/client/front/summary/index.html index 90e503af9..80c576ac6 100644 --- a/modules/client/front/summary/index.html +++ b/modules/client/front/summary/index.html @@ -1,5 +1,5 @@ -
{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.firstName}} {{$ctrl.summary.salesPerson.name}}
+
{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.user.nickname}}

Basic data

@@ -22,7 +22,7 @@ value="{{$ctrl.summary.email}}"> + value="{{$ctrl.summary.salesPerson.user.nickname}}"> diff --git a/modules/item/back/methods/item/filter.js b/modules/item/back/methods/item/filter.js index 8aadf77bb..316fd2ef6 100644 --- a/modules/item/back/methods/item/filter.js +++ b/modules/item/back/methods/item/filter.js @@ -33,10 +33,11 @@ module.exports = Self => { `SELECT i.id, i.image, i.name, i.description, i.size, i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7, i.tag8, i.value8, - t.name type, w.firstName, w.name worker + t.name type, u.nickname userNickname FROM item i JOIN itemType t ON t.id = i.typeFk - JOIN worker w ON w.id = t.workerFk` + JOIN worker w ON w.id = t.workerFk + JOIN account.user u ON u.id = w.userFk` ); if (tags) { diff --git a/modules/item/back/methods/item/getCard.js b/modules/item/back/methods/item/getCard.js index b076d46c8..b9be274e1 100644 --- a/modules/item/back/methods/item/getCard.js +++ b/modules/item/back/methods/item/getCard.js @@ -26,18 +26,26 @@ module.exports = Self => { let filter = { where: {id: id}, include: [ - {relation: 'itemType', + { + relation: 'itemType', scope: { fields: ['id', 'name', 'workerFk', 'warehouseFk'], include: [{ relation: 'worker', scope: { - fields: ['id', 'name', 'firstName'] + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } } }] } }, - {relation: 'tags', + { + relation: 'tags', scope: { fields: ['id', 'value', 'tagFk'], include: [{ diff --git a/modules/item/back/methods/item/getSummary.js b/modules/item/back/methods/item/getSummary.js index 3cbb8bcab..44e599e4a 100644 --- a/modules/item/back/methods/item/getSummary.js +++ b/modules/item/back/methods/item/getSummary.js @@ -33,7 +33,13 @@ module.exports = Self => { include: [{ relation: 'worker', scope: { - fields: ['id', 'name', 'firstName'] + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } } }] } diff --git a/modules/item/back/methods/item/specs/getLastEntries.spec.js b/modules/item/back/methods/item/specs/getLastEntries.spec.js index 5c28d16bd..5147dd126 100644 --- a/modules/item/back/methods/item/specs/getLastEntries.spec.js +++ b/modules/item/back/methods/item/specs/getLastEntries.spec.js @@ -12,7 +12,8 @@ describe('item getLastEntries()', () => { it('should return three entries for a given item', async() => { let date = new Date(); - date.setMonth(date.getMonth() - 2, 15); + date.setMonth(date.getMonth() - 2, 1); + let filter = {where: {itemFk: 1, date: date}}; let result = await app.models.Item.getLastEntries(filter); diff --git a/modules/item/front/descriptor/index.html b/modules/item/front/descriptor/index.html index 09df4d520..3210366d0 100644 --- a/modules/item/front/descriptor/index.html +++ b/modules/item/front/descriptor/index.html @@ -49,7 +49,7 @@ value="{{::$ctrl.item.name}}"> + value="{{$ctrl.item.itemType.worker.user.nickname}}"> + value="{{::$ctrl.item.userNickname}}">
@@ -36,4 +36,3 @@
- diff --git a/modules/item/front/summary/index.html b/modules/item/front/summary/index.html index fa6fefd09..429feff3e 100644 --- a/modules/item/front/summary/index.html +++ b/modules/item/front/summary/index.html @@ -20,7 +20,7 @@

Basic data

- + value="{{$ctrl.summary.item.itemType.worker.user.nickname}}">
diff --git a/modules/item/front/summary/index.js b/modules/item/front/summary/index.js index 3bea01ea5..9c7e98785 100644 --- a/modules/item/front/summary/index.js +++ b/modules/item/front/summary/index.js @@ -7,15 +7,14 @@ class Controller { } getSummary() { - this.$http.get(`/item/api/Items/${this.item.id}/getSummary`).then((response) => { + this.$http.get(`/item/api/Items/${this.item.id}/getSummary`).then(response => { this.summary = response.data; }); } $onChanges() { - if (this.item && this.item.id) { + if (this.item && this.item.id) this.getSummary(); - } } } diff --git a/modules/item/front/ticket-descriptor-popover/index.js b/modules/item/front/ticket-descriptor-popover/index.js index 21b87a7ac..e552fde16 100644 --- a/modules/item/front/ticket-descriptor-popover/index.js +++ b/modules/item/front/ticket-descriptor-popover/index.js @@ -51,25 +51,43 @@ class Controller extends Component { let filter = { include: [ - {relation: 'warehouse', scope: {fields: ['name']}}, - {relation: 'agencyMode', scope: {fields: ['name']}}, + { + relation: 'warehouse', + scope: { + fields: ['name'] + } + }, + { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + }, { relation: 'client', scope: { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'] + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } } } }, { - relation: 'tracking', + relation: 'state', scope: { fields: ['stateFk'], include: { relation: 'state', - fields: ['name'] + fields: ['id', 'name'], } } } diff --git a/modules/item/front/ticket-descriptor-popover/index.spec.js b/modules/item/front/ticket-descriptor-popover/index.spec.js index 2059b9fdb..9e3d39e4b 100644 --- a/modules/item/front/ticket-descriptor-popover/index.spec.js +++ b/modules/item/front/ticket-descriptor-popover/index.spec.js @@ -71,25 +71,43 @@ describe('Item', () => { let filter = { include: [ - {relation: 'warehouse', scope: {fields: ['name']}}, - {relation: 'agencyMode', scope: {fields: ['name']}}, + { + relation: 'warehouse', + scope: { + fields: ['name'] + } + }, + { + relation: 'agencyMode', + scope: { + fields: ['name'] + } + }, { relation: 'client', scope: { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'] + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } } } }, { - relation: 'tracking', + relation: 'state', scope: { fields: ['stateFk'], include: { relation: 'state', - fields: ['name'] + fields: ['id', 'name'], } } } diff --git a/modules/item/front/ticket-descriptor/index.html b/modules/item/front/ticket-descriptor/index.html index 6cd41ab54..da734aa11 100644 --- a/modules/item/front/ticket-descriptor/index.html +++ b/modules/item/front/ticket-descriptor/index.html @@ -29,19 +29,19 @@ - + - - - -
diff --git a/modules/order/front/card/index.js b/modules/order/front/card/index.js index 3b3e2524c..948f24989 100644 --- a/modules/order/front/card/index.js +++ b/modules/order/front/card/index.js @@ -7,16 +7,36 @@ class Controller { this.order = {}; this.filter = { include: [ - {relation: 'agencyMode', scope: {fields: ['name']}}, - {relation: 'address', scope: {fields: ['nickname']}}, - {relation: 'rows', scope: {fields: ['id']}}, + { + relation: 'agencyMode', scope: { + fields: ['name'] + } + }, + { + relation: 'address', scope: { + fields: ['nickname'] + } + }, + { + relation: 'rows', scope: { + fields: ['id'] + } + }, { relation: 'client', scope: { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'] + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } } } } diff --git a/modules/order/front/descriptor/index.html b/modules/order/front/descriptor/index.html index 03b5f1f3f..ffdbe2f25 100644 --- a/modules/order/front/descriptor/index.html +++ b/modules/order/front/descriptor/index.html @@ -20,7 +20,7 @@ value="{{$ctrl.order.isConfirmed ? $ctrl.translate.instant('Confirmed') : $ctrl.translate.instant('Not confirmed')}}"> + value="{{$ctrl.order.client.salesPerson.user.nickname}}"> diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 887a599a1..8d7d2cf95 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -23,9 +23,11 @@ Id Client + Sales person Confirmed Created from Created + Landed Company @@ -38,6 +40,7 @@ {{::order.client.name}} + {{::order.client.salesPerson.user.nickname}} {{::order.sourceApp}} {{::order.created | date:'dd/MM/yyyy HH:mm'}} + {{::order.landed | date:'dd/MM/yyyy'}} {{::order.company.code}} { st.originalQuantity, st.created, st.workerFk, - w.firstName, - w.name, + u.nickname userNickname, ste.name AS state FROM saleTracking st JOIN sale s ON s.id = st.saleFk JOIN worker w ON w.id = st.workerFk + JOIN account.user u ON u.id = w.userFk JOIN state ste ON ste.id = st.stateFk`); stmt.merge(Self.makeSuffix(filter)); diff --git a/modules/ticket/back/methods/ticket/filter.js b/modules/ticket/back/methods/ticket/filter.js index 4e165f123..59754d706 100644 --- a/modules/ticket/back/methods/ticket/filter.js +++ b/modules/ticket/back/methods/ticket/filter.js @@ -164,7 +164,7 @@ module.exports = Self => { stmts.push('DROP TEMPORARY TABLE IF EXISTS tmp.filter'); stmt = new ParameterizedSQL( - `CREATE TEMPORARY TABLE tmp.filter + `CREATE TEMPORARY TABLE tmp.filter (INDEX (id)) ENGINE = MEMORY SELECT @@ -182,7 +182,8 @@ module.exports = Self => { wk.name AS salesPerson, ts.stateFk as stateFk, ts.alertLevel as alertLevel, - ts.code as alertLevelCode + ts.code as alertLevelCode, + u.nickname userNickname FROM ticket t LEFT JOIN address a ON a.id = t.addressFk LEFT JOIN province p ON p.id = a.provinceFk @@ -191,7 +192,8 @@ module.exports = Self => { LEFT JOIN ticketState ts ON ts.ticketFk = t.id LEFT JOIN state st ON st.id = ts.stateFk LEFT JOIN client c ON c.id = t.clientFk - LEFT JOIN worker wk ON wk.id = c.salesPersonFk`); + LEFT JOIN worker wk ON wk.id = c.salesPersonFk + LEFT JOIN account.user u ON u.id = wk.userFk`); stmt.merge(conn.makeSuffix(filter)); stmts.push(stmt); diff --git a/modules/ticket/back/methods/ticket/summary.js b/modules/ticket/back/methods/ticket/summary.js index b951b8f5c..36a5b961e 100644 --- a/modules/ticket/back/methods/ticket/summary.js +++ b/modules/ticket/back/methods/ticket/summary.js @@ -57,7 +57,15 @@ module.exports = Self => { fields: ['salesPersonFk', 'name'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'] + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } } } }, diff --git a/modules/ticket/back/models/ticket-log.json b/modules/ticket/back/models/ticket-log.json index 843a0f4be..be4021637 100644 --- a/modules/ticket/back/models/ticket-log.json +++ b/modules/ticket/back/models/ticket-log.json @@ -1,55 +1,55 @@ { - "name": "TicketLog", + "name": "TicketLog", "base": "VnModel", - "options": { - "mysql": { - "table": "ticketLog" - } - }, - "properties": { - "id": { - "id": true, - "type": "Number", - "forceId": false - }, - "originFk": { - "type": "Number", - "required": true - }, - "userFk": { - "type": "Number" - }, - "action": { - "type": "String", - "required": true - }, - "changedModel": { - "type": "String" - }, - "oldInstance": { - "type": "Object" - }, - "newInstance": { - "type": "Object" - }, - "creationDate": { - "type": "Date" - }, - "changedModelId": { - "type": "Number" - }, - "changedModelValue": { - "type": "String" - }, - "description": { - "type": "String" - } - }, - "relations": { - "user": { - "type": "belongsTo", - "model": "Account", - "foreignKey": "userFk" - } - } + "options": { + "mysql": { + "table": "ticketLog" + } + }, + "properties": { + "id": { + "id": true, + "type": "Number", + "forceId": false + }, + "originFk": { + "type": "Number", + "required": true + }, + "userFk": { + "type": "Number" + }, + "action": { + "type": "String", + "required": true + }, + "changedModel": { + "type": "String" + }, + "oldInstance": { + "type": "Object" + }, + "newInstance": { + "type": "Object" + }, + "creationDate": { + "type": "Date" + }, + "changedModelId": { + "type": "Number" + }, + "changedModelValue": { + "type": "String" + }, + "description": { + "type": "String" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + } } diff --git a/modules/ticket/front/card/index.js b/modules/ticket/front/card/index.js index cfd60800d..776b450ca 100644 --- a/modules/ticket/front/card/index.js +++ b/modules/ticket/front/card/index.js @@ -16,7 +16,15 @@ class Controller { fields: ['salesPersonFk', 'name', 'isActive', 'isFreezed', 'isTaxDataChecked', 'credit'], include: { relation: 'salesPerson', - fields: ['firstName', 'name'], + scope: { + fields: ['userFk'], + include: { + relation: 'user', + scope: { + fields: ['nickname'] + } + } + } }, }, }, diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index 2d8d5094f..066bac993 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -57,7 +57,7 @@ {{::ticket.id}} - {{::ticket.salesPerson | dashIfEmpty}} + {{::ticket.userNickname | dashIfEmpty}} {{::ticket.shipped | dateTime: 'dd/MM/yyyy'}} diff --git a/modules/ticket/front/request/create/index.html b/modules/ticket/front/request/create/index.html index 99b34b2fd..1e9dacbd0 100644 --- a/modules/ticket/front/request/create/index.html +++ b/modules/ticket/front/request/create/index.html @@ -10,16 +10,15 @@ - - {{firstName}} {{name}} + value-field="id" + where="{role: 'buyer'}" + label="Buyer"> diff --git a/modules/ticket/front/request/index/index.html b/modules/ticket/front/request/index/index.html index 921a75c20..ff2b3c8d1 100644 --- a/modules/ticket/front/request/index/index.html +++ b/modules/ticket/front/request/index/index.html @@ -34,8 +34,8 @@ {{::request.id}} {{::request.description}} {{::request.created | dateTime: 'dd/MM/yyyy'}} - {{::request.requester.user.name}} - {{::request.atender.user.name}} + {{::request.requester.user.nickname}} + {{::request.atender.user.nickname}} {{::request.quantity}} {{::request.price | currency: 'EUR': 2}} diff --git a/modules/ticket/front/request/index/index.js b/modules/ticket/front/request/index/index.js index 9dbd4fec1..5b146e769 100644 --- a/modules/ticket/front/request/index/index.js +++ b/modules/ticket/front/request/index/index.js @@ -6,21 +6,31 @@ class Controller { this.$scope = $scope; this.filter = { include: [ - {relation: 'atender', + { + relation: 'atender', scope: { include: { - relation: 'user' + relation: 'user', + scope: { + fields: ['nickname'] + } } } }, - {relation: 'requester', + { + relation: 'requester', scope: { include: { - relation: 'user' + relation: 'user', + scope: { + fields: ['nickname'] + } } } }, - {relation: 'sale'} + { + relation: 'sale' + } ] }; } diff --git a/modules/ticket/front/sale-tracking/index.html b/modules/ticket/front/sale-tracking/index.html index 1ef05b7b7..b19a1a74e 100644 --- a/modules/ticket/front/sale-tracking/index.html +++ b/modules/ticket/front/sale-tracking/index.html @@ -42,7 +42,7 @@ {{::sale.originalQuantity}} - {{::sale.firstName}} {{::sale.name}} + {{::sale.userNickname}} {{::sale.state}} {{::sale.created | date: 'dd/MM/yyyy HH:mm'}} diff --git a/modules/ticket/front/summary/index.html b/modules/ticket/front/summary/index.html index c8535d5ec..222ee928d 100644 --- a/modules/ticket/front/summary/index.html +++ b/modules/ticket/front/summary/index.html @@ -6,7 +6,7 @@ value="{{$ctrl.summary.state.state.name}}"> + value="{{$ctrl.summary.client.salesPerson.user.nickname}}"> diff --git a/modules/ticket/front/tracking/edit/index.html b/modules/ticket/front/tracking/edit/index.html index 0f2cfd09d..ce7019d92 100644 --- a/modules/ticket/front/tracking/edit/index.html +++ b/modules/ticket/front/tracking/edit/index.html @@ -19,12 +19,11 @@ ng-if="$ctrl.isPickerDesignedState" field="$ctrl.workerFk" url="/client/api/Clients/activeWorkersWithRole" - show-field="firstName" + show-field="nickname" search-function="{firstName: $search}" value-field="id" where="{role: 'employee'}" label="Worker"> - {{firstName}} {{name}}
diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index f06c0ce4c..2c744c705 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -22,7 +22,7 @@ class="vn-list-item"> -
{{::worker.firstName}} {{::worker.name}}
+
{{::worker.user.nickname}}
diff --git a/modules/worker/front/index/index.js b/modules/worker/front/index/index.js index 9c598d4a3..53a601ca7 100644 --- a/modules/worker/front/index/index.js +++ b/modules/worker/front/index/index.js @@ -8,7 +8,7 @@ export default class Controller { include: [ { relation: 'user', - scope: {fields: ['name', 'email']} + scope: {fields: ['nickname', 'email']} }, { relation: 'client', scope: {fields: ['fi']}