diff --git a/codbex-cities/codbex-cities.edm b/codbex-cities/codbex-cities.edm
index f853b98..50eb390 100644
--- a/codbex-cities/codbex-cities.edm
+++ b/codbex-cities/codbex-cities.edm
@@ -1,16 +1,16 @@
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
@@ -20,5 +20,5 @@
-
+
\ No newline at end of file
diff --git a/codbex-cities/codbex-cities.gen b/codbex-cities/codbex-cities.gen
index 30ee553..741d98f 100644
--- a/codbex-cities/codbex-cities.gen
+++ b/codbex-cities/codbex-cities.gen
@@ -14,7 +14,30 @@
"perspectives": {
"Cities": {
"views": [
- "City"
+ "City",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details",
+ "City-details"
],
"name": "Cities",
"label": "Cities",
@@ -42,7 +65,9 @@
"dataNullable": true,
"dataPrimaryKey": true,
"dataType": "INTEGER",
+ "description": "",
"name": "Id",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "",
@@ -62,8 +87,10 @@
"dataName": "CITY_NAME",
"dataNullable": false,
"dataType": "VARCHAR",
+ "description": "",
"isRequiredProperty": true,
"name": "Name",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "100",
"widgetSize": "",
@@ -85,8 +112,10 @@
"dataName": "CITY_COUNTRY",
"dataNullable": false,
"dataType": "INTEGER",
+ "description": "",
"isRequiredProperty": true,
"name": "Country",
+ "tooltip": "",
"widgetDropDownKey": "Id",
"widgetDropDownValue": "Name",
"widgetIsMajor": true,
@@ -113,9 +142,10 @@
"dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_CITY\"",
"dataName": "CITY",
"dataQuery": "",
+ "description": "Manage entity City",
"generateReport": "false",
"icon": "/services/web/resources/unicons/file.svg",
- "layoutType": "MANAGE",
+ "layoutType": "MANAGE_MASTER",
"menuIndex": "100",
"menuKey": "city",
"menuLabel": "City",
@@ -141,6 +171,65 @@
"Id"
],
"primaryKeysString": "Id",
+ "masterProperties": {
+ "title": {
+ "dataLength": "100",
+ "dataName": "CITY_NAME",
+ "dataNullable": false,
+ "dataType": "VARCHAR",
+ "description": "",
+ "isRequiredProperty": true,
+ "name": "Name",
+ "tooltip": "",
+ "widgetIsMajor": true,
+ "widgetLength": "100",
+ "widgetSize": "",
+ "widgetType": "TEXTBOX",
+ "dataNotNull": true,
+ "dataAutoIncrement": false,
+ "dataPrimaryKey": false,
+ "dataUnique": false,
+ "isCalculatedProperty": false,
+ "widgetLabel": "Name",
+ "widgetDropdownUrl": "",
+ "dataTypeJava": "string",
+ "dataTypeTypescript": "string",
+ "minLength": 0,
+ "maxLength": 100,
+ "inputRule": ""
+ },
+ "properties": [
+ {
+ "dataName": "CITY_COUNTRY",
+ "dataNullable": false,
+ "dataType": "INTEGER",
+ "description": "",
+ "isRequiredProperty": true,
+ "name": "Country",
+ "tooltip": "",
+ "widgetDropDownKey": "Id",
+ "widgetDropDownValue": "Name",
+ "widgetIsMajor": true,
+ "widgetLength": "20",
+ "widgetSize": "",
+ "widgetType": "DROPDOWN",
+ "relationshipName": "City_Country",
+ "relationshipEntityName": "Country",
+ "relationshipEntityPerspectiveName": "Countries",
+ "relationshipEntityPerspectiveLabel": "Entities",
+ "dataNotNull": true,
+ "dataAutoIncrement": false,
+ "dataPrimaryKey": false,
+ "dataUnique": false,
+ "isCalculatedProperty": false,
+ "widgetLabel": "Country",
+ "widgetDropdownUrl": "/services/ts/codbex-countries/gen/codbex-countries/api/Countries/CountryService.ts",
+ "dataTypeJava": "int",
+ "dataTypeTypescript": "number",
+ "inputRule": ""
+ }
+ ]
+ },
"hasDropdowns": true
},
{
@@ -153,7 +242,9 @@
"dataNullable": true,
"dataPrimaryKey": true,
"dataType": "INTEGER",
+ "description": "",
"name": "Id",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "",
@@ -176,7 +267,9 @@
"dataNullable": true,
"dataType": "VARCHAR",
"dataUnique": true,
+ "description": "",
"name": "Name",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "fd-col-md--4 fd-col--6",
@@ -202,7 +295,9 @@
"dataNullable": true,
"dataType": "CHAR",
"dataUnique": true,
+ "description": "",
"name": "Code2",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -228,7 +323,9 @@
"dataNullable": true,
"dataType": "CHAR",
"dataUnique": true,
+ "description": "",
"name": "Code3",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -254,7 +351,9 @@
"dataNullable": true,
"dataType": "CHAR",
"dataUnique": true,
+ "description": "",
"name": "Numeric",
+ "tooltip": "",
"widgetIsMajor": true,
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -277,6 +376,7 @@
"dataCount": "SELECT COUNT(*) AS COUNT FROM \"CODBEX_COUNTRY\"",
"dataName": "COUNTRY",
"dataQuery": "",
+ "description": "Manage entity Country",
"generateReport": "false",
"icon": "/services/web/resources/unicons/file.svg",
"layoutType": "MANAGE",
diff --git a/codbex-cities/codbex-cities.model b/codbex-cities/codbex-cities.model
index a689b10..71383d2 100644
--- a/codbex-cities/codbex-cities.model
+++ b/codbex-cities/codbex-cities.model
@@ -9,7 +9,9 @@
"dataNullable": "true",
"dataPrimaryKey": "true",
"dataType": "INTEGER",
+ "description": "",
"name": "Id",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "",
@@ -20,8 +22,10 @@
"dataName": "CITY_NAME",
"dataNullable": "false",
"dataType": "VARCHAR",
+ "description": "",
"isRequiredProperty": "true",
"name": "Name",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "100",
"widgetSize": "",
@@ -31,8 +35,10 @@
"dataName": "CITY_COUNTRY",
"dataNullable": "false",
"dataType": "INTEGER",
+ "description": "",
"isRequiredProperty": "true",
"name": "Country",
+ "tooltip": "",
"widgetDropDownKey": "Id",
"widgetDropDownValue": "Name",
"widgetIsMajor": "true",
@@ -49,9 +55,10 @@
"dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}CITY\"",
"dataName": "CITY",
"dataQuery": "",
+ "description": "Manage entity City",
"generateReport": "false",
"icon": "/services/web/resources/unicons/file.svg",
- "layoutType": "MANAGE",
+ "layoutType": "MANAGE_MASTER",
"menuIndex": "100",
"menuKey": "city",
"menuLabel": "City",
@@ -76,7 +83,9 @@
"dataNullable": "true",
"dataPrimaryKey": "true",
"dataType": "INTEGER",
+ "description": "",
"name": "Id",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "",
@@ -90,7 +99,9 @@
"dataNullable": "true",
"dataType": "VARCHAR",
"dataUnique": "true",
+ "description": "",
"name": "Name",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "fd-col-md--4 fd-col--6",
@@ -104,7 +115,9 @@
"dataNullable": "true",
"dataType": "CHAR",
"dataUnique": "true",
+ "description": "",
"name": "Code2",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -118,7 +131,9 @@
"dataNullable": "true",
"dataType": "CHAR",
"dataUnique": "true",
+ "description": "",
"name": "Code3",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -132,7 +147,9 @@
"dataNullable": "true",
"dataType": "CHAR",
"dataUnique": "true",
+ "description": "",
"name": "Numeric",
+ "tooltip": "",
"widgetIsMajor": "true",
"widgetLength": "20",
"widgetSize": "fd-col-md--2 fd-col--3",
@@ -143,6 +160,7 @@
"dataCount": "SELECT COUNT(*) AS COUNT FROM \"${tablePrefix}COUNTRY\"",
"dataName": "COUNTRY",
"dataQuery": "",
+ "description": "Manage entity Country",
"generateReport": "false",
"icon": "/services/web/resources/unicons/file.svg",
"layoutType": "MANAGE",
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/controller.js b/codbex-cities/gen/codbex-cities/ui/Cities/City/controller.js
index af33d1d..5f1c3ad 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/controller.js
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/controller.js
@@ -9,12 +9,13 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
$scope.dataPage = 1;
$scope.dataCount = 0;
- $scope.dataLimit = 20;
+ $scope.dataOffset = 0;
+ $scope.dataLimit = 10;
+ $scope.action = "select";
//-----------------Custom Actions-------------------//
Extensions.get('dialogWindow', 'codbex-cities-custom-action').then(function (response) {
$scope.pageActions = response.filter(e => e.perspective === "Cities" && e.view === "City" && (e.type === "page" || e.type === undefined));
- $scope.entityActions = response.filter(e => e.perspective === "Cities" && e.view === "City" && e.type === "entity");
});
$scope.triggerPageAction = function (action) {
@@ -26,33 +27,35 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
action
);
};
-
- $scope.triggerEntityAction = function (action) {
- messageHub.showDialogWindow(
- action.id,
- {
- id: $scope.entity.Id
- },
- null,
- true,
- action
- );
- };
//-----------------Custom Actions-------------------//
+ function refreshData() {
+ $scope.dataReset = true;
+ $scope.dataPage--;
+ }
+
function resetPagination() {
+ $scope.dataReset = true;
$scope.dataPage = 1;
$scope.dataCount = 0;
- $scope.dataLimit = 20;
+ $scope.dataLimit = 10;
}
- resetPagination();
//-----------------Events-------------------//
+ messageHub.onDidReceiveMessage("clearDetails", function (msg) {
+ $scope.$apply(function () {
+ $scope.selectedEntity = null;
+ $scope.action = "select";
+ });
+ });
+
messageHub.onDidReceiveMessage("entityCreated", function (msg) {
+ refreshData();
$scope.loadPage($scope.dataPage, $scope.filter);
});
messageHub.onDidReceiveMessage("entityUpdated", function (msg) {
+ refreshData();
$scope.loadPage($scope.dataPage, $scope.filter);
});
@@ -68,7 +71,10 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
if (!filter && $scope.filter) {
filter = $scope.filter;
}
- $scope.dataPage = pageNumber;
+ if (!filter) {
+ filter = {};
+ }
+ $scope.selectedEntity = null;
entityApi.count(filter).then(function (response) {
if (response.status != 200) {
messageHub.showAlertError("City", `Unable to count City: '${response.message}'`);
@@ -77,22 +83,25 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
if (response.data) {
$scope.dataCount = response.data;
}
- let offset = (pageNumber - 1) * $scope.dataLimit;
- let limit = $scope.dataLimit;
- let request;
- if (filter) {
- filter.$offset = offset;
- filter.$limit = limit;
- request = entityApi.search(filter);
- } else {
- request = entityApi.list(offset, limit);
+ $scope.dataPages = Math.ceil($scope.dataCount / $scope.dataLimit);
+ filter.$offset = ($scope.dataPage - 1) * $scope.dataLimit;
+ filter.$limit = $scope.dataLimit;
+ if ($scope.dataReset) {
+ filter.$offset = 0;
+ filter.$limit = $scope.dataPage * $scope.dataLimit;
}
- request.then(function (response) {
+
+ entityApi.search(filter).then(function (response) {
if (response.status != 200) {
messageHub.showAlertError("City", `Unable to list/filter City: '${response.message}'`);
return;
}
- $scope.data = response.data;
+ if ($scope.data == null || $scope.dataReset) {
+ $scope.data = [];
+ $scope.dataReset = false;
+ }
+ $scope.data = $scope.data.concat(response.data);
+ $scope.dataPage++;
});
});
};
@@ -100,43 +109,33 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
$scope.selectEntity = function (entity) {
$scope.selectedEntity = entity;
- };
-
- $scope.openDetails = function (entity) {
- $scope.selectedEntity = entity;
- messageHub.showDialogWindow("City-details", {
- action: "select",
+ messageHub.postMessage("entitySelected", {
entity: entity,
- optionsCountry: $scope.optionsCountry,
- });
- };
-
- $scope.openFilter = function (entity) {
- messageHub.showDialogWindow("City-filter", {
- entity: $scope.filterEntity,
+ selectedMainEntityId: entity.Id,
optionsCountry: $scope.optionsCountry,
});
};
$scope.createEntity = function () {
$scope.selectedEntity = null;
- messageHub.showDialogWindow("City-details", {
- action: "create",
+ $scope.action = "create";
+
+ messageHub.postMessage("createEntity", {
entity: {},
optionsCountry: $scope.optionsCountry,
- }, null, false);
+ });
};
- $scope.updateEntity = function (entity) {
- messageHub.showDialogWindow("City-details", {
- action: "update",
- entity: entity,
+ $scope.updateEntity = function () {
+ $scope.action = "update";
+ messageHub.postMessage("updateEntity", {
+ entity: $scope.selectedEntity,
optionsCountry: $scope.optionsCountry,
- }, null, false);
+ });
};
- $scope.deleteEntity = function (entity) {
- let id = entity.Id;
+ $scope.deleteEntity = function () {
+ let id = $scope.selectedEntity.Id;
messageHub.showDialogAsync(
'Delete City?',
`Are you sure you want to delete City? This action cannot be undone.`,
@@ -157,6 +156,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
messageHub.showAlertError("City", `Unable to delete City: '${response.message}'`);
return;
}
+ refreshData();
$scope.loadPage($scope.dataPage, $scope.filter);
messageHub.postMessage("clearDetails");
});
@@ -164,6 +164,13 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
});
};
+ $scope.openFilter = function (entity) {
+ messageHub.showDialogWindow("City-filter", {
+ entity: $scope.filterEntity,
+ optionsCountry: $scope.optionsCountry,
+ });
+ };
+
//----------------Dropdowns-----------------//
$scope.optionsCountry = [];
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/controller.js b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/controller.js
index a4c8a98..4d36e25 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/controller.js
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/controller.js
@@ -50,6 +50,7 @@ angular.module('page', ["ideUI", "ideView"])
entity: entity,
filter: filter
});
+ messageHub.postMessage("clearDetails");
$scope.cancel();
};
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/index.html b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/index.html
index 7704d24..4ae28bb 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/index.html
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/index.html
@@ -64,16 +64,16 @@
-
+
-
+
-
+
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/view.extension b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/view.extension
index 7d31539..08bcef7 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/view.extension
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/view.extension
@@ -1,5 +1,5 @@
{
"module": "codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-filter/view.js",
- "extensionPoint": "codbex-cities-dialog-window",
+ "extensionPoint": "dialog-window",
"description": "codbex-cities - Application Dialog Window"
}
\ No newline at end of file
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/controller.js b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/controller.js
index 39a02e8..06caca1 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/controller.js
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/controller.js
@@ -5,7 +5,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
.config(["entityApiProvider", function (entityApiProvider) {
entityApiProvider.baseUrl = "/services/ts/codbex-cities/gen/codbex-cities/api/Cities/CityService.ts";
}])
- .controller('PageController', ['$scope', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, messageHub, ViewParameters, entityApi) {
+ .controller('PageController', ['$scope', '$http', 'messageHub', 'ViewParameters', 'entityApi', function ($scope, $http, messageHub, ViewParameters, entityApi) {
$scope.entity = {};
$scope.forms = {
@@ -56,6 +56,19 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
});
};
+ $scope.serviceCountry = "/services/ts/codbex-countries/gen/codbex-countries/api/Countries/CountryService.ts";
+
+ $scope.optionsCountry = [];
+
+ $http.get("/services/ts/codbex-countries/gen/codbex-countries/api/Countries/CountryService.ts").then(function (response) {
+ $scope.optionsCountry = response.data.map(e => {
+ return {
+ value: e.Id,
+ text: e.Name
+ }
+ });
+ });
+
$scope.cancel = function () {
$scope.entity = {};
$scope.action = 'select';
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/index.html b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/index.html
index 840277f..051a3fa 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/index.html
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/index.html
@@ -47,6 +47,7 @@
The value doesn't match the required pattern ''
+
@@ -63,6 +64,7 @@
dropdown-items="optionsCountry"
dg-placeholder="Search Country ...">
+
@@ -75,7 +77,7 @@
-
+
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.extension b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.extension
index 844fad7..63fbcd5 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.extension
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.extension
@@ -1 +1 @@
-{"module":"codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.js","extensionPoint":"codbex-cities-dialog-window","description":"codbex-cities - Application Dialog Window"}
\ No newline at end of file
+{"module":"codbex-cities/gen/codbex-cities/ui/Cities/City/dialog-window/view.js","extensionPoint":"dialog-window","description":"codbex-cities - Application Dialog Window"}
\ No newline at end of file
diff --git a/codbex-cities/gen/codbex-cities/ui/Cities/City/index.html b/codbex-cities/gen/codbex-cities/ui/Cities/City/index.html
index 9e4eb11..11bd326 100644
--- a/codbex-cities/gen/codbex-cities/ui/Cities/City/index.html
+++ b/codbex-cities/gen/codbex-cities/ui/Cities/City/index.html
@@ -17,59 +17,49 @@
- Items ({{dataCount}})
-
-
+ Items
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- | Name |
- Country |
- |
-
-
-
-
- | No data available. |
-
-
- | {{next.Name}} |
-
- {{optionsCountryValue(next.Country)}}
- |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
+
+
+
+
+
+
+ {{optionsCountryValue(next.Country)}}
+
+
+
+
+
+
+ Load More ...
+
-
-
-