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}}