$scope.elementList = [];
$scope.elementTitles = [];
- function getEntityType() {
+ this.getEntityType = function() {
return (ctrl.entity.type === 'Contact' && ctrl.entity.data) ? ctrl.entity.data.contact_type || 'Contact' : ctrl.entity.type;
- }
+ };
$scope.getMeta = function() {
- return afGui.meta.entities[getEntityType()];
+ return afGui.meta.entities[ctrl.getEntityType()];
};
$scope.getAdminTpl = function() {
$scope.fieldList.length = 0;
$scope.fieldList.push({
entityName: ctrl.entity.name,
- entityType: getEntityType(),
+ entityType: ctrl.getEntityType(),
label: ts('%1 Fields', {1: $scope.getMeta().label}),
fields: filterFields($scope.getMeta().fields)
});
<legend>{{:: ts('Values:') }}</legend>
<div class="form-inline" ng-if="getMeta().fields[fieldName]" ng-repeat="(fieldName, value) in $ctrl.entity.data">
<label>{{ getMeta().fields[fieldName].label }}:</label><br />
- <input class="form-control" af-gui-field-value="getField($ctrl.entity.type, fieldName)" ng-model="$ctrl.entity.data[fieldName]" />
+ <input class="form-control" af-gui-field-value="getField($ctrl.getEntityType(), fieldName)" ng-model="$ctrl.entity.data[fieldName]" />
<a href ng-click="removeValue($ctrl.entity, fieldName)">
<i class="crm-i fa-times"></i>
</a>