This commit is contained in:
Bernat Exposito Domenech 2020-09-10 09:18:16 +02:00
commit 829d0c3b3c
54 changed files with 437 additions and 84 deletions

View File

@ -199,7 +199,7 @@ export default {
}, },
dms: { dms: {
deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]', deleteFileButton: 'vn-client-dms-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
firstDocWorker: 'vn-client-dms-index vn-td:nth-child(7) > span', firstDocWorker: 'vn-client-dms-index vn-td:nth-child(8) > span',
firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor' firstDocWorkerDescriptor: '.vn-popover.shown vn-worker-descriptor'
}, },
clientContacts: { clientContacts: {
@ -894,6 +894,7 @@ export default {
header: 'vn-entry-summary > vn-card > h5', header: 'vn-entry-summary > vn-card > h5',
reference: 'vn-entry-summary vn-label-value[label="Reference"]', reference: 'vn-entry-summary vn-label-value[label="Reference"]',
confirmed: 'vn-entry-summary vn-check[label="Confirmed"]', confirmed: 'vn-entry-summary vn-check[label="Confirmed"]',
anyBuyLine: 'vn-entry-summary tr.dark-row'
}, },
entryDescriptor: { entryDescriptor: {
agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span', agency: 'vn-entry-descriptor div.body vn-label-value:nth-child(1) span',

View File

@ -9,7 +9,7 @@ describe('Entry summary path', () => {
browser = await getBrowser(); browser = await getBrowser();
page = browser.page; page = browser.page;
await page.loginAndModule('buyer', 'entry'); await page.loginAndModule('buyer', 'entry');
await page.waitToClick('vn-entry-index vn-tbody > a:nth-child(2)'); await page.accessToSearchResult('4');
}); });
afterAll(async() => { afterAll(async() => {
@ -30,7 +30,7 @@ describe('Entry summary path', () => {
it('should display some entry details like the reference', async() => { it('should display some entry details like the reference', async() => {
const result = await page.waitToGetProperty(selectors.entrySummary.reference, 'innerText'); const result = await page.waitToGetProperty(selectors.entrySummary.reference, 'innerText');
expect(result).toContain('Movement 2'); expect(result).toContain('Movement 4');
}); });
it('should display other entry details like the confirmed', async() => { it('should display other entry details like the confirmed', async() => {
@ -38,4 +38,10 @@ describe('Entry summary path', () => {
expect(result).toContain('unchecked'); expect(result).toContain('unchecked');
}); });
it('should display all buys for the entry', async() => {
const result = await page.countElement(selectors.entrySummary.anyBuyLine);
expect(result).toEqual(4);
});
}); });

View File

@ -106,7 +106,7 @@ module.exports = Self => {
let stmt; let stmt;
stmt = new ParameterizedSQL( stmt = new ParameterizedSQL(
`SELECT cl.id, c.name, cl.clientFk, cl.workerFk, u.nickName, cs.description, cl.created `SELECT cl.id, c.name, cl.clientFk, cl.workerFk, u.name AS userName, cs.description, cl.created
FROM claim cl FROM claim cl
LEFT JOIN client c ON c.id = cl.clientFk LEFT JOIN client c ON c.id = cl.clientFk
LEFT JOIN worker w ON w.id = cl.workerFk LEFT JOIN worker w ON w.id = cl.workerFk

View File

@ -12,7 +12,7 @@ class Controller extends ModuleCard {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -32,20 +32,32 @@
value="{{$ctrl.claim.created | date: 'dd/MM/yyyy HH:mm'}}"> value="{{$ctrl.claim.created | date: 'dd/MM/yyyy HH:mm'}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Salesperson" label="Salesperson">
value="{{$ctrl.claim.client.salesPersonUser.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.claim.client.salesPersonFk)"
class="link">
{{$ctrl.claim.client.salesPersonUser.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Attended by" label="Attended by">
value="{{$ctrl.claim.worker.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.userFk)"
class="link">
{{$ctrl.claim.worker.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Agency" label="Agency"
value="{{$ctrl.claim.ticket.agencyMode.name}}"> value="{{$ctrl.claim.ticket.agencyMode.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Ticket" label="Ticket">
value="{{$ctrl.claim.ticketFk}}"> <span
ng-click="ticketDescriptor.show($event, $ctrl.claim.ticketFk)"
class="link">
{{$ctrl.claim.ticketFk}}
</span>
</vn-label-value> </vn-label-value>
</div> </div>
<div class="quicklinks"> <div class="quicklinks">
@ -78,4 +90,10 @@
on-accept="$ctrl.deleteClaim()" on-accept="$ctrl.deleteClaim()"
question="Delete claim" question="Delete claim"
message="Are you sure you want to delete this claim?"> message="Are you sure you want to delete this claim?">
</vn-confirm> </vn-confirm>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>
<vn-ticket-descriptor-popover
vn-id="ticketDescriptor">
</vn-ticket-descriptor-popover>

View File

@ -34,7 +34,7 @@
<span <span
vn-click-stop="workerDescriptor.show($event, claim.workerFk)" vn-click-stop="workerDescriptor.show($event, claim.workerFk)"
class="link" > class="link" >
{{::claim.nickName}} {{::claim.userName}}
</span> </span>
</vn-td> </vn-td>
<vn-td> <vn-td>

View File

@ -48,7 +48,7 @@ module.exports = Self => {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -23,7 +23,13 @@
<vn-tbody> <vn-tbody>
<vn-tr ng-repeat="credit in credits track by credit.id"> <vn-tr ng-repeat="credit in credits track by credit.id">
<vn-td>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td> <vn-td>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::credit.worker.user.nickname}}</vn-td> <vn-td>
<span
ng-click="workerDescriptor.show($event, credit.worker.userFk)"
class="link">
{{::credit.worker.user.name}}
</span>
</vn-td>
<vn-td number>{{::credit.amount | currency:'EUR':2}}</vn-td> <vn-td number>{{::credit.amount | currency:'EUR':2}}</vn-td>
</vn-tr> </vn-tr>
</vn-tbody> </vn-tbody>
@ -39,3 +45,6 @@
vn-bind="+" vn-bind="+"
fixed-bottom-right> fixed-bottom-right>
</vn-float-button> </vn-float-button>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -13,7 +13,7 @@ class Controller extends Section {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -35,8 +35,12 @@
info="Invoices minus payments plus orders not yet invoiced"> info="Invoices minus payments plus orders not yet invoiced">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Sales person" label="Sales person">
value="{{$ctrl.client.salesPerson.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.client.salesPersonFk)"
class="link">
{{$ctrl.client.salesPerson.user.name}}
</span>
</vn-label-value> </vn-label-value>
</div> </div>
<div class="icons"> <div class="icons">
@ -89,4 +93,7 @@
<vn-client-sms <vn-client-sms
vn-id="sms" vn-id="sms"
sms="$ctrl.newSMS"> sms="$ctrl.newSMS">
</vn-client-sms> </vn-client-sms>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -53,6 +53,12 @@
{{::document.dms.description}} {{::document.dms.description}}
</span> </span>
</vn-td> </vn-td>
<vn-td shrink>
<vn-check
ng-model="document.dms.hasFile"
disabled="true">
</vn-check>
</vn-td>
<vn-td shrink> <vn-td shrink>
<span title="{{'Download file' | translate}}" class="link" <span title="{{'Download file' | translate}}" class="link"
ng-click="$ctrl.downloadFile(document.dmsFk)"> ng-click="$ctrl.downloadFile(document.dmsFk)">
@ -62,7 +68,7 @@
<vn-td shrink> <vn-td shrink>
<span class="link" <span class="link"
ng-click="workerDescriptor.show($event, document.dms.workerFk)"> ng-click="workerDescriptor.show($event, document.dms.workerFk)">
{{::document.dms.worker.user.nickname | dashIfEmpty}} {{::document.dms.worker.user.name | dashIfEmpty}}
</span></vn-td> </span></vn-td>
<vn-td> <vn-td>
{{::document.dms.created | date:'dd/MM/yyyy HH:mm'}} {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}

View File

@ -32,7 +32,7 @@ class Controller extends Section {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
}, },
} }

View File

@ -32,7 +32,7 @@
<span <span
ng-click="workerDescriptor.show($event, sample.worker.id)" ng-click="workerDescriptor.show($event, sample.worker.id)"
class="link"> class="link">
{{::sample.worker.user.nickname}} {{::sample.worker.user.name}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::sample.company.code}}</vn-td> <vn-td>{{::sample.company.code}}</vn-td>

View File

@ -18,7 +18,7 @@ class Controller extends Section {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -21,8 +21,12 @@
<vn-label-value label="Email" ellipsize="false" <vn-label-value label="Email" ellipsize="false"
value="{{$ctrl.summary.email}}"> value="{{$ctrl.summary.email}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Sales person" <vn-label-value label="Sales person">
value="{{$ctrl.summary.salesPerson.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.summary.salesPersonFk)"
class="link">
{{$ctrl.summary.salesPerson.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Channel" <vn-label-value label="Channel"
value="{{$ctrl.summary.contactChannel.name}}"> value="{{$ctrl.summary.contactChannel.name}}">
@ -197,4 +201,7 @@
</vn-vertical> </vn-vertical>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -0,0 +1,74 @@
module.exports = Self => {
Self.remoteMethod('getBuys', {
description: 'Returns buys for one entry',
accessType: 'READ',
accepts: {
arg: 'id',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
},
returns: {
type: ['Object'],
root: true
},
http: {
path: `/:id/getBuys`,
verb: 'GET'
}
});
Self.getBuys = async id => {
let filter = {
where: {entryFk: id},
fields: [
'id',
'itemFk',
'stickers',
'packing',
'grouping',
'quantity',
'packageFk',
'weight',
'buyingValue',
'price2',
'price3'
],
include: {
relation: 'item',
scope: {
fields: [
'id',
'typeFk',
'name',
'size',
'minPrice',
'tag5',
'value5',
'tag6',
'value6',
'tag7',
'value7',
'tag8',
'value8',
'tag9',
'value9',
'tag10',
'value10',
'groupingMode'
],
include: {
relation: 'itemType',
scope: {
fields: ['code', 'description']
}
}
}
}
};
let buys = await Self.app.models.Buy.find(filter);
return buys;
};
};

View File

@ -0,0 +1,14 @@
const app = require('vn-loopback/server/server');
describe('entry getBuys()', () => {
const entryId = 4;
it('should get the buys and items of an entry', async() => {
const result = await app.models.Entry.getBuys(entryId);
const length = result.length;
const anyResult = result[Math.floor(Math.random() * Math.floor(length))];
expect(result.length).toEqual(4);
expect(anyResult.item).toBeDefined();
});
});

View File

@ -31,6 +31,12 @@
"grouping": { "grouping": {
"type": "number" "type": "number"
}, },
"stickers": {
"type": "number"
},
"packageFk": {
"type": "number"
},
"groupingMode": { "groupingMode": {
"type": "number" "type": "number"
}, },
@ -56,6 +62,12 @@
"model": "Entry", "model": "Entry",
"foreignKey": "entryFk", "foreignKey": "entryFk",
"required": true "required": true
},
"item": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "itemFk",
"required": true
} }
} }
} }

View File

@ -1,4 +1,5 @@
module.exports = Self => { module.exports = Self => {
require('../methods/entry/filter')(Self); require('../methods/entry/filter')(Self);
require('../methods/entry/getEntry')(Self); require('../methods/entry/getEntry')(Self);
require('../methods/entry/getBuys')(Self);
}; };

View File

@ -19,8 +19,12 @@
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one> <vn-one>
<vn-label-value label="Agency" <vn-label-value label="Agency">
value="{{$ctrl.entryData.travel.agency.name}}"> <span
ng-click="travelDescriptor.show($event, $ctrl.entry.travel.agencyFk)"
class="link">
{{$ctrl.entryData.travel.agency.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Shipped" <vn-label-value label="Shipped"
value="{{$ctrl.entryData.travel.shipped | date: 'dd/MM/yyyy'}}"> value="{{$ctrl.entryData.travel.shipped | date: 'dd/MM/yyyy'}}">
@ -65,4 +69,89 @@
</vn-vertical> </vn-vertical>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
<vn-horizontal>
<vn-auto name="buys">
<h4 translate>Buys</h4>
<table class="vn-table">
<thead>
<tr>
<th translate center field="quantity">Quantity</th>
<th translate center field="sticker">Stickers</th>
<th translate center field="packageFk">Package</th>
<th translate center field="weight">Weight</th>
<th translate center field="packing">Packing</th>
<th translate center field="grouping">Grouping</th>
<th translate center field="buyingValue">Buying value</th>
<th translate center field="price3">Import</th>
<th translate center expand field="price2">Grouping price</th>
<th translate center expand field="price3">Packing price</th>
</tr>
</thead>
<tbody ng-repeat="line in $ctrl.buys">
<tr>
<td center title="{{::line.quantity}}">{{::line.quantity}}</td>
<td center title="{{::line.stickers | dashIfEmpty}}">{{::line.stickers | dashIfEmpty}}</td>
<td center title="{{::line.packageFk | dashIfEmpty}}">{{::line.packageFk | dashIfEmpty}}</td>
<td center title="{{::line.weight}}">{{::line.weight}}</td>
<td center>
<vn-chip translate-attr="line.groupingMode == 2 ? {title: 'Minimun amount'} : {title: 'Packing'}" ng-class="{'message': line.groupingMode == 2}">
<span translate>{{::line.packing | dashIfEmpty}}</span>
</vn-chip>
</td>
<td center>
<vn-chip translate-attr="line.groupingMode == 1 ? {title: 'Minimun amount'} : {title: 'Grouping'}" ng-class="{'message': line.groupingMode == 1}">
<span translate>{{::line.grouping | dashIfEmpty}}</span>
</vn-chip>
</vn-td>
<td center title="{{::line.buyingValue | currency: 'EUR':2}}">{{::line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.quantity * line.buyingValue | currency: 'EUR':2}}">{{::line.quantity * line.buyingValue | currency: 'EUR':2}}</td>
<td center title="{{::line.price2 | currency: 'EUR':2}}">{{::line.price2 | currency: 'EUR':2}}</td>
<td center title="{{::line.price3 | currency: 'EUR':2}}">{{::line.price3 | currency: 'EUR':2}}</td>
</tr>
<tr class="dark-row">
<td shrink>
<span
translate-attr="{title: 'Item type'}">
{{::line.item.itemType.code}}
</span>
</td>
<td shrink>
<span
ng-click="itemDescriptor.show($event, line.item.id)"
class="link">
{{::line.item.id | zeroFill:6}}
</span>
</td>
<td number shrink>
<span
translate-attr="{title: 'Item size'}">
{{::line.item.size}}
</span>
</td>
<td center>
<span
translate-attr="{title: 'Minimum price'}">
{{::line.item.minPrice | currency: 'EUR':2}}
</span>
</td>
<td expand colspan="6">
<vn-fetched-tags
expand
item="::line.item"
name="::line.item.name"
sub-name="::line.item.subName">
</vn-fetched-tags>
</td>
</tr>
</tbody>
</table>
</vn-auto>
</vn-horizontal>
</vn-card> </vn-card>
<vn-item-descriptor-popover
vn-id="itemDescriptor">
</vn-item-descriptor-popover>
<vn-travel-descriptor-popover
vn-id="travelDescriptor">
</vn-travel-descriptor-popover>

View File

@ -10,15 +10,23 @@ class Controller extends Section {
set entry(value) { set entry(value) {
this._entry = value; this._entry = value;
if (value && value.id) if (value && value.id) {
this.getEntryData(); this.getEntryData();
this.getBuys();
}
} }
getEntryData() { getEntryData() {
return this.$http.get(`/api/Entries/${this.entry.id}/getEntry`).then(response => { return this.$http.get(`Entries/${this.entry.id}/getEntry`).then(response => {
this.entryData = response.data; this.entryData = response.data;
}); });
} }
getBuys() {
return this.$http.get(`Entries/${this.entry.id}/getBuys`).then(response => {
this.buys = response.data;
});
}
} }
ngModule.vnComponent('vnEntrySummary', { ngModule.vnComponent('vnEntrySummary', {

View File

@ -38,7 +38,7 @@ describe('component vnEntrySummary', () => {
it('should perform a get and then store data on the controller', () => { it('should perform a get and then store data on the controller', () => {
controller._entry = {id: 999}; controller._entry = {id: 999};
const query = `/api/Entries/${controller._entry.id}/getEntry`; const query = `Entries/${controller._entry.id}/getEntry`;
$httpBackend.expectGET(query).respond('I am the entryData'); $httpBackend.expectGET(query).respond('I am the entryData');
controller.getEntryData(); controller.getEntryData();
$httpBackend.flush(); $httpBackend.flush();
@ -46,4 +46,20 @@ describe('component vnEntrySummary', () => {
expect(controller.entryData).toEqual('I am the entryData'); expect(controller.entryData).toEqual('I am the entryData');
}); });
}); });
describe('getBuys()', () => {
it('should perform a get asking for the buys of an entry', () => {
controller._entry = {id: 999};
const thatQuery = `Entries/${controller._entry.id}/getEntry`;
const query = `Entries/${controller._entry.id}/getBuys`;
$httpBackend.whenGET(thatQuery).respond('My Entries');
$httpBackend.expectGET(query).respond('Some buys');
controller.getBuys();
$httpBackend.flush();
expect(controller.buys).toEqual('Some buys');
});
});
}); });

View File

@ -1,3 +1,8 @@
Inventory: Inventario Inventory: Inventario
Virtual: Redada Virtual: Redada
Entry: Entrada Entry: Entrada
Stickers: Etiquetas
Item size: Tamaño
Item type: Tipo
Minimum price: Precio mínimo
Buys: Compras

View File

@ -3,4 +3,18 @@
vn-entry-summary .summary { vn-entry-summary .summary {
max-width: $width-lg; max-width: $width-lg;
}
.dark-row {
background-color: lighten($color-marginal, 10%);
}
tbody {
border: 2px solid $color-marginal;
}
tr {
margin-bottom: 10px;
}
}
$color-font-link-medium: lighten($color-font-link, 20%)

View File

@ -37,8 +37,12 @@
value="{{$ctrl.invoiceOut.amount | currency: 'EUR': 2}}"> value="{{$ctrl.invoiceOut.amount | currency: 'EUR': 2}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Client" label="Client">
value="{{$ctrl.invoiceOut.client.name}}"> <span
ng-click="clientDescriptor.show($event, $ctrl.invoiceOut.client.id)"
class="link">
{{$ctrl.invoiceOut.client.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Company" label="Company"
@ -74,4 +78,7 @@
vn-id="bookConfirmation" vn-id="bookConfirmation"
on-accept="$ctrl.bookInvoiceOut()" on-accept="$ctrl.bookInvoiceOut()"
question="Are you sure you want to book this invoice?"> question="Are you sure you want to book this invoice?">
</vn-confirm> </vn-confirm>
<vn-client-descriptor-popover
vn-id="clientDescriptor">
</vn-client-descriptor-popover>

View File

@ -26,7 +26,9 @@ module.exports = Self => {
await fs.mkdir(tempPath, {recursive: true}); await fs.mkdir(tempPath, {recursive: true});
const timer = setInterval(async() => { const timer = setInterval(async() => {
const image = await Self.findOne({where: {error: null}}); const image = await Self.findOne({
where: {error: null, url: {neq: null}}
});
// Exit loop // Exit loop
if (!image) return clearInterval(timer); if (!image) return clearInterval(timer);

View File

@ -113,7 +113,7 @@ module.exports = Self => {
i.isActive, i.isActive,
t.name type, t.name type,
t.workerFk buyerFk, t.workerFk buyerFk,
u.nickname userNickname, u.name userName,
intr.description AS intrastat, intr.description AS intrastat,
i.stems, i.stems,
ori.code AS origin, ori.code AS origin,

View File

@ -37,7 +37,7 @@ module.exports = Self => {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -38,7 +38,7 @@ module.exports = Self => {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -44,8 +44,12 @@
<slot-body> <slot-body>
<div class="attributes"> <div class="attributes">
<vn-label-value <vn-label-value
label="Buyer" label="Buyer">
value="{{$ctrl.item.itemType.worker.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
class="link">
{{$ctrl.item.itemType.worker.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
ng-repeat="tag in $ctrl.item.tags | limitTo:4" ng-repeat="tag in $ctrl.item.tags | limitTo:4"
@ -96,3 +100,6 @@
question="Do you want to clone this item?" question="Do you want to clone this item?"
message="All it's properties will be copied"> message="All it's properties will be copied">
</vn-confirm> </vn-confirm>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -70,11 +70,11 @@
{{::item.intrastat}} {{::item.intrastat}}
</vn-td> </vn-td>
<vn-td shrink>{{::item.origin}}</vn-td> <vn-td shrink>{{::item.origin}}</vn-td>
<vn-td shrink title="{{::item.userNickname}}"> <vn-td shrink title="{{::item.userName}}">
<span <span
class="link" class="link"
vn-click-stop="workerDescriptor.show($event, item.buyerFk)"> vn-click-stop="workerDescriptor.show($event, item.buyerFk)">
{{::item.userNickname}} {{::item.userName}}
</span> </span>
</vn-td> </vn-td>
<vn-td shrink>{{::item.density}}</vn-td> <vn-td shrink>{{::item.density}}</vn-td>

View File

@ -36,8 +36,12 @@
<vn-label-value label="stems" <vn-label-value label="stems"
value="{{$ctrl.summary.item.stems}}"> value="{{$ctrl.summary.item.stems}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Buyer" <vn-label-value label="Buyer">
value="{{$ctrl.summary.item.itemType.worker.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"
class="link">
{{$ctrl.summary.item.itemType.worker.user.name}}
</span>
</vn-label-value> </vn-label-value>
</vn-one> </vn-one>
<vn-one name="otherData"> <vn-one name="otherData">
@ -105,4 +109,7 @@
</p> </p>
</vn-one> </vn-one>
</vn-horizontal> </vn-horizontal>
</vn-card> </vn-card>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -37,7 +37,7 @@ class Controller extends ModuleCard {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -63,7 +63,7 @@
ng-model="$ctrl.orderField" ng-model="$ctrl.orderField"
selection="$ctrl.orderSelection" selection="$ctrl.orderSelection"
translate-fields="['name']" translate-fields="['name']"
order="name" order="priority DESC"
show-field="name" show-field="name"
value-field="field" value-field="field"
label="Order by" label="Order by"

View File

@ -14,10 +14,10 @@ class Controller extends Section {
{way: 'DESC', name: 'Descendant'}, {way: 'DESC', name: 'Descendant'},
]; ];
this.defaultOrderFields = [ this.defaultOrderFields = [
{field: 'relevancy DESC, name', name: 'Relevancy'}, {field: 'relevancy DESC, name', name: 'Relevancy', priority: 999},
{field: 'showOrder, price', name: 'Color and price'}, {field: 'showOrder, price', name: 'Color and price', priority: 999},
{field: 'name', name: 'Name'}, {field: 'name', name: 'Name', priority: 999},
{field: 'price', name: 'Price'} {field: 'price', name: 'Price', priority: 999}
]; ];
this.orderFields = [].concat(this.defaultOrderFields); this.orderFields = [].concat(this.defaultOrderFields);
this._orderWay = this.orderWays[0].way; this._orderWay = this.orderWays[0].way;
@ -312,9 +312,11 @@ class Controller extends Section {
tags.push({ tags.push({
name: itemTag.name, name: itemTag.name,
field: itemTag.tagFk, field: itemTag.tagFk,
isTag: true isTag: true,
priority: 1
}); });
} } else
tags[alreadyAdded].priority += 1;
}); });
}); });
let newFilterList = [].concat(this.defaultOrderFields); let newFilterList = [].concat(this.defaultOrderFields);

View File

@ -45,7 +45,7 @@ describe('Order', () => {
jest.spyOn(controller, 'buildTagsFilter'); jest.spyOn(controller, 'buildTagsFilter');
jest.spyOn(controller, 'buildOrderFilter'); jest.spyOn(controller, 'buildOrderFilter');
const expectedResult = [{field: 'showOrder, price', name: 'Color and price'}]; const expectedResult = [{field: 'showOrder, price', name: 'Color and price', priority: 999}];
const items = [{id: 1, name: 'My Item', tags: [ const items = [{id: 1, name: 'My Item', tags: [
{tagFk: 4, name: 'Length'}, {tagFk: 4, name: 'Length'},
{tagFk: 5, name: 'Color'} {tagFk: 5, name: 'Color'}

View File

@ -15,8 +15,12 @@
value="{{$ctrl.$t($ctrl.order.isConfirmed ? 'Confirmed' : 'Not confirmed')}}"> value="{{$ctrl.$t($ctrl.order.isConfirmed ? 'Confirmed' : 'Not confirmed')}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Sales person" label="Sales person">
value="{{$ctrl.order.client.salesPerson.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.order.client.salesPersonFk)"
class="link">
{{$ctrl.order.client.salesPerson.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Landed" label="Landed"
@ -64,4 +68,7 @@
on-accept="$ctrl.deleteOrder()" on-accept="$ctrl.deleteOrder()"
message="You are going to delete this order" message="You are going to delete this order"
question="continue anyway?"> question="continue anyway?">
</vn-confirm> </vn-confirm>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -119,7 +119,7 @@ module.exports = Self => {
r.m3, r.m3,
r.description, r.description,
am.name agencyName, am.name agencyName,
u.nickname AS workerNickname, u.name AS workerUserName,
v.numberPlate AS vehiclePlateNumber v.numberPlate AS vehiclePlateNumber
FROM route r FROM route r
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
@ -128,7 +128,6 @@ module.exports = Self => {
LEFT JOIN account.user u ON u.id = w.userFk` LEFT JOIN account.user u ON u.id = w.userFk`
); );
stmt.merge(conn.makeSuffix(filter)); stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1; let itemsIndex = stmts.push(stmt) - 1;

View File

@ -25,7 +25,7 @@ describe('route summary()', () => {
const result = await app.models.Route.summary(1); const result = await app.models.Route.summary(1);
const worker = result.route.worker().user(); const worker = result.route.worker().user();
expect(worker.nickname).toEqual('deliveryNick'); expect(worker.name).toEqual('delivery');
}); });
it(`should return a summary object containing data from the tickets`, async() => { it(`should return a summary object containing data from the tickets`, async() => {

View File

@ -38,7 +38,7 @@ module.exports = Self => {
{ {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['id', 'nickname'] fields: ['id', 'name']
} }
} }
] ]

View File

@ -38,7 +38,7 @@
<span <span
class="link" class="link"
vn-click-stop="workerDescriptor.show($event, route.workerFk)"> vn-click-stop="workerDescriptor.show($event, route.workerFk)">
{{::route.workerNickname}} {{::route.workerUserName}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::route.agencyName | dashIfEmpty}}</vn-td> <vn-td>{{::route.agencyName | dashIfEmpty}}</vn-td>

View File

@ -14,8 +14,12 @@
<vn-label-value label="Vehicle" <vn-label-value label="Vehicle"
value="{{$ctrl.summary.route.vehicle.numberPlate}}"> value="{{$ctrl.summary.route.vehicle.numberPlate}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Driver" <vn-label-value label="Driver">
value="{{$ctrl.summary.route.worker.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.summary.route.workerFk)"
class="link">
{{$ctrl.summary.route.worker.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Cost" <vn-label-value label="Cost"
value="{{$ctrl.summary.route.cost | currency: 'EUR':2}}"> value="{{$ctrl.summary.route.cost | currency: 'EUR':2}}">
@ -106,3 +110,6 @@
<vn-client-descriptor-popover <vn-client-descriptor-popover
vn-id="clientDescriptor"> vn-id="clientDescriptor">
</vn-client-descriptor-popover> </vn-client-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -245,7 +245,7 @@ module.exports = Self => {
SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped SELECT f.id ticketFk, f.clientFk, f.warehouseFk, f.shipped
FROM tmp.filter f FROM tmp.filter f
LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel LEFT JOIN alertLevel al ON al.alertLevel = f.alertLevel
WHERE (f.alertLevelCode = 'FREE' OR f.alertLevel IS NULL) WHERE (al.code = 'FREE' OR f.alertLevel IS NULL)
AND f.shipped >= CURDATE()`); AND f.shipped >= CURDATE()`);
stmts.push('CALL ticketGetProblems()'); stmts.push('CALL ticketGetProblems()');

View File

@ -63,7 +63,7 @@ module.exports = Self => {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -44,7 +44,7 @@ class Controller extends ModuleCard {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -90,8 +90,12 @@
value="{{$ctrl.ticket.ticketState.state.name}}"> value="{{$ctrl.ticket.ticketState.state.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Sales person" label="Sales person">
value="{{$ctrl.ticket.client.salesPerson.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.ticket.client.salesPersonFk)"
class="link">
{{$ctrl.ticket.client.salesPerson.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value <vn-label-value
label="Shipped" label="Shipped"
@ -295,4 +299,7 @@
<input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/> <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
<button response="accept" translate>Save</button> <button response="accept" translate>Save</button>
</tpl-buttons> </tpl-buttons>
</vn-dialog> </vn-dialog>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -210,7 +210,7 @@ class Controller extends Descriptor {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -51,6 +51,12 @@
{{::document.dms.description}} {{::document.dms.description}}
</span> </span>
</vn-td> </vn-td>
<vn-td shrink>
<vn-check
ng-model="document.dms.hasFile"
disabled="true">
</vn-check>
</vn-td>
<vn-td shrink> <vn-td shrink>
<span title="{{'Download file' | translate}}" class="link" <span title="{{'Download file' | translate}}" class="link"
ng-click="$ctrl.downloadFile(document.dmsFk)"> ng-click="$ctrl.downloadFile(document.dmsFk)">
@ -60,8 +66,9 @@
<vn-td shrink> <vn-td shrink>
<span class="link" <span class="link"
ng-click="workerDescriptor.show($event, document.dms.workerFk)"> ng-click="workerDescriptor.show($event, document.dms.workerFk)">
{{::document.dms.worker.user.nickname | dashIfEmpty}} {{::document.dms.worker.user.name | dashIfEmpty}}
</span></vn-td> </span>
</vn-td>
<vn-td> <vn-td>
{{::document.dms.created | date:'dd/MM/yyyy HH:mm'}} {{::document.dms.created | date:'dd/MM/yyyy HH:mm'}}
</vn-td> </vn-td>

View File

@ -33,7 +33,7 @@ class Controller extends Section {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
}, },
} }

View File

@ -18,8 +18,12 @@
<vn-label-value label="State" <vn-label-value label="State"
value="{{$ctrl.summary.ticketState.state.name}}"> value="{{$ctrl.summary.ticketState.state.name}}">
</vn-label-value> </vn-label-value>
<vn-label-value label="Salesperson" <vn-label-value label="Salesperson">
value="{{$ctrl.summary.client.salesPerson.user.nickname}}"> <span
ng-click="workerDescriptor.show($event, $ctrl.summary.client.salesPersonFk)"
class="link">
{{$ctrl.summary.client.salesPerson.user.name}}
</span>
</vn-label-value> </vn-label-value>
<vn-label-value label="Agency" <vn-label-value label="Agency"
value="{{$ctrl.summary.agencyMode.name}}"> value="{{$ctrl.summary.agencyMode.name}}">
@ -239,4 +243,7 @@
</vn-item-descriptor-popover> </vn-item-descriptor-popover>
<vn-invoice-out-descriptor-popover <vn-invoice-out-descriptor-popover
vn-id="invoice-out-descriptor"> vn-id="invoice-out-descriptor">
</vn-invoice-out-descriptor-popover> </vn-invoice-out-descriptor-popover>
<vn-worker-descriptor-popover
vn-id="workerDescriptor">
</vn-worker-descriptor-popover>

View File

@ -25,7 +25,7 @@
<span <span
class="link" class="link"
ng-click="workerDescriptor.show($event, tracking.worker.user.id)"> ng-click="workerDescriptor.show($event, tracking.worker.user.id)">
{{::tracking.worker.user.nickname | dashIfEmpty}} {{::tracking.worker.user.name | dashIfEmpty}}
</span> </span>
</vn-td> </vn-td>
<vn-td>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td> <vn-td>{{::tracking.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>

View File

@ -13,7 +13,7 @@ class Controller extends Section {
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name']
} }
} }
} }

View File

@ -1,6 +1,6 @@
Reference: Referencia Reference: Referencia
Wh. In: Warehouse entrada Wh. In: Almacén entrada
Wh. Out: Warehouse salida Wh. Out: Almacén salida
Shipped: F. envío Shipped: F. envío
Landed: F. entrega Landed: F. entrega
Total entries: Entradas totales Total entries: Entradas totales

View File

@ -18,6 +18,7 @@
<vn-th field="reference" shrink>Reference</vn-th> <vn-th field="reference" shrink>Reference</vn-th>
<vn-th expand>Description</vn-th> <vn-th expand>Description</vn-th>
<vn-th field="hasFile" shrink>Original</vn-th> <vn-th field="hasFile" shrink>Original</vn-th>
<vn-th shrink>File</vn-th>
<vn-th field="created">Created</vn-th> <vn-th field="created">Created</vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
<vn-th shrink></vn-th> <vn-th shrink></vn-th>
@ -36,7 +37,13 @@
<span title="{{::document.description}}"> <span title="{{::document.description}}">
{{::document.description}} {{::document.description}}
</span> </span>
</vn-td > </vn-td>
<vn-td shrink>
<vn-check
ng-model="document.dms.hasFile"
disabled="true">
</vn-check>
</vn-td>
<vn-td shrink> <vn-td shrink>
<span title="{{'Download file' | translate}}" class="link" <span title="{{'Download file' | translate}}" class="link"
ng-click="$ctrl.downloadFile(document.dmsFk)"> ng-click="$ctrl.downloadFile(document.dmsFk)">