Commit e623ee94 authored by jaapjansma's avatar jaapjansma

update

parent 03678e64
......@@ -64,7 +64,7 @@ class UpdateCustomData extends AbstractAction {
if (isset($customField['is_view']) && $customField['is_view']) {
continue;
}
$spec = CustomField::getSpecFromCustomField($customField, $customGroup['title'].': ', false);
if ($spec) {
$specs->addSpecification($spec);
......
......@@ -9,7 +9,7 @@
crm-ui-id="{{spec.name}}"
ui-options="{allowClear: true}"
name="{{spec.name}}"
ng-model="configuration[spec.name]"
ng-model="configuration.configuration[spec.name]"
ng-required="spec.required"
>
<option ng-repeat="(key,value) in spec.options" value="{{key}}">{{value}}</option>
......@@ -21,7 +21,7 @@
crm-entityref="{entity: spec.fk_entity, select: {allowClear: true, placeholder: spec.title}}"
name="{{spec.name}}"
crm-ui-id="{{spec.name}}"
ng-model="configuration[spec.name]"
ng-model="configuration.configuration[spec.name]"
ng-required="spec.required"
/>
</div>
......@@ -31,7 +31,7 @@
type="text"
crm-ui-id="{{spec.name}}"
name="{{spec.name}}"
ng-model="action.condition_configuration.configuration[spec.name]"
ng-model="configuration.configuration[spec.name]"
class="big crm-form-text"
ng-required="spec.required"
/>
......@@ -49,7 +49,7 @@
name="{{spec.name}}"
ui-jq="select2"
ui-options="{allowClear: true}"
ng-model="action.condition_configuration.parameter_mapping[spec.name]"
ng-model="configuration.parameter_mapping[spec.name]"
ng-required="spec.required"
ng-options="field.name as field.label for field in fields">
<option value=""></option>
......@@ -60,7 +60,7 @@
<div ng-if="fields" class="crm-block crm-form-block" ng-form="output_mapper">
<h3>{{ts('Map output data if condition is not valid')}}</h3>
<ng-repeat ng-repeat="spec in action.type.output_spec">
<ng-repeat ng-repeat="spec in actionObject.output_spec">
<div crm-ui-field="{name: 'output_mapper.'+spec.name, title: spec.title}">
<select
style="width: 90%;"
......@@ -68,7 +68,7 @@
name="{{spec.name}}"
ui-jq="select2"
ui-options="{allowClear: true}"
ng-model="action.condition_configuration.output_mapping[spec.name]"
ng-model="configuration.output_mapping[spec.name]"
ng-options="field.name as field.label for field in fields">
<option value=""></option>
</select>
......
......@@ -3,10 +3,12 @@
// Example usage: <crm-ap-condition-configuration configuration="condition.configuration" condition="condition.type"></crm-ap-condition-configuration>
angular.module('action_provider').directive('crmApConditionConfiguration', ["crmApi", function(crmApi) {
var conditions = {};
var actions = {};
return {
restrict: 'E',
templateUrl: '~/action_provider/crmApConditionConfiguration.html',
scope: {
name: '=',
action: '=',
context: '@',
configuration: '=',
......@@ -16,28 +18,44 @@
link: function($scope, $el, $attr) {
$scope.ts = CRM.ts(null);
$scope.condition = {};
$scope.actionObject = {};
if (!($scope.context in conditions)) {
conditions[$scope.context] = {};
}
if (!($scope.context in actions)) {
actions[$scope.context] = {};
}
$scope.$watch('action.condition_configuration', function(newCondition, oldCondition) {
$scope.$watch('name', function(newCondition, oldCondition) {
if (!newCondition) {
$scope.condition = null;
return;
}
if ($scope.action.condition_configuration.name in conditions[$scope.context]) {
$scope.condition = conditions[$scope.context][$scope.action.condition_configuration.name];
if ($scope.name in conditions[$scope.context]) {
$scope.condition = conditions[$scope.context][$scope.name];
return;
}
crmApi('ActionProvider', 'getcondition', {name: $scope.action.condition_configuration.name, context: $scope.context}).
crmApi('ActionProvider', 'getcondition', {name: $scope.name, context: $scope.context}).
then(function (data) {
conditions[$scope.context][$scope.action.condition_configuration.name] = data;
conditions[$scope.context][$scope.name] = data;
$scope.condition = data;
});
});
if ($scope.action in actions[$scope.context]) {
$scope.actionObject = actions[$scope.context][$scope.action];
} else {
crmApi('ActionProvider', 'getaction', {
name: $scope.action,
context: $scope.context
}).then(function (data) {
actions[$scope.context][$scope.action] = data;
$scope.actionObject = data;
});
}
}
};
}]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment