Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2240-salix-version-refresh
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
commit
0d4ab527c3
|
@ -28,12 +28,12 @@ describe('Client defaulter path', () => {
|
||||||
const salesPersonName =
|
const salesPersonName =
|
||||||
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
await page.waitToGetProperty(selectors.clientDefaulter.firstSalesPersonName, 'innerText');
|
||||||
|
|
||||||
expect(clientName).toEqual('Ororo Munroe');
|
expect(clientName).toEqual('Bruce Banner');
|
||||||
expect(salesPersonName).toEqual('salesPersonNick');
|
expect(salesPersonName).toEqual('developer');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should first observation not changed', async() => {
|
it('should first observation not changed', async() => {
|
||||||
const expectedObservation = 'Madness, as you know, is like gravity, all it takes is a little push';
|
const expectedObservation = 'Meeting with Black Widow 21st 9am';
|
||||||
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
const result = await page.waitToGetProperty(selectors.clientDefaulter.firstObservation, 'value');
|
||||||
|
|
||||||
expect(result).toContain(expectedObservation);
|
expect(result).toContain(expectedObservation);
|
||||||
|
|
|
@ -15,8 +15,9 @@ export default function currency($translate) {
|
||||||
maximumFractionDigits: fractionSize
|
maximumFractionDigits: fractionSize
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const lang = $translate.use() == 'es' ? 'de' : $translate.use();
|
||||||
if (typeof input == 'number') {
|
if (typeof input == 'number') {
|
||||||
return new Intl.NumberFormat($translate.use(), options)
|
return new Intl.NumberFormat(lang, options)
|
||||||
.format(input);
|
.format(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,12 @@ module.exports = Self => {
|
||||||
DISTINCT c.id clientFk,
|
DISTINCT c.id clientFk,
|
||||||
c.name clientName,
|
c.name clientName,
|
||||||
c.salesPersonFk,
|
c.salesPersonFk,
|
||||||
u.nickname salesPersonName,
|
u.name salesPersonName,
|
||||||
d.amount,
|
d.amount,
|
||||||
co.created,
|
co.created,
|
||||||
co.text observation,
|
co.text observation,
|
||||||
uw.id workerFk,
|
uw.id workerFk,
|
||||||
uw.nickname workerName,
|
uw.name workerName,
|
||||||
c.creditInsurance,
|
c.creditInsurance,
|
||||||
d.defaulterSinced
|
d.defaulterSinced
|
||||||
FROM vn.defaulter d
|
FROM vn.defaulter d
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
url="Defaulters/filter"
|
url="Defaulters/filter"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
limit="20"
|
limit="20"
|
||||||
|
order="amount DESC"
|
||||||
data="defaulters"
|
data="defaulters"
|
||||||
auto-load="true">
|
auto-load="true">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
@ -70,13 +71,13 @@
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
vn-tooltip="Last observation date"
|
vn-tooltip="Last observation date"
|
||||||
field="created"
|
field="created">
|
||||||
shrink-datetime>
|
<span translate>L. O. Date</span>
|
||||||
<span translate>Last observation D.</span>
|
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
vn-tooltip="Credit insurance"
|
vn-tooltip="Credit insurance"
|
||||||
field="creditInsurance" >
|
field="creditInsurance"
|
||||||
|
shrink>
|
||||||
<span translate>Credit I.</span>
|
<span translate>Credit I.</span>
|
||||||
</th>
|
</th>
|
||||||
<th field="defaulterSinced">
|
<th field="defaulterSinced">
|
||||||
|
@ -124,13 +125,13 @@
|
||||||
ng-model="defaulter.observation">
|
ng-model="defaulter.observation">
|
||||||
</vn-textarea>
|
</vn-textarea>
|
||||||
</td>
|
</td>
|
||||||
<td shrink-datetime>
|
<td shrink-date>
|
||||||
<span class="chip {{::$ctrl.chipColor(defaulter.created)}}">
|
<span class="chip {{::$ctrl.chipColor(defaulter.created)}}">
|
||||||
{{::defaulter.created | date: 'dd/MM/yyyy'}}
|
{{::defaulter.created | date: 'dd/MM/yyyy'}}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
|
<td shrink>{{::defaulter.creditInsurance | currency: 'EUR': 2}}</td>
|
||||||
<td>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
|
<td shrink-date>{{::defaulter.defaulterSinced | date: 'dd/MM/yyyy'}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -26,7 +26,7 @@ export default class Controller extends Section {
|
||||||
url: 'Workers/activeWithInheritedRole',
|
url: 'Workers/activeWithInheritedRole',
|
||||||
where: `{role: 'salesPerson'}`,
|
where: `{role: 'salesPerson'}`,
|
||||||
searchFunction: '{firstName: $search}',
|
searchFunction: '{firstName: $search}',
|
||||||
showField: 'nickname',
|
showField: 'name',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -35,7 +35,7 @@ export default class Controller extends Section {
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
url: 'Workers/activeWithInheritedRole',
|
url: 'Workers/activeWithInheritedRole',
|
||||||
searchFunction: '{firstName: $search}',
|
searchFunction: '{firstName: $search}',
|
||||||
showField: 'nickname',
|
showField: 'name',
|
||||||
valueField: 'id',
|
valueField: 'id',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -53,16 +53,8 @@ export default class Controller extends Section {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
get balanceDueTotal() {
|
this.getBalanceDueTotal();
|
||||||
let balanceDueTotal = 0;
|
|
||||||
const defaulters = this.$.model.data || [];
|
|
||||||
|
|
||||||
for (let defaulter of defaulters)
|
|
||||||
balanceDueTotal += defaulter.amount;
|
|
||||||
|
|
||||||
return balanceDueTotal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get checked() {
|
get checked() {
|
||||||
|
@ -76,6 +68,18 @@ export default class Controller extends Section {
|
||||||
return checkedLines;
|
return checkedLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getBalanceDueTotal() {
|
||||||
|
this.$http.get('Defaulters/filter')
|
||||||
|
.then(res => {
|
||||||
|
if (!res.data) return 0;
|
||||||
|
|
||||||
|
this.balanceDueTotal = res.data.reduce(
|
||||||
|
(accumulator, currentValue) => {
|
||||||
|
return accumulator + (currentValue['amount'] || 0);
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
chipColor(date) {
|
chipColor(date) {
|
||||||
const day = 24 * 60 * 60 * 1000;
|
const day = 24 * 60 * 60 * 1000;
|
||||||
const today = new Date();
|
const today = new Date();
|
||||||
|
|
|
@ -36,17 +36,6 @@ describe('client defaulter', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('balanceDueTotal() getter', () => {
|
|
||||||
it('should return balance due total', () => {
|
|
||||||
const data = controller.$.model.data;
|
|
||||||
const expectedAmount = data[0].amount + data[1].amount + data[2].amount;
|
|
||||||
|
|
||||||
const result = controller.balanceDueTotal;
|
|
||||||
|
|
||||||
expect(result).toEqual(expectedAmount);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('chipColor()', () => {
|
describe('chipColor()', () => {
|
||||||
it('should return undefined when the date is the present', () => {
|
it('should return undefined when the date is the present', () => {
|
||||||
let today = new Date();
|
let today = new Date();
|
||||||
|
@ -93,6 +82,7 @@ describe('client defaulter', () => {
|
||||||
const params = [{text: controller.defaulter.observation, clientFk: data[1].clientFk}];
|
const params = [{text: controller.defaulter.observation, clientFk: data[1].clientFk}];
|
||||||
|
|
||||||
jest.spyOn(controller.vnApp, 'showMessage');
|
jest.spyOn(controller.vnApp, 'showMessage');
|
||||||
|
$httpBackend.expect('GET', `Defaulters/filter`).respond(200);
|
||||||
$httpBackend.expect('POST', `ClientObservations`, params).respond(200, params);
|
$httpBackend.expect('POST', `ClientObservations`, params).respond(200, params);
|
||||||
|
|
||||||
controller.onResponse();
|
controller.onResponse();
|
||||||
|
@ -115,5 +105,17 @@ describe('client defaulter', () => {
|
||||||
expect(expr).toEqual({'d.clientFk': '5'});
|
expect(expr).toEqual({'d.clientFk': '5'});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('getBalanceDueTotal()', () => {
|
||||||
|
it('should return balance due total', () => {
|
||||||
|
const defaulters = controller.$.model.data;
|
||||||
|
$httpBackend.when('GET', `Defaulters/filter`).respond(defaulters);
|
||||||
|
|
||||||
|
controller.getBalanceDueTotal();
|
||||||
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
expect(controller.balanceDueTotal).toEqual(875);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@ Add observation to all selected clients: Añadir observación a {{total}} client
|
||||||
Balance D.: Saldo V.
|
Balance D.: Saldo V.
|
||||||
Credit I.: Crédito A.
|
Credit I.: Crédito A.
|
||||||
Last observation: Última observación
|
Last observation: Última observación
|
||||||
Last observation D.: Fecha última O.
|
L. O. Date: Fecha Ú. O.
|
||||||
Last observation date: Fecha última observación
|
Last observation date: Fecha última observación
|
||||||
Search client: Buscar clientes
|
Search client: Buscar clientes
|
||||||
Worker who made the last observation: Trabajador que ha realizado la última observación
|
Worker who made the last observation: Trabajador que ha realizado la última observación
|
Loading…
Reference in New Issue