diff --git a/codbex-organizations/codbex-organizations.edm b/codbex-organizations/codbex-organizations.edm
index 8e9392e..d9b833b 100644
--- a/codbex-organizations/codbex-organizations.edm
+++ b/codbex-organizations/codbex-organizations.edm
@@ -33,7 +33,7 @@
-
+
@@ -61,5 +61,5 @@
-
+
\ No newline at end of file
diff --git a/codbex-organizations/codbex-organizations.gen b/codbex-organizations/codbex-organizations.gen
index 307f660..7b66640 100644
--- a/codbex-organizations/codbex-organizations.gen
+++ b/codbex-organizations/codbex-organizations.gen
@@ -871,10 +871,10 @@
"description": "",
"name": "Department",
"tooltip": "",
- "widgetDependsOnEntity": "",
- "widgetDependsOnFilterBy": "",
- "widgetDependsOnProperty": "",
- "widgetDependsOnValueFrom": "",
+ "widgetDependsOnEntity": "Organization",
+ "widgetDependsOnFilterBy": "Organization",
+ "widgetDependsOnProperty": "Organization",
+ "widgetDependsOnValueFrom": "Id",
"widgetDropDownKey": "Id",
"widgetDropDownValue": "Name",
"widgetIsMajor": true,
@@ -1024,10 +1024,10 @@
"description": "",
"name": "Department",
"tooltip": "",
- "widgetDependsOnEntity": "",
- "widgetDependsOnFilterBy": "",
- "widgetDependsOnProperty": "",
- "widgetDependsOnValueFrom": "",
+ "widgetDependsOnEntity": "Organization",
+ "widgetDependsOnFilterBy": "Organization",
+ "widgetDependsOnProperty": "Organization",
+ "widgetDependsOnValueFrom": "Id",
"widgetDropDownKey": "Id",
"widgetDropDownValue": "Name",
"widgetIsMajor": true,
diff --git a/codbex-organizations/codbex-organizations.model b/codbex-organizations/codbex-organizations.model
index 7253f9d..aa820fc 100644
--- a/codbex-organizations/codbex-organizations.model
+++ b/codbex-organizations/codbex-organizations.model
@@ -417,10 +417,10 @@
"description": "",
"name": "Department",
"tooltip": "",
- "widgetDependsOnEntity": "",
- "widgetDependsOnFilterBy": "",
- "widgetDependsOnProperty": "",
- "widgetDependsOnValueFrom": "",
+ "widgetDependsOnEntity": "Organization",
+ "widgetDependsOnFilterBy": "Organization",
+ "widgetDependsOnProperty": "Organization",
+ "widgetDependsOnValueFrom": "Id",
"widgetDropDownKey": "Id",
"widgetDropDownValue": "Name",
"widgetIsMajor": "true",
diff --git a/codbex-organizations/gen/codbex-organizations/ui/Teams/Team/main-details/controller.js b/codbex-organizations/gen/codbex-organizations/ui/Teams/Team/main-details/controller.js
index 1b18a19..c84979e 100644
--- a/codbex-organizations/gen/codbex-organizations/ui/Teams/Team/main-details/controller.js
+++ b/codbex-organizations/gen/codbex-organizations/ui/Teams/Team/main-details/controller.js
@@ -81,6 +81,35 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
$scope.serviceOrganization = "/services/ts/codbex-organizations/gen/codbex-organizations/api/Organizations/OrganizationService.ts";
$scope.serviceDepartment = "/services/ts/codbex-organizations/gen/codbex-organizations/api/Organizations/DepartmentService.ts";
+
+ $scope.$watch('entity.Organization', function (newValue, oldValue) {
+ if (newValue !== undefined && newValue !== null) {
+ entityApi.$http.get($scope.serviceOrganization + '/' + newValue).then(function (response) {
+ let valueFrom = response.data.Id;
+ entityApi.$http.post("/services/ts/codbex-organizations/gen/codbex-organizations/api/Organizations/DepartmentService.ts/search", {
+ $filter: {
+ equals: {
+ Organization: valueFrom
+ }
+ }
+ }).then(function (response) {
+ $scope.optionsDepartment = response.data.map(e => {
+ return {
+ value: e.Id,
+ text: e.Name
+ }
+ });
+ if ($scope.action !== 'select' && newValue !== oldValue) {
+ if ($scope.optionsDepartment.length == 1) {
+ $scope.entity.Department = $scope.optionsDepartment[0].value;
+ } else {
+ $scope.entity.Department = undefined;
+ }
+ }
+ });
+ });
+ }
+ });
//-----------------Events-------------------//
$scope.create = function () {