Merge branch 'dev' into 3273-supplier_billing-data
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-12-21 11:27:34 +00:00
commit 707c9c33f7
5 changed files with 76 additions and 2 deletions

View File

@ -524,7 +524,7 @@ export default {
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
acceptDialog: '.vn-dialog.shown button[response="accept"]',
acceptChangeHourButton: '.vn-dialog.shown button[response="accept"]',
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(3) > section > span',
descriptorDeliveryDate: 'vn-ticket-descriptor slot-body > .attributes > vn-label-value:nth-child(4) > section > span',
acceptInvoiceOutButton: '.vn-confirm.shown button[response="accept"]',
acceptDeleteStowawayButton: '.vn-dialog.shown button[response="accept"]'
},

View File

@ -83,6 +83,11 @@ module.exports = Self => {
type: 'boolean',
description: `Whether to show only tickets with problems`
},
{
arg: 'hasRoute',
type: 'boolean',
description: `Whether to show only tickets with route`
},
{
arg: 'pending',
type: 'boolean',
@ -188,6 +193,10 @@ module.exports = Self => {
case 'alertLevel':
return {'ts.alertLevel': value};
case 'hasRoute':
if (value == true)
return {'t.routeFk': {neq: null}};
return {'t.routeFk': null};
case 'pending':
if (value) {
return {and: [
@ -266,7 +275,8 @@ module.exports = Self => {
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 account.user u ON u.id = wk.userFk`);
LEFT JOIN account.user u ON u.id = wk.userFk
LEFT JOIN route r ON r.id = t.routeFk`);
if (args.orderFk) {
stmt.merge({

View File

@ -221,4 +221,61 @@ describe('ticket filter()', () => {
throw e;
}
});
it('should return the tickets matching the route on true', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 9}}, args: {hasRoute: true}};
const filter = {};
const result = await models.Ticket.filter(ctx, filter, options);
expect(result.length).toEqual(22);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return the tickets matching the route on false', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 9}}, args: {hasRoute: false}};
const filter = {};
const result = await models.Ticket.filter(ctx, filter, options);
expect(result.length).toEqual(5);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should return the tickets matching the route on null', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ctx = {req: {accessToken: {userId: 9}}, args: {hasRoute: null}};
const filter = {};
const result = await models.Ticket.filter(ctx, filter, options);
expect(result.length).toEqual(27);
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -135,6 +135,12 @@
ng-model="filter.pending"
triple-state="true">
</vn-check>
<vn-check
vn-one
label="Has route"
ng-model="filter.hasRoute"
triple-state="true">
</vn-check>
</vn-horizontal>
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
<vn-submit label="Search"></vn-submit>

View File

@ -12,6 +12,7 @@ Order id: Id cesta
Grouped States: Estado agrupado
Days onward: Días adelante
With problems: Con problemas
Has route: Con ruta
Pending: Pendiente
FREE: Libre
DELIVERED: Servido