refs #4789 hasInvoice on ticket searchbar @3h30m
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
46af56922c
commit
a733bc8c2f
|
@ -88,6 +88,11 @@ module.exports = Self => {
|
|||
type: 'boolean',
|
||||
description: `Whether to show only tickets with route`
|
||||
},
|
||||
{
|
||||
arg: 'hasInvoice',
|
||||
type: 'boolean',
|
||||
description: `Whether to show only tickets with invoice`
|
||||
},
|
||||
{
|
||||
arg: 'pending',
|
||||
type: 'boolean',
|
||||
|
@ -199,6 +204,10 @@ module.exports = Self => {
|
|||
if (value == true)
|
||||
return {'t.routeFk': {neq: null}};
|
||||
return {'t.routeFk': null};
|
||||
case 'hasInvoice':
|
||||
if (value == true)
|
||||
return {'t.refFk': {neq: null}};
|
||||
return {'t.refFk': null};
|
||||
case 'pending':
|
||||
return {'st.isNotValidated': value};
|
||||
case 'id':
|
||||
|
|
|
@ -278,4 +278,42 @@ describe('ticket filter()', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return the tickets the invoice on false', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args: {hasInvoice: true}};
|
||||
const filter = {};
|
||||
const result = await models.Ticket.filter(ctx, filter, options);
|
||||
|
||||
expect(result.length).toEqual(6);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('should return the tickets the invoice on null', async() => {
|
||||
const tx = await models.Ticket.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const ctx = {req: {accessToken: {userId: 9}}, args: {hasInvoice: 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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -141,6 +141,11 @@
|
|||
ng-model="filter.hasRoute"
|
||||
triple-state="true">
|
||||
</vn-check>
|
||||
<vn-check
|
||||
vn-one
|
||||
label="Has invoice"
|
||||
ng-model="filter.hasInvoice"
|
||||
triple-state="true">
|
||||
</vn-horizontal>
|
||||
<vn-horizontal class="vn-px-lg vn-pb-lg vn-mt-lg">
|
||||
<vn-submit label="Search"></vn-submit>
|
||||
|
|
|
@ -13,6 +13,7 @@ Grouped States: Estado agrupado
|
|||
Days onward: Días adelante
|
||||
With problems: Con problemas
|
||||
Has route: Con ruta
|
||||
Has invoice: Con factura
|
||||
Pending: Pendiente
|
||||
FREE: Libre
|
||||
DELIVERED: Servido
|
||||
|
|
Loading…
Reference in New Issue