listado de crédito de cliente

This commit is contained in:
Daniel Herrero 2017-11-28 12:58:05 +01:00
parent 438c573ec1
commit 9df3d30c40
6 changed files with 85 additions and 3 deletions

View File

@ -14,3 +14,4 @@ import './address-edit/address-edit';
import './notes/notes';
import './note-create/note-create';
import './web-access/web-access';
import './credit-list/credit-list';

View File

@ -0,0 +1,29 @@
<vn-vertical pad-medium>
<mg-ajax
path="/client/api/clientCredits/filter"
options="vnIndexNonAuto"></mg-ajax>
<vn-card>
<vn-vertical pad-large>
<vn-horizontal margin-large-bottom>
<vn-title vn-one>Credit</vn-title>
</vn-horizontal>
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
<vn-column-header vn-one pad-medium-h field="amount" text="credit"></vn-column-header>
<vn-column-header vn-one pad-medium-h field="created" text="Desde"></vn-column-header>
<vn-six></vn-six>
</vn-grid-header>
<vn-one class="list list-content">
<vn-horizontal vn-one class="list list-element text-center" ng-repeat="credit in index.model.instances track by credit.id">
<vn-one pad-medium-h>{{::credit.amount | number:2}}</vn-one>
<vn-one pad-medium-h>{{::credit.created}}</vn-one>
<vn-six></vn-six>
</vn-horizontal>
</vn-one>
<vn-horizontal vn-one class="list list-footer"></vn-horizontal>
<vn-one>
<vn-paging index="index" total="index.model.count"></vn-paging>
</vn-one>
</vn-vertical>
</vn-card>
</vn-vertical>

View File

@ -0,0 +1,38 @@
import ngModule from '../module';
class ClientCreditList {
constructor($scope) {
this.$ = $scope;
}
onOrder(field, order) {
this.filter(`${field} ${order}`);
}
filter(order) {
this.$.index.filter = {
page: 1,
size: 10,
clientFk: this.client.id
};
if (order) {
this.$.index.filter.order = order;
}
this.$.index.accept();
}
$onChanges() {
if (this.client && this.client.id) {
this.filter();
}
}
}
ClientCreditList.$inject = ['$scope'];
ngModule.component('vnClientCreditList', {
template: require('./credit-list.html'),
controller: ClientCreditList,
bindings: {
client: '<'
}
});

View File

@ -0,0 +1,14 @@
module.exports = function(Self) {
Self.installMethod('filter', filterCredits);
function filterCredits(params) {
return {
where: {
clientFk: params.clientFk
},
skip: (params.page - 1) * params.size,
limit: params.size,
order: params.order || 'created DESC'
};
}
};

View File

@ -1,5 +1,5 @@
{
"name": "ClientCredit",
"name": "clientCredit",
"base": "VnModel",
"validateUpsert": true,
"properties": {

View File

@ -27,8 +27,8 @@
"Client": {
"dataSource": "vn"
},
"ClientCredit": {
"dataSource": "salix"
"clientCredit": {
"dataSource": "vn"
},
"ClientCreditLimit": {
"dataSource": "salix"