app.controller('cost_center_codesCTRL', function($scope, $http, $location) { // Standard C/R/U/D buttons for the three tables on this page var buildButtons = function(createName) { return { 'C': { 'id': 'c', 'name': createName, 'inline': false, 'header': true, 'action': 'create', 'icon': 'fa-plus', 'cancelName': 'Annuleren', 'confirmName': 'Maak', }, 'R': { 'id': 'r', 'label': 'Bekijk', 'name': 'Bekijk', 'inline': true, 'icon': 'fa-arrow-right', 'action': 'read', }, 'U': { 'id': 'u', 'label': 'Bewerk', 'name': 'Bewerken', 'action': 'update', 'inline': true, 'header': false, 'cancelName': 'Annuleren', 'confirmName': 'Bewerk', 'icon': 'fa-pencil', }, 'D': { 'id': 'd', 'name': 'Verwijder', 'label': 'Verwijder', 'cancelName': 'Annuleren', 'confirmName': 'Verwijder', 'inline': true, 'header': false, 'icon': 'fa-trash', 'action': 'delete', }, }; }; // Cost center keys (destination, sport, group) with their cost unit; format and uniqueness checked by the backend $scope.cost_center_codes_overview = { name: 'Kostenplaatssleutels', controller: 'Cost_center_code', function: 'getAll', panelClass: 'panel-trainingskampen', showFilters: true, pageLimit: 25, fields: [ 'code', 'name', 'type', 'cost_unit', 'is_active', 'sort_order', ], fieldDetails: { 'code': { 'label': 'Code', }, 'name': { 'label': 'Omschrijving', }, 'type': { 'label': 'Type', 'type': 'enum', 'options': [ { id: 'destination', name: 'Bestemming' }, { id: 'sport', name: 'Sport' }, { id: 'group', name: 'Groep' }, ], }, 'cost_unit': { 'label': 'Kostendrager', 'type': 'enum', 'options': [ { id: 'R', name: 'R - reisbureauregeling' }, { id: 'C', name: 'C - geen RBR (Canarische eilanden, buiten Europa)' }, { id: 'G', name: 'G - doorbelaste vluchten EMboost' }, ], }, 'is_active': { 'label': 'Actief', 'type': 'boolean', 'booleanOn': 1, 'booleanOff': 0, }, 'sort_order': { 'label': 'Volgorde', 'type': 'number', }, }, buttons: buildButtons('Voeg sleutel toe'), }; // Place aliases: a camp location or hotel place linked to a key (Torremolinos -> MALA) $scope.cost_center_code_aliases_overview = { name: 'Plaatsen per sleutel', controller: 'Cost_center_code_alias', function: 'getAll', panelClass: 'panel-trainingskampen', showFilters: true, pageLimit: 25, fields: [ 'name', 'cost_center_code_id', ], subQueries: { 'cost_center_code': { 'lfield': 'cost_center_code_id', 'ffield': 'id', 'controller': 'cost_center_code', }, }, fieldDetails: { 'name': { 'label': 'Plaats (kamplocatie of hotelplaats)', }, 'cost_center_code_id': { 'label': 'Sleutel', 'changeTo': ['cost_center_code.code', ' - ', 'cost_center_code.name'], }, }, buttons: buildButtons('Voeg plaats toe'), }; // Airport -> destination for unsold Transavia seats; unknown or ambiguous airports go to OVER $scope.airport_cost_center_codes_overview = { name: 'Vliegveld naar bestemming', controller: 'Airport_cost_center_code', function: 'getAll', panelClass: 'panel-trainingskampen', showFilters: true, pageLimit: 25, fields: [ 'iata', 'cost_center_code_id', 'is_default', ], subQueries: { 'cost_center_code': { 'lfield': 'cost_center_code_id', 'ffield': 'id', 'controller': 'cost_center_code', }, }, fieldDetails: { 'iata': { 'label': 'Vliegveld (IATA)', }, 'cost_center_code_id': { 'label': 'Bestemming', 'changeTo': ['cost_center_code.code', ' - ', 'cost_center_code.name'], }, 'is_default': { 'label': 'Standaard', 'type': 'boolean', 'booleanOn': 1, 'booleanOff': 0, }, }, buttons: buildButtons('Voeg vliegveld toe'), }; });