[R12 - T16] REST para mandatos
This commit is contained in:
parent
786d321794
commit
b8a6340afd
|
@ -1,12 +1,12 @@
|
|||
<mg-ajax path="/client/api/mandate/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||
<mg-ajax path="/client/api/mandates/filter" options="vnIndexNonAuto"></mg-ajax>
|
||||
<vn-card pad-medium>
|
||||
<vn-vertical pad-medium>
|
||||
<vn-title vn-one margin-large-bottom>Mandate</vn-title>
|
||||
|
||||
<vn-grid-header on-order="$ctrl.onOrder(field, order)">
|
||||
<vn-column-header vn-one pad-medium-h field="id" text="Id"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="company" text="Company"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="type" text="Type"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="companyFk" text="Company"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="mandateTypeFk" text="Type"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="created" text="Register date" default-order="ASC"></vn-column-header>
|
||||
<vn-column-header vn-one pad-medium-h field="finished" text="End date"></vn-column-header>
|
||||
</vn-grid-header>
|
||||
|
@ -17,8 +17,8 @@
|
|||
ng-repeat="mandate in index.model.instances track by mandate.id"
|
||||
>
|
||||
<vn-one pad-medium-h>{{::mandate.id}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.company}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.type}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.company.code}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.mandateType.name}}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.created | date:'dd/MM/yyyy HH:mm' }}</vn-one>
|
||||
<vn-one pad-medium-h>{{::mandate.finished | date:'dd/MM/yyyy HH:mm' || '-'}}</vn-one>
|
||||
</vn-horizontal>
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
module.exports = Self => {
|
||||
Self.installMethod('filter', filterParams);
|
||||
|
||||
function filterParams(params) {
|
||||
return {
|
||||
where: {
|
||||
clientFk: params.clientFk
|
||||
},
|
||||
skip: (params.page - 1) * params.size,
|
||||
limit: params.size,
|
||||
order: params.order || 'created DESC',
|
||||
include: [
|
||||
{
|
||||
relation: "mandateType",
|
||||
scope: {
|
||||
fields: ["id", "name"]
|
||||
}
|
||||
},
|
||||
{
|
||||
relation: "company",
|
||||
scope: {
|
||||
fields: ["id", "code"]
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
};
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "company",
|
||||
"base": "VnModel",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"code": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = function(Self) {
|
||||
require('../methods/mandate/filter.js')(Self);
|
||||
};
|
|
@ -0,0 +1,32 @@
|
|||
{
|
||||
"name": "mandate",
|
||||
"base": "VnModel",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"code": {
|
||||
"type": "String"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
},
|
||||
"finished": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"company": {
|
||||
"type": "belongsTo",
|
||||
"model": "company",
|
||||
"foreignKey": "companyFk"
|
||||
},
|
||||
"mandateType": {
|
||||
"type": "belongsTo",
|
||||
"model": "mandateType",
|
||||
"foreignKey": "mandateTypeFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "mandateType",
|
||||
"base": "VnModel",
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,5 +65,14 @@
|
|||
},
|
||||
"greugeType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"mandate": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"mandateType": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"company": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue