This commit is contained in:
Juan Ferrer 2019-02-01 11:06:39 +01:00
commit 3f08ab1b22
58 changed files with 469 additions and 237 deletions

View File

@ -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)`,

View File

@ -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');
});
});

View File

@ -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() => {

View File

@ -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();

View File

@ -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();

View File

@ -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']
}
}
}
}
}
}

View File

@ -20,13 +20,14 @@
</vn-autocomplete>
<vn-autocomplete
vn-one
disabled="true"
disabled="false"
field="$ctrl.claim.workerFk"
url="/client/api/Workers"
fields="['firstName', 'name']"
url="/api/Clients/activeWorkersWithRole"
show-field="nickname"
search-function="{firstName: $search}"
value-field="id"
where="{role: 'employee'}"
label="Worker">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
<vn-date-picker
vn-one

View File

@ -6,7 +6,17 @@ class Controller {
this.$state = $state;
this.filter = {
include: [
{relation: 'worker', scope: {fields: ['name', 'firstName']}},
{relation: 'worker',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
{
relation: 'ticket',
scope: {
@ -16,14 +26,28 @@ class Controller {
}
}
},
{relation: 'claimState', scope: {fields: ['id', 'description']}},
{
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']
}
}
}
}
}
}

View File

@ -29,10 +29,10 @@
value="{{$ctrl.claim.created | dateTime: 'dd/MM/yyyy'}}">
</vn-label-value>
<vn-label-value label="Salesperson"
value="{{$ctrl.claim.client.salesPerson.firstName}} {{$ctrl.claim.client.salesPerson.name}}">
value="{{$ctrl.claim.client.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Attended by"
value="{{$ctrl.claim.worker.firstName}} {{$ctrl.claim.worker.name}}">
value="{{$ctrl.claim.worker.user.nickname}}">
</vn-label-value>
<vn-label-value label="Agency"
value="{{$ctrl.claim.ticket.agencyMode.name}}">

View File

@ -71,15 +71,14 @@
</vn-autocomplete>
<vn-autocomplete
vn-one
label="Worker"
field="claimDevelopment.workerFk"
url="/client/api/Clients/activeWorkersWithRole"
url="/api/Clients/activeWorkersWithRole"
show-field="nickname"
search-function="{firstName: $search}"
where="{role: 'employee'}"
show-field="firstName"
value-field="id"
where="{role: 'employee'}"
label="Worker"
vn-acl="salesAssistant">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one

View File

@ -42,7 +42,7 @@
</span>
</vn-td>
<vn-td>{{::claim.created | date:'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::claim.worker.firstName}} {{::claim.worker.name}}</vn-td>
<vn-td>{{::claim.worker.user.nickname}}</vn-td>
<vn-td class="{{::claim.claimState.description}}">{{::claim.claimState.description}}</vn-td>
<vn-td>
<vn-icon-button

View File

@ -17,7 +17,13 @@ export default class Controller {
{
relation: 'worker',
scope: {
fields: ['firstName', 'name']
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
{

View File

@ -9,10 +9,10 @@
value="{{$ctrl.summary.claim.claimState.description}}">
</vn-label-value>
<vn-label-value label="Salesperson"
value="{{$ctrl.summary.claim.client.salesPerson.firstName}} {{$ctrl.summary.claim.client.salesPerson.name}}">
value="{{$ctrl.summary.claim.client.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Attended by"
value="{{$ctrl.summary.claim.worker.firstName}} {{$ctrl.summary.claim.worker.name}}">
value="{{$ctrl.summary.claim.worker.user.nickname}}">
</vn-label-value>
</vn-one>
<vn-one>

View File

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

View File

@ -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',

View File

@ -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: {

View File

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

View File

@ -42,6 +42,17 @@
}
},
"scope": {
"include": "worker"
"include": {
"relation": "worker",
"scope": {
"fields": ["userFk"],
"include": {
"relation": "user",
"scope": {
"fields": ["nickname"]
}
}
}
}
}
}

View File

@ -42,16 +42,15 @@
<vn-horizontal>
<vn-autocomplete
vn-one
initial-data="$ctrl.client.salesPerson"
disabled="false"
field="$ctrl.client.salesPersonFk"
url="/client/api/Clients/activeWorkersWithRole"
show-field="firstName"
show-field="nickname"
search-function="{firstName: $search}"
value-field="id"
where="{role: 'employee'}"
label="Salesperson"
vn-acl="salesAssistant">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete
vn-one

View File

@ -21,7 +21,7 @@
<vn-tr ng-repeat="credit in credits track by credit.id">
<vn-td>{{::credit.amount | number:2}} €</vn-td>
<vn-td>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::credit.worker.firstName}} {{::credit.worker.name}}</vn-td>
<vn-td>{{::credit.worker.user.nickname}}</vn-td>
</vn-tr>
</vn-tbody>
<vn-empty-rows ng-if="model.data.length === 0" translate>

View File

@ -8,7 +8,13 @@ class Controller {
{
relation: 'worker',
scope: {
fields: ['firstName', 'name']
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
}
]

View File

@ -33,7 +33,7 @@
value="{{$ctrl.client.creditInsurance | currency: 'EUR': 2}}">
</vn-label-value>
<vn-label-value label="Sales person"
value="{{$ctrl.client.salesPerson.firstName}} {{$ctrl.client.salesPerson.name}}">
value="{{$ctrl.client.salesPerson.user.nickname}}">
</vn-label-value>
</div>
<div class="icons">

View File

@ -1,7 +1,7 @@
<vn-crud-model
vn-id="model"
url="/client/api/clientObservations"
filter="{order: 'created DESC'}"
filter="$ctrl.filter"
link="{clientFk: $ctrl.$stateParams.id}"
data="notes"
auto-load="true">
@ -15,7 +15,7 @@
border-radius
margin-small-bottom>
<vn-horizontal margin-small-bottom style="color: #666">
<vn-one>{{::note.worker.firstName}} {{::note.worker.name}}</vn-one>
<vn-one>{{::note.worker.user.nickname}}</vn-one>
<vn-auto>{{::note.created | date:'dd/MM/yyyy HH:mm'}}</vn-auto>
</vn-horizontal>
<vn-horizontal class="text">

View File

@ -3,6 +3,9 @@ import ngModule from '../../module';
export default class Controller {
constructor($stateParams) {
this.$stateParams = $stateParams;
this.filter = {
order: 'created DESC',
};
}
}

View File

@ -60,7 +60,7 @@
<vn-tr ng-repeat="risk in $ctrl.risks">
<vn-td>{{::risk.payed | dateTime:'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::risk.created | dateTime:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::risk.firstName}} {{::risk.name}}</vn-td>
<vn-td>{{::risk.userNickname}}</vn-td>
<vn-td>
<span ng-show="risk.ref" translate>BILL</span> {{::risk.ref}}
</vn-td>

View File

@ -24,7 +24,7 @@
<vn-tr ng-repeat="sample in samples">
<vn-td>{{::sample.created | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-td>{{::sample.type.description}}</vn-td>
<vn-td>{{::sample.worker.firstName}} {{::sample.worker.name}}</vn-td>
<vn-td>{{::sample.worker.user.nickname}}</vn-td>
<vn-td>{{::sample.company.code}}</vn-td>
</vn-tr>
</vn-tbody>

View File

@ -14,7 +14,13 @@ class Controller {
{
relation: 'worker',
scope: {
fields: ['firstName', 'name']
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
},
{

View File

@ -1,5 +1,5 @@
<vn-card class="summary">
<h5>{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.firstName}} {{$ctrl.summary.salesPerson.name}}</h5>
<h5>{{$ctrl.summary.name}} - {{$ctrl.summary.id}} - {{$ctrl.summary.salesPerson.user.nickname}}</h5>
<vn-horizontal>
<vn-one>
<h4 translate>Basic data</h4>
@ -22,7 +22,7 @@
value="{{$ctrl.summary.email}}">
</vn-label-value>
<vn-label-value label="Sales person"
value="{{$ctrl.summary.salesPerson.firstName}} {{$ctrl.summary.salesPerson.name}}">
value="{{$ctrl.summary.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Channel"
value="{{$ctrl.summary.contactChannel.name}}">

View File

@ -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) {

View File

@ -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: [{

View File

@ -33,7 +33,13 @@ module.exports = Self => {
include: [{
relation: 'worker',
scope: {
fields: ['id', 'name', 'firstName']
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
}]
}

View File

@ -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);

View File

@ -49,7 +49,7 @@
value="{{::$ctrl.item.name}}">
</vn-label-value>
<vn-label-value label="Buyer"
value="{{$ctrl.item.itemType.worker.firstName}} {{$ctrl.item.itemType.worker.name}}">
value="{{$ctrl.item.itemType.worker.user.nickname}}">
</vn-label-value>
<vn-label-value
ng-repeat="tag in $ctrl.item.tags | limitTo:4"

View File

@ -18,7 +18,7 @@
value="{{::$ctrl.item.type}}">
</vn-label-value>
<vn-label-value label="Buyer"
value="{{::$ctrl.item.firstName}} {{::$ctrl.item.worker}}">
value="{{::$ctrl.item.userNickname}}">
</vn-label-value>
<vn-fetched-tags max-length="4" item="$ctrl.item" class="noTitle"/>
</vn-one>
@ -36,4 +36,3 @@
</vn-horizontal>
</vn-horizontal>
</a>

View File

@ -39,7 +39,7 @@
value="{{$ctrl.summary.item.origin.stems}}">
</vn-label-value>
<vn-label-value label="Buyer"
value="{{$ctrl.summary.item.itemType.worker.firstName}} {{$ctrl.summary.item.itemType.worker.name}}">
value="{{$ctrl.summary.item.itemType.worker.user.nickname}}">
</vn-label-value>
</vn-one>
<vn-one name="otherData">

View File

@ -7,16 +7,15 @@ 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();
}
}
}
Controller.$inject = ['$http'];

View File

@ -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'],
}
}
}

View File

@ -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'],
}
}
}

View File

@ -30,7 +30,7 @@
value="{{$ctrl.ticket.state.state.name}}">
</vn-label-value>
<vn-label-value label="Sales person"
value="{{$ctrl.ticket.client.salesPerson.firstName}} {{$ctrl.ticket.client.salesPerson.name}}">
value="{{$ctrl.ticket.client.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Shipped"
value="{{$ctrl.ticket.shipped | date: 'dd/MM/yyyy HH:mm' }}">

View File

@ -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']
}
}
}
}
}
}

View File

@ -20,7 +20,7 @@
value="{{$ctrl.order.isConfirmed ? $ctrl.translate.instant('Confirmed') : $ctrl.translate.instant('Not confirmed')}}">
</vn-label-value>
<vn-label-value label="Sales person"
value="{{$ctrl.order.client.salesPerson.firstName}} {{$ctrl.order.client.salesPerson.name}}">
value="{{$ctrl.order.client.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Landed"
value="{{$ctrl.order.landed | date: 'dd/MM/yyyy' }}">

View File

@ -23,9 +23,11 @@
<vn-tr>
<vn-th field="id" default-order="DESC">Id</vn-th>
<vn-th field="clientFk">Client</vn-th>
<vn-th field="clientFk">Sales person</vn-th>
<vn-th field="isConfirmed">Confirmed</vn-th>
<vn-th field="sourceApp">Created from</vn-th>
<vn-th field="created">Created</vn-th>
<vn-th field="created">Landed</vn-th>
<vn-th field="companyFk">Company</vn-th>
</vn-tr>
</vn-thead>
@ -38,6 +40,7 @@
{{::order.client.name}}
</span>
</vn-td>
<vn-td>{{::order.client.salesPerson.user.nickname}}</vn-td>
<vn-td>
<vn-check
field="order.isConfirmed"
@ -46,6 +49,7 @@
</vn-td>
<vn-td>{{::order.sourceApp}}</vn-td>
<vn-td>{{::order.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
<vn-td>{{::order.landed | date:'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::order.company.code}}</vn-td>
<vn-td>
<vn-icon-button

View File

@ -8,7 +8,22 @@ export default class Controller {
include: [
{
relation: 'client',
fields: ['name']
scope: {
fields: ['name', 'salesPersonFk'],
include: {
relation: 'salesPerson',
scope: {
fields: ['userFk'],
include: {
relation: 'user',
scope: {
fields: ['nickname']
}
}
}
}
}
},
{
relation: 'company',

View File

@ -31,12 +31,12 @@ module.exports = Self => {
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));

View File

@ -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);

View File

@ -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']
}
}
}
}
}
},

View File

@ -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']
}
}
}
},
},
},

View File

@ -57,7 +57,7 @@
</vn-icon>
</vn-td>
<vn-td number>{{::ticket.id}}</vn-td>
<vn-td>{{::ticket.salesPerson | dashIfEmpty}}</vn-td>
<vn-td>{{::ticket.userNickname | dashIfEmpty}}</vn-td>
<vn-td class="{{$ctrl.compareDate(ticket.shipped)}}">
{{::ticket.shipped | dateTime: 'dd/MM/yyyy'}}
</vn-td>

View File

@ -12,14 +12,13 @@
<vn-textfield vn-one label="Description" field="$ctrl.ticketRequest.description" vn-focus></vn-textfield>
<vn-autocomplete
vn-one
label="Buyer"
field="$ctrl.ticketRequest.atenderFk"
select-fields="['id', 'firstName']"
url="/client/api/Clients/activeWorkersWithRole"
where="{role: 'buyer'}"
show-field="nickname"
search-function="{firstName: $search}"
show-field="firstName">
<tpl-item>{{firstName}} {{name}}</tpl-item>
value-field="id"
where="{role: 'buyer'}"
label="Buyer">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>

View File

@ -34,8 +34,8 @@
<vn-td number>{{::request.id}}</vn-td>
<vn-td>{{::request.description}}</vn-td>
<vn-td number>{{::request.created | dateTime: 'dd/MM/yyyy'}}</vn-td>
<vn-td>{{::request.requester.user.name}}</vn-td>
<vn-td>{{::request.atender.user.name}}</vn-td>
<vn-td>{{::request.requester.user.nickname}}</vn-td>
<vn-td>{{::request.atender.user.nickname}}</vn-td>
<vn-td number>{{::request.quantity}}</vn-td>
<vn-td number>{{::request.price | currency: 'EUR': 2}}</vn-td>
<vn-td number>

View File

@ -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'
}
]
};
}

View File

@ -42,7 +42,7 @@
<vn-td>{{::sale.originalQuantity}}</vn-td>
<vn-td title="{{::sale.firstName}} {{::sale.name}}"
class="ellipsize" style="max-width: 5em">
{{::sale.firstName}} {{::sale.name}}
{{::sale.userNickname}}
</vn-td>
<vn-td>{{::sale.state}}</vn-td>
<vn-td>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>

View File

@ -6,7 +6,7 @@
value="{{$ctrl.summary.state.state.name}}">
</vn-label-value>
<vn-label-value label="Salesperson"
value="{{$ctrl.summary.client.salesPerson.firstName}} {{$ctrl.summary.client.salesPerson.name}}">
value="{{$ctrl.summary.client.salesPerson.user.nickname}}">
</vn-label-value>
<vn-label-value label="Agency"
value="{{$ctrl.summary.agencyMode.name}}">

View File

@ -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">
<tpl-item>{{firstName}} {{name}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
</vn-card>

View File

@ -22,7 +22,7 @@
class="vn-list-item">
<vn-horizontal>
<vn-one>
<h6>{{::worker.firstName}} {{::worker.name}}</h6>
<h6>{{::worker.user.nickname}}</h6>
<vn-label-value label="Id"
value="{{::worker.id}}">
</vn-label-value>

View File

@ -8,7 +8,7 @@ export default class Controller {
include: [
{
relation: 'user',
scope: {fields: ['name', 'email']}
scope: {fields: ['nickname', 'email']}
}, {
relation: 'client',
scope: {fields: ['fi']}