diff --git a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/index.html b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/index.html
index 75d2c61..e6d8d05 100644
--- a/codbex-payments/gen/codbex-payments/ui/EmployeePayment/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/EmployeePayment/index.html
@@ -52,7 +52,7 @@
.constant('extensionPoint', {
perspectives: 'codbex-payments',
views: 'codbex-payments-view',
- dialogWindows: 'codbex-payments-dialog-window'
+ dialogWindows: 'dialog-window'
})
.controller('ApplicationController', ['$scope', 'messageHub', 'Extensions', function ($scope, messageHub, Extensions) {
$scope.state = {
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/controller.js
index 9ec6f44..1282cf6 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/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-payments-custom-action').then(function (response) {
$scope.pageActions = response.filter(e => e.perspective === "PaymentAdjustment" && e.view === "PaymentAdjustment" && (e.type === "page" || e.type === undefined));
- $scope.entityActions = response.filter(e => e.perspective === "PaymentAdjustment" && e.view === "PaymentAdjustment" && 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("PaymentAdjustment", `Unable to count PaymentAdjustment: '${response.message}'`);
@@ -77,21 +83,23 @@ 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("PaymentAdjustment", `Unable to list/filter PaymentAdjustment: '${response.message}'`);
return;
}
+ if ($scope.data == null || $scope.dataReset) {
+ $scope.data = [];
+ $scope.dataReset = false;
+ }
response.data.forEach(e => {
if (e.Date) {
@@ -102,7 +110,8 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
}
});
- $scope.data = response.data;
+ $scope.data = $scope.data.concat(response.data);
+ $scope.dataPage++;
});
});
};
@@ -110,21 +119,9 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
$scope.selectEntity = function (entity) {
$scope.selectedEntity = entity;
- };
-
- $scope.openDetails = function (entity) {
- $scope.selectedEntity = entity;
- messageHub.showDialogWindow("PaymentAdjustment-details", {
- action: "select",
+ messageHub.postMessage("entitySelected", {
entity: entity,
- optionsCurrency: $scope.optionsCurrency,
- optionsCompany: $scope.optionsCompany,
- });
- };
-
- $scope.openFilter = function (entity) {
- messageHub.showDialogWindow("PaymentAdjustment-filter", {
- entity: $scope.filterEntity,
+ selectedMainEntityId: entity.Id,
optionsCurrency: $scope.optionsCurrency,
optionsCompany: $scope.optionsCompany,
});
@@ -132,25 +129,26 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
$scope.createEntity = function () {
$scope.selectedEntity = null;
- messageHub.showDialogWindow("PaymentAdjustment-details", {
- action: "create",
+ $scope.action = "create";
+
+ messageHub.postMessage("createEntity", {
entity: {},
optionsCurrency: $scope.optionsCurrency,
optionsCompany: $scope.optionsCompany,
- }, null, false);
+ });
};
- $scope.updateEntity = function (entity) {
- messageHub.showDialogWindow("PaymentAdjustment-details", {
- action: "update",
- entity: entity,
+ $scope.updateEntity = function () {
+ $scope.action = "update";
+ messageHub.postMessage("updateEntity", {
+ entity: $scope.selectedEntity,
optionsCurrency: $scope.optionsCurrency,
optionsCompany: $scope.optionsCompany,
- }, null, false);
+ });
};
- $scope.deleteEntity = function (entity) {
- let id = entity.Id;
+ $scope.deleteEntity = function () {
+ let id = $scope.selectedEntity.Id;
messageHub.showDialogAsync(
'Delete PaymentAdjustment?',
`Are you sure you want to delete PaymentAdjustment? This action cannot be undone.`,
@@ -171,6 +169,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
messageHub.showAlertError("PaymentAdjustment", `Unable to delete PaymentAdjustment: '${response.message}'`);
return;
}
+ refreshData();
$scope.loadPage($scope.dataPage, $scope.filter);
messageHub.postMessage("clearDetails");
});
@@ -178,6 +177,14 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
});
};
+ $scope.openFilter = function (entity) {
+ messageHub.showDialogWindow("PaymentAdjustment-filter", {
+ entity: $scope.filterEntity,
+ optionsCurrency: $scope.optionsCurrency,
+ optionsCompany: $scope.optionsCompany,
+ });
+ };
+
//----------------Dropdowns-----------------//
$scope.optionsCurrency = [];
$scope.optionsCompany = [];
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/controller.js
index 86fdda5..95d0ea4 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/controller.js
@@ -84,6 +84,7 @@ angular.module('page', ["ideUI", "ideView"])
entity: entity,
filter: filter
});
+ messageHub.postMessage("clearDetails");
$scope.cancel();
};
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/index.html
index a039bb1..70502ee 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/index.html
@@ -171,7 +171,7 @@
-
+
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/view.extension b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/view.extension
index 6f0c149..5898b5e 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/view.extension
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/view.extension
@@ -1,5 +1,5 @@
{
"module": "codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-filter/view.js",
- "extensionPoint": "codbex-payments-dialog-window",
+ "extensionPoint": "dialog-window",
"description": "codbex-payments - Application Dialog Window"
}
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/controller.js b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/controller.js
index cd43c61..f235871 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/controller.js
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/controller.js
@@ -5,7 +5,7 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
.config(["entityApiProvider", function (entityApiProvider) {
entityApiProvider.baseUrl = "/services/ts/codbex-payments/gen/codbex-payments/api/PaymentAdjustment/PaymentAdjustmentService.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 = {
@@ -64,7 +64,29 @@ angular.module('page', ["ideUI", "ideView", "entityApi"])
};
$scope.serviceCurrency = "/services/ts/codbex-currencies/gen/codbex-currencies/api/Currencies/CurrencyService.ts";
+
+ $scope.optionsCurrency = [];
+
+ $http.get("/services/ts/codbex-currencies/gen/codbex-currencies/api/Currencies/CurrencyService.ts").then(function (response) {
+ $scope.optionsCurrency = response.data.map(e => {
+ return {
+ value: e.Id,
+ text: e.Name
+ }
+ });
+ });
$scope.serviceCompany = "/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts";
+
+ $scope.optionsCompany = [];
+
+ $http.get("/services/ts/codbex-companies/gen/codbex-companies/api/Companies/CompanyService.ts").then(function (response) {
+ $scope.optionsCompany = response.data.map(e => {
+ return {
+ value: e.Id,
+ text: e.Name
+ }
+ });
+ });
$scope.cancel = function () {
$scope.entity = {};
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.extension b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.extension
index 8634168..7610c5e 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.extension
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.extension
@@ -1 +1 @@
-{"module":"codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.js","extensionPoint":"codbex-payments-dialog-window","description":"codbex-payments - Application Dialog Window"}
\ No newline at end of file
+{"module":"codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/dialog-window/view.js","extensionPoint":"dialog-window","description":"codbex-payments - Application Dialog Window"}
\ No newline at end of file
diff --git a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/index.html b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/index.html
index 3e81fc1..952c6ec 100644
--- a/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/index.html
+++ b/codbex-payments/gen/codbex-payments/ui/PaymentAdjustment/PaymentAdjustment/index.html
@@ -18,74 +18,53 @@
Items
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
- | Date |
- Valor |
- Amount |
- Currency |
- Company |
- Reason |
- UUID |
- |
-
-
-
-
- | No data available. |
-
-
- |
-
- |
-
-
- |
- {{next.Amount}} |
-
- {{optionsCurrencyValue(next.Currency)}}
- |
-
- {{optionsCompanyValue(next.Company)}}
- |
- {{next.Reason}} |
- {{next.UUID}} |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- |
-
-
-
+
+
+
+
+
+
+ {{next.Valor | date: "dd/MMM/yyyy"}} |
+ {{next.Amount}} |
+ {{optionsCurrencyValue(next.Currency)}} |
+ {{optionsCompanyValue(next.Company)}} |
+ {{next.Reason}} |
+ {{next.UUID}}
+
+
+
+
+
+
+ Load More ...
+
-
-
-