fix: retrieve bills and bills payments list.

This commit is contained in:
Ahmed Bouhuolia
2020-10-24 12:37:17 +02:00
parent ab4ec24619
commit 0a03fcdd92
7 changed files with 148 additions and 49 deletions

View File

@@ -17,6 +17,10 @@ export default class Bill extends TenantModel {
return 'bills';
}
static get resourceable() {
return true;
}
/**
* Timestamps columns.
*/
@@ -48,7 +52,7 @@ export default class Bill extends TenantModel {
to: 'contacts.id',
},
filter(query) {
query.where('contact_type', 'Vendor');
query.where('contact_service', 'vendor');
}
},
@@ -97,4 +101,14 @@ export default class Bill extends TenantModel {
.where('id', billId)
[changeMethod]('payment_amount', Math.abs(amount));
}
static get fields() {
return {
created_at: {
label: 'Created at',
column: 'created_at',
columnType: 'date',
},
}
}
}

View File

@@ -16,6 +16,10 @@ export default class BillPayment extends TenantModel {
return ['createdAt', 'updatedAt'];
}
static get resourceable() {
return true;
}
/**
* Relationship mapping.
*/
@@ -43,7 +47,7 @@ export default class BillPayment extends TenantModel {
to: 'contacts.id',
},
filter(query) {
query.where('contact_type', 'Vendor');
query.where('contact_service', 'vendor');
}
},
@@ -69,4 +73,15 @@ export default class BillPayment extends TenantModel {
}
};
}
static get fields() {
return {
created_at: {
label: 'Created at',
column: 'created_at',
columnType: 'date',
},
}
}
}