zettapi_client
Version:
Client side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project
48 lines (44 loc) • 1.36 kB
JavaScript
app.directive('zlReport', function (zapiPath) {
return {
restrict: 'E',
scope: {
field: '=',
condition: '='
},
replace: false,
templateUrl: zapiPath + '/directives/report/report.html',
controller: function ($scope, $report) {
$scope.metadata = {};
$scope.item = {
type: 'exp',
database: '',
collection: '',
query: [],
select: {},
limit: 0,
sort: {},
populate: ''
};
$scope.map = {
"id_animal": "Número SIA",
"id_eletronico": "Brinco Electrónico",
"sexo": "Sexo",
"raca": "Raça",
"data_nascimento": "Dt. Nascimento",
"mae": "Mãe",
"pai": "Pai",
"tipo": "Aptidão",
"fenotipo": "Fenotipo"
};
$report.getMetadata(function (err, metadata) {
$scope.metadata = metadata;
});
$scope.appendQuery = function (fieldName, field) {
$scope.item.query.push({
field: field,
fieldName: fieldName
});
};
}
};
});